f : function(){of();f();}; }//addElementEvent var _loadImage = []; function loadImage(s,f,always_show_loading){ var l = function(){if(_loadImage[s]){if(f)f(s);}else{var i=newElement('IMG');i.onload=function(){_loadImage[s]=true;if(f)f(s);};new function(){i.src=s;};}} if(always_show_loading) setTimeout(l, typeof(always_show_loading) == 'number' ? always_show_loading : 1000); else l(); }//loadImage function array_copy(a){ if(a.constructor == Array) var r = []; else var r = {}; foreach(a, function(i){ r[i] = typeof(a[i]) != 'object' ? a[i] : array_copy(a[i]); }); return r; }//array_copy function now(){ return (new Date()).getTime(); }//now function eq(a, b){ return String(a).replace(/^\s+/, '').replace(/\s+$/, '').toLowerCase() == String(b).replace(/^\s+/, '').replace(/\s+$/, '').toLowerCase(); }//eq function array_search(arr, a, b){ var result = false; if(!b){ foreach(arr, function(i){ if(eq(arr[i], b)){ result = i; return true; } }); } else{ foreach(arr, function(i){ if(eq(arr[i][a], b)){ result = i; return true; } }); } return result; }//array_search function validateOption(a, b){ b = b.split(','); var result; foreach(b, function(i){ result = b[i]; if(eq(a, b[i])) return true; }); return result; }//validateOption var setOpacity; function setOpacityInit(){ if(setOpacity) return; var p, b = document.body, s = b.style; if (typeof s.opacity == 'string') p = 'opacity'; else if (typeof s.MozOpacity == 'string') p = 'MozOpacity'; else if (typeof s.KhtmlOpacity == 'string') p = 'KhtmlOpacity'; else if (b.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) p = 'filter'; if(p == 'filter'){ setOpacity = function(style, v){ if(v > 1) v = 1; else if(v < 0) v = 0; style[p] = "alpha(opacity=" + Math.round(v*100) + ")"; } }else if(p){ setOpacity = function(style, v){ if(v > 1) v = 1; else if(v < 0) v = 0; style[p] = v.toFixed(2); } }else setOpacity = ef }//setOpacityInit function setStyle(style, property, value){ if(typeof(value) == 'string') style[property] = value; else if(property == 'clip') style[property] = 'rect('+Math.round(value[0])+'px, '+Math.round(value[1])+'px, '+Math.round(value[2])+'px, '+Math.round(value[3])+'px)'; else if(property == 'opacity') setOpacity(style, value); else style[property] = Math.round(value)+'px'; }//setStyle function setStyles(style, properties){ foreach(properties, function(property){ setStyle(style, property, properties[property]); }); } function hide(style){style.display = 'none';} function show(style){style.display = '';} function newElement(tagName, styles){ var e = document.createElement(tagName); if(styles) setStyles(e.style, styles); return e; }//newElement var EffectsArr = []; function Effects(parameters){ var effect = parameters.effect, display = parameters.display; if(!effect) effect = {}; if(parameters.contentmode) effect.zoom = false; effect.interval = effect.interval || 40; effect.duration = effect.duration || 200; effect.delay = effect.delay || 0; var framesCount = Math.round(effect.duration / effect.interval); var index, piece, r, image, startStylesArr = [], AnimateArr = [], needAnimate = [], AnimateItemsArr = [], styleStart, styleEnd, styleDif; var container = newElement('div', {width: display.width, height: display.height, position: 'absolute', top: 0, left: 0, overflow: 'hidden'}) parameters.container.appendChild(container); var pieces = {cols: effect.cols ? effect.cols : 1, rows: effect.rows ? effect.rows : 1}; pieces.count = pieces.cols*pieces.rows; pieces.width = display.width / pieces.cols, pieces.height = display.height / pieces.rows; for(var c = 0; c < pieces.cols; c++) for(var r = 0; r < pieces.rows; r++) pieces[c+','+r] = [r*pieces.height, c*pieces.width+pieces.width, r*pieces.height+pieces.height, c*pieces.width]; var optionsCopy = array_copy(effect); var effectsInvers = array_copy(effect); effectsInvers.top = optionsCopy.bottom; effectsInvers.bottom = optionsCopy.top; effectsInvers.left = optionsCopy.right; effectsInvers.right = optionsCopy.left; effect.order = validateOption(effect.order, 'straight,swirl,snake,straight_stairs,random'); var orderArr = doOrder(pieces.cols, pieces.rows, effect.order, effect.road, effect.reverse); var effectsOptStr = effect.order == 'random' ? now() : [ effect.interval, effect.duration, effect.delay, effect.cols, effect.rows, effect.top, effect.right, effect.bottom, effect.left, effect.fade, effect.zoom, effect.move, effect.chess, effect.order, effect.road, effect.reverse ].join(','); if(EffectsArr[effectsOptStr]){ startStylesArr = EffectsArr[effectsOptStr].startStylesArr; AnimateArr = EffectsArr[effectsOptStr].AnimateArr; needAnimate = EffectsArr[effectsOptStr].needAnimate; }else{ for(r = 0; r < pieces.rows; r++) for(c = 0; c < pieces.cols;