X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fcommons.js;h=342fc99bd659c07084ff3effa3c0bbf2ac87ffa7;hb=61777f564d9c25aeea2542a9f2fdad87b5a4780b;hp=189effcbee06459fbb8e08cb87d95e5da53dd0d9;hpb=96b3b0c2196bea834cfc3e7d77283029782f87d7;p=brisk.git diff --git a/web/commons.js b/web/commons.js index 189effc..342fc99 100644 --- a/web/commons.js +++ b/web/commons.js @@ -1,7 +1,10 @@ /* * brisk - commons.js * - * Copyright (C) 2006 matteo.nastasi@milug.org + * Copyright (C) 2006-2008 Matteo Nastasi + * mailto: nastasi@alternativeoutput.it + * matteo.nastasi@milug.org + * web: http://www.alternativeoutput.it * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,6 +110,32 @@ function getStyle(x,IEstyleProp, MozStyleProp) })() +function addEvent(obj,type,fn) +{ + if (obj.addEventListener) { + obj.addEventListener( type, fn, false); + } + else if (obj.attachEvent) { + obj["e"+type+fn] = fn; + obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } + obj.attachEvent( "on"+type, obj[type+fn] ); + } + else + throw new Error("Event registration not supported"); +} + +function removeEvent(obj,type,fn) +{ + if (obj.removeEventListener) { + obj.removeEventListener( type, fn, false ); + } + else if (obj.detachEvent) { + obj.detachEvent( "on"+type, obj[type+fn] ); + obj[type+fn] = null; + obj["e"+type+fn] = null; + } +} + // var card_pos = RANGE 0 <= x < cards_ea_n function show_bigpict(obj, act, x, y)