
if(typeof(SK)=='undefined')SK={};var sk_namespaces=["SK.Env","SK.Obj","SK.Singletons","SK.UI","SK.UI.Arrangement","SK.UI.Help","SK.Util","SK.Const","SK.Actions.Common"];for(var i=0;i<sk_namespaces.length;i++){var nsp=sk_namespaces[i];var nsp_elements=nsp.split('.');var nsp_prefix_arr=[];for(var j=0;j<nsp_elements.length;j++){var nsp_element=nsp_elements[j];var prefix=this.nsp_prefix_arr.length>0?this.nsp_prefix_arr.join(".")+".":"";var nsp_str=prefix+nsp_element;if(typeof(eval(nsp_str))=='undefined'){eval(nsp_str+' = {};');}
nsp_prefix_arr.push(nsp_element);}}


var MooTools={'version':'1.2.4','build':'0d9113241a90b9cd5643b926795852a2026710d4'};var Native=function(options){options=options||{};var name=options.name;var legacy=options.legacy;var protect=options.protect;var methods=options.implement;var generics=options.generics;var initialize=options.initialize;var afterImplement=options.afterImplement||function(){};var object=initialize||legacy;generics=generics!==false;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);}
var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){var pa1=this.prototype[a1];if((a1=pa1))return add(this,a2,a1,a3);}
for(var a in a1)this.alias(a,a1[a],a2);return this;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};if(methods)object.implement(methods);return object;};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};(function(){var natives={'Array':Array,'Date':Date,'Function':Function,'Number':Number,'RegExp':RegExp,'String':String};for(var n in natives)new Native({name:n,initialize:natives[n],protect:true});var types={'boolean':Boolean,'native':Native,'object':Object};for(var t in types)Native.typize(types[t],t);var generics={'Array':["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],'String':["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var g in generics){for(var i=generics[g].length;i--;)Native.genericize(natives[g],generics[g][i],true);}})();var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];}
return clean;},getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;}
return length;}});Hash.alias('forEach','each');Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var l=iterable.length,array=new Array(l);while(l--)array[l]=iterable[l];return array;}
return Array.prototype.slice.call(iterable);};function $arguments(i){return function(){return arguments[i];};};function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};function $empty(){};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $H(object){return new Hash(object);};function $lambda(value){return($type(value)=='function')?value:function(){return value;};};function $merge(){var args=Array.slice(arguments);args.unshift({});return $mixin.apply(null,args);};function $mixin(mix){for(var i=1,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$mixin(mp,op):$unlink(op);}}
return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];}
return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return+new Date;};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';}
return typeof obj;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=new Hash(object);break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;}
return unlinked;};var Browser=$merge({Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}}
return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');},function(){return new ActiveXObject('Microsoft.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1],10)||0,build:parseInt(version[2],10)||0};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};}
win.document.window=win;return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];if(Browser.Engine.trident&&Browser.Engine.version<=4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});if(Browser.Engine.trident)doc.window.attachEvent('onunload',function(){doc.window.detachEvent('onunload',arguments.callee);doc.head=doc.html=doc.window=null;});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;}
return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;}
return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}}
return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);}
return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);}
return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},run:function(args,bind){return this.apply(bind,$splat(args));},pass:function(args,bind){return this.create({bind:bind,arguments:args});},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,arguments:args,event:true});},attempt:function(args,bind){return this.create({bind:bind,arguments:args,attempt:true})();},delay:function(delay,bind,args){return this.create({bind:bind,arguments:args,delay:delay})();},periodical:function(periodical,bind,args){return this.create({bind:bind,arguments:args,periodical:periodical})();}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^{}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;}
return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties||{},function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties||{},function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){if(this[key]==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;}
return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;}
return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);}
if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;}
key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;}
var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;}
if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}}
return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});function Class(params){if(params instanceof Function)params={initialize:params};var newClass=function(){Object.reset(this);if(newClass._prototyping)return this;this._current=$empty;var value=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return value;}.extend(this);newClass.implement(params);newClass.constructor=Class;newClass.prototype.constructor=newClass;return newClass;};Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(object,key){if(key==null){for(var p in object)Object.reset(object,p);return object;}
delete object[key];switch($type(object[key])){case'object':var F=function(){};F.prototype=object[key];var i=new F;object[key]=Object.reset(i);break;case'array':object[key]=$unlink(object[key]);break;}
return object;};new Native({name:'Class',initialize:Class}).extend({instantiate:function(F){F._prototyping=true;var proto=new F;delete F._prototyping;return proto;},wrap:function(self,key,method){if(method._origin)method=method._origin;return function(){if(method._protected&&this._current==null)throw new Error('The method "'+key+'" cannot be called.');var caller=this.caller,current=this._current;this.caller=current;this._current=arguments.callee;var result=method.apply(this,arguments);this._current=current;this.caller=caller;return result;}.extend({_owner:self,_origin:method,_name:key});}});Class.implement({implement:function(key,value){if($type(key)=='object'){for(var p in key)this.implement(p,key[p]);return this;}
var mutator=Class.Mutators[key];if(mutator){value=mutator.call(this,value);if(value==null)return this;}
var proto=this.prototype;switch($type(value)){case'function':if(value._hidden)return this;proto[key]=Class.wrap(this,key,value);break;case'object':var previous=proto[key];if($type(previous)=='object')$mixin(previous,value);else proto[key]=$unlink(value);break;case'array':proto[key]=$unlink(value);break;default:proto[key]=value;}
return this;}});Class.Mutators={Extends:function(parent){this.parent=parent;this.prototype=Class.instantiate(parent);this.implement('parent',function(){var name=this.caller._name,previous=this.caller._owner.parent.prototype[name];if(!previous)throw new Error('The method "'+name+'" has no parent.');return previous.apply(this,arguments);}.protect());},Implements:function(items){$splat(items).each(function(item){if(item instanceof Function)item=Class.instantiate(item);this.implement(item);},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;}
return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(events){var type;if($type(events)=='object'){for(type in events)this.removeEvent(type,events[type]);return this;}
if(events)events=Events.removeOn(events);for(type in this.$events){if(events&&events!=type)continue;var fns=this.$events[type];for(var i=fns.length;i--;i)this.removeEvent(type,fns[i]);}
return this;}});Events.removeOn=function(string){return string.replace(/^on([A-Z])/,function(full,first){return first.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent)return this;for(var option in this.options){if($type(this.options[option])!='function'||!(/^on[A-Z]/).test(option))continue;this.addEvent(option,this.options[option]);delete this.options[option];}
return this;}});var Element=new Native({name:'Element',legacy:window.Element,initialize:function(tag,props){var konstructor=Element.Constructors.get(tag);if(konstructor)return konstructor(props);if(typeof tag=='string')return document.newElement(tag,props);return document.id(tag).set(props);},afterImplement:function(key,value){Element.Prototype[key]=value;if(Array[key])return;Elements.implement(key,function(){var items=[],elements=true;for(var i=0,j=this.length;i<j;i++){var returns=this[i][key].apply(this[i],arguments);items.push(returns);if(elements)elements=($type(returns)=='element');}
return(elements)?new Elements(items):items;});}});Element.Prototype={$family:{name:'element'}};Element.Constructors=new Hash;var IFrame=new Native({name:'IFrame',generics:false,initialize:function(){var params=Array.link(arguments,{properties:Object.type,iframe:$defined});var props=params.properties||{};var iframe=document.id(params.iframe);var onload=props.onload||$empty;delete props.onload;props.id=props.name=$pick(props.id,props.name,iframe?(iframe.id||iframe.name):'IFrame_'+$time());iframe=new Element(iframe||'iframe',props);var onFrameLoad=function(){var host=$try(function(){return iframe.contentWindow.location.host;});if(!host||host==window.location.host){var win=new Window(iframe.contentWindow);new Document(iframe.contentWindow.document);$extend(win.Element.prototype,Element.Prototype);}
onload.call(iframe.contentWindow,iframe.contentWindow.document);};var contentWindow=$try(function(){return iframe.contentWindow;});((contentWindow&&contentWindow.document.body)||window.frames[props.id])?onFrameLoad():iframe.addListener('load',onFrameLoad);return iframe;}});var Elements=new Native({initialize:function(elements,options){options=$extend({ddup:true,cash:true},options);elements=elements||[];if(options.ddup||options.cash){var uniques={},returned=[];for(var i=0,l=elements.length;i<l;i++){var el=document.id(elements[i],!options.cash);if(options.ddup){if(uniques[el.uid])continue;uniques[el.uid]=true;}
if(el)returned.push(el);}
elements=returned;}
return(options.cash)?$extend(elements,this):elements;}});Elements.implement({filter:function(filter,bind){if(!filter)return this;return new Elements(Array.filter(this,(typeof filter=='string')?function(item){return item.match(filter);}:filter,bind));}});Document.implement({newElement:function(tag,props){if(Browser.Engine.trident&&props){['name','type','checked'].each(function(attribute){if(!props[attribute])return;tag+=' '+attribute+'="'+props[attribute]+'"';if(attribute!='checked')delete props[attribute];});tag='<'+tag+'>';}
return document.id(this.createElement(tag)).set(props);},newTextNode:function(text){return this.createTextNode(text);},getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var types={string:function(id,nocash,doc){id=doc.getElementById(id);return(id)?types.element(id,nocash):null;},element:function(el,nocash){$uid(el);if(!nocash&&!el.$family&&!(/^object|embed$/i).test(el.tagName)){var proto=Element.Prototype;for(var p in proto)el[p]=proto[p];};return el;},object:function(obj,nocash,doc){if(obj.toElement)return types.element(obj.toElement(doc),nocash);return null;}};types.textnode=types.whitespace=types.window=types.document=$arguments(0);return function(el,nocash,doc){if(el&&el.$family&&el.uid)return el;var type=$type(el);return(types[type])?types[type](el,nocash,doc||document):null;};})()});if(window.$==null)Window.implement({$:function(el,nc){return document.id(el,nc,this.document);}});Window.implement({$$:function(selector){if(arguments.length==1&&typeof selector=='string')return this.document.getElements(selector);var elements=[];var args=Array.flatten(arguments);for(var i=0,l=args.length;i<l;i++){var item=args[i];switch($type(item)){case'element':elements.push(item);break;case'string':elements.extend(this.document.getElements(item,true));}}
return new Elements(elements);},getDocument:function(){return this.document;},getWindow:function(){return this;}});Native.implement([Element,Document],{getElement:function(selector,nocash){return document.id(this.getElements(selector,true)[0]||null,nocash);},getElements:function(tags,nocash){tags=tags.split(',');var elements=[];var ddup=(tags.length>1);tags.each(function(tag){var partial=this.getElementsByTagName(tag.trim());(ddup)?elements.extend(partial):elements=partial;},this);return new Elements(elements,{ddup:ddup,cash:!nocash});}});(function(){var collected={},storage={};var props={input:'checked',option:'selected',textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerHTML':'value'};var get=function(uid){return(storage[uid]||(storage[uid]={}));};var clean=function(item,retain){if(!item)return;var uid=item.uid;if(Browser.Engine.trident){if(item.clearAttributes){var clone=retain&&item.cloneNode(false);item.clearAttributes();if(clone)item.mergeAttributes(clone);}else if(item.removeEvents){item.removeEvents();}
if((/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}}
if(!uid)return;collected[uid]=storage[uid]=null;};var purge=function(){Hash.each(collected,clean);if(Browser.Engine.trident)$A(document.getElementsByTagName('object')).each(clean);if(window.CollectGarbage)CollectGarbage();collected=storage=null;};var walk=function(element,walk,start,match,all,nocash){var el=element[start||walk];var elements=[];while(el){if(el.nodeType==1&&(!match||Element.match(el,match))){if(!all)return document.id(el,nocash);elements.push(el);}
el=el[walk];}
return(all)?new Elements(elements,{ddup:false,cash:!nocash}):null;};var attributes={'html':'innerHTML','class':'className','for':'htmlFor','defaultValue':'defaultValue','text':(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?'innerText':'textContent'};var bools=['compact','nowrap','ismap','declare','noshade','checked','disabled','readonly','multiple','selected','noresize','defer'];var camels=['value','type','defaultValue','accessKey','cellPadding','cellSpacing','colSpan','frameBorder','maxLength','readOnly','rowSpan','tabIndex','useMap'];bools=bools.associate(bools);Hash.extend(attributes,bools);Hash.extend(attributes,camels.associate(camels.map(String.toLowerCase)));var inserters={before:function(context,element){if(element.parentNode)element.parentNode.insertBefore(context,element);},after:function(context,element){if(!element.parentNode)return;var next=element.nextSibling;(next)?element.parentNode.insertBefore(context,next):element.parentNode.appendChild(context);},bottom:function(context,element){element.appendChild(context);},top:function(context,element){var first=element.firstChild;(first)?element.insertBefore(context,first):element.appendChild(context);}};inserters.inside=inserters.bottom;Hash.each(inserters,function(inserter,where){where=where.capitalize();Element.implement('inject'+where,function(el){inserter(this,document.id(el,true));return this;});Element.implement('grab'+where,function(el){inserter(document.id(el,true),this);return this;});});Element.implement({set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':var property=Element.Properties.get(prop);(property&&property.set)?property.set.apply(this,Array.slice(arguments,1)):this.setProperty(prop,value);}
return this;},get:function(prop){var property=Element.Properties.get(prop);return(property&&property.get)?property.get.apply(this,Array.slice(arguments,1)):this.getProperty(prop);},erase:function(prop){var property=Element.Properties.get(prop);(property&&property.erase)?property.erase.apply(this):this.removeProperty(prop);return this;},setProperty:function(attribute,value){var key=attributes[attribute];if(value==undefined)return this.removeProperty(attribute);if(key&&bools[attribute])value=!!value;(key)?this[key]=value:this.setAttribute(attribute,''+value);return this;},setProperties:function(attributes){for(var attribute in attributes)this.setProperty(attribute,attributes[attribute]);return this;},getProperty:function(attribute){var key=attributes[attribute];var value=(key)?this[key]:this.getAttribute(attribute,2);return(bools[attribute])?!!value:(key)?value:value||null;},getProperties:function(){var args=$A(arguments);return args.map(this.getProperty,this).associate(args);},removeProperty:function(attribute){var key=attributes[attribute];(key)?this[key]=(key&&bools[attribute])?false:'':this.removeAttribute(attribute);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},hasClass:function(className){return this.className.contains(className,' ');},addClass:function(className){if(!this.hasClass(className))this.className=(this.className+' '+className).clean();return this;},removeClass:function(className){this.className=this.className.replace(new RegExp('(^|\\s)'+className+'(?:\\s|$)'),'$1');return this;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},adopt:function(){Array.flatten(arguments).each(function(element){element=document.id(element,true);if(element)this.appendChild(element);},this);return this;},appendText:function(text,where){return this.grab(this.getDocument().newTextNode(text),where);},grab:function(el,where){inserters[where||'bottom'](document.id(el,true),this);return this;},inject:function(el,where){inserters[where||'bottom'](this,document.id(el,true));return this;},replaces:function(el){el=document.id(el,true);el.parentNode.replaceChild(this,el);return this;},wraps:function(el,where){el=document.id(el,true);return this.replaces(el).grab(el,where);},getPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,false,nocash);},getAllPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,true,nocash);},getNext:function(match,nocash){return walk(this,'nextSibling',null,match,false,nocash);},getAllNext:function(match,nocash){return walk(this,'nextSibling',null,match,true,nocash);},getFirst:function(match,nocash){return walk(this,'nextSibling','firstChild',match,false,nocash);},getLast:function(match,nocash){return walk(this,'previousSibling','lastChild',match,false,nocash);},getParent:function(match,nocash){return walk(this,'parentNode',null,match,false,nocash);},getParents:function(match,nocash){return walk(this,'parentNode',null,match,true,nocash);},getSiblings:function(match,nocash){return this.getParent().getChildren(match,nocash).erase(this);},getChildren:function(match,nocash){return walk(this,'nextSibling','firstChild',match,true,nocash);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(id,nocash){var el=this.ownerDocument.getElementById(id);if(!el)return null;for(var parent=el.parentNode;parent!=this;parent=parent.parentNode){if(!parent)return null;}
return document.id(el,nocash);},getSelected:function(){return new Elements($A(this.options).filter(function(option){return option.selected;}));},getComputedStyle:function(property){if(this.currentStyle)return this.currentStyle[property.camelCase()];var computed=this.getDocument().defaultView.getComputedStyle(this,null);return(computed)?computed.getPropertyValue([property.hyphenate()]):null;},toQueryString:function(){var queryString=[];this.getElements('input, select, textarea',true).each(function(el){if(!el.name||el.disabled||el.type=='submit'||el.type=='reset'||el.type=='file')return;var value=(el.tagName.toLowerCase()=='select')?Element.getSelected(el).map(function(opt){return opt.value;}):((el.type=='radio'||el.type=='checkbox')&&!el.checked)?null:el.value;$splat(value).each(function(val){if(typeof val!='undefined')queryString.push(el.name+'='+encodeURIComponent(val));});});return queryString.join('&');},clone:function(contents,keepid){contents=contents!==false;var clone=this.cloneNode(contents);var clean=function(node,element){if(!keepid)node.removeAttribute('id');if(Browser.Engine.trident){node.clearAttributes();node.mergeAttributes(element);node.removeAttribute('uid');if(node.options){var no=node.options,eo=element.options;for(var j=no.length;j--;)no[j].selected=eo[j].selected;}}
var prop=props[element.tagName.toLowerCase()];if(prop&&element[prop])node[prop]=element[prop];};if(contents){var ce=clone.getElementsByTagName('*'),te=this.getElementsByTagName('*');for(var i=ce.length;i--;)clean(ce[i],te[i]);}
clean(clone,this);return document.id(clone);},destroy:function(){Element.empty(this);Element.dispose(this);clean(this,true);return null;},empty:function(){$A(this.childNodes).each(function(node){Element.destroy(node);});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(el){el=document.id(el,true);if(!el)return false;if(Browser.Engine.webkit&&Browser.Engine.version<420)return $A(this.getElementsByTagName(el.tagName)).contains(el);return(this.contains)?(this!=el&&this.contains(el)):!!(this.compareDocumentPosition(el)&16);},match:function(tag){return(!tag||(tag==this)||(Element.get(this,'tag')==tag));}});Native.implement([Element,Window,Document],{addListener:function(type,fn){if(type=='unload'){var old=fn,self=this;fn=function(){self.removeListener('unload',fn);old();};}else{collected[this.uid]=this;}
if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);return this;},removeListener:function(type,fn){if(this.removeEventListener)this.removeEventListener(type,fn,false);else this.detachEvent('on'+type,fn);return this;},retrieve:function(property,dflt){var storage=get(this.uid),prop=storage[property];if(dflt!=undefined&&prop==undefined)prop=storage[property]=dflt;return $pick(prop);},store:function(property,value){var storage=get(this.uid);storage[property]=value;return this;},eliminate:function(property){var storage=get(this.uid);delete storage[property];return this;}});window.addListener('unload',purge);})();Element.Properties=new Hash;Element.Properties.style={set:function(style){this.style.cssText=style;},get:function(){return this.style.cssText;},erase:function(){this.style.cssText='';}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();}};Element.Properties.html=(function(){var wrapper=document.createElement('div');var translations={table:[1,'<table>','</table>'],select:[1,'<select>','</select>'],tbody:[2,'<table><tbody>','</tbody></table>'],tr:[3,'<table><tbody><tr>','</tr></tbody></table>']};translations.thead=translations.tfoot=translations.tbody;var html={set:function(){var html=Array.flatten(arguments).join('');var wrap=Browser.Engine.trident&&translations[this.get('tag')];if(wrap){var first=wrapper;first.innerHTML=wrap[1]+html+wrap[2];for(var i=wrap[0];i--;)first=first.firstChild;this.empty().adopt(first.childNodes);}else{this.innerHTML=html;}}};html.erase=html.set;return html;})();if(Browser.Engine.webkit&&Browser.Engine.version<420)Element.Properties.text={get:function(){if(this.innerText)return this.innerText;var temp=this.ownerDocument.newElement('div',{html:this.innerHTML}).inject(this.ownerDocument.body);var text=temp.innerText;temp.destroy();return text;}};Element.Properties.events={set:function(events){this.addEvents(events);}};Native.implement([Element,Window,Document],{addEvent:function(type,fn){var events=this.retrieve('events',{});events[type]=events[type]||{'keys':[],'values':[]};if(events[type].keys.contains(fn))return this;events[type].keys.push(fn);var realType=type,custom=Element.Events.get(type),condition=fn,self=this;if(custom){if(custom.onAdd)custom.onAdd.call(this,fn);if(custom.condition){condition=function(event){if(custom.condition.call(this,event))return fn.call(this,event);return true;};}
realType=custom.base||realType;}
var defn=function(){return fn.call(self);};var nativeEvent=Element.NativeEvents[realType];if(nativeEvent){if(nativeEvent==2){defn=function(event){event=new Event(event,self.getWindow());if(condition.call(self,event)===false)event.stop();};}
this.addListener(realType,defn);}
events[type].values.push(defn);return this;},removeEvent:function(type,fn){var events=this.retrieve('events');if(!events||!events[type])return this;var pos=events[type].keys.indexOf(fn);if(pos==-1)return this;events[type].keys.splice(pos,1);var value=events[type].values.splice(pos,1)[0];var custom=Element.Events.get(type);if(custom){if(custom.onRemove)custom.onRemove.call(this,fn);type=custom.base||type;}
return(Element.NativeEvents[type])?this.removeListener(type,value):this;},addEvents:function(events){for(var event in events)this.addEvent(event,events[event]);return this;},removeEvents:function(events){var type;if($type(events)=='object'){for(type in events)this.removeEvent(type,events[type]);return this;}
var attached=this.retrieve('events');if(!attached)return this;if(!events){for(type in attached)this.removeEvents(type);this.eliminate('events');}else if(attached[events]){while(attached[events].keys[0])this.removeEvent(events,attached[events].keys[0]);attached[events]=null;}
return this;},fireEvent:function(type,args,delay){var events=this.retrieve('events');if(!events||!events[type])return this;events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},cloneEvents:function(from,type){from=document.id(from);var fevents=from.retrieve('events');if(!fevents)return this;if(!type){for(var evType in fevents)this.cloneEvents(from,evType);}else if(fevents[type]){fevents[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var $check=function(event){var related=event.relatedTarget;if(related==undefined)return true;if(related===false)return false;return($type(this)!='document'&&related!=this&&related.prefix!='xul'&&!this.hasChild(related));};Element.Events=new Hash({mouseenter:{base:'mouseover',condition:$check},mouseleave:{base:'mouseout',condition:$check},mousewheel:{base:(Browser.Engine.gecko)?'DOMMouseScroll':'mousewheel'}});})();Element.Properties.styles={set:function(styles){this.setStyles(styles);}};Element.Properties.opacity={set:function(opacity,novisibility){if(!novisibility){if(opacity==0){if(this.style.visibility!='hidden')this.style.visibility='hidden';}else{if(this.style.visibility!='visible')this.style.visibility='visible';}}
if(!this.currentStyle||!this.currentStyle.hasLayout)this.style.zoom=1;if(Browser.Engine.trident)this.style.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')';this.style.opacity=opacity;this.store('opacity',opacity);},get:function(){return this.retrieve('opacity',1);}};Element.implement({setOpacity:function(value){return this.set('opacity',value,true);},getOpacity:function(){return this.get('opacity');},setStyle:function(property,value){switch(property){case'opacity':return this.set('opacity',parseFloat(value));case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();if($type(value)!='string'){var map=(Element.Styles.get(property)||'@').split(' ');value=$splat(value).map(function(val,i){if(!map[i])return'';return($type(val)=='number')?map[i].replace('@',Math.round(val)):val;}).join(' ');}else if(value==String(Number(value))){value=Math.round(value);}
this.style[property]=value;return this;},getStyle:function(property){switch(property){case'opacity':return this.get('opacity');case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();var result=this.style[property];if(!$chk(result)){result=[];for(var style in Element.ShortStyles){if(property!=style)continue;for(var s in Element.ShortStyles[style])result.push(this.getStyle(s));return result.join(' ');}
result=this.getComputedStyle(property);}
if(result){result=String(result);var color=result.match(/rgba?\([\d\s,]+\)/);if(color)result=result.replace(color[0],color[0].rgbToHex());}
if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(result,10)))){if(property.test(/^(height|width)$/)){var values=(property=='width')?['left','right']:['top','bottom'],size=0;values.each(function(value){size+=this.getStyle('border-'+value+'-width').toInt()+this.getStyle('padding-'+value).toInt();},this);return this['offset'+property.capitalize()]-size+'px';}
if((Browser.Engine.presto)&&String(result).test('px'))return result;if(property.test(/(border(.+)Width|margin|padding)/))return'0px';}
return result;},setStyles:function(styles){for(var style in styles)this.setStyle(style,styles[style]);return this;},getStyles:function(){var result={};Array.flatten(arguments).each(function(key){result[key]=this.getStyle(key);},this);return result;}});Element.Styles=new Hash({left:'@px',top:'@px',bottom:'@px',right:'@px',width:'@px',height:'@px',maxWidth:'@px',maxHeight:'@px',minWidth:'@px',minHeight:'@px',backgroundColor:'rgb(@, @, @)',backgroundPosition:'@px @px',color:'rgb(@, @, @)',fontSize:'@px',letterSpacing:'@px',lineHeight:'@px',clip:'rect(@px @px @px @px)',margin:'@px @px @px @px',padding:'@px @px @px @px',border:'@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',borderWidth:'@px @px @px @px',borderStyle:'@ @ @ @',borderColor:'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',zIndex:'@','zoom':'@',fontWeight:'@',textIndent:'@px',opacity:'@'});Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};['Top','Right','Bottom','Left'].each(function(direction){var Short=Element.ShortStyles;var All=Element.Styles;['margin','padding'].each(function(style){var sd=style+direction;Short[style][sd]=All[sd]='@px';});var bd='border'+direction;Short.border[bd]=All[bd]='@px @ rgb(@, @, @)';var bdw=bd+'Width',bds=bd+'Style',bdc=bd+'Color';Short[bd]={};Short.borderWidth[bdw]=Short[bd][bdw]=All[bdw]='@px';Short.borderStyle[bds]=Short[bd][bds]=All[bds]='@';Short.borderColor[bdc]=Short[bd][bdc]=All[bdc]='rgb(@, @, @)';});(function(){Element.implement({scrollTo:function(x,y){if(isBody(this)){this.getWindow().scrollTo(x,y);}else{this.scrollLeft=x;this.scrollTop=y;}
return this;},getSize:function(){if(isBody(this))return this.getWindow().getSize();return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(isBody(this))return this.getWindow().getScrollSize();return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(isBody(this))return this.getWindow().getScroll();return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var element=this,position={x:0,y:0};while(element&&!isBody(element)){position.x+=element.scrollLeft;position.y+=element.scrollTop;element=element.parentNode;}
return position;},getOffsetParent:function(){var element=this;if(isBody(element))return null;if(!Browser.Engine.trident)return element.offsetParent;while((element=element.parentNode)&&!isBody(element)){if(styleString(element,'position')!='static')return element;}
return null;},getOffsets:function(){if(this.getBoundingClientRect){var bound=this.getBoundingClientRect(),html=document.id(this.getDocument().documentElement),htmlScroll=html.getScroll(),elemScrolls=this.getScrolls(),elemScroll=this.getScroll(),isFixed=(styleString(this,'position')=='fixed');var patch_offsets={x:0,y:0};if((document.compatMode=='BackCompat'&&Browser.Engine.trident)){patch_offsets={x:-2,y:-2};}
return{x:bound.left.toInt()+elemScrolls.x-elemScroll.x+((isFixed)?0:htmlScroll.x)-html.clientLeft+patch_offsets.x,y:bound.top.toInt()+elemScrolls.y-elemScroll.y+((isFixed)?0:htmlScroll.y)-html.clientTop+patch_offsets.y};}
var element=this,position={x:0,y:0};if(isBody(this))return position;while(element&&!isBody(element)){position.x+=element.offsetLeft;position.y+=element.offsetTop;if(Browser.Engine.gecko){if(!borderBox(element)){position.x+=leftBorder(element);position.y+=topBorder(element);}
var parent=element.parentNode;if(parent&&styleString(parent,'overflow')!='visible'){position.x+=leftBorder(parent);position.y+=topBorder(parent);}}else if(element!=this&&Browser.Engine.webkit){position.x+=leftBorder(element);position.y+=topBorder(element);}
element=element.offsetParent;}
if(Browser.Engine.gecko&&!borderBox(this)){position.x-=leftBorder(this);position.y-=topBorder(this);}
return position;},getPosition:function(relative){if(isBody(this))return{x:0,y:0};var offset=this.getOffsets(),scroll=this.getScrolls();var position={x:offset.x-scroll.x,y:offset.y-scroll.y};var relativePosition=(relative&&(relative=document.id(relative)))?relative.getPosition():{x:0,y:0};return{x:position.x-relativePosition.x,y:position.y-relativePosition.y};},getCoordinates:function(element){if(isBody(this))return this.getWindow().getCoordinates();var position=this.getPosition(element),size=this.getSize();var obj={left:position.x,top:position.y,width:size.x,height:size.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj;},computePosition:function(obj){return{left:obj.x-styleNumber(this,'margin-left'),top:obj.y-styleNumber(this,'margin-top')};},setPosition:function(obj){return this.setStyles(this.computePosition(obj));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var win=this.getWindow();return{x:win.innerWidth,y:win.innerHeight};}
var doc=getCompatElement(this);return{x:doc.clientWidth,y:doc.clientHeight};},getScroll:function(){var win=this.getWindow(),doc=getCompatElement(this);return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop};},getScrollSize:function(){var doc=getCompatElement(this),min=this.getSize();return{x:Math.max(doc.scrollWidth,min.x),y:Math.max(doc.scrollHeight,min.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var size=this.getSize();return{top:0,left:0,bottom:size.y,right:size.x,height:size.y,width:size.x};}});var styleString=Element.getComputedStyle;function styleNumber(element,style){return styleString(element,style).toInt()||0;};function borderBox(element){return styleString(element,'-moz-box-sizing')=='border-box';};function topBorder(element){return styleNumber(element,'border-top-width');};function leftBorder(element){return styleNumber(element,'border-left-width');};function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};function getCompatElement(element){var doc=element.getDocument();return(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;};})();Element.alias('setPosition','position');Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(expression,nocash){expression=expression.split(',');var items,local={};for(var i=0,l=expression.length;i<l;i++){var selector=expression[i],elements=Selectors.Utils.search(this,selector,local);if(i!=0&&elements.item)elements=$A(elements);items=(i==0)?elements:(items.item)?$A(items).concat(elements):items.concat(elements);}
return new Elements(items,{ddup:(expression.length>1),cash:!nocash});}});Element.implement({match:function(selector){if(!selector||(selector==this))return true;var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(!Selectors.Filters.byID(this,id)||!Selectors.Filters.byTag(this,tag))return false;var parsed=Selectors.Utils.parseSelector(selector);return(parsed)?Selectors.Utils.filter(this,parsed,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(item,uniques){if(!uniques)return true;var uid=$uid(item);if(!uniques[uid])return uniques[uid]=true;return false;},parseNthArgument:function(argument){if(Selectors.Cache.nth[argument])return Selectors.Cache.nth[argument];var parsed=argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!parsed)return false;var inta=parseInt(parsed[1],10);var a=(inta||inta===0)?inta:1;var special=parsed[2]||false;var b=parseInt(parsed[3],10)||0;if(a!=0){b--;while(b<1)b+=a;while(b>=a)b-=a;}else{a=b;special='index';}
switch(special){case'n':parsed={a:a,b:b,special:'n'};break;case'odd':parsed={a:2,b:0,special:'n'};break;case'even':parsed={a:2,b:1,special:'n'};break;case'first':parsed={a:0,special:'index'};break;case'last':parsed={special:'last-child'};break;case'only':parsed={special:'only-child'};break;default:parsed={a:(a-1),special:'index'};}
return Selectors.Cache.nth[argument]=parsed;},parseSelector:function(selector){if(Selectors.Cache.parsed[selector])return Selectors.Cache.parsed[selector];var m,parsed={classes:[],pseudos:[],attributes:[]};while((m=Selectors.RegExps.combined.exec(selector))){var cn=m[1],an=m[2],ao=m[3],av=m[5],pn=m[6],pa=m[7];if(cn){parsed.classes.push(cn);}else if(pn){var parser=Selectors.Pseudo.get(pn);if(parser)parsed.pseudos.push({parser:parser,argument:pa});else parsed.attributes.push({name:pn,operator:'=',value:pa});}else if(an){parsed.attributes.push({name:an,operator:ao,value:av});}}
if(!parsed.classes.length)delete parsed.classes;if(!parsed.attributes.length)delete parsed.attributes;if(!parsed.pseudos.length)delete parsed.pseudos;if(!parsed.classes&&!parsed.attributes&&!parsed.pseudos)parsed=null;return Selectors.Cache.parsed[selector]=parsed;},parseTagAndID:function(selector){var tag=selector.match(Selectors.RegExps.tag);var id=selector.match(Selectors.RegExps.id);return[(tag)?tag[1]:'*',(id)?id[1]:false];},filter:function(item,parsed,local){var i;if(parsed.classes){for(i=parsed.classes.length;i--;i){var cn=parsed.classes[i];if(!Selectors.Filters.byClass(item,cn))return false;}}
if(parsed.attributes){for(i=parsed.attributes.length;i--;i){var att=parsed.attributes[i];if(!Selectors.Filters.byAttribute(item,att.name,att.operator,att.value))return false;}}
if(parsed.pseudos){for(i=parsed.pseudos.length;i--;i){var psd=parsed.pseudos[i];if(!Selectors.Filters.byPseudo(item,psd.parser,psd.argument,local))return false;}}
return true;},getByTagAndID:function(ctx,tag,id){if(id){var item=(ctx.getElementById)?ctx.getElementById(id,true):Element.getElementById(ctx,id,true);return(item&&Selectors.Filters.byTag(item,tag))?[item]:[];}else{return ctx.getElementsByTagName(tag);}},search:function(self,expression,local){var splitters=[];var selectors=expression.trim().replace(Selectors.RegExps.splitter,function(m0,m1,m2){splitters.push(m1);return':)'+m2;}).split(':)');var items,filtered,item;for(var i=0,l=selectors.length;i<l;i++){var selector=selectors[i];if(i==0&&Selectors.RegExps.quick.test(selector)){items=self.getElementsByTagName(selector);continue;}
var splitter=splitters[i-1];var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(i==0){items=Selectors.Utils.getByTagAndID(self,tag,id);}else{var uniques={},found=[];for(var j=0,k=items.length;j<k;j++)found=Selectors.Getters[splitter](found,items[j],tag,id,uniques);items=found;}
var parsed=Selectors.Utils.parseSelector(selector);if(parsed){filtered=[];for(var m=0,n=items.length;m<n;m++){item=items[m];if(Selectors.Utils.filter(item,parsed,local))filtered.push(item);}
items=filtered;}}
return items;}};Selectors.Getters={' ':function(found,self,tag,id,uniques){var items=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=items.length;i<l;i++){var item=items[i];if(Selectors.Utils.chk(item,uniques))found.push(item);}
return found;},'>':function(found,self,tag,id,uniques){var children=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child.parentNode==self&&Selectors.Utils.chk(child,uniques))found.push(child);}
return found;},'+':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(Selectors.Utils.chk(self,uniques)&&Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);break;}}
return found;},'~':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(!Selectors.Utils.chk(self,uniques))break;if(Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);}}
return found;}};Selectors.Filters={byTag:function(self,tag){return(tag=='*'||(self.tagName&&self.tagName.toLowerCase()==tag));},byID:function(self,id){return(!id||(self.id&&self.id==id));},byClass:function(self,klass){return(self.className&&self.className.contains&&self.className.contains(klass,' '));},byPseudo:function(self,parser,argument,local){return parser.call(self,argument,local);},byAttribute:function(self,name,operator,value){var result=Element.prototype.getProperty.call(self,name);if(!result)return(operator=='!=');if(!operator||value==undefined)return true;switch(operator){case'=':return(result==value);case'*=':return(result.contains(value));case'^=':return(result.substr(0,value.length)==value);case'$=':return(result.substr(result.length-value.length)==value);case'!=':return(result!=value);case'~=':return result.contains(value,' ');case'|=':return result.contains(value,'-');}
return false;}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return!(this.innerText||this.textContent||'').length;},not:function(selector){return!Element.match(this,selector);},contains:function(text){return(this.innerText||this.textContent||'').contains(text);},'first-child':function(){return Selectors.Pseudo.index.call(this,0);},'last-child':function(){var element=this;while((element=element.nextSibling)){if(element.nodeType==1)return false;}
return true;},'only-child':function(){var prev=this;while((prev=prev.previousSibling)){if(prev.nodeType==1)return false;}
var next=this;while((next=next.nextSibling)){if(next.nodeType==1)return false;}
return true;},'nth-child':function(argument,local){argument=(argument==undefined)?'n':argument;var parsed=Selectors.Utils.parseNthArgument(argument);if(parsed.special!='n')return Selectors.Pseudo[parsed.special].call(this,parsed.a,local);var count=0;local.positions=local.positions||{};var uid=$uid(this);if(!local.positions[uid]){var self=this;while((self=self.previousSibling)){if(self.nodeType!=1)continue;count++;var position=local.positions[$uid(self)];if(position!=undefined){count=position+count;break;}}
local.positions[uid]=count;}
return(local.positions[uid]%parsed.a==parsed.b);},index:function(index){var element=this,count=0;while((element=element.previousSibling)){if(element.nodeType==1&&++count>index)return false;}
return(count==index);},even:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n+1',local);},odd:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n',local);},selected:function(){return this.selected;},enabled:function(){return(this.disabled===false);}});Element.Events.domready={onAdd:function(fn){if(Browser.loaded)fn.call(this);}};(function(){var domready=function(){if(Browser.loaded)return;Browser.loaded=true;window.fireEvent('domready');document.fireEvent('domready');};window.addEvent('load',domready);if(Browser.Engine.trident){var temp=document.createElement('div');(function(){($try(function(){temp.doScroll();return document.id(temp).inject(document.body).set('html','temp').dispose();}))?domready():arguments.callee.delay(50);})();}else if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(['loaded','complete'].contains(document.readyState))?domready():arguments.callee.delay(50);})();}else{document.addEvent('DOMContentLoaded',domready);}})();var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$specialChars:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$replaceChars:function(chr){return JSON.$specialChars[chr]||'\\u00'+Math.floor(chr.charCodeAt()/16).toString(16)+(chr.charCodeAt()%16).toString(16);},encode:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case'array':return'['+String(obj.map(JSON.encode).clean())+']';case'object':case'hash':var string=[];Hash.each(obj,function(value,key){var json=JSON.encode(value);if(json)string.push(JSON.encode(key)+':'+json);});return'{'+string+'}';case'number':case'boolean':return String(obj);case false:return'null';}
return null;},decode:function(string,secure){if($type(string)!='string'||!string.length)return null;if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'')))return null;return eval('('+string+')');}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(key,options){this.key=key;this.setOptions(options);},write:function(value){value=encodeURIComponent(value);if(this.options.domain)value+='; domain='+this.options.domain;if(this.options.path)value+='; path='+this.options.path;if(this.options.duration){var date=new Date();date.setTime(date.getTime()+this.options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();}
if(this.options.secure)value+='; secure';this.options.document.cookie=this.key+'='+value;return this;},read:function(){var value=this.options.document.cookie.match('(?:^|;)\\s*'+this.key.escapeRegExp()+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write('');return this;}});Cookie.write=function(key,value,options){return new Cookie(key,options).write(value);};Cookie.read=function(key){return new Cookie(key).read();};Cookie.dispose=function(key,options){return new Cookie(key,options).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=document.id(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=document.id(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){document.id(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:'ignore'},initialize:function(options){this.subject=this.subject||this;this.setOptions(options);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var wait=this.options.wait;if(wait===false)this.options.link='cancel';},getTransition:function(){return function(p){return-(Math.cos(Math.PI*p)-1)/2;};},step:function(){var time=$time();if(time<this.time+this.options.duration){var delta=this.transition((time-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,delta));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(now){return now;},compute:function(from,to,delta){return Fx.compute(from,to,delta);},check:function(){if(!this.timer)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},start:function(from,to){if(!this.check(from,to))return this;this.from=from;this.to=to;this.time=0;this.transition=this.getTransition();this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer())this.onComplete();return this;},cancel:function(){if(this.stopTimer())this.onCancel();return this;},onStart:function(){this.fireEvent('start',this.subject);},onComplete:function(){this.fireEvent('complete',this.subject);if(!this.callChain())this.fireEvent('chainComplete',this.subject);},onCancel:function(){this.fireEvent('cancel',this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();return this;},stopTimer:function(){if(!this.timer)return false;this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer)return false;this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(from,to,delta){return(to-from)*delta+from;};Fx.Durations={'short':250,'normal':500,'long':1000};Fx.CSS=new Class({Extends:Fx,prepare:function(element,property,values){values=$splat(values);var values1=values[1];if(!$chk(values1)){values[1]=values[0];values[0]=element.getStyle(property);}
var parsed=values.map(this.parse);return{from:parsed[0],to:parsed[1]};},parse:function(value){value=$lambda(value)();value=(typeof value=='string')?value.split(' '):$splat(value);return value.map(function(val){val=String(val);var found=false;Fx.CSS.Parsers.each(function(parser,key){if(found)return;var parsed=parser.parse(val);if($chk(parsed))found={value:parsed,parser:parser};});found=found||{value:val,parser:Fx.CSS.Parsers.String};return found;});},compute:function(from,to,delta){var computed=[];(Math.min(from.length,to.length)).times(function(i){computed.push({value:from[i].parser.compute(from[i].value,to[i].value,delta),parser:from[i].parser});});computed.$family={name:'fx:css:value'};return computed;},serve:function(value,unit){if($type(value)!='fx:css:value')value=this.parse(value);var returned=[];value.each(function(bit){returned=returned.concat(bit.parser.serve(bit.value,unit));});return returned;},render:function(element,property,value,unit){element.setStyle(property,this.serve(value,unit));},search:function(selector){if(Fx.CSS.Cache[selector])return Fx.CSS.Cache[selector];var to={};Array.each(document.styleSheets,function(sheet,j){var href=sheet.href;if(href&&href.contains('://')&&!href.contains(document.domain))return;var rules=sheet.rules||sheet.cssRules;Array.each(rules,function(rule,i){if(!rule.style)return;var selectorText=(rule.selectorText)?rule.selectorText.replace(/^\w+/,function(m){return m.toLowerCase();}):null;if(!selectorText||!selectorText.test('^'+selector+'$'))return;Element.Styles.each(function(value,style){if(!rule.style[style]||Element.ShortStyles[style])return;value=String(rule.style[style]);to[style]=(value.test(/^rgb/))?value.rgbToHex():value;});});});return Fx.CSS.Cache[selector]=to;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(value){if(value.match(/^#[0-9a-f]{3,6}$/i))return value.hexToRgb(true);return((value=value.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[value[1],value[2],value[3]]:false;},compute:function(from,to,delta){return from.map(function(value,i){return Math.round(Fx.compute(from[i],to[i],delta));});},serve:function(value){return value.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(value,unit){return(unit)?value+unit:value;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);},set:function(property,now){if(arguments.length==1){now=property;property=this.property||this.options.property;}
this.render(this.element,property,now,this.options.unit);return this;},start:function(property,from,to){if(!this.check(property,from,to))return this;var args=Array.flatten(arguments);this.property=this.options.property||args.shift();var parsed=this.prepare(this.element,this.property,args);return this.parent(parsed.from,parsed.to);}});Element.Properties.tween={set:function(options){var tween=this.retrieve('tween');if(tween)tween.cancel();return this.eliminate('tween').store('tween:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('tween')){if(options||!this.retrieve('tween:options'))this.set('tween',options);this.store('tween',new Fx.Tween(this,this.retrieve('tween:options')));}
return this.retrieve('tween');}};Element.implement({tween:function(property,from,to){this.get('tween').start(arguments);return this;},fade:function(how){var fade=this.get('tween'),o='opacity',toggle;how=$pick(how,'toggle');switch(how){case'in':fade.start(o,1);break;case'out':fade.start(o,0);break;case'show':fade.set(o,1);break;case'hide':fade.set(o,0);break;case'toggle':var flag=this.retrieve('fade:flag',this.get('opacity')==1);fade.start(o,(flag)?0:1);this.store('fade:flag',!flag);toggle=true;break;default:fade.start(o,arguments);}
if(!toggle)this.eliminate('fade:flag');return this;},highlight:function(start,end){if(!end){end=this.retrieve('highlight:original',this.getStyle('background-color'));end=(end=='transparent')?'#fff':end;}
var tween=this.get('tween');tween.start('background-color',start||'#ffff88',end).chain(function(){this.setStyle('background-color',this.retrieve('highlight:original'));tween.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);},set:function(now){if(typeof now=='string')now=this.search(now);for(var p in now)this.render(this.element,p,now[p],this.options.unit);return this;},compute:function(from,to,delta){var now={};for(var p in from)now[p]=this.parent(from[p],to[p],delta);return now;},start:function(properties){if(!this.check(properties))return this;if(typeof properties=='string')properties=this.search(properties);var from={},to={};for(var p in properties){var parsed=this.prepare(this.element,p,properties[p]);from[p]=parsed.from;to[p]=parsed.to;}
return this.parent(from,to);}});Element.Properties.morph={set:function(options){var morph=this.retrieve('morph');if(morph)morph.cancel();return this.eliminate('morph').store('morph:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('morph')){if(options||!this.retrieve('morph:options'))this.set('morph',options);this.store('morph',new Fx.Morph(this,this.retrieve('morph:options')));}
return this.retrieve('morph');}};Element.implement({morph:function(props){this.get('morph').start(props);return this;}});Fx.implement({getTransition:function(){var trans=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof trans=='string'){var data=trans.split(':');trans=Fx.Transitions;trans=trans[data[0]]||trans[data[0].capitalize()];if(data[1])trans=trans['ease'+data[1].capitalize()+(data[2]?data[2].capitalize():'')];}
return trans;}});Fx.Transition=function(transition,params){params=$splat(params);return $extend(transition,{easeIn:function(pos){return transition(pos,params);},easeOut:function(pos){return 1-transition(1-pos,params);},easeInOut:function(pos){return(pos<=0.5)?transition(2*pos,params)/2:(2-transition(2*(1-pos),params))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(transitions){for(var transition in transitions)Fx.Transitions[transition]=new Fx.Transition(transitions[transition]);};Fx.Transitions.extend({Pow:function(p,x){return Math.pow(p,x[0]||6);},Expo:function(p){return Math.pow(2,8*(p-1));},Circ:function(p){return 1-Math.sin(Math.acos(p));},Sine:function(p){return 1-Math.sin((1-p)*Math.PI/2);},Back:function(p,x){x=x[0]||1.618;return Math.pow(p,2)*((x+1)*p-x);},Bounce:function(p){var value;for(var a=0,b=1;1;a+=b,b/=2){if(p>=(7-4*a)/11){value=b*b-Math.pow((11-6*a-11*p)/4,2);break;}}
return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:'',data:'',headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*'},async:true,format:false,method:'post',link:'ignore',isSuccess:null,emulation:true,urlEncoded:true,encoding:'utf-8',evalScripts:false,evalResponse:false,noCache:false},initialize:function(options){this.xhr=new Browser.Request();this.setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running)return;this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));this.xhr.onreadystatechange=$empty;if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(text){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))return $exec(text);return text.stripScripts(this.options.evalScripts);},success:function(text,xml){this.onSuccess(this.processScripts(text),xml);},onSuccess:function(){this.fireEvent('complete',arguments).fireEvent('success',arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent('complete').fireEvent('failure',this.xhr);},setHeader:function(name,value){this.headers.set(name,value);return this;},getHeader:function(name){return $try(function(){return this.xhr.getResponseHeader(name);}.bind(this));},check:function(){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},send:function(options){if(!this.check(options))return this;this.running=true;var type=$type(options);if(type=='string'||type=='element')options={data:options};var old=this.options;options=$extend({data:old.data,url:old.url,method:old.method},options);var data=options.data,url=String(options.url),method=options.method.toLowerCase();switch($type(data)){case'element':data=document.id(data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(data);}
if(this.options.format){var format='format='+this.options.format;data=(data)?format+'&'+data:format;}
if(this.options.emulation&&!['get','post'].contains(method)){var _method='_method='+method;data=(data)?_method+'&'+data:_method;method='post';}
if(this.options.urlEncoded&&method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.headers.set('Content-type','application/x-www-form-urlencoded'+encoding);}
if(this.options.noCache){var noCache='noCache='+new Date().getTime();data=(data)?noCache+'&'+data:noCache;}
var trimPosition=url.lastIndexOf('/');if(trimPosition>-1&&(trimPosition=url.indexOf('#'))>-1)url=url.substr(0,trimPosition);if(data&&method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
this.xhr.open(method.toUpperCase(),url,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(value,key){try{this.xhr.setRequestHeader(key,value);}catch(e){this.fireEvent('exception',[key,value]);}},this);this.fireEvent('request');this.xhr.send(data);if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent('cancel');return this;}});(function(){var methods={};['get','post','put','delete','GET','POST','PUT','DELETE'].each(function(method){methods[method]=function(){var params=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(params,{method:method}));};});Request.implement(methods);})();Element.Properties.send={set:function(options){var send=this.retrieve('send');if(send)send.cancel();return this.eliminate('send').store('send:options',$extend({data:this,link:'cancel',method:this.get('method')||'post',url:this.get('action')},options));},get:function(options){if(options||!this.retrieve('send')){if(options||!this.retrieve('send:options'))this.set('send',options);this.store('send',new Request(this.retrieve('send:options')));}
return this.retrieve('send');}};Element.implement({send:function(url){var sender=this.get('send');sender.send({data:this,url:url||sender.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/xml');}
root=doc.getElementsByTagName('root')[0];if(!root)return null;for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);},success:function(text){var options=this.options,response=this.response;response.html=text.stripScripts(function(script){response.javascript=script;});var temp=this.processHTML(response.html);response.tree=temp.childNodes;response.elements=temp.getElements('*');if(options.filter)response.tree=response.elements.filter(options.filter);if(options.update)document.id(options.update).empty().set('html',response.html);else if(options.append)document.id(options.append).adopt(temp.getChildren());if(options.evalScripts)$exec(response.javascript);this.onSuccess(response.tree,response.elements,response.html,response.javascript);}});Element.Properties.load={set:function(options){var load=this.retrieve('load');if(load)load.cancel();return this.eliminate('load').store('load:options',$extend({data:this,link:'cancel',update:this,method:'get'},options));},get:function(options){if(options||!this.retrieve('load')){if(options||!this.retrieve('load:options'))this.set('load',options);this.store('load',new Request.HTML(this.retrieve('load:options')));}
return this.retrieve('load');}};Element.implement({load:function(){this.get('load').send(Array.link(arguments,{data:Object.type,url:String.type}));return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(options){this.parent(options);this.headers.extend({'Accept':'application/json','X-Request':'JSON'});},success:function(text){this.response.json=JSON.decode(text,this.options.secure);this.onSuccess(this.response.json,text);}});


var OBJ_EDIT_FORM='ObjEditForm';SK.Const.ACTIONS_MESSAGES={'activating':'Activation in progress...','updating':'Updating modified items...','publishing':'Publishing to normal view...','adding':'Adding requested items...','deleting':'Deleting items...','holding':'Hiding items from viewers...','unholding':'Showing items to viewers...','moving':'Moving to specified position...','cutting':'Cutting items...','copying':'Copying items...','duplicating':'Duplicating items...','pasting':'Pasting items...','reverting':'Rejecting previewed changes...','accepting':'Applying previewed changes...','previewing':'Generating preview...','loading':'Loading...','':'Processing...'};SK.Actions.CLICK_ACTIONS={};SK.Actions.SELECTED_ITEMS={};SK.Actions.O_MESSAGES={SELECT_ITEMS:"Please select some item(s)",DELETION_CONFIRMATION:"Are you sure you want to delete the object(s)?"};SK.Actions.Common.button_clicked=false;SK.Actions.Common.NAVIGATE_AWAY_WARNING_MESSAGE="WARNING: Any changes you might have made will be lost if you press OK";var EDIT_TMPL_VALIDATORS=new Array();SK.Actions.default_window_size={"version_1":{width:636,height:480},"version_2":{width:750,height:560}};SK.preinit=function(){return;}
SK.init=function(){var system_type=SK.Singletons.env.get('system_type');SK.initFlashContent();SK.Singletons.cm=new SK.UI.CM();window.setTimeout(function(){document.body.style.cursor='wait';SK.Singletons.cm.init(MENU_CLASSES,"env",{slow_system:SK.Util.isSlowSystem(),no_backing_iframes:SK.Actions.Common.failsToSetRuntimeWMode()});document.body.style.cursor='default';SK.UI.Preview.addEvents({onEnable:SK.Singletons.cm.disable.bind(SK.Singletons.cm),onDisable:SK.Singletons.cm.enable.bind(SK.Singletons.cm)});SK.UI.Preview.initializeEvents();},10);SK.initHelp();SK.initTemporaryDesign();SK.initStatusMessage();SK.initClipboard();SK.initPeripherials();SK.initBugger();SK.initTopMenuStripe();SK.initTrialStatus();SK.Singletons.tm=new SK.UI.TM();SK.Singletons.tm.init(TM_CONFIG,{slowSystem:SK.Util.isSlowSystem()});SK.Singletons.cm.addNonOverlappingCoordinator('tm',SK.Singletons.tm.getElementsCoordinates.bind(SK.Singletons.tm));window.setTimeout(function(){SK.initElementsStatus();},10);if(Cookie.read('JustLogged')=='1'){$(window).fireEvent('afterlogin');Cookie.write('JustLogged',0);Cookie.dispose('JustLogged');}}
SK.initPeripherials=function(){SK.Singletons.peripherials=new SK.Peripherials();SK.Singletons.peripherials.init();}
SK.initFlashContent=function(){var needs_replacement=SK.Actions.Common.failsToSetRuntimeWMode();var embed_elements=$$('embed');for(var i=0;i<embed_elements.length;i++){var embed=$(embed_elements[i]);if(embed.getAttribute('wmode')&&embed.getAttribute('wmode').toLowerCase()=='transparent'){continue;}
if(needs_replacement==false){embed.setAttribute('wmode','transparent');}
if(needs_replacement==true){var p=embed.parentNode;var found=false;while(p&&p.tagName&&p.tagName.toLowerCase()!='body'){if(p.getAttribute('env')!=null){found=true;break;}
p=p.parentNode;}
if(found&&p){var env=JSON.decode(p.getAttribute('env'));if(!$defined(env.callbacks)){env.callbacks={};}
env.callbacks.onshowhighlight="SK.Actions.Common.handleInEmbedPlaceholder";env.callbacks.onhidehighlight="SK.Actions.Common.handleOutEmbedPlaceholder";env.callbacks.onhidemenu="SK.Actions.Common.handleOutEmbedPlaceholder";p.setAttribute('env',JSON.encode(env));}}}}
SK.initTrialStatus=function(){if(SK.Actions.Common.isOnTrialPlan()){var tm_cfg=new SK.Util.TMConfigBuilder(TM_CONFIG);var item=tm_cfg.getItem('trial');var days=parseInt(SK.Singletons.env.get('days_till_plan_expiration'));if(!isNaN(days)&&days>=0){item.text=days=="1"?"Trial ends in "+days+" day":"Trial ends in "+days+" days";tm_cfg.setItem('trial',item);}}}
SK.initClipboard=function(){var tm_cfg=new SK.Util.TMConfigBuilder(TM_CONFIG);var operations=['cut','copy'];for(var i=0;i<operations.length;i++){var operation=operations[i];var operation_name="";switch(operation){case'cut':operation_name='cut';break;case'copy':operation_name='copied';break;}
var clipboard=SK.Singletons.env.get('clipboard')[operation];for(var j=0;j<clipboard.length;j++){var obj=clipboard[j];var item=tm_cfg.generateDefaultSubItem();var sk_node=SK.Singletons.obj_nodes.find(obj);var name="Unknown Element";var comment="";if(sk_node){name=sk_node.getProperty('name');comment=""+operation_name+" from page '"+obj.getProperty('page_title')+"'<br>"+"click to paste on this page";}
item.text=name;item.comment=comment;item.obj=obj;var similar_item=tm_cfg.getSubItem('add',obj.getObjID());if(similar_item){item.icon_sprite_offset=similar_item.icon_sprite_offset;item.icon_sprite_width=similar_item.icon_sprite_width;item.icon_sprite_height=similar_item.icon_sprite_height;}else{var add_content_items=tm_cfg.getItem('add');if(add_content_items){item.icon_sprite_offset=tm_cfg.getLastAddContentImageOffset();item.icon_sprite_width=add_content_items.submenu_items[0].icon_sprite_width;item.icon_sprite_height=add_content_items.submenu_items[0].icon_sprite_height;}}
item.callbacks.onclick=function(item){SK.Actions.Common.initiatePaste([item.obj]);}
tm_cfg.addSubItemFirst('clipboard',item);}}}
SK.initHelp=function(){if(SK.Actions.Common.isHelpEnabled()&&SK.Actions.Common.hasTemporaryDesign()==false){SK.Singletons.help=new SK.UI.Help(SK.Singletons.env.get('help_url'),{},parseInt(SK.Singletons.env.get('days_from_registration'))<14?false:true);SK.Singletons.help.init();}}
SK.initTemporaryDesign=function(){if(SK.Actions.Common.hasTemporaryDesign()){if(SK.Singletons.env.get('select_design_ui')=='thumbnails'){SK.Actions.Common.openChangeDesign(SK.Singletons.env.get('user_id'));}else{SK.Actions.Common.openSiteProperties(SK.Singletons.env.get('user_id'),{title:"Change Design"});}}}
SK.initStatusMessage=function(){if(SK.Singletons.env.get('publish_completed')){var page_urls=SK.Singletons.env.get('publish_page_urls');page_urls=page_urls.map(function(e){return'<nobr><a href="'+e+'" target="_blank" class="sk-tooltip-text-link">'+e+'</a></nobr>';});var share_this_site_msg="";var share_site_url=SK.Singletons.env.get('share_site_url');if(share_site_url!=""){share_this_site_msg="<br>\n"+'<a href="javascript:void(null)" onclick="SK.Actions.Common.openShareSite()" class="sk-tooltip-text-link">Share this site</a>';}
var published_status_tooltip="Your page has been published to:<br>\n";published_status_tooltip+=page_urls.join("<br>\n")+share_this_site_msg;SK.Singletons.env.set('status_message',published_status_tooltip)}
if(SK.Singletons.env.get('status_message')!=""){var tooltip=new SK.UI.FancyTooltip(SK.Singletons.env.get('status_message'),{bottom:0,left:0,animation_type:'top-bottom',mode:SK.Singletons.env.get('status_code')?'status':'error'});tooltip.init();tooltip.display();window.setTimeout(function(){tooltip.hide()},10*1000);}}
SK.initTopMenuStripe=function(){if(SK.Singletons.env.get('aa_top_padding')==true){$('aa_top_padding').setStyle('display','block');if(SK.Singletons.env.get('aa_top_padding_height')!=''&&!isNaN(parseInt(SK.Singletons.env.get('aa_top_padding_height')))){$('aa_top_padding').setStyle('height',SK.Singletons.env.get('aa_top_padding_height'));}
if(SK.Singletons.env.get('aa_top_padding_background')==''||(SK.Singletons.env.get('aa_top_padding_background')!=''&&SK.Singletons.env.get('aa_top_padding_background')==false)){$('aa_top_padding').setStyle('background','transparent');}}}
SK.initBugger=function(){var bugger=SK.Singletons.env.get('bugger');if(bugger!=""&&typeof bugger=='object'){var bugger_callback=function(){var tooltip_options=bugger.options;tooltip_options.mode='info';var tooltip=new SK.UI.FancyTooltip(bugger.message,bugger.options);tooltip.init();tooltip.display();if(bugger.options.hide_delay>0){window.setTimeout(function(){tooltip.hide()},bugger.options.hide_delay);}}
if(bugger.options.event_for_display=='delay'){var old_bugger_callback=bugger_callback;bugger_callback=function(){window.setTimeout(old_bugger_callback,bugger.options.event_for_display_params||1);};}
bugger_callback();}}
SK.initElementsStatus=function(){var objs=SK.getActiveElements();for(var i=0;i<objs.length;i++){var meta=JSON.decode($(objs[i]).get('meta'));if(meta.held){var env=JSON.decode($(objs[i]).get('env'));var elements_to_mark=[$(objs[i])];if(env.control_icons){for(var icon_id in env.control_icons){if($defined(env.control_icons[icon_id].items)&&$defined(env.control_icons[icon_id].items.del)&&$defined(env.control_icons[icon_id].items.del.hl_rel_elements)){env.control_icons[icon_id].items.del.hl_rel_elements.each(function(rel_element){var re=$(rel_element);if(re){this.arr.push(re);}},{arr:elements_to_mark});}}}
elements_to_mark.each(function(e){e.setStyles({'opacity':'0.2'}).addClass('sk-skip-in-preview');});}}}
SK.getActiveElements=function(){var elmnts=[];['form','table','tr','td','img','div','span','ul','li','p','a'].each(function(t){var objs=$$(t);for(var i=0;i<objs.length;i++){if(typeof $=='function'&&$(objs[i])&&$(objs[i]).get&&$(objs[i]).get('env')){elmnts.push(objs[i]);}}});return elmnts;}
SK.Actions.Common.displayProgress=function(action_message,callback){if(SK.Singletons.cm){SK.Singletons.cm.disable();}
var progress=new SK.UI.Progress();progress.init(action_message,{onafterdisplay:$type(callback)=='function'?function(){callback(this)}.bind(progress):$empty()});progress.display();return progress;}
SK.Actions.Common.hideProgress=function(progress){progress.hide();if(SK.Singletons.cm){SK.Singletons.cm.enable();}}
SK.Actions.Common.displayProgressQuick=function(action_message,callback){if(SK.Singletons.cm){SK.Singletons.cm.disable();}
var progress=new SK.UI.Progress({duration:0});progress.init(action_message,{onafterdisplay:$type(callback)=='function'?function(){callback(this)}.bind(progress):$empty()});progress.display();return progress;}
SK.Actions.Common.getActionMessage=function(action_type){if(typeof SK.Const.ACTIONS_MESSAGES[action_type]=='undefined'){return SK.Const.ACTIONS_MESSAGES[""];}
return SK.Const.ACTIONS_MESSAGES[action_type];}
SK.Actions.Common.assertSession=function(){if(!SK.Util.SessionMonitor.isValidSession(SK.Singletons.env.get('track_num'))){EscapeForNotValidSession();return false;}
return true;}
SK.Actions.Common.getUICallbacksConfiguration=function(obj_id,obj_inst){var obj_info=SK.Singletons.obj_nodes.find(new SK.Obj.Node(obj_id,obj_inst));if(obj_info!=null){var ui_callbacks=obj_info.getProperty('ui_callbacks');if(ui_callbacks!=""){ui_callbacks=JSON.decode(ui_callbacks);return ui_callbacks;}}
return{};}
SK.Actions.Common.hasTemporaryDesign=function(){return SK.Singletons.env.get('temporary_design');}
SK.Actions.Common.failsToSetRuntimeWMode=function(){return Browser.Engine.trident4==true||Browser.Engine.trident5==true||(Browser.Engine.gecko&&Browser.Platform.win);}
SK.Actions.Common.handleInEmbedPlaceholder=function(fh,obj){var children=obj.getChildren();while(children.length>0){var child=children.pop();if(child.tagName&&child.tagName.toLowerCase()=='embed'){var size={x:child.getAttribute('width'),y:child.getAttribute('height')};var placeholder_id=obj.id+'embed';var old_embed=$(placeholder_id);if(old_embed){old_embed.dispose();old_embed=null;}
child.style.display='none';var new_embed=new Element('div',{id:placeholder_id});new_embed.inject(child,'after');new_embed.setStyles({display:'block',width:size.x,height:size.y,"background-color":"#CCCCCC"});new_embed.inject(child,'after');var img=new Element('img');img.set('src',SK.Singletons.env.get('static_image_server')+'/Shared/Images/media_placeholder.gif');img.set('alt','Media Placeholder');img.width=size.x;img.height=size.y;img.border=1;new_embed.appendChild(img);}
var child_children=child.childNodes;if(child_children.length>0){children.extend(child_children);}}}
SK.Actions.Common.handleOutEmbedPlaceholder=function(fh,obj){var children=obj.getChildren();while(children.length>0){var child=children.pop();if(child.tagName&&child.tagName.toLowerCase()=='embed'){var placeholder_id=obj.id+'embed';var old_embed=$(placeholder_id);if(old_embed){old_embed.dispose();old_embed=null;}
child.style.display='';}
var child_children=child.childNodes;if(child_children.length>0){children.extend(child_children);}}}
SK.Actions.Common.isPagePublished=function(){return SK.Singletons.env.get('published');}
SK.Actions.Common.isInPreviewMode=function(){return SK.Singletons.env.get('site_properties_published')?false:true;}
SK.Actions.Common.generatePopupTitle=function(action,obj_name){if(action=='add'){return'Add {s}'.substitute({s:obj_name});}else{return'{s} Properties'.substitute({s:obj_name});}}
SK.Actions.Common.generateVersion2PopupTitle=function(action,obj_name){return'Loading...';}
SK.Actions.Common.getWindowOptions=function(obj_info,window_options){var obj_id=obj_info.obj_id;var obj_inst=obj_info.obj_inst;var dimensions=['width','height'];var version=obj_info.properties.version?"version_"+obj_info.properties.version:"version_1";var default_dimensions=SK.Actions.default_window_size[version];if(typeof window_options=='undefined'||!window_options){window_options={};}
if(typeof window_options.controls=='undefined'){window_options.controls={};}
if(typeof window_options.controls.maximize=='undefined'){window_options.controls.maximize=true;}
for(var i=0;i<dimensions.length;i++){var dimension=dimensions[i];if(typeof window_options[dimension]=='undefined'||!window_options[dimension]){window_options[dimension]=default_dimensions[dimension];}}
var body_size=$(document).getSize();var available_real_estate={width:body_size.x,height:body_size.y};for(var i=0;i<dimensions.length;i++){var dimension=dimensions[i];var dimension_str=window_options[dimension]+"";if(dimension_str.indexOf("%")!=-1){var percent=parseInt(dimension_str.substring(0,dimension_str.indexOf("%")));window_options[dimension]=Math.round(available_real_estate[dimension]*percent/100.0);}}
return window_options;}
SK.Actions.Common.getEditTmplParams=function(obj_id,obj_inst,params){if(typeof params=='undefined'||!params){params={};}
return params;}
SK.Actions.Common.openEditTmpl=function(meta,params,window_options){var edit_tmpl_options=SK.Actions.Common.generateEditTmplOptions(meta,params,window_options);var win=new SKFancyWindow(edit_tmpl_options.url,edit_tmpl_options.popup_title,edit_tmpl_options.window_options.width,edit_tmpl_options.window_options.height,edit_tmpl_options.window_options);win.init();win.display();}
SK.Actions.Common.generateEditTmplOptions=function(meta,params,window_options){var form=document.forms[OBJ_EDIT_FORM];var user_id=form.user_id?form.user_id.value:'';var page_id=form.page_id?form.page_id.value:'';var obj_info=SK.Singletons.obj_nodes.find(new SK.Obj.Node(meta.obj_id,meta.obj_inst));window_options=window_options||{};var extra_window_options=SK.Actions.Common.getWindowOptions(obj_info,window_options);$extend(window_options,extra_window_options||{});params=params||{};var extra_params=SK.Actions.Common.getEditTmplParams(meta.obj_id,meta.obj_inst,params);$extend(params,extra_params||{});var ui_callbacks=SK.Actions.Common.getUICallbacksConfiguration(meta.obj_id,meta.obj_inst);if(typeof ui_callbacks.edit_tmpl_options_callback!='undefined'){var opts=ui_callbacks.edit_tmpl_options_callback(meta,params,window_options);if(typeof opts.params!='undefined'){for(var i in opts.params){params[i]=opts.params[i];}}
if(typeof opts.window_options!='undefined'){for(var i in opts.window_options){window_options[i]=opts.window_options[i];}}}
var default_params={user_id:user_id,page_id:page_id,reload_func:'SK.Actions.Common.reloadPage',auth_token:SK.Singletons.env.get('session_id')};if(typeof(params)!='undefined'&&params){for(var i in params){default_params[i]=params[i];}}
var meta_array=[];for(var i in meta){default_params[i]=meta[i];}
var params_array=[];for(var i in default_params){params_array.push(i+'='+escape(default_params[i]));}
var version=obj_info.properties.version&&obj_info.properties.version==2?2:1;var url=(version==2?'/Shared/Html/properties.html':'/Shared/Html/edit_tmpl.html')+'?'+params_array.join("&")+'&random='+(new Date()).getTime()+'&encoding='+((document.all)?document.charset:document.characterSet);var std_title=version==2?SK.Actions.Common.generateVersion2PopupTitle(meta.node_id?'edit':'add',obj_info?obj_info.getProperty('name'):''):SK.Actions.Common.generatePopupTitle(meta.node_id?'edit':'add',obj_info?obj_info.getProperty('name'):'');var popup_title=window_options.title?window_options.title:std_title;return{url:url,popup_title:popup_title,window_options:window_options,params:params};}
SK.Actions.Common.ValidateEditTmplFuncs=function(add,update,publish){var len=EDIT_TMPL_VALIDATORS.length;var obj_id=document.forms[OBJ_EDIT_FORM].obj_id.value;var node_id=document.forms[OBJ_EDIT_FORM].node_id.value;for(var i=0;i<len;i++){var func=EDIT_TMPL_VALIDATORS[i];var ret_val=func(OBJ_EDIT_FORM,'_'+obj_id+'_'+node_id,(add?true:false),(update?true:false),(publish?true:false));if(!ret_val)
return false;}
return true;}
SK.Actions.Common.update=function(){var session_monitor=new SK.Util.SessionMonitor();session_monitor.checkServerSession(SK.Actions.Common.updateSessionValid);}
SK.Actions.Common.updateSessionValid=function(is_session_valid){if(!is_session_valid){new SK.Util.SessionMonitor().showInvalidSessionWarning();return;}
SK.Actions.Common.resetPPs();var form=document.forms[OBJ_EDIT_FORM];SK.Actions.Common.setSubmitClicked();if(typeof SK.Actions.CLICK_ACTIONS['update ']=='undefined'){SK.Actions.CLICK_ACTIONS['update']=0;}
if(SK.Actions.CLICK_ACTIONS['update']>0){return;}
SK.Actions.CLICK_ACTIONS['update']++;if(!SK.Actions.Common.ValidateEditTmplFuncs(false,true,false)){SK.Actions.CLICK_ACTIONS['update']--;return;}
form.do_obj_update.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('updating'),function(){form.submit();});}
SK.Actions.Common.add=function(){var session_monitor=new SK.Util.SessionMonitor();session_monitor.checkServerSession(SK.Actions.Common.addSessionValid);}
SK.Actions.Common.addSessionValid=function(is_session_valid){if(!is_session_valid){new SK.Util.SessionMonitor().showInvalidSessionWarning();return;}
SK.Actions.Common.resetPPs();var form=document.forms[OBJ_EDIT_FORM];SK.Actions.Common.setSubmitClicked();if(typeof SK.Actions.CLICK_ACTIONS['add']=='undefined'){SK.Actions.CLICK_ACTIONS['add']=0;}
if(SK.Actions.CLICK_ACTIONS['add']>0){return;}
SK.Actions.CLICK_ACTIONS['add']++;if(!SK.Actions.Common.ValidateEditTmplFuncs(true,false,false)){SK.Actions.CLICK_ACTIONS['add']--;return;}
form.do_obj_add.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('adding'),function(){form.submit();});}
SK.Actions.Common.close=function(){if(!$defined(SK.Actions.Common.close__last_time)){SK.Actions.Common.close__last_time=0;}
var diff=(new Date().getTime())-SK.Actions.Common.close__last_time;if(diff<=3*1000){return false;}
SK.Actions.Common.close__last_time=new Date().getTime();var f=window.oncustombeforeunload;if(typeof f=='function'){var msg=f();if(typeof msg!='undefined'&&msg!=""){return confirm(msg);}}
return true;}
SK.Actions.Common.setSubmitClicked=function(){SK.Actions.Common.button_clicked=true;}
SK.Actions.Common.isEditTemplateLegalSubmission=function(){return SK.Actions.Common.button_clicked;}
SK.Actions.Common.areEditTemplatePropertiesModified=function(){if(typeof AreObjectPropertiesModified!='undefined'){return AreObjectPropertiesModified();}else{var new_values=SK.Actions.Common.getEditTemplatePropertyValues();for(var i in new_values){if(typeof SK.Actions.Common.SAVED_EDIT_TEMPLATE_PROPERTY_VALUES[i]!='undefined'&&new_values[i]!=SK.Actions.Common.SAVED_EDIT_TEMPLATE_PROPERTY_VALUES[i]){return true;}}}
return false;}
SK.Actions.Common.getEditTemplatePropertyValues=function(){var edit_template_values={};['input','select','textarea'].each(function(tag){$$(tag).each(function(e){if(e.get('name')&&e.get('name').test(/^.*?\_\d+\_/)){edit_template_values[e.get('name')]=e.get('value');}});});return edit_template_values;}
SK.Actions.Common.initEditTemplate=function(){SK.Actions.Common.SAVED_EDIT_TEMPLATE_PROPERTY_VALUES=SK.Actions.Common.getEditTemplatePropertyValues();}
SK.Actions.Common.onEditTemplateUnload=function(){if(!SK.Actions.Common.isEditTemplateLegalSubmission()&&SK.Actions.Common.areEditTemplatePropertiesModified()){return SK.Actions.Common.NAVIGATE_AWAY_WARNING_MESSAGE;}}
SK.Actions.Common.onMainPageUnload=function(){var handles=SK_WINDOW_HANDLES.getAll();for(var i=0;i<handles.length;i++){var h=handles[i];var f=h.getContentFrame();if(f&&f.contentWindow&&typeof f.contentWindow.oncustombeforeunload!='undefined'){var func=null;if(typeof f.contentWindow.SK.Actions.Common.onEditTemplateUnload=='function'){func=f.contentWindow.SK.Actions.Common.onEditTemplateUnload;}else{func=f.contentWindow.oncustombeforeunload;}
var result=func();if(typeof result!='undefined'&&result!=''){return SK.Actions.Common.NAVIGATE_AWAY_WARNING_MESSAGE;}}}}
SK.Actions.Common.move=function(node_id,new_parent_id,position_node_id){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];form.node_id.value=node_id;form.parent_id.value=new_parent_id;form.position_node_id.value=position_node_id?position_node_id:"";form.do_obj_move.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('moving'),function(){form.submit();});}
SK.Actions.Common.hold=function(node_id,held){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var node_ids=SK.Actions.Common.getSelectedObjects();if(typeof(node_id)!='undefined'){node_ids[node_ids.length]=node_id;}
var form=document.forms[OBJ_EDIT_FORM];form.group_node_ids.value=node_ids.join(",");form.held.value=held?1:0;form.do_obj_hold.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage(held?'holding':'unholding'),function(){form.submit();});}
SK.Actions.Common.del=function(node_id,confirmation_message,callback_ok,callback_cancel){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];var node_ids=SK.Actions.Common.getSelectedObjects();if(!confirmation_message||typeof confirmation_message=='undefined'||confirmation_message==""){confirmation_message=SK.Actions.O_MESSAGES['DELETION_CONFIRMATION'];}
if(typeof(node_id)!='undefined'){node_ids[node_ids.length]=node_id;}
if(node_ids.length>0){SKConfirm(confirmation_message,function(){if(typeof callback_ok=='function')callback_ok();for(var i=0;i<node_ids.length;i++){form.node_id.value=node_ids[i];}
form.group_node_ids.value=node_ids.join(",");form.do_obj_delete.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('deleting'),function(){form.submit();});},function(){if(typeof callback_cancel=='function'){callback_cancel();}});}}
SK.Actions.Common.resetPPs=function(){var form=document.forms[OBJ_EDIT_FORM];if(Browser.Engine.trident){for(var i=0;i<form.elements;i++){if(form.elements[i].name&&form.elements[i].name.indexOf("do_")==0&&form.elements[i].value=="go"){form.elements[i].value="";}}}else{for(var i in form.elements){if(form.elements[i].name&&form.elements[i].name.indexOf("do_")==0&&form.elements[i].value=="go"){form.elements[i].value="";}}}}
SK.Actions.Common.publish=function(node_id){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];var node_ids=SK.Actions.Common.getSelectedObjects();if(typeof(node_id)!='undefined'){form.node_id.value=node_id;node_ids[node_ids.length]=node_id;}
form.group_node_ids.value=node_ids.join(",");form.do_obj_publish.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('publishing'),function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.publishPage=function(node_id){var page=new SK.Page(node_id,{user_id:SK.Singletons.env.get('user_id'),user_name:SK.Singletons.env.get('user_name'),frontend_site_url:SK.Singletons.env.get('frontend_site_url'),publish_urls:SK.Singletons.env.get('publish_page_urls')});page.publish();}
SK.Actions.Common.acceptRejectPreviewChanges=function(){var site=new SK.Site({user_id:SK.Singletons.env.get('user_id'),design_id:SK.Singletons.env.get('current_design_id'),user_name:SK.Singletons.env.get('user_name'),frontend_site_url:SK.Singletons.env.get('frontend_site_url')});site.acceptRejectPreview();}
SK.Actions.Common.acceptSitePropertiesChanges=function(){if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];form.do_accept_site_properties_changes.value="go";form.parse_eua.value="1";form.parse_aa.value="1";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('accepting'),function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.rejectSitePropertiesChanges=function(){if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];form.do_revert_site_properties_changes.value="go";SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('reverting'),function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.cut=function(node_id){SK.Actions.Common.resetPPs();SK.Actions.Common.loadClipboard('cut',node_id);}
SK.Actions.Common.copy=function(node_id){SK.Actions.Common.resetPPs();SK.Actions.Common.loadClipboard('copy',node_id);}
SK.Actions.Common.loadClipboard=function(operation,node_id){if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];var node_ids=SK.Actions.Common.getSelectedObjects();if(typeof(node_id)!='undefined'){node_ids[node_ids.length]=node_id;}
if(node_ids.length>0){form.group_node_ids.value=node_ids.join(",");}else{SKMessage(SK.Actions.O_MESSAGES['SELECT_ITEMS']);return;}
form.elements['do_obj_edit_'+operation].value="go";var progress_message="";switch(operation){case'copy':progress_message='copying';break;case'cut':progress_message='cutting';break;}
SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage(progress_message),function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.duplicate=function(node_id){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];var node_ids=SK.Actions.Common.getSelectedObjects();if(typeof(node_id)!='undefined'){node_ids[node_ids.length]=node_id;}
var paste_info={};var parents={};if(node_ids.length>0){parents=SK.Actions.Common.getParents(node_ids);}else{SKMessage(SK.Actions.O_MESSAGES['SELECT_ITEMS']);return;}
for(var i=0;i<node_ids.length;i++){var this_node_id=node_ids[i];paste_info[this_node_id]={position_node_id:this_node_id,incl_parent_id:parents[this_node_id],parent_id:parents[this_node_id]};}
SK.Actions.Common.paste(paste_info,'do_obj_edit_duplicate','duplicating');}
SK.Actions.Common.paste=function(paste_info,pp_name,action_type){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];form.paste_info.value=JSON.encode(paste_info);form[pp_name].value='go';SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage(action_type),function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.select=function(node_id){SK.Actions.SELECTED_ITEMS[node_id]=true;}
SK.Actions.Common.deselect=function(node_id){SK.Actions.SELECTED_ITEMS[node_id]=false;}
SK.Actions.Common.clearClipboard=function(node_id){SK.Actions.Common.resetPPs();if(!SK.Actions.Common.assertSession())return;var form=document.forms[OBJ_EDIT_FORM];form.node_id.value=typeof(node_id)=='undefined'?"":node_id;form.do_obj_edit_clear_clipboard.value="go";SK.Actions.Common.displayProgress('Clearing clipboard',function(){document.forms[OBJ_EDIT_FORM].submit();});}
SK.Actions.Common.isClipboardLoaded=function(){return SK.Singletons.env.get('clipboard').cut.length>0||SK.Singletons.env.get('clipboard').copy.length>0;}
SK.Actions.Common.initiatePaste=function(objs){if(typeof objs=='undefined'){objs=[];if(SK.Singletons.env.get('clipboard').cut.length>0){objs.extend(SK.Singletons.env.get('clipboard').cut);}
if(SK.Singletons.env.get('clipboard').copy.length>0){objs.extend(SK.Singletons.env.get('clipboard').copy);}}
if(objs.length>0){SK.UI.Arrangement.initiatePaste(objs);}}
SK.Actions.Common.isCurrentPage=function(node_id){return SK.Singletons.env.get('page_node_id')==node_id;}
SK.Actions.Common.openPageLayout=function(){SK.Actions.Common.openEditTmpl({obj_id:SK.Singletons.env.get('page_obj_id'),obj_inst:SK.Singletons.env.get('page_obj_inst'),node_id:SK.Singletons.env.get('page_node_id')},{edit_tmpl:'$layout_edit_tmpl'},{height:400,title:'Page Layout'});}
SK.Actions.Common.reloadPageIfValidSession=function(){var session_monitor=new SK.Util.SessionMonitor();session_monitor.checkServerSession(SK.Actions.Common.reloadPageSessionValid);}
SK.Actions.Common.reloadPageSessionValid=function(is_session_valid){if(!is_session_valid){new SK.Util.SessionMonitor().showInvalidSessionWarning(SK.Actions.Common.reloadPage);return;}
SK.Actions.Common.reloadPage();}
SK.Actions.Common.reloadPage=function(url){var new_url=SK.Actions.Common.getReloadURL(url);SK.Actions.Common.displayProgressQuick('Please wait...',function(){document.location.href=this.new_url;}.bind({new_url:new_url}));}
SK.Actions.Common.getReloadURL=function(url){var new_url=url;if(typeof(url)=='undefined'||url==""){new_url=document.location.pathname;}
if(document.location.search){var search=document.location.search;if(new_url.indexOf('?')!=-1){search='&'+search.substring(1);}
new_url+=search;}
var rnd_start='skrnd=a';var idx=-1;if((idx=new_url.indexOf(rnd_start))!=-1){var end_idx=new_url.indexOf('&',idx+rnd_start.length);if(end_idx==-1){new_url=new_url.substring(0,idx);}else{new_url=new_url.substring(0,idx)+new_url.substring(end_idx+1);}
var last_char=new_url.charAt(new_url.length-1);if(last_char=='?'||last_char=='&'){new_url=new_url.substring(0,new_url.length-1);}}
new_url+=(new_url.indexOf('?')==-1?'?':'&')+rnd_start+Math.random();if(document.location.anchor){new_url+=document.location.anchor;}
if(new_url.indexOf("/")==0){new_url='http://'+document.location.host+new_url;}
return new_url;}
SK.Actions.Common.execAfterEditTmplClose=function(code){return function(){var code=""+this;if(code!="")eval(code);}.bind(code)}
SK.Actions.Common.getSelectedObjects=function(){var node_ids=[];for(var i in SK.Actions.SELECTED_ITEMS){if(SK.Actions.SELECTED_ITEMS[i]){node_ids.push(i);}}
return node_ids;}
SK.Actions.Common.setSelectedObjects=function(node_ids){node_ids.each(function(node_id){this[node_id]=true;},SK.Actions.SELECTED_ITEMS);}
SK.Actions.Common.getParents=function(node_ids){var objs=$$('[meta]');var result={};for(var i=0;i<objs.length;i++){var meta=JSON.decode(objs[i].get('meta'));for(var j=0;j<node_ids.length;j++){if(node_ids[j]!=meta.node_id)continue;var parent_id=meta.parent_id;if(parent_id==0){parent_id=SK.Actions.Common.getFirstActiveParentID(objs[i].parentNode);}
result[node_ids[j]]=parent_id;}}
return result;}
SK.Actions.Common.openShareSite=function(){var page_urls=SK.Singletons.env.get('publish_page_urls');var share_site_url=SK.Singletons.env.get('share_site_url');var url=share_site_url+'?'+'email='+escape(SK.Singletons.env.get('user_email'))+'&'+'url='+escape(page_urls[0])+'&'+'user_id='+SK.Singletons.env.get('user_id')+'&'+'name='+escape(SK.Singletons.env.get('user_name'));var win=new SKFancyWindow(url,'Share This Site',600,400,{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.openActivateAccount=function(){var params=['user_name='+SK.Singletons.env.get('user_name'),'_'+Math.random(),'popup=1',];var win=new SKFancyWindow('/Tools/confirm_email.html?'+params.join("&"),'Confirm Email',660,430,{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.isAccountActivated=function(){return SK.Singletons.env.get('email_confirmed');}
SK.Actions.Common.isHelpEnabled=function(){return SK.Singletons.env.get('help_url')!='';}
SK.Actions.Common.openAccountUpgrade=function(){SKPopup(SK.Singletons.env.get('account_upgrade_url')+'?'+'user_name='+SK.Singletons.env.get('user_name')+'&'+'s='+SK.Singletons.env.get('track_num')+'&'+'reload_parent=1',Math.round(4*parseInt(screen.width)/5),Math.round(3*parseInt(screen.height)/4),{menubar:'yes',toolbar:'yes',location:'yes'});}
SK.Actions.Common.isOnTrialPlan=function(){if(SK.Actions.Common.isAccountActivated()==false){return false;}
return SK.Singletons.env.get('free_trial_plan');}
SK.Actions.Common.openSiteProperties=function(user_id,options){if(typeof options=='undefined')options={};var win=new SKFancyWindow('/Shared/Html/site_properties.html?user_id='+user_id+'&reload_func=SK.Actions.Common.reloadPage'+
(options.edit_tmpl?'&edit_tmpl='+escape(options.edit_tmpl):'')+'&_r='+(new Date()).getTime(),options.title?options.title:'Site Properties',(options.width?options.width:'760'),(options.height?options.height:'600'),{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.openChangeDesign=function(user_id){SK.Actions.Common.openSiteProperties(user_id,{edit_tmpl:'$change_design_edit_tmpl',width:890,height:590,title:'Change Design'});}
SK.Actions.Common.isObjectAvailableForDesign=function(obj_id,obj_inst){var sk_node=SK.Singletons.obj_nodes.find(new SK.Obj.Node(obj_id,obj_inst));if(sk_node==null)return false;return(sk_node.getProperty('pinned')=="1");}
SK.Actions.Common.openNewPage=function(sknode){var window_options={title:'New Page'};var node=SK.Singletons.obj_nodes.find(new SK.Obj.Node(sknode.obj_id,sknode.obj_inst));if(node&&node.properties.version&&node.properties.version==2){window_options.height=500;}
SK.Actions.Common.openEditTmpl({obj_id:sknode.getObjID(),obj_inst:sknode.getObjInst()},null,window_options);}
SK.Actions.Common.openPageProperties=function(node_id){SK.Actions.Common.openEditTmpl({node_id:node_id,obj_id:SK.Singletons.env.get('page_obj_id'),obj_inst:SK.Singletons.env.get('page_obj_inst')},null,{title:'Page Options'});}
SK.Actions.Common.openManagePages=function(user_id){SKPopup('/Shared/Html/manage_pages.html?'+'user_id='+user_id+'&'+'encoding='+((document.all)?document.charset:document.characterSet),900,690);}
SK.Actions.Common.isManageAccountsEnabled=function(){return SK.Singletons.env.get('is_reseller');}
SK.Actions.Common.isDatabaseEnabled=function(){return SK.Singletons.env.get('database_enabled');}
SK.Actions.Common.areApplicationsEnabled=function(){return SK.Singletons.env.get('applications_enabled');}
SK.Actions.Common.areDesignsCollectionsAvailable=function(){return SK.Singletons.env.get('select_design_ui')=='thumbnails'&&SK.Singletons.env.get('allow_design_edit')!='1'?true:false;}
SK.Actions.Common.openCSSCustomizationEditor=function(){var session_monitor=new SK.Util.SessionMonitor();session_monitor.checkServerSession(SK.Actions.Common.openCSSCustomizationEditorSessionValid);}
SK.Actions.Common.openCSSCustomizationEditorSessionValid=function(is_session_valid){if(!is_session_valid){new SK.Util.SessionMonitor().showInvalidSessionWarning();return;}
var at=new ActionTrace();at.AddAction(SK.Singletons.env.get('user_id'),'open design customization');SK.CSSCustomization.load();}
SK.Actions.Common.isCSSCustomizationEnabled=function(){return SK.Singletons.env.get('has_css_customization_editor')&&SK.Singletons.env.get('allow_design_edit')!='1';}
SK.Actions.Common.isLayoutEditorEnabled=function(){return SK.Singletons.env.get('has_layout_editor');}
SK.Actions.Common.isStyleEditorEnabled=function(){return SK.Singletons.env.get('has_style_editor');}
SK.Actions.Common.loadStyleAndLayoutFiles=function(user_id,progress,env){var placeholder=new Element('div',{id:'sk_style_and_layout_environment',styles:{display:'none'}});placeholder.inject($(document.ObjEditForm));env.progress=progress;placeholder.set('load',{async:false,onComplete:function(){SK.Actions.Common.hideProgress(this.progress);this.callback();}.bind(env)});placeholder.load('/Designs/Freemona/Html/site_ext_special_features.html?'+'user_id='+user_id+'&'+'close_callback=SK.Actions.Common.promptForSavingSiteProperties&'+'load_from_main_page=1&'+'e='+(new Date()).getTime());}
SK.Actions.Common.loadStyleAndLayoutEnvironment=function(user_id,callback){if($('sk_style_and_layout_environment')!=null){$('sk_style_and_layout_environment').dispose();}
var env={callback:callback};var progress=SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('loading'),function(progress){SK.Actions.Common.loadStyleAndLayoutFiles(user_id,progress,env);}.bind(env));}
SK.Actions.Common.openLayoutEditor=function(user_id){window.open('/Shared/Html/loading.html','SKLayoutEditor','menubar=no,toolbar=no,scrollbars=yes,resizable=yes');SK.Actions.Common.loadStyleAndLayoutEnvironment(user_id,function(){OpenLayoutEditor();});}
SK.Actions.Common.openStyleEditor=function(user_id){window.open('/Shared/Html/loading.html','SKStyleEditor','menubar=no,toolbar=no,scrollbars=yes,resizable=yes');SK.Actions.Common.loadStyleAndLayoutEnvironment(user_id,function(){OpenCSSEditor();});}
SK.Actions.Common.openManageAccounts=function(user_id){SKPopup('/Shared/Html/resellers_admin_area.html?reseller_id='+user_id,1000,600);}
SK.Actions.Common.promptForSavingSiteProperties=function(){var session_monitor=new SK.Util.SessionMonitor();session_monitor.checkServerSession(SK.Actions.Common.promptForSavingSitePropertiesSessionValid);}
SK.Actions.Common.promptForSavingSitePropertiesSessionValid=function(is_session_valid){if(!is_session_valid){new SK.Util.SessionMonitor().showInvalidSessionWarning(SK.Actions.Common.promptForSavingSitePropertiesProgress);return;}
SK.Actions.Common.promptForSavingSitePropertiesProgress();}
SK.Actions.Common.promptForSavingSitePropertiesProgress=function(){SK.Actions.Common.displayProgressQuick("Please wait...",function(progress){SK.Actions.Common.promptForSavingSitePropertiesBase(function(){SK.Actions.Common.hideProgress(progress);}.bind(progress));});}
SK.Actions.Common.promptForSavingSitePropertiesBase=function(callback){var site=new SK.Site({user_id:SK.Singletons.env.get('user_id'),design_id:SK.Singletons.env.get('current_design_id'),user_name:SK.Singletons.env.get('user_name'),frontend_site_url:SK.Singletons.env.get('frontend_site_url')});if(document.ObjEditForm.sp__CustomLayoutJSON.value==''&&document.ObjEditForm.sp__CustomStyleJSON.value==''){callback();return;}
var properties={};['CustomStylesJSON','CustomLayoutJSON'].each(function(id){if(document.ObjEditForm.elements['sp__'+id].value!=''){properties[id]=JSON.decode(document.ObjEditForm.elements['sp__'+id].value);}});var url_params={publish:1,cmd:'object.site.set',auth_token:SK.Singletons.env.get('session_id'),properties:JSON.encode(properties)};var f_update=function(){var f_params=url_params;f_params.publish=1;SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('updating'),function(progress){new Request.JSON({url:'/api',async:false,onComplete:function(json){progress.hide();}}).post(f_params);progress.hide();SK.Actions.Common.reloadPage();});};var f_preview=function(){var f_params=url_params;f_params.publish=0;SK.Actions.Common.displayProgress(SK.Actions.Common.getActionMessage('updating'),function(progress){new Request.JSON({url:'/api',async:false,onComplete:function(json){progress.hide();}}).post(f_params);progress.hide();SK.Actions.Common.reloadPage();});}
var is_publish_supported=site.isPublishSupported();callback();if(is_publish_supported){site.previewUpdateChanges({'preview':f_preview,'update':f_update});}else{site.acceptRejectPreviewBase(null,{'accept':f_update,'reject':SK.Actions.Common.rejectSitePropertiesChanges,'upgrade':SK.Actions.Common.openAccountUpgrade});}}
SK.Actions.Common.openSiteStatistics=function(user_id){var statistics_engine=SK.Singletons.env.get('statistics_engine');if(typeof statistics_engine.Engine!='undefined'){if(statistics_engine.Engine=='internal'){SKPopup('/Shared/Html/site_stats.html?user_id='+user_id,900,600);}else if(statistics_engine.Engine=='google_analytics'){SKPopup('http://google-analytics.com',900,600,{status:'yes',menubar:'yes',toolbar:'yes',location:'yes'});}}}
SK.Actions.Common.areSiteStatisticsEnabled=function(user_id){var statistics_engine=SK.Singletons.env.get('statistics_engine');return(statistics_engine!=null&&typeof statistics_engine.Engine!='undefined'&&(statistics_engine.Engine=='google_analytics'||SK.Actions.Common.areInternalSiteStatisticsEnabled(user_id)));}
SK.Actions.Common.areInternalSiteStatisticsEnabled=function(user_id){var statistics_engine=SK.Singletons.env.get('statistics_engine');return(statistics_engine!=null&&typeof statistics_engine.Engine!='undefined'&&statistics_engine.Engine=='internal');}
SK.Actions.Common.openMyAccount=function(user_id){var win=new SKFancyWindow('/Shared/Html/user_details.html?user_id='+user_id+'&reload_func=SK.Actions.Common.reloadPage','My Account',SK.Actions.default_window_size["version_1"].width,570,{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.openMailingLists=function(user_id){var win=new SKFancyWindow('/Shared/Html/mailing_lists.html?user_id='+user_id,'Mailing Lists',660,600,{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.openDatabases=function(user_id){var win=new SKFancyWindow('/Shared/Html/databases.html?'+'user_id='+user_id+'&'+'e='+(new Date()).getTime()+'&'+'encoding='+((document.all)?document.charset:document.characterSet),'Databases',1024,768,{controls:{maximize:true}});win.init();win.display();}
SK.Actions.Common.openApplications=function(user_id){var win=new SKFancyWindow('/Shared/Html/applications.html?'+'user_id='+user_id+'&'+'session_id='+SK.Singletons.env.get('session_id')+'&'+'e='+(new Date()).getTime()+'&'+'encoding='+((document.all)?document.charset:document.characterSet),'Applications',710,600,{controls:{maximize:false},callbacks:{onafterhide:function(){SK.Actions.Common.reloadPageIfValidSession();}}});win.init();win.display();}
SK.Actions.Common.logout=function(){var url=document.location.pathname;url=url.replace("/Admin","");var eua_page=url;if(!SK.Singletons.env.get('published')){var user_name=eua_page.split('/')[1];eua_page='/'+user_name;}
SK.Actions.Common.displayProgress('Logging you out...',function(){var r=new Request({async:false,method:'get',url:'/Shared/Html/invalidate_curr_session.html'}).send('');top.location.href=eua_page;});}
SK.Actions.openChildElementForAdding=function(fh,obj){fh.notifyCallbackFinished(obj);var meta=JSON.decode(obj.getAttribute('meta'));var nodes=SK.Singletons.obj_nodes.getNodes();for(var i=0;i<nodes.length;i++){var parents=nodes[i].getParents();for(var j=0;j<parents.length;j++){if(parents[j].getObjID()==meta.obj_id&&parents[j].getObjInst()==meta.obj_inst){SK.UI.Arrangement.initiateAdd(nodes[i],meta);break;}}}}
SK.Actions.isAddChildElementEnabled=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));var nodes=SK.Singletons.obj_nodes.getNodes();for(var i=0;i<nodes.length;i++){var parents=nodes[i].getParents();for(var j=0;j<parents.length;j++){if(parents[j].getObjID()==meta.obj_id&&parents[j].getObjInst()==meta.obj_inst){return true;}}}
return false;}
SK.Actions.openForAddingDeprecated=function(fh,obj){fh.notifyCallbackFinished(obj);var tooltip=new SK.UI.FancyTooltip("We recently upgraded our editing interface. To add a content element now, select it from the Add Content menu and drop it in the desired location.",{arrow_position:'top-left',top:50,left:0,animation_type:'bottom-top'});tooltip.init();tooltip.display();window.setTimeout(function(){tooltip.hide()},10000);}
SK.Actions.isDeprecatedAddEnabled=function(){return SK.Singletons.env.get("deprecated_add_enabled")==true;}
SK.Actions.openForEditing=function(fh,obj,options){var meta=obj.getAttribute('meta');meta=JSON.decode(meta);var window_options={};if(options&&options.height){window_options.height=options.height;options=(new Hash(options)).erase('height').getClean();}
if(options&&options.title){window_options.title=options.title;options=(new Hash(options)).erase('title').getClean();}
SK.Actions.Common.openEditTmpl(meta,$defined(options)?options:null,window_options);fh.notifyCallbackFinished(obj);}
SK.Actions.del=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));var obj_name='element';var sk_node=SK.Singletons.obj_nodes.find(new SK.Obj.Node(meta.obj_id,meta.obj_inst));if(sk_node!=null&&sk_node.getProperty('name')!=''){obj_name=sk_node.getProperty('name');}
var msg="";if(SK.Actions.Common.getSelectedObjects().length>0){msg='Are you sure you want to delete this {s} and the items that are currently {b}selected{e}?'.substitute({s:'<b>'+obj_name+'</b>',b:'<b><span style="color:'+STANDARD_MENU_ITEMS.select.hl_color+'">',e:'</span></b>'});}else{msg='Are you sure you want to delete this {s}?'.substitute({s:'<b>'+obj_name+'</b>'});}
SK.Actions.Common.del(meta.node_id,msg,function(){fh.notifyCallbackFinished(obj);},function(){fh.notifyCallbackFinished(obj);});}
SK.Actions.move=function(fh,obj){fh.notifyCallbackFinished(obj);SK.UI.Arrangement.initiateMove(obj);}
SK.Actions.hold=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));fh.notifyCallbackFinished(obj);SK.Actions.Common.hold(meta.node_id,typeof(meta.held)=='undefined'?true:!meta.held);}
SK.Actions.unhold=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));fh.notifyCallbackFinished(obj);SK.Actions.Common.hold(meta.node_id,typeof(meta.held)=='undefined'?false:!meta.held);}
SK.Actions.select=function(fh,obj){fh.notifyCallbackFinished(obj);obj.setAttribute('skselected','1');var color=STANDARD_MENU_ITEMS.select.hl_color;fh.showHighlight(obj,color);var meta=JSON.decode(obj.get('meta'));SK.Actions.Common.select(meta.node_id);}
SK.Actions.deselect=function(fh,obj){obj.setAttribute('skselected','0');fh.hideHighlight(obj);var meta=JSON.decode(obj.get('meta'));SK.Actions.Common.deselect(meta.node_id);fh.notifyCallbackFinished(obj);}
SK.Actions.cut=function(fh,obj){fh.notifyCallbackFinished(obj);var meta=JSON.decode(obj.getAttribute('meta'));SK.Actions.Common.cut(meta.node_id);}
SK.Actions.copy=function(fh,obj){fh.notifyCallbackFinished(obj);var meta=JSON.decode(obj.getAttribute('meta'));SK.Actions.Common.copy(meta.node_id);}
SK.Actions.duplicate=function(fh,obj){fh.notifyCallbackFinished(obj);var meta=JSON.decode(obj.getAttribute('meta'));SK.Actions.Common.duplicate(meta.node_id);}
SK.Actions.Common.getFirstActiveParentID=function(e){e=$(e);if(!e||$type(e)!='element'||!e.get)return 0;if(e.get('env')!=null&&e.get('meta')!=null){var meta=JSON.decode(e.get('meta'));return meta.node_id;}
return SK.Actions.Common.getFirstActiveParentID(e.parentNode);}
SK.Actions.openSiteProperties=function(fh,obj,options){fh.notifyCallbackFinished(obj);var meta=JSON.decode(obj.getAttribute('meta'));SK.Actions.Common.openSiteProperties(meta.user_id,options);}
SK.Actions.Common.addContentClick=function(){if(SK.Singletons.env.get("deprecated_add_enabled")==true){window.setTimeout(function(){var myRequest=new Request({method:'get',url:'/Shared/Html/deprecated_add_dec.html?user_id='+SK.Singletons.env.get('user_id')});myRequest.send();},1000);}}
SK.Actions.Common.hasLiveMovePreviewIE=function(meta){if(Browser.Engine.trident)return false;return true;}
SK.Actions.Common.hasNoLiveMovePreview=function(meta){return false;}
SK.Actions.isEditEnabled=function(fh,obj){return true;}
SK.Actions.isAddEnabled=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));return SK.Singletons.obj_nodes.hasChildren(new SK.Obj.Node(meta.obj_id,meta.obj_inst))&&SK.Singletons.obj_nodes.getChildren(new SK.Obj.Node(meta.obj_id,meta.obj_inst)).length==1;}
SK.Actions.isEditItemEnabled=function(fh,obj){return true;}
SK.Actions.isAddItemEnabled=function(fh,obj){return true;}
SK.Actions.isMoveItemEnabled=function(fh,obj){return true;}
SK.Actions.isDeleteItemEnabled=function(fh,obj){return true;}
SK.Actions.isHoldItemEnabled=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));return typeof meta.held=='undefined'||!meta.held;}
SK.Actions.isUnholdItemEnabled=function(fh,obj){var meta=JSON.decode(obj.getAttribute('meta'));return typeof meta.held!='undefined'&&meta.held;}
SK.Actions.isSelectItemEnabled=function(fh,obj){var skselected=obj.getAttribute('skselected');return skselected==null||skselected=="0"?true:false;}
SK.Actions.isDeselectItemEnabled=function(fh,obj){var skselected=obj.getAttribute('skselected');return skselected==null||skselected=="0"?false:true;}
SK.Actions.isCutItemEnabled=function(fh,obj){return true;}
SK.Actions.isCopyItemEnabled=function(fh,obj){return true;}
SK.Actions.isPasteItemEnabled=function(fh,obj){return false;}
SK.Actions.isDuplicateItemEnabled=function(fh,obj){return true;}
SK.Actions.RTE={};SK.Actions.RTE.editTmplOptionsCallback=function(meta,params,window_options){var rte_holder=document.getElementById('rte_holder_'+meta.node_id);var rte_holder_width=0;if(rte_holder&&typeof rte_holder!='undefined')
rte_holder_width=document.getElementById('rte_holder_'+meta.node_id).offsetWidth;var s={x:(parseInt(screen.width)>800)?1000:780,y:(parseInt(screen.width)>800)?760:580};return{params:{width:rte_holder_width},window_options:{width:s.x,height:s.y}};}
SK.Actions.Gallery={};SK.Actions.Gallery.editTmplOptionsCallback=function(meta,params,window_options){return{};}
SK.Actions.FB={};SK.Actions.FB.editTmplOptionsCallback=function(meta,params,window_options){return{window_options:{width:641,height:570}};}
Document.implement({purge:function(){var elements=Browser.toPurge;if(typeof elements!='undefined'){for(var i=0,l=elements.length;i<l;i++)Browser.freeMem(elements[i]);}}});Browser.toPurge=[];Native.implement([Element,Window,Document],{addListener:function(type,fn){if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);Browser.toPurge.include(this);return this;}});


if(typeof SK=='undefined')SK={};if(typeof SK.Util=='undefined')SK.Utils={};SK.Util.isSlowSystem=function(){return Browser.Engine.trident4==true||parseInt(SK.Singletons.env.get('system_type'))==SK.Util.SYSTEM_TYPE_SLOW;}


SK.UI.Progress=function(options){this.ie6=document.all&&navigator.appVersion.indexOf("MSIE 6")!=-1?true:false;this.ie7=document.all&&navigator.appVersion.indexOf("MSIE 7")!=-1?true:false;this.ff2=navigator.userAgent.toLowerCase().indexOf("firefox/2")!=-1?true:false;this.ff1=navigator.userAgent.toLowerCase().indexOf("firefox/1")!=-1?true:false;this.mac=navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1?true:false;this.ff2mac=this.ff2&&this.mac;this.ff1mac=this.ff1&&this.mac;this.safari=navigator.appVersion.indexOf("Safari")!=-1?true:false;this.ANIMATION_INTERVAL=60;this.ANIMATION_STEPS=24;this.FRAME_HEIGHT=60;this.WRAPPER_OPACITY=1.0;this.BG_OPACITY=0.7;this.options={};if(typeof options!='undefined')this.options=options;if(typeof this.options.callbacks=='undefined'){this.options.callbacks={};}
if(typeof this.options.placeholder=='undefined'){this.options.placeholder=$(document);}
this.disturbing_elements=[];this.init=function(message,callbacks){this.create();this.reset();this.message=message;if(typeof(callbacks)!='undefined'){this.options.callbacks=$extend(this.options.callbacks,callbacks);}
var self=this;window.addEvent('scroll',function(){self.center();});window.addEvent('resize',function(){self.center();});}
this.create=function(){if(this.options.zindex){$('progress_ui_wrapper').setStyles({'z-index':this.options.zindex});}}
this.destroy=function(){if(this.options.zindex)
$('progress_ui_wrapper').setStyles({'z-index':''});}
this.reset=function(){this.disturbing_elements=[];}
this.display=function(){this.collectDisturbingElements();this.hideDisturbingElements();this.center();this.executeCallback('beforedisplay');this.displayContents();this.executeCallback('afterdisplay');}
this.hide=function(){this.executeCallback('beforehide');this.hideContents();this.displayDisturbingElements();this.destroy();this.executeCallback('afterhide');}
this.getCallback=function(event_id){if(typeof SK=='undefined'||typeof SK.Singletons=='undefined'||typeof SK.Singletons.env=='undefined'){return null;}
var callback=SK.Singletons.env.get('SK.UI.Progress.on'+event_id);return callback==''?null:eval(callback);}
this.executeCallback=function(event_id){var callback=this.getCallback(event_id);if(callback!=null){callback(this);}}
this.getContentPlaceholder=function(){return $('progress_ui_content_animation');}
this.setMessage=function(message){$('progress_ui_message').innerHTML=message;}
this.displayContents=function(){this.setMessage(this.message);$('progress_ui_wrapper').setStyles({'opacity':'0.0','display':'block'});var self=this;var complete_f=function(){if(self.options.callbacks.onafterdisplay){self.options.callbacks.onafterdisplay();}};var wrapper_opacity=this.WRAPPER_OPACITY;var bg_opacity=this.BG_OPACITY;if(this.options.duration==0){$('progress_ui_wrapper').setStyle('opacity',wrapper_opacity);$('progress_ui_background').setStyle('opacity',bg_opacity);complete_f();}else{var anim=new Fx.Morph('progress_ui_wrapper',{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut,onComplete:complete_f});anim.start({opacity:wrapper_opacity});$('progress_ui_background').setStyles({'opacity':'0.0','display':'block'});var self=this;var anim=new Fx.Morph('progress_ui_background',{duration:this.options.duration?this.options.duration:200,transition:Fx.Transitions.Sine.easeOut});anim.start({opacity:bg_opacity});}
this.startImagesAnimation();}
this.startImagesAnimation=function(){var self=this;if(!$('skwaiting_stripe'))return;$('skwaiting_stripe').setStyle('display','block');var frame_id=1;this.images_animation_timer=window.setInterval(function(){self.displayImagesAnimationFrame(frame_id++);if(frame_id>self.ANIMATION_STEPS){frame_id=1;}},this.ANIMATION_INTERVAL);}
this.displayImagesAnimationFrame=function(frame_id){if(!$('skwaiting_stripe'))return;var top=-(frame_id-1)*this.FRAME_HEIGHT;$('skwaiting_stripe').setStyle('top',top);}
this.stopImagesAnimation=function(){window.clearTimeout(this.images_animation_timer);}
this.hideContents=function(){$('progress_ui_wrapper').setStyle('display','none');this.stopImagesAnimation();}
this.isFullOfBugsIE=function(){return((document.compatMode=='BackCompat'&&Browser.Engine.trident)||(document.compatMode!='BackCompat'&&Browser.Engine.trident4==true));}
this.center=function(){var p=$(this.options.placeholder);var size=p.getSize();var scroll=p.getScroll();var pos=p.getCoordinates();if(this.isFullOfBugsIE()){$('progress_ui_wrapper').setStyles({'left':scroll.x+pos.left,'top':scroll.y+pos.top});}else{var position=!p.get||p.get('tag').toLowerCase()=='body'?'fixed':p.getStyle('position')=='fixed'?'fixed':'absolute';$('progress_ui_wrapper').setStyles({'position':position,'left':0+pos.left,'top':0+pos.top});}
var objs=['progress_ui_wrapper','progress_ui_background','progress_ui_foreground','progress_ui_content'];for(var i=0;i<objs.length;i++){$(objs[i]).setStyle('width',size.x);$(objs[i]).setStyle('height',size.y);}}
this.hideDisturbingElements=function(){for(var i=0;i<this.disturbing_elements.length;i++){if($(this.disturbing_elements[i])&&$(this.disturbing_elements[i]).setStyle){$(this.disturbing_elements[i]).setStyle('display','none');}}}
this.displayDisturbingElements=function(){for(var i=0;i<this.disturbing_elements.length;i++){if($(this.disturbing_elements[i])&&$(this.disturbing_elements[i]).setStyle){$(this.disturbing_elements[i]).setStyle('display','');}
if(this.safari){this.patchSafariFlashElements(this.disturbing_elements[i],false);}}}
this.collectDisturbingElements=function(){var target_tags=['object','embed','param'];if(this.ie6)target_tags.push('select');for(var j=0;j<target_tags.length;j++){var objs=document.getElementsByTagName(target_tags[j]);for(var i=0;i<objs.length;i++){this.disturbing_elements.push(objs[i]);if(this.safari){this.patchSafariFlashElements(objs[i],false);}}}}
this.patchSafariFlashElements=function(e,undo){if(undo){var old_wmode=e.getAttribute('old_wmode');if(old_wmode)e.setAttribute('wmode',old_wmode);else e.removeAttribute('wmode');}else{var old_wmode=e.getAttribute('wmode');e.setAttribute('wmode','opaque');if(old_wmode)e.setAttribute('old_wmode',old_wmode);}}};


function SetCookie(name,value,expires,path,domain,secure){var exp_date=new Date(expires);var cur_cookie=name+"="+escape(value)+
((expires)?"; expires="+exp_date.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=cur_cookie;}
function GetCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)
return null;}else
begin+=2;var end=dc.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}
function DeleteCookie(name,path,domain){if(GetCookie(name))
document.cookie=name+"="+"; expires=Thu, 01-Jan-70 00:00:01 GMT"+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"");}


