/*
	GAJAX
	Javascript Libraly And Ajax Frame Work
	design by http://www.goragod.com (goragod wiriya)
	13-11-52
*/

GBrowser={IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf('AppleWebKit/')>-1,Gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)};var domloaded=false;var GClass={create:function(){return function(){this.initialize.apply(this,arguments)}}};Object.extend=function(a,b){for(var c in b){a[c]=b[c]};return a};Object.extend(Object,{isObject:function(a){return typeof a=="object"},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isNull:function(a){return typeof a=="undefined"},isGElement:function(a){return a!=null&&typeof a=="object"&&'getDimensions'in a&&'viewportOffset'in a}});GEvent={isButton:function(a,b){var c={0:1,1:4,2:2};if(GBrowser.IE){return a.button==c[b]}else if(GBrowser.WebKit){switch(b){case 0:return a.which==1&&!a.metaKey;case 1:return a.which==1&&a.metaKey;default:return false}}else{return a.which?(a.which===b+1):(a.button===b)}},isLeftClick:function(a){return GEvent.isButton(a,0)},isMiddleClick:function(a){return GEvent.isButton(a,1)},isRightClick:function(a){return GEvent.isButton(a,2)},element:function(a){var b=a.target?a.target:a.srcElement;return a.nodeType==3?b.parentNode:b},keyCode:function(a){return a.which||a.keyCode},stop:function(a){if(a.stopPropagation){a.stopPropagation();a.preventDefault()}else{a.cancelBubble=true;a.returnValue=false}},pointer:function(a){return{x:a.pageX||(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:a.pageY||(a.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(a){return GEvent.pointer(a).x},pointerY:function(a){return GEvent.pointer(a).y}};GNative=GClass.create();GNative.prototype={initialize:function(a){if(Object.isString(a))a=document.getElementById(a);if(!a||a.nodeType!=1||a==window){this.elem=a}else{try{for(var b in a){this[b]=a[b]}}catch(e){};this.elem=a}}};GElement=GClass.create();GElement.prototype=Object.extend(new GNative(),{getDimensions:function(){var a=this.getStyle('display');if(a!='none'&&a!=null){var b=this.elem.offsetWidth;var c=this.elem.offsetHeight}else{var d=this.elem.style;var e=d.visibility;var f=d.position;var g=d.display;d.visibility='hidden';d.position='absolute';d.display='block';var b=this.elem.clientWidth;var c=this.elem.clientHeight;d.display=g;d.position=f;d.visibility=e};var h=[b,c];h.width=b;h.height=c;return h},viewportOffset:function(){var a=this.elem.offsetTop;var b=this.elem.offsetLeft;var c=this.elem.offsetParent;while(c!=null){a+=c.offsetTop;b+=c.offsetLeft;if(c.offsetParent==document.body&&c.style.position=='absolute')break;c=c.offsetParent};var d=[b,a];d.left=b;d.top=a;return d},getOffsetParent:function(){if(this.elem.offsetParent)return GElement(this.elem.offsetParent);if(this.elem==document.body)return this.elem;while((element=this.elem.parentNode)&&element!=document.body){if(element.style.position!='static')return GElement(element)};return GElement(document.body)},getTop:function(){return this.viewportOffset().top},getLeft:function(){return this.viewportOffset().left},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},hide:function(){this.setStyle('visibility','hidden')},show:function(){this.setStyle('visibility','visible')},visible:function(){return this.style.visibility!='hidden'},toggle:function(){if(this.visible){this.hide()}else{this.show()}},center:function(){size=this.getDimensions();this.style.top=(document.viewport.getscrollTop()+((document.viewport.getHeight()-size.height)/2))+'px';this.style.left=(document.viewport.getscrollLeft()+((document.viewport.getWidth()-size.width)/2))+'px'},getStyle:function(a){a=(a=='float'&&this.elem.currentStyle)?'styleFloat':a;a=(a=='borderColor')?'borderBottomColor':a;value=(this.elem.currentStyle)?this.elem.currentStyle[a]:null;value=(!value&&window.getComputedStyle)?document.defaultView.getComputedStyle(this.elem,null).getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase()):value;if(a=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value},setStyle:function(a,b){if(a=='opacity'){if(window.ActiveXObject)this.elem.style.filter="alpha(opacity="+(b*100)+")";this.elem.style.opacity=b}else if(a=='float'||a=='styleFloat'||a=='cssFloat'){if(Object.isNull(this.elem.style.styleFloat)){this.elem.style['cssFloat']=b}else{this.elem.style['styleFloat']=b}}else this.elem.style[a]=b},addEvent:function(a,b,c){var d=this.elem;if(d.addEventListener){c=!c?false:c;d.addEventListener(a,b,c)}else if(d.attachEvent){d["e"+a+b]=b;d[a+b]=function(){d["e"+a+b](window.event)};d.attachEvent("on"+a,d[a+b])}},removeEvent:function(a,b){if(this.elem.removeEventListener)this.elem.removeEventListener(((a=='mousewheel'&&window.gecko)?'DOMMouseScroll':a),b,false);else this.elem.detachEvent('on'+a,b)},remove:function(){this.elem.parentNode.removeChild(this.elem)},copy:function(){return $G(this.elem.cloneNode(true))},insert:function(a){this.elem.appendChild(Object.isGElement(a)?a.elem:a)},get:function(a){return this.elem.getAttribute(a)},set:function(a,b){this.elem.setAttribute(a,b)},Ready:function(a){var b=this;var c=function(){if(domloaded&&typeof b.elem!="undefined"){a.call(b)}else{window.setTimeout(c,10)}};c()}});Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}};function functionReady(a,b){var c=function(){if(domloaded&&typeof a!="undefined"){b.apply()}else{window.setTimeout(c,10)}};c()};$G(window).addEvent('load',function(){domloaded=true});if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,i){i||(i=0);var b=this.length;if(i<0)i=b+i;for(;i<b;i++)if(this[i]===a)return i;return-1};function forEach(a,b){for(var i=0;i<a.length;i++){b.call(this,a[i],i)}};Object.extend(String.prototype,{hexToRgb:function(a){var b=this.match(new RegExp('^[#]{0,1}([\\w]{1,2})([\\w]{1,2})([\\w]{1,2})$'));var c=[];for(var i=1;i<b.length;i++){if(b[i].length==1)b[i]+=b[i];c.push(parseInt(b[i],16))};var d='rgb('+c.join(',')+')';if(a)return[parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2])];else return d},ToRgb:function(){if(this.match(/^#[0-9a-f]{3,6}$/i))return this.hexToRgb(true);return((value=this.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[parseFloat(value[1]),parseFloat(value[2]),parseFloat(value[3])]:false},entityify:function(){return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;')},unentityify:function(){return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>')},toJSON:function(){try{if(this.length>4)return eval('('+this+')')}catch(e){};return null},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1')},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase()})},evalScript:function(){var a=/<script type="text\/javascript">(.*?)<\/script>/g;text=this.replace(/[\r\n]/g,'');text=text.replace(/\/\/<\!\[CDATA\[/g,'');text=text.replace(/\/\/\]\]>/g,'');match=a.exec(text);while(match!=null){try{eval(match[1])}catch(e){};match=a.exec(text)}}});function $G(a){return new GElement(a)};function $E(a){return Object.isString(a)?document.getElementById(a):(Object.isGElement(a)?a.elem:a)};document.viewport={getWidth:function(){if(GBrowser.Opera||document.documentElement.clientHeight==0||GBrowser.Gecko&&!(document.body.clientHeight==document.body.offsetHeight&&document.body.clientHeight==document.body.scrollHeight))return document.body.clientWidth;else if(GBrowser.WebKit)return self.innerWidth;else return document.documentElement.clientWidth},getHeight:function(){if(GBrowser.Opera||document.documentElement.clientHeight==0||GBrowser.Gecko&&!(document.body.clientHeight==document.body.offsetHeight&&document.body.clientHeight==document.body.scrollHeight))return document.body.clientHeight;else if(GBrowser.WebKit)return self.innerHeight;else return document.documentElement.clientHeight},getscrollTop:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop},getscrollLeft:function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft}};document.getWidth=function(){if(window.innerWidth&&window.scrollMaxX)return window.innerWidth+window.scrollMaxX;else if(document.body.scrollWidth>document.body.offsetWidth)return document.body.scrollWidth;else return document.body.offsetWidth};document.getHeight=function(){if(window.innerHeight&&window.scrollMaxY)return window.innerHeight+window.scrollMaxY;else if(document.body.scrollHeight>document.body.offsetHeight)return document.body.scrollHeight;else return document.body.offsetHeight};Cookie={get:function(a){var b=document.cookie.match('(?:^|;)\\s*'+a.escapeRegExp()+'=([^;]*)');return(b)?decodeURIComponent(b[1]):null},set:function(a,b,c){_options={path:false,domain:false,duration:false,secure:false};for(var d in c){_options[d]=c[d]};b=encodeURIComponent(b);if(_options.domain)b+='; domain='+_options.domain;if(_options.path)b+='; path='+_options.path;if(_options.duration){var e=new Date();e.setTime(e.getTime()+_options.duration*24*60*60*1000);b+='; expires='+e.toGMTString()};if(_options.secure)b+='; secure';document.cookie=a+'='+b},remove:function(a){Cookie.set(a,'',{duration:-1})}};GAjax=GClass.create();GAjax.prototype={initialize:function(a){this.options={method:'post',cache:false,asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8'};for(var b in a){this.options[b]=a[b]};this.options.method=this.options.method.toLowerCase()},xhr:function(){var a=null;try{a=new XMLHttpRequest()}catch(e){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){a=new ActiveXObject("Microsoft.XMLHTTP")}};return a},send:function(a,b,c){var d=this;this._xhr=this.xhr();this._abort=false;if(!Object.isNull(this._xhr)){d.showLoading();option=this.options;if(option.method=='get'){a+='?'+b;b=null}else{b=b==null?'':b};if(option.cache==false){var e=/\?/;if(e.test(a)){a=a+'&timestamp='+new Date().getTime()}else{a=a+'?timestamp='+new Date().getTime()}};var f=function(){if(this._xhr.readyState==4){d.hideLoading();if(this._xhr.status==200&&this._abort==false&&Object.isFunction(c)){d.responseText=this._xhr.responseText;d.responseXML=this._xhr.responseXML;c(d)}}};this._xhr.open(option.method,a,option.asynchronous);this._xhr.onreadystatechange=f.bind(this);if(option.method=='post'){this._xhr.setRequestHeader('Content-Type',option.contentType+'; charset='+option.encoding);this._xhr.setRequestHeader('Content-Length',(b==null?0:b.length))};this._xhr.send(b);if(option.asynchronous==false){this.responseText=this._xhr.responseText;this.responseXML=this._xhr.responseXML}}},autoupdate:function(a,b,c,d){this._xhr=this.xhr();this.interval=b*1000;if(!Object.isNull(this._xhr)){this.url=a;this.getrequest=c;this.callback=d;this._abort=false;this._getupdate()}},_getupdate:function(){if(this._abort==false){var a=null;var b=this.url;var c=this.options;if(Object.isFunction(this.getrequest)){if(c.method=='get'){b+='?'+this.getrequest()}else{a=this.getrequest()}};a=(c.method=='post'&&a==null)?'':a;if(c.cache==false){var d=/\?/;if(d.test(b)){b=b+'&timestamp='+new Date().getTime()}else{b=b+'?timestamp='+new Date().getTime()}};var f=this._xhr;var g=this;f.open(c.method,b,true);f.onreadystatechange=function(){if(f.readyState==4&&f.status==200){try{g.callback(f)}catch(e){};this.timeinterval=window.setTimeout(g._getupdate.bind(g),g.interval)}};if(c.method=='post'){f.setRequestHeader('Content-Type',c.contentType+'; charset='+c.encoding);f.setRequestHeader('Content-Length',(a==null?0:a.length))};f.send(a)}},getRequestBody:function(a){a=$E(a);var b=new Array();for(var n=0;n<a.elements.length;n++){if((a.elements[n].checked==true&&a.elements[n].type=="radio")||(a.elements[n].checked==true&&a.elements[n].type=="checkbox")||(a.elements[n].type!="radio"&&a.elements[n].type!="checkbox")){var c=a.elements[n].name;c+="=";c+=encodeURIComponent(a.elements[n].value);b.push(c)}};return b.join("&")},showLoading:function(){if(this.loading){this.wait=$G(this.loading);if(this.wait){if(this.center){this.wait.setStyle('display','block');this.wait.center()}else{this.wait.setStyle('visibility','visible')}}}},hideLoading:function(){if(this.wait){if(this.center){this.wait.setStyle('display','none')}else{this.wait.setStyle('visibility','hidden')}}},inintLoading:function(a,b){this.loading=a;this.center=b},abort:function(){clearTimeout(this.timeinterval);this._abort=true}};var gform_id=0;GForm=GClass.create();GForm.prototype={initialize:function(a,b,c,d){this.form=$E(a);this.loading=b;this.center=c;this._onsubmit=Object.isFunction(d)?d:function(){return true}},onsubmit:function(g){var h=true;var i=this;this.form.onsubmit=function(){if(i._onsubmit(i.form)==false){return false}else{i.showLoading();var b=function(){var a=c.contentWindow?c.contentWindow.document:c.contentDocument?c.contentDocument:c.document;i.responseText=a.body?a.body.innerHTML:null;i.responseXML=a.XMLDocument?a.XMLDocument:a;if(i.responseText==''&&h&&GBrowser.Opera){h=false;setTimeout(function(){b.bind(this)},100);return};h=true;i.hideLoading();c.removeEvent('load',b);window.setTimeout(function(){c.remove()},1);i.form.method=e;i.form.target=d;if(i.form.encoding)i.form.encoding=f;else i.form.enctype=f;g(i)}.bind(i.form);var c=i.createIframe();var d=this.target||'';var e=this.method||"post";var f=this.encoding?this.encoding:this.enctype;if(this.encoding)this.encoding='multipart/form-data';else this.enctype='multipart/form-data';c.addEvent('load',b);this.target=c.id;this.method='post';return true}}},submit:function(b){var c=this;this.showLoading();var d=function(){c.hideLoading();var a={};try{a.responseText=f.contentWindow.document.body?f.contentWindow.document.body.innerHTML:null;a.responseXML=f.contentWindow.document.XMLDocument?f.contentWindow.document.XMLDocument:f.contentWindow.document}catch(e){};f.removeEvent('load',d);window.setTimeout(function(){f.remove()},1);c.form.method=h;c.form.target=g;b(a)}.bind(this);if(this.form.encoding)this.form.encoding='multipart/form-data';else this.form.enctype='multipart/form-data';var f=this.createIframe();var g=this.form.target||'';var h=this.form.method||"post";f.addEvent('load',d);this.form.target=f.id;this.form.method="post";this.form.submit()},createIframe:function(){var a='GForm_Submit_'+gform_id+'_'+(this.form.id||this.form.name);gform_id++;if(window.ActiveXObject){io=document.createElement('<iframe id="'+a+'" name="'+a+'" />');io.src='javascript:false'}else{io=document.createElement('iframe');io.setAttribute('id',a);io.setAttribute('name',a)};io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);return $G(io)},showLoading:function(){if(this.loading){this.wait=$G(this.loading);if(this.wait){if(this.center){this.wait.setStyle('display','block');this.wait.center()}else{this.wait.setStyle('visibility','visible')}}}},hideLoading:function(){if(this.wait){if(this.center){this.wait.setStyle('display','none')}else{this.wait.setStyle('visibility','hidden')}}},inintLoading:function(a,b){this.loading=a;this.center=b}};GLoader=GClass.create();GLoader.prototype={initialize:function(c,d){this.id='GLoader_iframe';var f=true;this.encode=true;this.geturl=c;var g=this.createIframe();var h=function(){this.hideLoading();var a={};try{if(g.contentWindow.document.body){var b=g.contentWindow.document.body.innerHTML;a.responseText=(this.encode?decodeURIComponent(b):b)}else a.responseText='Document Not Support !!'}catch(e){a.responseText='Invalid Charactor !!'};if(!f)d(a);f=false}.bind(this);g.addEvent('load',h)},createIframe:function(){var a=null;if(!$E(this.id)){if(window.ActiveXObject){a=document.createElement('<iframe id="'+this.id+'" name="'+this.id+'" />')}else{a=document.createElement('iframe');a.setAttribute('id',this.id);a.setAttribute('name',this.id)};a.style.position='absolute';a.style.top='-1000px';a.style.left='-1000px';a.style.display='none';document.body.appendChild(a)};return $G(this.id)},inint:function(a){var b=a.getElementsByTagName('a');var c=this;var d=new RegExp('^.*?'+location.hostname+'/(.*?)$');var f=new RegExp('.*?#.*?');for(var i=0;i<b.length;i++){link=b[i];try{href=link.href;if(link.target==''&&link.onclick==null&&d.exec(href)&&!f.exec(href)){ret=this.geturl.call(this,href);if(ret){link.tag=ret;link.onclick=function(){c.showLoading();$E(c.id).src=this.tag;return false}}}}catch(e){}}},showLoading:function(){if(this.loading){this.wait=$G(this.loading);if(this.wait){if(this.center){this.wait.setStyle('display','block');this.wait.center()}else{this.wait.setStyle('visibility','visible')}}}},hideLoading:function(){if(this.wait){if(this.center){this.wait.setStyle('display','none')}else{this.wait.setStyle('visibility','hidden')}}},inintLoading:function(a,b){this.loading=a;this.center=b},submit:function(a){var b=a.target;var c=a.action;a.target=this.id;a.action=this.geturl(c);this.showLoading();a.submit();window.setTimeout(function(){a.target=b;a.action=c},1);return false},location:function(a){this.showLoading();$E(this.id).contentWindow.document.location=this.geturl(a)}};GModal=GClass.create();GModal.prototype={initialize:function(c){this.onhide=c||function(){};var d=this;var e=function(a){var b=a.which||a.keyCode;if(b==27){d.hide();GEvent.stop(a);return false}};var f='GModal_div';if(!$E(f)){$G(document).addEvent('keypress',e);$G(document).addEvent('keydown',e);var g=document.createElement('div');g.setAttribute('id',f);g.style.left='-1000px';g.style.position='absolute';document.body.appendChild(g)};this.div=$G(f);this.div.setStyle('opacity',0)},show:function(a){this.div.elem.innerHTML=a;this.div.elem.style.display='';this.div.center();this.overlay();new GFade(this.div).play({'from':0,'to':100});this.div.elem.style.zIndex=9999},hide:function(){new GFade(this.div).play({'from':100,'to':0,'onComplete':this._hide.bind(this)})},overlay:function(){var a='GModal_iframe';if(!$E(a)){var b=null;if(window.ActiveXObject){b=document.createElement('<iframe id="'+a+'" height="100%" />')}else{b=document.createElement('iframe');b.setAttribute('id',a)};b.setAttribute('frameBorder','0');b.style.position='absolute';document.body.appendChild(b);if(document.all)document.frames(a).document.bgColor='#000000';else b.style.backgroundColor='#000000';b.style.zIndex=8888};this.iframe=$G(a);this.iframe.style.left='0px';this.iframe.style.top='0px';this.iframe.style.height=document.getHeight()+'px';this.iframe.style.width=document.getWidth()+'px';this.iframe.setStyle('opacity',0.7);this.iframe.style.display='block'},_hide:function(){this.iframe.style.display='none';this.div.style.display='none';this.onhide.call(this)}};GFx=function(){};GFx.prototype={_run:function(){this.playing=true;this.step()},stop:function(){this.playing=false;this.options.onComplete.call(this,this)}};GFade=GClass.create();GFade.prototype=Object.extend(new GFx(),{initialize:function(a){this.options={from:0,to:100,speed:50,duration:5,unit:'',onComplete:function(){}};this.Element=$G(a);this.playing=false;this.timer=0},play:function(a){for(var b in a){this.options[b]=a[b]};if(this.options.to>this.options.from){this.name='fadeIn';this.to=(this.options.to>100)?100:this.options.to;this.from=(this.options.from<0)?0:this.options.from}else{this.name='fadeOut';this.to=(this.options.to<0)?0:this.options.to;this.from=(this.options.from>100)?100:this.options.from};if(!this.playing){this.now=this.from;this._run()}},step:function(){if(this.playing)this.Element.setStyle('opacity',this.now/100);now=(this.name=='fadeIn')?this.now+this.options.duration:this.now-this.options.duration;if(this.playing&&((this.name=='fadeOut'&&now>=this.to)||(this.name=='fadeIn'&&now<=this.to))){this.now=now;var a=this;this.timer=window.setTimeout(a.step.bind(a),a.options.speed)}else this.stop()}});GHighlight=GClass.create();GHighlight.prototype=Object.extend(new GFx(),{initialize:function(a){this.options={from:'red',to:'auto',speed:10,time:20,unit:'',onComplete:function(){}};this.Element=$G(a);this.playing=false;this.timer=0},play:function(a){for(var b in a){this.options[b]=a[b]};if(this.options.from=='red'){this.options.from={'borderColor':'#FF0000','backgroundColor':'#FFBFBF'}}else if(this.options.from=='green'){this.options.from={'borderColor':'#00FF00','backgroundColor':'#E3F4E3'}};source=this.options.from;if(Object.isObject(source)){destination={};for(var b in source)destination[b]=source[b].ToRgb();this.from=destination};source=this.options.to;destination={};if(Object.isObject(source)){for(var b in source)destination[b]=source[b].ToRgb();this.to=destination}else if(source=='auto'){source=this.options.from;for(var b in source)destination[b]=this.Element.getStyle(b).ToRgb();this.to=destination};source=this.options.from;if(source=='auto'){source=this.options.to;for(var b in source)destination[b]=this.Element.getStyle(b).ToRgb();this.from=destination};this.delta=[];for(var b in this.from){to=this.to[b];from=this.from[b];this.delta[b]=[(to[0]-from[0])/this.options.time,(to[1]-from[1])/this.options.time,(to[2]-from[2])/this.options.time]}if(!this.playing){this.now=0;this._run()}},step:function(){if(this.playing){for(var a in this.from){colors=this.from[a];this.Element.setStyle(a,'rgb('+parseInt(colors[0]+(this.delta[a][0]*this.now))+','+parseInt(colors[1]+(this.delta[a][1]*this.now))+','+parseInt(colors[2]+(this.delta[a][2]*this.now))+')')}};this.now++;if(this.now>this.options.time)this.stop();else this.timer=window.setTimeout(this.step.bind(this),this.options.speed)}});GScroll=GClass.create();GScroll.prototype=Object.extend(new GFx(),{initialize:function(a,b){this.options={speed:30,duration:1,pauseit:1,scrollto:'top'};this.container=$G(a);this.scroller=$G(b);this.container.addEvent('mouseover',function(){this.rel='pause'});this.container.addEvent('mouseout',function(){this.rel='play'});this.container.elem.rel='play';this.playing=false;var c=this.container.getDimensions();this.containerHeight=c.height;this.containerWidth=c.width},play:function(a){for(var b in a){this.options[b]=a[b]};this.scrollerTop=0;this.scrollerLeft=0;this._run()},step:function(){if(this.container.elem.rel=='play'||this.options.pauseit!=1){if(this.options.scrollto=='bottom'){this.scrollerTop=this.scrollerTop>this.containerHeight?0-this.scroller.getHeight():this.scrollerTop+this.options.duration;this.scroller.elem.style.top=this.scrollerTop+'px'}else if(this.options.scrollto=='left'){this.scrollerLeft=this.scrollerLeft+this.scroller.getWidth()<0?this.containerWidth:this.scrollerLeft-this.options.duration;this.scroller.elem.style.left=this.scrollerLeft+'px'}else if(this.options.scrollto=='right'){this.scrollerLeft=this.scrollerLeft>this.containerWidth?0-this.scrollerWidth:this.scrollerLeft+this.options.duration;this.scroller.elem.style.left=this.scrollerLeft+'px'}else{this.scrollerTop=this.scrollerTop+this.scroller.getHeight()<0?this.containerHeight:this.scrollerTop-this.options.duration;this.scroller.elem.style.top=this.scrollerTop+'px'}};this.timer=window.setTimeout(this.step.bind(this),this.options.speed)}});HScroll=GClass.create();HScroll.prototype=Object.extend(new GFx(),{initialize:function(a,b){this.options={speed:30,duration:5,arrowTop:'arrowTop',arrowBottom:'arrowBottom'};var c=this;this.scroller=$G(b);var d=$G(this.options.arrowTop);d.addEvent('mouseover',function(){c.rel='play';c.pos='up'});d.addEvent('mouseout',function(){c.rel='pause'});var e=$G(this.options.arrowBottom);e.addEvent('mouseover',function(){c.rel='play';c.pos='down'});e.addEvent('mouseout',function(){c.rel='pause'});this.containerHeight=$G(a).getDimensions().height},play:function(a){for(var b in a){this.options[b]=a[b]};this.scrollerTop=0;this._run()},step:function(){if(this.rel=='play'){if(this.pos=='up'&&this.scrollerTop<0){this.scrollerTop=this.scrollerTop+this.options.duration;this.scroller.elem.style.top=this.scrollerTop+'px'}else if(this.pos=='down'&&this.scroller.getHeight()+this.scrollerTop>this.containerHeight){this.scrollerTop=this.scrollerTop-this.options.duration;this.scroller.elem.style.top=this.scrollerTop+'px'}}this.timer=window.setTimeout(this.step.bind(this),this.options.speed)}});VScroll=GClass.create();VScroll.prototype=Object.extend(new GFx(),{initialize:function(a,b){this.options={speed:30,duration:5,arrowLeft:'arrowLeft',arrowRight:'arrowRight'};var c=this;this.scroller=$G(b);this.container=$G(a);var d=$G(this.options.arrowLeft);d.addEvent('mouseover',function(){c.rel='play';c.pos='left'});d.addEvent('mouseout',function(){c.rel='pause'});var e=$G(this.options.arrowRight);e.addEvent('mouseover',function(){c.rel='play';c.pos='right'});e.addEvent('mouseout',function(){c.rel='pause'});this.containerWidth=this.container.getWidth()},play:function(a){for(var b in a){this.options[b]=a[b]};this.scrollerLeft=0;this._run()},step:function(){if(this.rel=='play'){if(this.pos=='left'&&this.scrollerLeft<0){this.scrollerLeft=this.scrollerLeft+this.options.duration;this.scroller.elem.style.left=this.scrollerLeft+'px'}else if(this.pos=='right'&&this.scroller.getWidth()+this.scrollerLeft>this.containerWidth){this.scrollerLeft=this.scrollerLeft-this.options.duration;this.scroller.elem.style.left=this.scrollerLeft+'px'}}else if(this.rel=='move'){if(this.scrollTo<this.scrollerLeft&&this.scroller.getWidth()+this.scrollerLeft>this.containerWidth){this.scrollerLeft=this.scrollerLeft-this.options.duration;this.scrollerLeft=this.scrollerLeft<this.scrollTo?this.scrollTo:this.scrollerLeft;this.scroller.elem.style.left=this.scrollerLeft+'px'}else if(this.scrollTo>this.scrollerLeft&&this.scrollerLeft<0){this.scrollerLeft=this.scrollerLeft+this.options.duration;this.scrollerLeft=this.scrollerLeft>this.scrollTo?this.scrollTo:this.scrollerLeft;this.scroller.elem.style.left=this.scrollerLeft+'px'}else{this.rel=='pause'}};this.timer=window.setTimeout(this.step.bind(this),this.options.speed)},MoveTo:function(a){if(document.getElementById(a)){a=$G(a);this.scrollTo=this.scroller.getLeft()-((a.getLeft()+a.getWidth())-this.containerWidth+5)}else{this.scrollTo=0}this.rel='move'}});GSlide=GClass.create();GSlide.prototype=Object.extend(new GFx(),{initialize:function(){this.options={speed:30,duration:1,from:0,to:0,onSlide:function(){}}},play:function(a){for(var b in a){this.options[b]=a[b]};this.Pos=this.options.from;this._run()},step:function(){var a=this.options;if(a.to>a.from&&this.Pos<a.to){this.Pos=this.Pos+a.duration;this.Pos=this.Pos>a.to?a.to:this.Pos;a.onSlide.call(this);this.timer=window.setTimeout(this.step.bind(this),a.speed)}else if(a.to<a.from&&this.Pos>a.to){this.Pos=this.Pos-a.duration;this.Pos=this.Pos<a.to?a.to:this.Pos;a.onSlide.call(this);this.timer=window.setTimeout(this.step.bind(this),a.speed)}}});GCrossFade=GClass.create();GCrossFade.prototype=Object.extend(new GFx(),{initialize:function(a,b){this.options={speed:10,loop:true,auto:true,onChanged:function(){}};for(var c in b){this.options[c]=b[c]};this.Slide=$G(a);size=this.Slide.getDimensions();this.width=size.width;this.height=size.height;var d=document.createElement('img');d.src='blank.gif';d.style.position='absolute';d.style.left='-10000px';this.Slide.insert(d);this.img1=d;var d=document.createElement('img');d.src='blank.gif';d.style.position='absolute';d.style.left='-10000px';this.Slide.insert(d);this.img2=d;this.currImg=this.img2;this.fader=0;this.action='stop'},next:function(a){window.clearTimeout(this.fader);var b=this.Pos+a;b=b>=this.pictures.length?this.pictures.length-1:b;b=b<0?0:b;if(b!=this.Pos){this.show(b)}},play:function(){this.nextPos=this.Pos+1;this._run()},step:function(){if(this.options.loop){this.nextPos=this.nextPos>=this.pictures.length?0:this.nextPos}else if(this.nextPos>=this.pictures.length){return}var b=this;new preload(this.pictures[this.nextPos],function(){b.currImg=b.currImg==b.img2?b.img1:b.img2;var a=b.currImg==b.img2?b.img1:b.img2;b._resizeImage(b.currImg,this);new GFade(b.currImg).play({'onComplete':function(){b.fader=window.setTimeout(b.step.bind(b),b.options.speed*1000);b.Pos=b.nextPos;b.options.onChanged.call(b);b.nextPos++}});new GFade(a).play({'from':100,'to':0});b.currImg.style.zIndex=1;a.style.zIndex=0})},show:function(b){var c=this;new preload(this.pictures[b],function(){c.currImg=c.currImg==c.img2?c.img1:c.img2;var a=c.currImg==c.img2?c.img1:c.img2;c._resizeImage(c.currImg,this);new GFade(c.currImg).play({'onComplete':function(){c.Pos=b;c.options.onChanged.call(c)}});new GFade(a).play({'from':100,'to':0});c.currImg.style.zIndex=1;a.style.zIndex=0})},pictures:function(a){this.pictures=a.split(',');this.picturesWidth=new Array();this.picturesHeight=new Array();if(this.options.auto){this.Pos=0;this.play()}else{this.show(0)}},_resizeImage:function(a,b){a.src=b.src;var w=b.width;var h=b.height;if(w>=h&&w>this.width){if(this.height<=this.width){var c=this.width;var d=(this.width*h)/w}else{var d=this.height;var c=(this.height*w)/h}}else if(w<h&&h>this.height){if(this.height<=this.width){var d=this.height;var c=(this.height*w)/h}else{var c=this.width;var d=(this.width*h)/w}}else{var d=h;var c=w};a.style.width=c+'px';a.style.height=d+'px';a.style.top=((this.height-d)/2)+'px';a.style.left=((this.width-c)/2)+'px'}});preload=GClass.create();preload.prototype={initialize:function(a,b){if(Object.isString(a)){this.img=new Image();this.img.src=a}else{this.img=a};this.onComplete=b;setTimeout(this.preload.bind(this),30)},preload:function(){if(this.img.complete){this.onComplete.call(this.img)}else{setTimeout(this.preload.bind(this),30)}}};