var THE_PAGE_IS_LOADED=false;if(navigator.userAgent.match(/MSIE.*Mac/)){Array.prototype.push=function(str_value){this[this.length]=str_value;}}
var ONLOAD_FUNCTIONS=new Array();function Goto(form_name,tmpl,pairs_to_set)
{var form=document.forms[form_name];form.template.value=tmpl;if(typeof(form.news_id)!='undefined')form.news_id.value='';if(typeof(pairs_to_set)!='undefined'){var array=pairs_to_set.split('&');for(var i=0;i<array.length;i++){var pair=array[i].split('=');var obj=eval('form.'+pair[0]);if(typeof(obj)!='undefined'){obj.value=pair[1];}}}
if(form.action.indexOf("javascript:Goto")!=-1){form.action=tmpl;}
form.submit();}
function GotoEx(window_obj,form_name,tmpl)
{window_obj.Goto(form_name,tmpl);}
function Trim(str)
{str=str.replace(/^\s*/,"");str=str.replace(/\s*$/,"");return str;}
function IsValidInteger(str)
{str=Trim(str);return str.length>0&&IsValid(str,'0123456789-');}
function IsValidNatural(str)
{str=Trim(str);return str.length>0&&str.indexOf('0')!=0&&IsValid(str,'1234567890');}
function IsValidReal(str)
{str=Trim(str);return str.length>0&&IsValid(str,'0123456789.-');}
function IsValid(str,alphabet)
{for(var i=0;i<str.length;i++){if(alphabet.indexOf(str.charAt(i))==-1)return false;}
return true;}
function IsValidIdentifier(str)
{str=Trim(str);return IsValid(str,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890-_');}
function IsValidEmail(strEmail)
{var validEmailRegExp=/^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]+)(\.[a-z]{2,6}(\.[a-z]{2,6}){0,2})$/i;return validEmailRegExp.test(strEmail);}
function IsValidSQLDate(sql_date)
{sql_date=Trim(sql_date);var parts=sql_date.split(' ');var time_str=parts.length>1?parts[1]:"";var date_str=parts.length>0?parts[0]:"";if(date_str==""){return false;}
if(time_str!=""){var time_parts=time_str.split(/:/);if(time_parts.length!=3)return false;var time_parts_valid=(time_parts[0]!=""&&time_parts[0]>=0&&time_parts[0]<=23&&time_parts[1]!=""&&time_parts[1]>=0&&time_parts[1]<=59&&time_parts[2]!=""&&time_parts[2]>=0&&time_parts[2]<=59);if(!time_parts_valid)return false;}
var date_parts=date_str.split(/-/);if(date_parts.length!=3)return false;var date_obj=new Date(date_parts[0],date_parts[1]-1,date_parts[2]);return date_parts[0]==date_obj.getFullYear()&&date_parts[1]==date_obj.getMonth()+1&&date_parts[2]==date_obj.getDate();}
function SKPopup(url,width,height,options)
{SKPopupHandle(url,width,height,options);}
function SKPopupHandle(url,width,height,options)
{var left=screen.width/2-width/2;var top=screen.height/2-height/2;var name='OpenedPopupWindow'+width+height;var resizable="yes";var scrollbars="yes";var status="no";var toolbar="no";var menubar="no";var modal="no";var location="no";if(typeof(options)!='undefined'){if(typeof(options['resizable'])!='undefined')
resizable=options['resizable'];if(typeof(options['scrollbars'])!='undefined')
scrollbars=options['scrollbars'];if(typeof(options['left'])!='undefined')
left=options['left'];if(typeof(options['top'])!='undefined')
top=options['top'];if(typeof(options['name'])!='undefined')
name=options['name'];if(typeof(options['status'])!='undefined')
status=options['status'];if(typeof(options['toolbar'])!='undefined'){toolbar=options['toolbar'];}
if(typeof(options['modal'])!='undefined'){modal=options['modal'];}
if(typeof(options['menubar'])!='undefined'){menubar=options['menubar'];}
if(typeof(options['location'])!='undefined'){location=options['location'];}}
var options='left='+left+',top='+top+',width='+width+',height='+height+',resizable='+resizable+',scrollbars='+scrollbars+',toolbar='+toolbar+',menubar='+menubar+',location='+location+',modal='+modal+',status='+status;try{document.body.style.cursor='wait';var handle=window.open(url,name,options);if(handle)
handle.focus();else
AlertSystemMessage("<font class=\"heading1\">Please, enable pop-up windows</font>\n"+"<font class=\"plain\">Your browser is set up to block pop-up windows or you have a 3rd party pop-up blocker installed. To be able to administer your site, please enable pop-ups.<br><div class=\"popupBlockerImage\">&nbsp;</div></font>");document.body.style.cursor='default';return handle;}catch(e){document.body.style.cursor='default';return null;}}
function AreCookiesEnabled()
{var test_cookie_string="TestingIfCookiesAreEnabled=TestValue";document.cookie=test_cookie_string;if(document.cookie.indexOf(test_cookie_string)==-1){return false;}
document.cookie=test_cookie_string+'Expires: '+"; expires=Thu, 01-Jan-70 00:00:01 GMT";return true;}
function AlertNotEnabledCookiesMessage()
{AlertSystemMessage("<font class=\"heading1\">Your cookies are disabled</font>\n"+"<font class=\"plain\">Session cookies are not allowed in your browser settings. To be able to administrate your website, please allow cookies.</font>");}
function AlertSystemMessage(message)
{var box=document.createElement('div');box.setAttribute('class','SystemAlertPlaceholder');box.className='SystemAlertPlaceholder';box.id='SystemAlertPlaceholderID';box.setAttribute('id','SystemAlertPlaceholderID');box.innerHTML='<div class="content"><div class="text">'+
message+'<div class="break"></div><a href="javascript:{}" class="plain" onclick="document.body.removeChild(document.getElementById(\'SystemAlertPlaceholderID\'));">Hide This Message</a><br>'+'</div></div>'+'<div class="bl"></div><div class="bm"></div><div class="br"></div>';document.body.appendChild(box);}
function RefreshCachedImages()
{}
function LoginToEdit(login,login_page,template_path)
{var options=new Array();options['resizable']='no';options['scrollbars']='no';if(typeof(template_path)=='undefined'||template_path==''){template_path=document.location.pathname;}
SKPopup(login_page+'?template_path='+escape(template_path)+'&domain='+document.location.host+'&target_window=top.opener'+'&login='+login,300,200,options);}
function ExecuteOnLoadFunctions()
{THE_PAGE_IS_LOADED=true;for(var i=0;i<ONLOAD_FUNCTIONS.length;i++){if(typeof ONLOAD_FUNCTIONS[i]=='function'){ONLOAD_FUNCTIONS[i]();}else{eval(ONLOAD_FUNCTIONS[i]);}}}
function IsPageLoaded()
{return THE_PAGE_IS_LOADED;}
function FixURL(url)
{url=Trim(url);url=url.replace(/\"/g,escape('"'));url=url.replace(/\'/g,escape("'"));url=url.replace(/ /g,escape(" "));if(url.toLowerCase().indexOf('://')==-1&&url.toLowerCase().indexOf('mailto:')!=0){if(url.indexOf('@')!=-1&&url.indexOf('.')!=-1){return'mailto:'+url;}else{return'http://'+url;}}
return url;}
function ScrollTop(){window.scrollTo(0,0);}
function GetCurrentLocationFileName(){var loc=document.location.pathname;return loc.substring(loc.lastIndexOf('/')+1,loc.length);}


function OpenNextObject(obj_id,obj_inst)
{var form=document.forms[OBJ_EDIT_FORM];form.next_obj_id.value=obj_id;form.next_obj_inst.value=obj_inst;}
function SetValidator(func){EDIT_TMPL_VALIDATORS.push(func);}
function SaveLocation()
{var form=document.forms[OBJ_EDIT_FORM];if(form.prev_location.value==''){var fields_to_remember=new Array('node_id','position_node_id','obj_id','obj_inst','parent_id','design_id','user_id','objs_current_sequence_start_index');var pairs="";for(var i=0;i<fields_to_remember.length;i++){var field=fields_to_remember[i];if(typeof(form.elements[field])!='undefined'){pairs+=field+"="+escape(form.elements[field].value)+"&";}}
if(pairs.length!=0)
pairs=pairs.substring(0,pairs.length-1);form.prev_location.value=document.location.pathname+"?"+pairs;}}


if(typeof SK=='undefined')SK={};if(typeof SK.UI=='undefined')SK.UI={};SK.UI.MessageBox=new Class({BOX_WIDTH:440,BOX_HEIGHT:200,initialize:function(text,buttons,size,window_options){if(typeof size=='undefined'){size={};}
if(typeof size.width=='undefined'){size.width=this.BOX_WIDTH;}
if(typeof size.height=='undefined'){size.height=this.BOX_HEIGHT;}
var width=size.width;var height=size.height;if(typeof window_options=='undefined'){window_options={};}
if(typeof window_options.callbacks=='undefined'){window_options.callbacks={};}
window_options.callbacks.onafterdisabledesktop=function(win){var e=$(win.getDesktopCoveringElementID());e.setStyle('opacity',0.3);}
window_options.callbacks.onafterhide=function(win){this.mgr.executeCallback(this.mgr.last_callback);}.bind({mgr:this});window_options.callbacks.onafterdisplay=function(win){this.mgr.buildContent(win.getContent(),this.text,this.buttons);}.bind({mgr:this,buttons:buttons,text:text});var win=new SKFancyWindow('',window_options.title?window_options.title:'Confirmation',width,height,window_options);win.init();win.display();this.win=win;},buildContent:function(body,text,buttons){var content_wrapper=new Element('div',{'class':'sk-confirmation-box'}).inject(body);var text_html=text.replace(/\r/g,"").replace(/\n\n/g,"<p class=\"confirmation-box-plain\">").replace(/\n/g,"<br>");var text_content=new Element('div',{'class':'txt',html:text_html}).inject(content_wrapper);var buttons_wrapper=new Element('div',{'class':'btns'}).inject(content_wrapper);var focused_button=null;for(var i=0;i<buttons.length;i++){var button=buttons[i];var button_element=new Element('input',{'id':'btn'+i,'type':'button','class':'aabutton','value':button.caption,'events':{'click':function(){this.mgr.last_callback=this.callback;this.mgr.close();}.bind({mgr:this,callback:button.callback})}});button_element.inject(buttons_wrapper);if(i==0||button.focused){focused_button=button_element;}}
if(focused_button){try{focused_button.focus();}catch(e){}}},executeCallback:function(callback){if(typeof callback!='function'){callback=eval(callback);}
if(typeof callback=='function')callback();},close:function(){this.win.hide();}});SK.UI.ConfirmBox=new Class({initialize:function(message,callback_ok,callback_cancel,size,window_options){SKConfirm(message,callback_ok,callback_cancel,size,window_options);}});SK.UI.NoticeBox=new Class({initialize:function(message,callback_ok,size,window_options){SKMessage(message,callback_ok,size,window_options);}});function SKConfirm(message,callback_ok,callback_cancel,size,window_options)
{var btn_ok={caption:'OK',callback:function(){this.callback();}.bind({callback:callback_ok})};var btn_cancel={caption:'Cancel',callback:typeof callback_cancel=='undefined'?null:function(){this.callback();}.bind({callback:callback_cancel})};var buttons=[btn_ok,btn_cancel];new SK.UI.MessageBox(message,buttons,size,window_options);}
function SKMessage(message,callback_ok,size,window_options){if(typeof(callback_ok)=='undefined'||callback_ok==null){callback_ok=function(){};}
var buttons=[{caption:'OK',callback:function(){callback_ok();}}];if(!$defined(window_options)){window_options={};}
if(!$defined(window_options.title)){window_options.title="Notice";}
new SK.UI.MessageBox(message,buttons,size,window_options);}


var TOOLTIP_LAYER_NAME='TooltipLayer';var HIDE_TOOLTIP_LAYER_TIMEOUT=1000*60;var TOOLTIP_LAYER_OFFSET=10;var TOOLTIP_LAYER_WIDTH=257;var TOOLTIP_LAYER_HEIGHT=50;var TOOLTIP_LAYER_CORNER_WIDTH=7;var TOOLTIP_LAYER_CORNER_HEIGHT=7;var tooltip_timer_handle=null;var _TOOLTIP_IS_ALREADY_SHOWN=false;var _LAST_SHOWN_TOOLTIP_KEY="";var _TOOLTIP_GLOBAL_LOCK=false;var _CURRENT_TOOLTIP_OBJ=null;var _CURRENT_TOOLTIP_WIDTH='';var _CURRENT_TOOLTIP_HEIGHT='';var _CURRENT_TOOLTIP_TOP_OFFSET='';var _CURRENT_TOOLTIP_LEFT_OFFSET='';function ShowTooltip(obj,key,_width,_height,_top_offset,_left_offset,fixed_left_position,fixed_top_postion)
{if(typeof(obj)=='undefined'||typeof(TOOLTIPS)=='undefined'||typeof(TOOLTIPS[key])=='undefined')
return;if(typeof(_top_offset)=='undefined'||_top_offset==''){_top_offset=0;}
if(typeof(_left_offset)=='undefined'||_left_offset==''){_left_offset=0;}
if(_TOOLTIP_GLOBAL_LOCK){_CURRENT_TOOLTIP_OBJ=obj;_CURRENT_TOOLTIP_WIDTH=_width;_CURRENT_TOOLTIP_HEIGH=_height;_CURRENT_TOOLTIP_TOP_OFFSET=_top_offset;_CURRENT_TOOLTIP_LEFT_OFFSET=_left_offset;var str="ShowTooltip( _CURRENT_TOOLTIP_OBJ, '"+key+"', _CURRENT_TOOLTIP_WIDTH, _CURRENT_TOOLTIP_HEIGHT, _CURRENT_TOOLTIP_TOP_OFFSET, _CURRENT_TOOLTIP_LEFT_OFFSET );";window.setTimeout(str,10);return;}
var top_offset=_top_offset;var left_offset=_left_offset;var layer=new Layer(TOOLTIP_LAYER_NAME);var width=typeof(_width)=='undefined'||!_width?TOOLTIP_LAYER_WIDTH:_width;var height=typeof(_height)=='undefined'||!_height?TOOLTIP_LAYER_HEIGHT:_height;layer.SetVisible(false);if(tooltip_timer_handle){window.clearTimeout(tooltip_timer_handle);tooltip_timer_handle=null;}
if(!layer)return;var tooltip=TOOLTIPS[key];if(typeof(NO_ESCAPE[key])=='undefined'||!NO_ESCAPE[key]){tooltip=tooltip.replace(/&/g,"&amp;");tooltip=tooltip.replace(/\"/g,"&#34;");tooltip=tooltip.replace(/</g,"&lt;");tooltip=tooltip.replace(/>/g,"&gt;");}
tooltip=tooltip.replace(/\r/g,"");tooltip=tooltip.replace(/\n/g,"<br>");var tooltip_html='<table cellspacing=0 cellpadding=0 border=0 width=100%>'+'<tr><td width=2><img src="'+SPACE+'" width=3 height=1></td>'+'<td class=tooltip width=99%>'+tooltip+'</td>'+'<td width=2><img src="'+SPACE+'" width=2 height=1></td>'+'<td valign=top><a onclick="javascript:HideTooltip( )">'+'<img src="'+TOOLTIP_CLOSE+'" border=0 width=13 height=13></a></td></tr>'+'<tr><td width=2 colspan=4><img src="'+SPACE+'" width=1 height=2></td></tr>'+'</table>';var code='<table cellspacing=0 cellpadding=0 border=0 width='+width+'>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_TOP_LEFT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'<td class=tooltip width='+(width-2*TOOLTIP_LAYER_CORNER_WIDTH)+' ><img src="'+SPACE+'" width='+width+' height=7></td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_TOP_RIGHT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'</tr>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' class=tooltip><img src="'+SPACE+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height=7></td>'+'<td class=tooltip>'+tooltip_html+'</td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' class=tooltip><img src="'+SPACE+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height=7></td>'+'</tr>'+'<tr>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_BOTTOM_LEFT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'<td class=tooltip width='+(width-2*TOOLTIP_LAYER_CORNER_WIDTH)+' ><img src="'+SPACE+'" width='+width+' height=7></td>'+'<td width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'<img src="'+TOOLTIP_BOTTOM_RIGHT+'" width='+TOOLTIP_LAYER_CORNER_WIDTH+' height='+TOOLTIP_LAYER_CORNER_HEIGHT+'>'+'</td>'+'</tr>'+'</table>';layer.SetDimentions(width,height);layer.HTML(code);var left=0;var top=0;if(obj!=null){if(!document.getElementById){left=window.pageXOffset;top=window.pageYOffset;}else{var obj_position=GetObjectAbsolutePosition(obj);if(!document.all){left=obj_position.left+obj.offsetWidth+TOOLTIP_LAYER_OFFSET;top=obj_position.top-obj.offsetHeight;}else{left=obj_position.left+obj.clientWidth+TOOLTIP_LAYER_OFFSET;top=obj_position.top-obj.clientHeight;}}}
if(fixed_left_position){left=fixed_left_position;}
if(fixed_top_postion){top=fixed_top_postion;}
if(left+width>layer.DocumentWidth){left=layer.DocumentWidth-width;}
if(left<0){left=0;}
layer.SetPosition(left+left_offset,top+top_offset);layer.SetDisplay(true);layer.SetVisible(true);_TOOLTIP_IS_ALREADY_SHOWN=true;_LAST_SHOWN_TOOLTIP_KEY=key;tooltip_timer_handle=window.setTimeout('HideTooltip();',HIDE_TOOLTIP_LAYER_TIMEOUT);}
function HideTooltip()
{_TOOLTIP_GLOBAL_LOCK=true;window.setTimeout('var l=new Layer( TOOLTIP_LAYER_NAME );l.SetVisible( false );l.SetDisplay( false );_TOOLTIP_GLOBAL_LOCK=false;',100);if(tooltip_timer_handle)
window.clearTimeout(tooltip_timer_handle);tooltip_timer_handle=false;_TOOLTIP_IS_ALREADY_SHOWN=false;}
function GetObjectAbsolutePosition(obj)
{var pos=new Object();pos.left=0;pos.top=0;if(!obj||typeof(obj)=='undefined'||typeof(obj.offsetLeft)=='undefined')
return pos;if(obj.nodeName!="DIV"&&obj.nodeName!="TR"&&obj.nodeName!="CENTER"&&obj.nodeName!="P"){pos.left=obj.offsetLeft;pos.top=obj.offsetTop;}
var parent_pos=GetObjectAbsolutePosition(obj.parentNode);if(obj.parentNode&&typeof(obj.parentNode)!='undefined'&&typeof(obj.parentNode.children)!='undefined'){for(var i=0;i<obj.parentNode.children.length;i++){if(obj.parentNode.children.sourceIndex>=obj.sourceIndex)
break;if(obj.parentNode.children[i].nodeName=="IMG"&&i==0&&obj.parentNode.nodeName!="TD")
pos.top+=obj.parentNode.children[i].offsetTop;}}
pos.left+=parent_pos.left;pos.top+=parent_pos.top;return pos;}
function SetHinderingObjectsVisibility(how)
{if(document.all){for(var i=0;i<document.forms.length;i++){for(var j=0;j<document.forms[i].elements.length;j++){if(document.forms[i].elements[j].nodeName.toUpperCase()=='SELECT'||document.forms[i].elements[j].nodeName.toUpperCase()=='IFRAME'){document.forms[i].elements[j].style.display=how?"block":"none";}}}}}
function AddTooltip(key,value)
{TOOLTIPS[key]=value;}


var TOOLTIPS=new Array();var NO_ESCAPE=new Array();TOOLTIPS['NavMenuItem__Text']='If you choose from Link [Create new page] this text will be a Page Name';TOOLTIPS['NavMenuItem__Alt']='If you choose from Link [Create new page] this MouseOver text will be a Page Title';TOOLTIPS['File__Src']='The time to upload may vary depending on the speed of your internet connection. Uploding files over 100Mb is not recommened.';TOOLTIPS['GalleryImageZip__Src']='You can upload a single image (JPG, GIF, PNG) or a ZIP file with many images in it. The time to upload may vary depending on the speed of your internet connection. Uploding files over 100Mb is not recommened.';TOOLTIPS['GalleryKeepImage__Chk']='If checked, site visitors will be able to see the images in their original resolution. However, keeping the original image requires significantly more storage space.';TOOLTIPS['MailingList__Name']='Your mailing list will appear with this name in the Mailing Lists Management';TOOLTIPS['MailingList__Prefix']='The text will be displayed in front of the mailing list subscription field';TOOLTIPS['MailingList__ButtonLabel']='The text will be displayed on the subscription button';TOOLTIPS['MailingList__RequiresConfirmation']='If this option is enabled users will be asked by email to confirm subscription';TOOLTIPS['MailingListAA__AppendUnsubscrURL']='A link for unsubscribing will be added automatically to your email';TOOLTIPS['SiteProperties__Keywords']="Site keywords";TOOLTIPS['SiteProperties__Description']="Site description";TOOLTIPS['SiteProperties__SiteTitle']="Your site title";TOOLTIPS['SiteProperties__PageTitleDelimiter']="Page Delimiter (separates Site and Page Titles in the browser titlebar (e.g. Site - Page)";TOOLTIPS['SiteProperties__NewsPerPage']="If you have a news group added to your site, specify how many news items you need displayed at once. If the number of all your news items is bigger than the number of news per page, all other news items will appear when you click 'Prev' and 'Next' navigation available above and below your news group.";


SK.Peripherials=function(){this.mouse_pos={x:0,y:0};this.init=function(){var self=this;var f_mm=function(e){self.mouse_pos={x:e.page.x,y:e.page.y};};var f_md=function(e){self.mouse_pos={x:e.page.x,y:e.page.y};}
$(document.body).addEvent('mousemove',f_mm);$(document.body).addEvent('mousedown',f_md);}
this.getMousePosition=function(){return this.mouse_pos;}}


var NN_4=(document.layers)?1:0;var IE=(document.all)?1:0;var NN_6=(!document.all&&document.getElementById)?1:0;var VISIBLE=NN_4?"show":"visible";var HIDDEN=NN_4?"hide":"hidden";var DISPLAY_ON="block";var DISPLAY_OFF="none";var LAYER__IS_NETSCAPE=(navigator.appName.indexOf("Explorer")==-1);var LAYER__NETSCAPE_TIME_PATCH_COEFFICIENT=NN_4?0:0;var inited_mouse_actions=false;var LAYERS_HASH={};var old_mouse_pos=new Object();old_mouse_pos.left=0;old_mouse_pos.top=0;var allow_default_dragging=false;var default_mousedown=null;var default_mousemove=null;var default_mouseup=null;function Layer(layer_name)
{NN_4=(document.layers)?1:0;IE=(document.all)?1:0;NN_6=(!document.all&&document.getElementById)?1:0;if(typeof(LAYERS_HASH)=='undefined')
LAYERS_HASH=new Array();this.LayerName=layer_name;this.Layer=Layer__GetLayerObj(layer_name);this.LayerStyle=Layer__GetLayerObjStyle(layer_name);this.Draggable=false;if(typeof(this.Layer)=='undefined'||typeof(this.LayerStyle)=='undefined'){this.Success=false;return null;}
this.SetPosition=Layer__SetLayerPosition;this.GetPosition=Layer__GetLayerPosition;this.SetVisible=Layer__SetLayerVisible;this.IsVisible=Layer__IsLayerVisible;this.SetDisplay=Layer__SetLayerDisplay;this.Move=Layer__Move;this.GetDimentions=IE||NN_6?Layer__GetLayerDimentions:Layer__GetLayerDimentions_NN;this.SetDimentions=IE||NN_6?Layer__SetLayerDimentions:Layer__SetLayerDimentions_NN;this.HTML=IE||NN_6?Layer__HTML:Layer__HTML_NN;this.DocumentMargins=IE||NN_6?Layer__GetDocumentMargins:Layer__GetDocumentMargins_NN;this.Document=IE?document:(NN_6?document:this.Layer.document);this.InitDrag=Layer__InitDrag;this.ReleaseDrag=Layer__ReleaseDrag;this.Maximize=Layer__Maximize;this.Center=Layer__Center;this.DocumentMargins();LAYERS_HASH[this.LayerName]=this;this.Success=true;return this;}
function Layer__DefaultDragging(func_handler_mousedown,func_handler_mousemove,func_handler_mouseup)
{default_mousedown=func_handler_mousedown;default_mousemove=func_handler_mousemove;default_mouseup=func_handler_mouseup;allow_default_dragging=true;}
function Layer__AllowDefaultDragging()
{allow_default_dragging=true;}
function Layer__ForbidDefaultDragging()
{allow_default_dragging=false;}
function Layer__GetLayerObj(layer_name,nested_ref){var layer;if(NN_6||IE){layer=document.getElementById(layer_name);}else if(NN_4){var layer_parent;if(typeof(nested_ref)!='undefined'){layer_parent=document.layers[nested_ref].document;}else{layer_parent=document;}
layer=layer_parent.layers[layer_name];}
return layer;}
function Layer__GetLayerObjStyle(layer_name,nested_ref){var layer=Layer__GetLayerObj(layer_name,nested_ref);if(!layer)return;if(NN_6){layer=layer.style;}else if(IE){layer=layer.style;}else if(NN_4){}
return layer;}
function Layer__SetLayerPosition(left,top)
{this.LayerStyle.left=left+((left+"").indexOf("px")==-1?"px":"");this.LayerStyle.top=top+((top+"").indexOf("px")==-1?"px":"");}
function Layer__GetLayerPosition()
{var pos=new Object();pos.left=parseInt(this.LayerStyle.left);pos.top=parseInt(this.LayerStyle.top);return pos;}
function Layer__SetLayerDimentions(width,height)
{this.LayerStyle.width=width+((width+"").indexOf("px")==-1?"px":"");this.LayerStyle.height=height+((height+"").indexOf("px")==-1?"px":"");}
function Layer__SetLayerDimentions_NN(width,height)
{this.LayerStyle.clip.width=width+((width+"").indexOf("px")==-1?"px":"");this.LayerStyle.clip.height=height+((height+"").indexOf("px")==-1?"px":"");}
function Layer__GetLayerDimentions()
{var dimentions=this.GetPosition();dimentions.width=parseInt(this.LayerStyle.width);dimentions.height=parseInt(this.LayerStyle.height);return dimentions;}
function Layer__GetLayerDimentions_NN()
{var dimentions=this.GetPosition();dimentions.width=parseInt(this.LayerStyle.clip.width);dimentions.height=parseInt(this.LayerStyle.clip.height);return dimentions;}
function Layer__Move(start_left,start_top,end_left,end_top,timeout,speed_coefficient,name)
{var layer=typeof(name)=='undefined'?this:new Layer(name);if(start_left==end_left&&start_top==end_top){layer.SetPosition(start_left,start_top);return;}
if(typeof(speed_coefficient)=='undefined'){speed_coefficient=1;}
var sign_left=__Layer__Sign(start_left,end_left);var sign_top=__Layer__Sign(start_top,end_top);var dleft=__Layer__Distance(start_left,end_left);var dtop=__Layer__Distance(start_top,end_top);var offset_left=1;var offset_top=1;if(dleft>dtop){if(dtop==0){offset_top=0;offset_left=1;}else{offset_top=1;offset_left=Math.floor(dleft/dtop);}}else{if(dleft==0){offset_top=1;offset_left=0;}else{offset_top=Math.floor(dtop/dleft);offset_left=1;}}
if(start_left!=end_left){start_left+=speed_coefficient*sign_left*offset_left+LAYER__NETSCAPE_TIME_PATCH_COEFFICIENT;}
if(start_top!=end_top){start_top+=speed_coefficient*sign_top*offset_top;}
layer.SetPosition(start_left,start_top);var new_sign_left=__Layer__Sign(start_left,end_left);var new_sign_top=__Layer__Sign(start_top,end_top);if(sign_left*new_sign_left<=0&&sign_top*new_sign_top<=0){return;}
var _name=typeof(name)=='undefined'?this.LayerName:name;if(timeout>0){window.setTimeout('Layer__Move('+start_left+', '+start_top+', '+end_left+', '+end_top+', '+timeout+', '+speed_coefficient+', "'+_name+'")',timeout);}else{Layer__Move(start_left,start_top,end_left,end_top,0,speed_coefficient,_name);}}
function __Layer__Distance(start,end)
{if(start>0&&end>0){return Math.abs(end-start);}
return Math.abs(start)+Math.abs(end);}
function __Layer__Sign(start,end)
{if(start<end)
return 1;if(start==end)
return 0;return-1;}
function Layer__SetLayerVisible(visible)
{this.LayerStyle.visibility=visible?VISIBLE:HIDDEN;}
function Layer__IsLayerVisible()
{return this.LayerStyle.visibility==VISIBLE;}
function Layer__SetLayerDisplay(visible)
{this.LayerStyle.display=visible?DISPLAY_ON:DISPLAY_OFF;}
function Layer__HTML(code)
{this.Layer.innerHTML=code;}
function Layer__HTML_NN(code)
{this.Document.open();this.Document.write(code);this.Document.close();}
function Layer__GetDocumentMargins()
{var d=document.body;if(document.documentElement&&document.compatMode!='BackCompat')d=document.documentElement;this.ScrollLeft=parseInt(d.scrollLeft);this.ScrollTop=parseInt(d.scrollTop);if(navigator.userAgent.toLowerCase().indexOf("safari")!=-1){this.ScrollLeft=parseInt(document.body.scrollLeft);this.ScrollTop=parseInt(document.body.scrollTop);}
this.WindowWidth=parseInt(d.clientWidth);this.WindowHeight=parseInt(d.clientHeight);this.DocumentWidth=parseInt(d.clientWidth)+parseInt(this.ScrollLeft);this.DocumentHeight=parseInt(d.clientHeight)+parseInt(this.ScrollTop);this.FullDocumentWidth=parseInt(d.scrollWidth);this.FullDocumentHeight=parseInt(d.scrollHeight);}
function Layer__GetDocumentMargins_NN()
{this.DocumentWidth=window.innerWidth+window.pageXOffset;this.DocumentHeight=window.innerHeight+window.pageYOffset;this.FullDocumentWidth=this.DocumentWidth;this.FullDocumentHeight=this.DocumentHeight;this.ScrollLeft=window.pageXOffset;this.ScrollTop=window.pageYOffset;this.WindowWidth=window.innerWidth;this.WindowHeight=window.innerHeight;}
function Layer__Maximize()
{this.DocumentMargins();this.SetDimentions(this.WindowWidth,this.WindowHeight);}
function Layer__Center(horizontally,vertically)
{var pos=this.GetPosition();var dimentions=this.GetDimentions();this.DocumentMargins();if(horizontally)
pos.left=this.WindowWidth/2-dimentions.width/2;if(vertically)
pos.top=this.WindowHeight/2-dimentions.height/2;this.SetPosition(pos.left,pos.top);}
function Layer__InitDrag()
{if(!inited_mouse_actions){if(IE){document.onmousedown=Layer__System__MOUSEDOWN;document.onclick=Layer__System__MOUSEUP;document.onmousemove=Layer__System__MOUSEMOVE;}else{document.onmousedown=Layer__System__MOUSEDOWN;document.captureEvents(Event.MOUSEDOWN);document.onmouseup=Layer__System__MOUSEUP;document.captureEvents(Event.MOUSEUP);document.onmousemove=Layer__System__MOUSEMOVE;document.captureEvents(Event.MOUSEMOVE);}
inited_mouse_actions=true;}
LAYERS_HASH[this.LayerName].Draggable=true;}
function Layer__ReleaseDrag()
{LAYERS_HASH[this.LayerName].Dragging=false;}
function Layer__System__MOUSEDOWN(event_obj)
{var dragged_some=false;for(var key in LAYERS_HASH){if(LAYERS_HASH[key].Draggable&&Layer__System__ClickedOverLayer(LAYERS_HASH[key],event_obj)){if(IE)
LAYERS_HASH[key].Dragging=true;else
LAYERS_HASH[key].Dragging=!LAYERS_HASH[key].Dragging;dragged_some=true;}}
if(!dragged_some&&allow_default_dragging){var current_pos=Layer__System__CurrentMousePosition(event_obj);default_mousedown(current_pos);}}
function Layer__System__MOUSEMOVE(event_obj)
{var old_pos=old_mouse_pos;var current_pos=Layer__System__CurrentMousePosition(event_obj);var dragged_some=false;for(var key in LAYERS_HASH){if(LAYERS_HASH[key].Draggable&&LAYERS_HASH[key].Dragging){LAYERS_HASH[key].LayerStyle.left=parseInt(LAYERS_HASH[key].LayerStyle.left)+(current_pos.left-old_pos.left);LAYERS_HASH[key].LayerStyle.top=parseInt(LAYERS_HASH[key].LayerStyle.top)+(current_pos.top-old_pos.top);dragged_some=true;}}
if(!dragged_some&&allow_default_dragging){default_mousemove(old_pos,current_pos);}}
function Layer__System__MOUSEUP(event_obj)
{var dragged_some=false;for(var key in LAYERS_HASH){if(LAYERS_HASH[key].Draggable&&LAYERS_HASH[key].Dragging){if(IE)
LAYERS_HASH[key].Dragging=false;dragged_some=true;}}
if(!dragged_some&&allow_default_dragging){var current_pos=Layer__System__CurrentMousePosition(event_obj);default_mouseup(current_pos);}}
function Layer__System__ClickedOverLayer(layer,event_obj)
{var pos=Layer__System__CurrentMousePosition(event_obj);var layer_pos=layer.GetDimentions();layer_pos.right=layer_pos.left+layer_pos.width;layer_pos.bottom=layer_pos.top+layer_pos.height;return(pos.left>=layer_pos.left&&pos.left<=layer_pos.right&&pos.top>=layer_pos.top&&pos.top<=layer_pos.bottom);}
function Layer__System__CurrentMousePosition(event_obj)
{var pos=new Object();if(IE){pos.left=event.clientX+document.body.scrollLeft;pos.top=event.clientY+document.body.scrollTop;}else{pos.left=event_obj.pageX+window.pageXOffset;pos.top=event_obj.pageY+window.pageYOffset;;}
old_mouse_pos=pos;return pos;}


if(typeof SK=='undefined')SK={};if(typeof SK.Util=='undefined')SK.Util={};SK.Util.SessionMonitor=new Class({initialize:function(){if(!SK.Singletons.env){return;}
if(SK.Singletons.env.get('session_id')==""||SK.Singletons.env.get("user_id")==""){return;}},run:function(){this.monitor();this.INVALID_SESSION_MONITOR_HANDLE=this.monitor.bind(this).periodical(60*1000);},monitor:function(){this.checkServerSession(function(){if(!this.isValidLocalSession()){this.showInvalidSessionWarning();}}.bind(this));},checkServerSession:function(callback){if(SK.Singletons.env.get('invalid_session_monitor_running')==true)return;SK.Singletons.env.set('invalid_session_monitor_running',true);new Request.JSON({'async':true,'url':'/Shared/Html/is_session_valid.html?session_id='+SK.Singletons.env.get('session_id')+'&'+'user_id='+SK.Singletons.env.get('user_id'),'onComplete':function(json){SK.Singletons.env.set('invalid_session_monitor_running',false);try{switch(json.status){case"replaced":SK.Singletons.env.set('session_id',json.session_id);SK.Singletons.env.set('invalid_session',false);break;case"invalid":SK.Singletons.env.set('invalid_session',true);break;}}catch(e){}
this.callback(!SK.Singletons.env.get('invalid_session'));}.bind({callback:callback})}).get();},isValidServerSession:function(callback){this.checkServerSession(function(valid){this.callback(valid);if(!valid){this.mgr.showInvalidSessionWarning();}}.bind({mgr:this,callback:callback}));},isValidLocalSession:function(){return SK.Singletons.env.get('invalid_session')!=true;},showInvalidSessionWarning:function(callback){var pool=SK_WINDOW_HANDLES;if(pool.getAll().length>0){return;}
SK.Singletons.env.set('invalid_session_callback',callback||$empty());var win=new SKFancyWindow("/Shared/Html/invalid_session.html","Your session has expired",550,350,{callbacks:{onhide:function(){new SK.Util.SessionMonitor().monitor();}}});win.init();win.display();}});SK.Util.SessionMonitor.expired=function(){new SK.Util.SessionMonitor().monitor();}
SK.Util.SessionMonitor.replaceSession=function(new_session_id,new_user_id){if(SK.Singletons.env.get("user_id")!=new_user_id){new SK.Util.SessionMonitor().monitor();}else{SK.Singletons.env.set('session_id',new_session_id);SK.Singletons.env.set('invalid_session',false);var callback=SK.Singletons.env.get('invalid_session_callback');if(callback)callback.delay(500);SK.Singletons.env.set('invalid_session_callback',null);}}
SK.Util.SessionMonitor.isValidSession=function(session_id){return SK.Singletons.env.get('invalid_session')!=true;}
try{if(document.location.href.indexOf("tihomir")!=-1||document.referrer.indexOf("tihomir")!=-1){$(window).addEvent('load',function(){new SK.Util.SessionMonitor().run();});}}catch(e){}


if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";this.addParam("quality",q);this.addParam("allowscriptaccess","always");this.addParam("allownetworking","external");this.setAttribute("useExpressInstall",_7);this.setAttribute("doExpressInstall",false);var _d=(_9)?_9:window.location;this.setAttribute("xiRedirectUrl",_d);this.setAttribute("redirectUrl","");if(_a){this.setAttribute("redirectUrl",_a);}};deconcept.SWFObject.prototype={setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){var _25=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");for(var i=15;i>6;i--){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);_25=new deconcept.PlayerVersion([i,0,0]);break;}
catch(e){}}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}
return _25;};deconcept.PlayerVersion=function(_29){this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;this.minor=parseInt(_29[1])||0;this.rev=parseInt(_29[2])||0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(q){var _2d=q.indexOf(_2b+"=");var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;if(q.length>1&&_2d>-1){return q.substring(q.indexOf("=",_2d)+1,_2e);}}return"";}};if(Array.prototype.push==null){Array.prototype.push=function(_2f){this[this.length]=_2f;return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


function GrabStyles(document_obj){var styles={inline:[],linked:[]},isIE=/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent),css_rules_key=(isIE?'rules':'cssRules'),owner_node_key=(isIE?'owningElement':'ownerNode');if(typeof(document_obj)!='object'){return styles;}
for(var i=0;i<document_obj.styleSheets.length;i++){var owner_node=document_obj.styleSheets[i][owner_node_key];var owner_tag=owner_node.tagName.toLowerCase();switch(owner_tag){case'link':styles.linked.push(owner_node.href);break;case'style':var css_rules=document_obj.styleSheets[i][css_rules_key];if(typeof(css_rules)!='undefined'){for(var j=0;j<css_rules.length;j++){if(css_rules[j].type==3&&css_rules[j].href!=''){styles.linked.push(css_rules[j].href);}else{break;}}}
if(isIE){styles.inline.push(document_obj.styleSheets[i].cssText);}else{styles.inline.push(owner_node.innerHTML);}
break;}}
return styles;}


if(typeof SK=='undefined')SK={};if(typeof SK.Util=='undefined')SK.Util={};SK.Util.URL={parseQueryString:function(query){var query_str=query||document.location.href;var begin=query_str.indexOf("?");if(begin==-1){return{};}
var end=query_str.indexOf("#",begin);if(end==-1)end=query_str.length;var params_str=query_str.substring(begin+1,end);var params=params_str.split("&");var result={};for(var i=0;i<params.length;i++){var pair=params[i].split("=");if(pair.length==2){result[unescape(pair[0])]=unescape(pair[1]);}}
return result;}};


if(typeof(SK)=='undefined')SK={};if(typeof(SK.Util)=='undefined')SK.Utils={};SK.Util.Popup=new Class({initilize:function(){return this;},close:function(callback_code){var win=this.getHandle();if(!win){if(typeof callback_code=='function'){parent.callback_code.delay(500);}else{var f=eval("parent."+callback_code);f.delay(500);}
self.close();}else{win.setCallback('onhide',parent.SK_WINDOW_HANDLES.execAfterClose(callback_code?callback_code:$empty));if(callback_code){win.setCallback('onbeforehide',parent.SK_WINDOW_HANDLES.execAfterClose(callback_code));win.setCallback('onhide',function(){});}
win.hide();}},getHandle:function(){var parent_window=this.getParentWindow();var loc=document.location.href;if(loc.indexOf('#')!=-1&&loc.indexOf("?")<loc.indexOf("#")){loc=loc.substring(0,loc.indexOf("#"));}
var params=SK.Util.URL.parseQueryString(loc);var skwid=params.skwid;if(skwid==-1||skwid==null||skwid==""){skwid=0;}
var win=parent_window.SK_WINDOW_HANDLES.get(skwid);return win;},getParentWindow:function(){return parent;}});function GetPopupHandle()
{return new SK.Util.Popup().getHandle();}
function CloseWindow(callback_code)
{return new SK.Util.Popup().close(callback_code);}
function GetParentWindow()
{return new SK.Util.Popup().getParentWindow();}


if(typeof(SK)=='undefined')SK={};if(typeof(SK.UI)=='undefined')SK.UI={};SK.UI.Window=new Class({initialize:function(url,title,size,options){var win=new SKFancyWindow(url,title,size.width,size.height,options);win.init();win.display();}});function SKFancyWindow(url,title,width,height,options){this.url=url;this.title=title;this.width=width;this.height=height;this.options=options;this.init=function(){var self=this;if(typeof this.options=='undefined')this.options={};if(typeof this.options.callbacks=='undefined')this.options.callbacks={};this.appendCallback('onhide',function(win){self.hideWindow();});this.appendCallback('onbeforedisplay',function(win){self.execDisplayAnimation();});this.zoom_anim=new SKWindowAnimations(this.options.animation);this.zoom_anim.init();this.win=new SKWindow(this.url,this.title,this.width,this.height,this.options);this.win.init();}
this.display=function(){var self=this;this.win.display();}
this.getWindow=function(){return this.win;}
this.execDisplayAnimation=function(){var self=this;this.zoom_anim.show({width:this.width,height:this.height},function(){self.win.notifyEventFinished('onbeforedisplay');});}
this.replaceURL=function(url){this.win.replaceURL(url);}
this.resize=function(size){this.win.resize(size);}
this.setTitle=function(title){this.win.setTitle(title);}
this.getTitle=function(){return this.win.getTitle();}
this.hide=function(){this.win.hide();}
this.displayWindow=function(){this.win.display();}
this.getContentFrame=function(){return this.win.getContentFrame();}
this.hideWindow=function(){var self=this;this.zoom_anim.hide({width:this.width,height:this.height},function(){self.executeOnAfterHide();});}
this.executeOnAfterHide=function(){this.zoom_anim.dispose();}
this.appendCallback=function(event,callback){var old_callback=this.options.callbacks[event];if(typeof old_callback=='undefined')old_callback=null;this.options.callbacks[event]=function(win){if(old_callback!=null)old_callback(win);callback();};}}


function SKWindowAnimations(animation_type){this.small_window_width=1;this.small_window_height=1;this.animation_type=typeof animation_type=='undefined'?'center':animation_type;this.shrink_coef=100/100;this.animation_layer_id='skanimationPlaceholder';this.createLayers=function(){var div=new Element('div',{id:this.animation_layer_id});div.innerHTML=' ';div.inject(document.body);}
this.destroyLayers=function(){if($(this.animation_layer_id)){$(this.animation_layer_id).dispose();}}
this.show=function(to_size,callback){if(SK.Util.isSlowSystem()){if(callback)callback();return;}
var window_dimensions=this.getWindowDimensions();var pos_to=pos_from={left:window_dimensions.left+window_dimensions.width/2-to_size.width/2,top:window_dimensions.top+window_dimensions.height/2-to_size.height/2,width:to_size.width,height:to_size.height,opacity:0.4};pos_from=$unlink(pos_to);pos_from.opacity=0.2;pos_from.display='block';pos_from.height=1;var self=this;var from=this.fitCenterToWindow(pos_from,window_dimensions);var to=this.fitCenterToWindow(pos_to,window_dimensions);$(this.animation_layer_id).setStyles(from);var anim=new Fx.Morph(this.animation_layer_id,{duration:300,fps:20,transition:Fx.Transitions.Sine.easeIn,onComplete:function(){self.hideAnimationLayer();if(callback)callback();}});anim.start(to);}
this.hide=function(from_size,callback){if(SK.Util.isSlowSystem()){if(callback)callback();return;}
var window_dimensions=this.getWindowDimensions();var pos_from=pos_to={left:window_dimensions.left+window_dimensions.width/2-from_size.width/2,top:window_dimensions.top+window_dimensions.height/2-from_size.height/2,width:from_size.width,height:from_size.height,display:'block',opacity:0.4};pos_to=$unlink(pos_from);pos_to.opacity=0.2;pos_to.height=1;var self=this;var from=this.fitCenterToWindow(pos_from,window_dimensions);var to=this.fitCenterToWindow(pos_to,window_dimensions);$(this.animation_layer_id).setStyles(from);var anim=new Fx.Morph(this.animation_layer_id,{duration:100,fps:20,transition:Fx.Transitions.Sine.easeOut,onComplete:function(){self.hideAnimationLayer();if(callback)callback();}});anim.start(to);}
this.hideAnimationLayer=function(){$(this.animation_layer_id).setStyle('display','none');}
this.getWindowDimensions=function(){var d_size=$(document).getSize();var d_scroll=$(document).getScroll();var dimensions={width:d_size.x,height:d_size.y,left:d_scroll.x,top:d_scroll.y};return dimensions;}
this.fitCenterToWindow=function(r,w){if(r.width>=w.width){r.width=w.width;r.left=w.left+Math.round(w.width/2-r.width/2);}
if(r.height>=w.height){r.height=w.height;r.top=w.top+Math.round(w.height/2-r.height/2);}
return r;}
this.init=function(){this.createLayers();}
this.dispose=function(){this.destroyLayers();}}


function SKWindow(url,title,width,height,options)
{this.url=url;this.title=title;this.width=parseInt(width);this.height=parseInt(height);this.options=options;this.hidden=true;this.created_elements={};this.ie6=document.all&&navigator.appVersion.indexOf("MSIE 6")!=-1?true:false;this.ie7=!this.ie6&&document.all&&navigator.appVersion.indexOf("MSIE ")!=-1?true:false;this.ff2=navigator.userAgent.toLowerCase().indexOf("firefox/2")!=-1?true:false;this.ff1=navigator.userAgent.toLowerCase().indexOf("firefox/1")!=-1?true:false;this.mac=navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1?true:false;this.ff2mac=this.ff2&&this.mac;this.ff1mac=this.ff1&&this.mac;this.safari=navigator.appVersion.indexOf("Safari")!=-1?true:false;this.header_height=40;this.bg_padding=50;this.bg_cells_size=100;this.controls_width=70;this.wait_interval=30;this.loading_message='Loading...';this.loading_message_animation_interval=100;this.loading_message_vertical_shift=-20;this.fade_rendering_anim_interval=20;this.finished_events={};this.ontop_elements=[];this.init=function(){this.id=SK_WINDOW_HANDLES.add(this);this.create();this.addIDToURL();this.setDefaultOptions();this.reset();this.background_displayed=this.content_displayed=this.header_displayed=false;}
this.dispose=function(){this.destroy();SK_WINDOW_HANDLES.remove(this.id);}
this.create=function(){var id='skwindowDesktop';this.created_elements[id]=new Element(SK.Util.isSlowSystem()?'div':'iframe',{id:id,border:0,frameborder:0,src:''});this.created_elements[id].inject(document.body);id='skwindowDesktopLayer';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].innerHTML=' ';this.created_elements[id].inject(document.body);id='skwindowBackground';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(document.body);for(var i=1;i<=9;i++){this.created_elements['skwindowBackground'+i]=new Element('div',{id:'skwindowBackground'+i,'class':'skwindowBackground'+i});this.created_elements['skwindowBackground'+i].inject(this.created_elements['skwindowBackground']);}
id='skwindowHeader';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(document.body);id='skwindowHeaderTitleBg';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeader']);id='skwindowHeaderTitle';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderTitleBg']);id='skwindowHeaderControlsBg';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeader']);id='skwindowHeaderControls';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControlsBg']);id='skwindowHeaderControlsCustom';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);if(this.options.callbacks.onaddcontrols){var element=this.options.callbacks.onaddcontrols(this);if(element){element.inject(this.created_elements[id]);var width=parseInt(element.getComputedStyle('width'));if(width>0&&!isNaN(width)){this.controls_width+=width;this.created_elements[id].setStyle('width',width);}}}
id='skwindowHeaderControlsMaximize';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);id='skwindowHeaderControlsRestore';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);id='skwindowHeaderControlsSpacer';this.created_elements[id]=new Element('div',{'class':id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);id='skwindowHeaderControlsHide';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);id='skwindowHeaderControlsSpacer';this.created_elements[id]=new Element('div',{'class':id});this.created_elements[id].inject(this.created_elements['skwindowHeaderControls']);id='skwindowContent';this.created_elements[id]=new Element('div',{id:id});this.created_elements[id].inject(document.body);}
this.destroy=function(){for(var i in this.created_elements){if($chk(this.created_elements[i])){this.destroyElement(this.created_elements[i],false);}}}
this.reset=function(){var default_dimensions={width:this.getWidth(),height:this.getHeight(),left:0,top:0};this.resizeContent(default_dimensions);this.resizeHeader(default_dimensions);this.resizeBackground(default_dimensions);this.hideContent();this.hideBackground();this.hideHeader();this.cleanupInitialContent();}
this.addIDToURL=function(){if(this.isFrameMode()){var delim=this.url.indexOf("?")!=-1?"&":"?";this.url+=delim+"skwid="+this.id;}}
this.isFrameMode=function(){return this.url!='';}
this.setDefaultOptions=function(){if(typeof(this.options)=='undefined'){this.options={};}
if(typeof(this.options.modal)=='undefined'){this.options.modal=true;}
if(typeof(this.options.controls)=='undefined'){this.options.controls={};}
if(typeof(this.options.callbacks)=='undefined'){this.options.callbacks={};}
if(typeof this.options.controls.close=='undefined'){this.options.controls.close=true;}
if(typeof this.options.controls.maximize=='undefined'){this.options.controls.maximize=false;}
if(typeof this.options.scrollbars=='undefined'){this.options.scrollbars=true;}}
this.setCallback=function(key,callback){this.options.callbacks[key]=callback;}
this.display=function(){if(!this.executeCallback('onbeforedisplay')){this.onbeforedisplayFinished();}
if(!this.ie6&&!this.ie7){this.displayWindow();}}
this.displayWindow=function(){this.hidden=false;this.setTitle();this.loadURL();}
this.onbeforedisplayFinished=function(){this.applyOptions();this.displayPlaceholders();this.maximizeContentFrame(this.getContentFrame());this.setTitleBarControls();this.attachEvents();if(this.ie6||this.ie7){this.displayWindow();}}
this.hide=function(){this.hidden=true;this.executeCallback('onbeforehide');this.hidePlaceholders();this.cleanupFinalContent();this.undoOptions();this.detachEvents();this.dispose();this.executeCallback('onhide');if(this.mac){window.focus();document.body.focus();}
this.executeCallback('onafterhide');}
this.resize=function(size){var width=parseInt(size.width);var height=parseInt(size.height);if(!isNaN(width))this.width=width;if(!isNaN(height))this.height=height;this.applyOptions();this.displayPlaceholders();this.maximizeContentFrame(this.getContentFrame());}
this.getSize=function(){return{width:this.width,height:this.height};}
this.toggleMaximize=function(){if(typeof this.current_maximize_state=='undefined'){this.current_maximize_state=false;}
var last_maximize_state=this.current_maximize_state;this.current_maximize_state=!this.current_maximize_state;if(last_maximize_state==false){this.maximize();}else{this.restore();}}
this.isMaximized=function(){return this.current_maximize_state?true:false;}
this.maximize=function(){this.original_width=parseInt(this.width);this.original_height=parseInt(this.height);var window_dimensions=this.getWindowDimensions();this.resize({width:window_dimensions.width,height:window_dimensions.height});this.displayRestoreIcon();}
this.restore=function(){this.width=parseInt(this.original_width);this.height=parseInt(this.original_height);this.resize({width:this.width,height:this.height});this.displayMaximizeIcon();}
this.displayMaximizeIcon=function(){this.hideElement('skwindowHeaderControlsRestore');this.showElement('skwindowHeaderControlsMaximize');}
this.displayRestoreIcon=function(){this.hideElement('skwindowHeaderControlsMaximize');this.showElement('skwindowHeaderControlsRestore');}
this.displayPlaceholders=function(){this.resizePlaceholders();this.renderPlaceholders();}
this.resizePlaceholders=function(){var window_dimensions=this.getWindowDimensions();var content_dimensions=this.calculateContentDimensions({width:this.getWidth(),height:this.getHeight()});var header_dimensions=this.calculateHeaderDimensions({width:this.getWidth(),height:this.getHeight()});var background_dimensions=this.calculateBackgroundDimensions({width:this.getWidth(),height:this.getHeight()});this.resetBackgroundShadows();if(this.getBgPaddingHor()==0){this.stretchBackgroundShadow('horizontal');}
if(this.getBgPaddingVer()==0){this.stretchBackgroundShadow('vertical');}
this.resizeBackground(background_dimensions);this.resizeContent(content_dimensions);this.resizeHeader(header_dimensions);}
this.resetBackgroundShadows=function(){var suffixes=['1','2','3','4','6','7','8','9'];for(var i=0;i<suffixes.length;i++){var bg=$('skwindowBackground'+suffixes[i]);if(bg)bg.className='skwindowBackground'+suffixes[i];}}
this.stretchBackgroundShadow=function(direction){var suffixes={'vertical':{1:'skwindowBackground4',3:'skwindowBackground6',7:'skwindowBackground4',9:'skwindowBackground6'},'horizontal':{1:'skwindowBackground2',3:'skwindowBackground2',7:'skwindowBackground8',9:'skwindowBackground8'}};if(typeof suffixes[direction]){for(var i in suffixes[direction]){var bg=$('skwindowBackground'+i);if(bg)bg.className=suffixes[direction][i];}}}
this.calculateContentDimensions=function(rect_size){var window_dimensions=this.getWindowDimensions();var content_dimensions={left:(this.isFullOfBugsIE()?window_dimensions.left:0)+
window_dimensions.width/2-rect_size.width/2,top:(this.isFullOfBugsIE()?window_dimensions.top:0)+
window_dimensions.height/2-rect_size.height/2+this.header_height,width:rect_size.width,height:rect_size.height-this.header_height};return content_dimensions;}
this.calculateHeaderDimensions=function(rect_size){var window_dimensions=this.getWindowDimensions();var header_dimensions={left:(this.isFullOfBugsIE()?window_dimensions.left:0)+
window_dimensions.width/2-rect_size.width/2,top:(this.isFullOfBugsIE()?window_dimensions.top:0)+
window_dimensions.height/2-rect_size.height/2,width:rect_size.width,height:this.header_height};return header_dimensions;}
this.calculateBackgroundDimensions=function(rect_size){var window_dimensions=this.getWindowDimensions();var background_dimensions={left:(this.isFullOfBugsIE()?window_dimensions.left:0)+
window_dimensions.width/2-rect_size.width/2-this.getBgPaddingHor(),top:(this.isFullOfBugsIE()?window_dimensions.top:0)+
window_dimensions.height/2-rect_size.height/2-this.getBgPaddingVer(),width:rect_size.width+2*this.getBgPaddingHor(),height:rect_size.height+2*this.getBgPaddingVer()};return background_dimensions;}
this.renderPlaceholders=function(){this.displayBackground();this.displayContent();this.displayHeader();}
this.resizeContent=function(dimensions){this.setAbsoluteElementPosition('skwindowContent');this.setElementDimensions('skwindowContent',dimensions);}
this.displayContent=function(dimensions){if(this.content_displayed==false){var self=this;if(this.ie6||this.ie7){this.showElement($('skwindowContent'));}else{this.fadeInElement($('skwindowContent'));}}
this.content_displayed=true;}
this.isLoaded=function(){var frame=this.getContentFrame();return frame&&frame.style.display&&frame.style.display=='block';}
this.resizeHeader=function(dimensions){this.setAbsoluteElementPosition('skwindowHeader');this.setElementDimensions('skwindowHeader',dimensions);this.setElementDimensions('skwindowHeaderTitleBg',{width:dimensions.width-this.controls_width});this.setElementDimensions('skwindowHeaderControlsBg',{width:this.controls_width});this.setElementDimensions('skwindowHeaderControls',{width:this.controls_width});}
this.displayHeader=function(){if(this.header_displayed==false){this.showElement('skwindowHeader');}
this.header_displayed=true;}
this.resizeBackground=function(dimensions){for(var i=1;i<=9;i++){this.setElementDimensions('skwindowBackground'+i,{width:this.bg_cells_size,height:this.bg_cells_size});}
this.setElementDimensions('skwindowBackground2',{width:dimensions.width-2*this.bg_cells_size});this.setElementDimensions('skwindowBackground8',{width:dimensions.width-2*this.bg_cells_size});this.setElementDimensions('skwindowBackground4',{height:dimensions.height-2*this.bg_cells_size});this.setElementDimensions('skwindowBackground6',{height:dimensions.height-2*this.bg_cells_size});this.setElementDimensions('skwindowBackground5',{width:dimensions.width-2*this.bg_cells_size,height:dimensions.height-2*this.bg_cells_size});this.setAbsoluteElementPosition('skwindowBackground');this.setElementDimensions('skwindowBackground',dimensions);}
this.displayBackground=function(){if(this.isMaximized()){this.hideElement('skwindowBackground');}else{this.showElement('skwindowBackground');}
this.background_displayed=true;}
this.hidePlaceholders=function(){this.hideHeader();this.hideContent();this.hideBackground();}
this.hideHeader=function(){this.hideElement('skwindowHeader');this.header_displayed=false;}
this.hideContent=function(){this.hideElement('skwindowContent');this.content_displayed=false;}
this.hideBackground=function(){this.hideElement('skwindowBackground');this.background_displayed=false;}
this.setTitle=function(title){var e=$('skwindowHeaderTitle');if(e==null)return;var set_title=false;if(typeof title!='undefined'){if(title!=this.title)set_title=true;this.title=title;}else{set_title=true;}
if(set_title){e.innerHTML=this.title;}}
this.getTitle=function(){return this.title;}
this.setTitleBarControls=function(){this.setTitleBarControlHide();this.setTitleBarControlMaximize();this.setHeaderDoubleClick();}
this.setTitleBarControlHide=function(){if(!$defined(this.setTitleBarControlHide__timer_handle)){this.setTitleBarControlHide__timer_handle=0;}
if((new Date().getTime())-this.setTitleBarControlHide__timer_handle<=3*1000){return false;}
this.setTitleBarControlHide__timer_handle=new Date().getTime();var e=$('skwindowHeaderControlsHide');if(e==null)return;var self=this;e.onclick=function(){try{if($(self.getContentFrame().contentWindow)&&$(self.getContentFrame().contentWindow).oncustombeforeunload){var f=$(self.getContentFrame().contentWindow).oncustombeforeunload;var msg=f();if(typeof msg=='undefined'||msg==""){self.hide();}else{if(confirm(msg)){self.hide();}}}else{self.hide();}}catch(e){self.hide();}}}
this.setTitleBarControlMaximize=function(){var self=this;if(this.options.controls.maximize==false){this.disableElement('skwindowHeaderControlsMaximize');}else{this.enableElement('skwindowHeaderControlsMaximize');this.displayMaximizeIcon();}
var e=$('skwindowHeaderControlsMaximize');if(e==null)return;e.onclick=function(){self.toggleMaximize();}
e=$('skwindowHeaderControlsRestore');if(e==null)return;e.onclick=function(){self.toggleMaximize();}}
this.setHeaderDoubleClick=function(){var header=$('skwindowHeader');var self=this;if(this.options.controls.maximize==true){header.ondblclick=function(){self.toggleMaximize();}}else{header.ondblclick=function(){}}
var title_obj=$('skwindowHeaderTitle');this.disableSelection(title_obj);}
this.disableSelection=function(e){e.onselectstart=function(){return false;};e.unselectable="on";e.style.MozUserSelect="none";e.style.cursor="default";}
this.applyOptions=function(){if(this.options.modal){this.disableDesktop();this.hideOnTopElements();}}
this.undoOptions=function(){if(this.options.modal){this.enableDesktop();this.displayOnTopElements();}}
this.disableDesktop=function(){var element_id=this.getDesktopCoveringElementID();var e=$(element_id);if(e==null)return;this.setAbsoluteElementPosition(element_id);var window_dimensions=this.getWindowDimensions();this.setElementDimensions(element_id,{left:this.isFullOfBugsIE()?window_dimensions.left:0,top:this.isFullOfBugsIE()?window_dimensions.top:0,width:window_dimensions.width,height:window_dimensions.height});this.executeCallback('onafterdisabledesktop');e.setStyles({display:'block'});}
this.enableDesktop=function(){var element_id=this.getDesktopCoveringElementID();var e=$(element_id);if(e==null)return;e.style.display='none';}
this.getDesktopCoveringElementID=function(){return this.ie6||this.ie7?'skwindowDesktopLayer':'skwindowDesktop';}
this.hideOnTopElements=function(){this.ontop_elements=[];var target_tags=['object','embed','param'];if(this.ie6)target_tags.push('select');for(var j=0;j<target_tags.length;j++){var objs=document.getElementsByTagName(target_tags[j]);for(var i=0;i<objs.length;i++){this.ontop_elements.push(objs[i]);this.hideElement(objs[i]);if(this.safari){this.patchSafariFlashElements(objs[i],false);}}}}
this.displayOnTopElements=function(){for(var i=0;i<this.ontop_elements.length;i++){this.showElement(this.ontop_elements[i]);if(this.safari){this.patchSafariFlashElements(this.ontop_elements[i],true);}}}
this.patchSafariFlashElements=function(e,undo){if(undo){var old_wmode=e.getAttribute('old_wmode');if(old_wmode)e.setAttribute('wmode',old_wmode);else e.removeAttribute('wmode');}else{var old_wmode=e.getAttribute('wmode');e.setAttribute('wmode','opaque');if(old_wmode)e.setAttribute('old_wmode',old_wmode);}}
this.isElementDisplayed=function(e){return e.style.display=='none'?false:true;}
this.fadeInElement=function(e,options){if(SK.Util.isSlowSystem()){e.setStyle('display','block');if(options&&options.callback){options.callback();}
return;}
e.setStyles({opacity:'1',display:'block'});if(options&&options.callback){options.callback();}}
this.setAbsoluteElementPosition=function(id){var e=$(id);if(e==null)return;if(this.isFullOfBugsIE()){e.style.position='absolute';}else{e.style.position='fixed';}}
this.setElementDimensions=function(id,dimensions){var e=$(id);e=e==null?id:e;if(e==null)return;for(var i in dimensions)e.style[i]=Math.round(dimensions[i])+'px';}
this.getWindowDimensions=function(){var d_size=$(document).getSize();var d_scroll=$(document).getScroll();var dimensions={width:d_size.x,height:d_size.y,left:d_scroll.x,top:d_scroll.y};return dimensions;}
this.hideElement=function(id){var e=$(id);e=e==null?id:e;if(e==null)return;e.style.display='none';}
this.showElement=function(id){var e=$(id);e=e==null?id:e;if(e==null)return;e.style.display='block';}
this.enableElement=function(id){var e=$(id);if(e==null)return;e.style.visibility='visible';}
this.disableElement=function(id){var e=$(id);if(e==null)return;e.style.visibility='hidden';}
this.replaceURL=function(url){if(this.isFrameMode()){this.url=url;this.loadURL();}}
this.loadURL=function(){var self=this;this.cleanupInitialContent();this.setLoadingMessage();this.loadBackgroundURL(function(frame){self.removeLoadingMessage();self.displayContentFrame(frame);});}
this.loadBackgroundURL=function(callback){var self=this;var frame_mode=this.isFrameMode();var frame=new Element(frame_mode?'iframe':'div');frame.id=this.generateRandomID();if(frame_mode){frame.set('loaded','0');if(!(Browser.Engine.trident==true)){frame.addEvent('load',function(){if(this.get('loaded')=='1'){return;}
this.set('loaded','1');if(self.ff2||self.ff1){callback(frame);}else{self.wait_for_document_load_time_handle=window.setInterval(function(){self.waitForDocumentLoad(frame,callback);},this.wait_interval);}});frame.src=this.url;}}
frame.addClass('skwindowContentFrame');frame.scrolling=this.options.scrollbars?"auto":"no";this.setFrameToContent(frame);if(frame_mode){if(this.ie6||this.ie7){callback(frame);frame.src=this.url;}}else{callback(frame);}}
this.generateRandomID=function(){return'id'+(new Date()).getTime();}
this.waitForDocumentLoad=function(frame,callback){try{window.clearInterval(this.wait_for_document_load_time_handle);callback(frame);}catch(e){window.clearInterval(this.wait_for_document_load_time_handle);callback(frame);}}
this.setFrameToContent=function(frame){var e=$('skwindowContent');if(e==null)return;this.maximizeContentFrame(frame);frame.inject(e,"top");}
this.displayContentFrame=function(frame){if(this.ff2||this.ie6||this.ie7){this.showElement(frame);}else{var self=this;this.fadeInElement(frame);}
this.executeCallback('onafterdisplay');}
this.maximizeContentFrame=function(frame){if(!frame)return;var e=$('skwindowContent');if(e==null)return;frame.style.width=e.style.width;frame.style.height=e.style.height;frame.width=e.style.width;frame.height=e.style.height;frame.frameBorder="no";frame.border="0";}
this.getContentFrame=function(){return $$('#skwindowContent .skwindowContentFrame')[0];}
this.getContent=function(){var frame=this.getContentFrame();if(!this.isFrameMode())return frame;return frame.contentWindow.document.body;}
this.cleanupInitialContent=function(){this.cleanupContent(true);}
this.cleanupFinalContent=function(){this.cleanupContent(false);}
this.cleanupContent=function(initial){var e=$('skwindowContent');if(e==null)return;var children=e.getChildren();for(var i=0;i<children.length;i++){this.destroyElement(children[i],initial);}}
this.destroyElement=function(e,initial){e=$(e);if(e.get('tag').toLowerCase()=='iframe'){if(Browser.Engine.webkit&&this.isInPopup()){}else{if(Browser.Engine.trident){e.contentWindow.close();e.src='about:blank';}else{e.contentWindow.close();}}}
if(Browser.Engine.trident){if(initial==true){e.dispose();}}else{e.dispose();}
e=null;}
this.setLoadingMessage=function(){var e=$('skwindowContent');if(e==null)return;var div=new Element('div');div.addClass('skwindowLoadingMessage');div.appendText(this.loading_message);div.inject(e);this.loading_message_layer=div;this.centerLoadingMessage(div);this.runLoadingMessageAnimation(div);}
this.centerLoadingMessage=function(e){var c=$('skwindowContent');if(c==null)return;this.setElementDimensions(e,{width:parseInt(c.style.width),height:parseInt(this.getHeight()-this.header_height)});e.style.lineHeight=(this.getHeight()-this.header_height+this.loading_message_vertical_shift)+'px';}
this.removeLoadingMessage=function(){window.clearInterval(this.loading_message_time_handle);var e=$('skwindowContent');if(!e)return;var children=e.getChildren();for(var i=0;i<children.length;i++){if(children[i].hasClass('skwindowLoadingMessage')){children[i].destroy();children[i]=null;break;}}}
this.runLoadingMessageAnimation=function(e){var self=this;this.loading_message_time_handle=window.setInterval(function(){self.execLoadingMessageAnimationLoop(e);},this.loading_message_animation_interval);}
this.execLoadingMessageAnimationLoop=function(e){if(!e){window.clearInterval(this.loading_message_time_handle);return;}
if(typeof this.loading_opacity_coef=='undefined'){this.loading_opacity_coef=0;}
this.centerLoadingMessage(e);var min_threshold=30;var opacity=min_threshold+
Math.round(Math.abs(Math.sin(this.loading_opacity_coef))*(99-min_threshold));$(e).setStyle('opacity',opacity/100.0);this.loading_opacity_coef+=3;}
this.attachEvents=function(){var self=this;window.addEvent('resize',function(){self.handleWindowChanges();});window.addEvent('scroll',function(){if(self.isFullOfBugsIE()){self.handleWindowChanges();}});}
this.isFullOfBugsIE=function(){return((document.compatMode=='BackCompat'&&Browser.Engine.trident)||(document.compatMode!='BackCompat'&&Browser.Engine.trident4==true));}
this.handleWindowChanges=function(){if(this.hidden)return;this.applyOptions();this.displayPlaceholders();this.maximizeContentFrame(this.getContentFrame());}
this.detachEvents=function(){window.removeEvent('scroll');window.removeEvent('resize');}
this.executeCallback=function(id){if(typeof(this.options.callbacks[id])=='function'){this.finished_events[id]=false;this.options.callbacks[id](this);return true;}else{this.finished_events[id]=true;return false;}}
this.notifyEventFinished=function(id){this.finished_events[id]=true;if($type(this[id+'Finished'])=='function'){this[id+'Finished']();}}
this.waitForEvent=function(id,callback){var self=this;this.wait_timeout_handle=window.setInterval(function(){self.checkForEventID(id,callback);},this.wait_interval);}
this.checkForEventID=function(id,callback){if(typeof this.finished_events[id]=='undefined'||this.finished_events[id]==true){callback();if(this.wait_timeout_handle)
window.clearInterval(this.wait_timeout_handle);}}
this.getWidth=function(){var window_dimensions=this.getWindowDimensions();if(parseInt(this.width)>window_dimensions.width)
return parseInt(window_dimensions.width);return parseInt(this.width);}
this.getHeight=function(){var window_dimensions=this.getWindowDimensions();if(parseInt(this.height)>window_dimensions.height)
return parseInt(window_dimensions.height);return parseInt(this.height);}
this.getBgPaddingHor=function(){if(this.isMaximized())return 0;var window_dimensions=this.getWindowDimensions();if(this.width+this.bg_padding>window_dimensions.width){var shrinked_padding=window_dimensions.width-this.width;return shrinked_padding<0?0:shrinked_padding;}
return this.bg_padding;}
this.getBgPaddingVer=function(){if(this.isMaximized())return 0;var window_dimensions=this.getWindowDimensions();if(this.height+this.bg_padding>window_dimensions.height){var shrinked_padding=window_dimensions.height-this.height;return shrinked_padding<0?0:shrinked_padding;}
return this.bg_padding;}
this.preloadImages=function(){var parent_div=new Element('div');for(var i=1;i<=9;i++){var div=new Element('div');div.addClass('skwindowBackground'+i);div.inject(parent_div);}
parent_div.setStyles({position:'absolute',width:'1',height:'1',left:'-100',top:'-100',display:'block'});parent_div.inject(document.body);}
this.isInPopup=function(){try{return parent&&parent.opener?true:false;}catch(e){return false;}}}
function SKWindowHandlesPool(){this.pool=[];this.add=function(win){this.pool.push(win);return this.pool.length-1;}
this.get=function(id){return this.pool[id];}
this.getAll=function(){return this.pool;}
this.remove=function(id){if(typeof this.pool[id]!='undefined'){var new_pool=[];for(var i=0;i<this.pool.length;i++){if(i!=id)new_pool.push(this.pool[i]);}
this.pool=new_pool;}},this.execAfterClose=function(code){return function(){var code=""+this;if(code!="")eval(code);}.bind(code)}}
var SK_WINDOW_HANDLES=new SKWindowHandlesPool();window.addEvent('load',function(){window.setTimeout(function(){var tmpwin=new SKWindow("","",1,1);tmpwin.preloadImages();},10);});


SK.Env=function(options){this.options=options;this.get=function(key){if(typeof this.options[key]=='undefined')return"";return this.options[key];}
this.set=function(key,value){this.options[key]=value;}
this.setMultiple=function(options){for(var i in options){if($defined(this.options[i])){this.options[i]=merge(this.options[i],options[i]);}else{this.options[i]=options[i];}}}}
SK.Singletons.env=new SK.Env({});


function ActionTrace()
{this.AddAction=function(id,a,params){var url='/Tools/at.html?user_id='+escape(id)+'&action='+escape(a)+'&seq='+((new Date()).getTime()%100000);for(var i in params){url+='&'+escape(i)+'='+escape(params[i]);}
new Request.HTML({url:url}).get();}}


