function Get_Cookie(check_name){var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++)
{a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name)
{b_cookie_found=true;if(a_temp_cookie.length>1)
{cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found)
{return null;}}
function Set_Cookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires)
{expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
function Delete_Cookie(name,path,domain){if(Get_Cookie(name))document.cookie=name+"="+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";};function _MaskAPI(){this.version="0.4b";this.instances=0;this.objects={};}
MaskAPI=new _MaskAPI();function Mask(m,t){this.mask=m;this.type=(typeof t=="string")?t:"string";this.error=[];this.errorCodes=[];this.value="";this.strippedValue="";this.allowPartial=false;this.id=MaskAPI.instances++;this.ref="MaskAPI.objects['"+this.id+"']";MaskAPI.objects[this.id]=this;}
Mask.prototype.attach=function(o){$addEvent(o,"onkeydown","return "+this.ref+".isAllowKeyPress(event, this);",true);$addEvent(o,"onkeyup","return "+this.ref+".getKeyPress(event, this);",true);$addEvent(o,"onblur","this.value = "+this.ref+".format(this.value);",true);}
Mask.prototype.isAllowKeyPress=function(e,o){if(this.type!="string")return true;var xe=new qEvent(e);if(((xe.keyCode>47)&&(o.value.length>=this.mask.length))&&!xe.ctrlKey)return false;return true;}
Mask.prototype.getKeyPress=function(e,o,_u){this.allowPartial=true;var xe=new qEvent(e);if((xe.keyCode>47)||(_u==true)||(xe.keyCode==8||xe.keyCode==46)){var v=o.value,d;if(xe.keyCode==8||xe.keyCode==46)d=true;else d=false
if(this.type=="number")this.value=this.setNumber(v,d);else if(this.type=="date")this.value=this.setDateKeyPress(v,d);else this.value=this.setGeneric(v,d);o.value=this.value;}
this.allowPartial=false;return true;}
Mask.prototype.format=function(s){if(this.type=="number")this.value=this.setNumber(s);else if(this.type=="date")this.value=this.setDate(s);else this.value=this.setGeneric(s);return this.value;}
Mask.prototype.throwError=function(c,e,v){this.error[this.error.length]=e;this.errorCodes[this.errorCodes.length]=c;if(typeof v=="string")return v;return true;}
Mask.prototype.setGeneric=function(_v,_d){var v=_v,m=this.mask;var r="x#*",rt=[],nv="",t,x,a=[],j=0,rx={"x":"A-Za-z","#":"0-9","*":"A-Za-z0-9"};v=v.replace(new RegExp("[^"+rx["*"]+"]","gi"),"");if((_d==true)&&(v.length==this.strippedValue.length))v=v.substring(0,v.length-1);this.strippedValue=v;var b=[];for(var i=0;i<m.length;i++){x=m.charAt(i);t=(r.indexOf(x)>-1);if(x=="!")x=m.charAt(i++);if((t&&!this.allowPartial)||(t&&this.allowPartial&&(rt.length<v.length)))rt[rt.length]="["+rx[x]+"]";a[a.length]={"chr":x,"mask":t};}
var hasOneValidChar=false;if(!this.allowPartial&&!(new RegExp(rt.join(""))).test(v))return this.throwError(1,"The value \""+_v+"\" must be in the format "+this.mask+".",_v);else if((this.allowPartial&&(v.length>0))||!this.allowPartial){for(i=0;i<a.length;i++){if(a[i].mask){while(v.length>0&&!(new RegExp(rt[j])).test(v.charAt(j)))v=(v.length==1)?"":v.substring(1);if(v.length>0){nv+=v.charAt(j);hasOneValidChar=true;}
j++;}else nv+=a[i].chr;if(this.allowPartial&&(j>v.length))break;}}
if(this.allowPartial&&!hasOneValidChar)nv="";if(this.allowPartial){if(nv.length<a.length)this.nextValidChar=rx[a[nv.length].chr];else this.nextValidChar=null;}
return nv;}
Mask.prototype.setNumber=function(_v,_d){var v=String(_v).replace(/[^\d.-]*/gi,""),m=this.mask;v=v.replace(/\./,"d").replace(/\./g,"").replace(/d/,".");if(!/^[\$]?((\$?[\+-]?([0#]{1,3},)?[0#]*(\.[0#]*)?)|([\+-]?\([\+-]?([0#]{1,3},)?[0#]*(\.[0#]*)?\)))$/.test(m))
return this.throwError(1,"An invalid mask was specified for the \nMask constructor.",_v);if((_d==true)&&(v.length==this.strippedValue.length))v=v.substring(0,v.length-1);if(this.allowPartial&&(v.replace(/[^0-9]/,"").length==0))return v;this.strippedValue=v;if(v.length==0)v=NaN;var vn=Number(v);if(isNaN(vn))return this.throwError(2,"The value entered was not a number.",_v);if(m.length==0)return v;var vi=String(Math.abs((v.indexOf(".")>-1)?v.split(".")[0]:v));var vd=(v.indexOf(".")>-1)?v.split(".")[1]:"";var _vd=vd;var isNegative=(vn!=0&&Math.abs(vn)*-1==vn);var show={"$":/^[\$]/.test(m),"(":(isNegative&&(m.indexOf("(")>-1)),"+":((m.indexOf("+")!=-1)&&!isNegative)}
show["-"]=(isNegative&&(!show["("]||(m.indexOf("-")!=-1)));m=m.replace(/[^#0.,]*/gi,"");var dm=(m.indexOf(".")>-1)?m.split(".")[1]:"";if(dm.length==0){vi=String(Math.round(Number(vi)));vd="";}else{var md=dm.lastIndexOf("0")+1;if(vd.length>dm.length)vd=String(Math.round(Number(vd.substring(0,dm.length+1))/10));else while(vd.length<md)vd+="0";}
var im=(m.indexOf(".")>-1)?m.split(".")[0]:m;im=im.replace(/[^0#]+/gi,"");var mv=im.indexOf("0")+1;if(mv>0){mv=im.length-mv+1;while(vi.length<mv)vi="0"+vi;}
if(/[#0]+,[#0]{3}/.test(m)){var x=[],i=0,n=Number(vi);while(n>999){x[i]="00"+String(n%1000);x[i]=x[i].substring(x[i].length-3);n=Math.floor(n/1000);i++;}
x[i]=String(n%1000);vi=x.reverse().join(",");}
if((vd.length>0&&!this.allowPartial)||((dm.length>0)&&this.allowPartial&&(v.indexOf(".")>-1)&&(_vd.length>=vd.length))){v=vi+"."+vd;}else if((dm.length>0)&&this.allowPartial&&(v.indexOf(".")>-1)&&(_vd.length<vd.length)){v=vi+"."+_vd;}else{v=vi;}
if(show["$"])v=this.mask.replace(/(^[\$])(.+)/gi,"$")+v;if(show["+"])v="+"+v;if(show["-"])v="-"+v;if(show["("])v="("+v+")";return v;}
Mask.prototype.setDate=function(_v){var v=_v,m=this.mask;var a,e,mm,dd,yy,x,s;a=m.split(/[^mdy]+/);s=m.split(/[mdy]+/);e=v.split(/[^0-9]/);if(s[0].length==0)s.splice(0,1);for(var i=0;i<a.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m")mm=parseInt(e[i],10)-1;else if(x=="d")dd=parseInt(e[i],10);else if(x=="y")yy=parseInt(e[i],10);}
if(String(yy).length<3){yy=2000+yy;if((new Date()).getFullYear()+5<yy)yy=yy-100;}
var d=new Date(yy,mm,dd);if(d.getDate()!=dd)return this.throwError(1,"An invalid day was entered.",_v);else if(d.getMonth()!=mm)return this.throwError(2,"An invalid month was entered.",_v);var nv="";for(i=0;i<a.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){mm++;if(a[i].length==2){mm="0"+mm;mm=mm.substring(mm.length-2);}
nv+=mm;}else if(x=="d"){if(a[i].length==2){dd="0"+dd;dd=dd.substring(dd.length-2);}
nv+=dd;}else if(x=="y"){if(a[i].length==2)nv+=d.getYear();else nv+=d.getFullYear();}
if(i<a.length-1)nv+=s[i];}
return nv;}
Mask.prototype.setDateKeyPress=function(_v,_d){var v=_v,m=this.mask,k=v.charAt(v.length-1);var a,e,c,ml,vl,mm="",dd="",yy="",x,p,z;if(_d==true){while((/[^0-9]/gi).test(v.charAt(v.length-1)))v=v.substring(0,v.length-1);if((/[^0-9]/gi).test(this.strippedValue.charAt(this.strippedValue.length-1)))v=v.substring(0,v.length-1);if(v.length==0)return"";}
a=m.split(/[^mdy]/);s=m.split(/[mdy]+/);if(s[0].length==0)s.splice(0,1);e=v.split(/[^0-9]/);p=(e.length>0)?e.length-1:0;c=a[p].charAt(0);ml=a[p].length;for(var i=0;i<e.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m")mm=parseInt(e[i],10)-1;else if(x=="d")dd=parseInt(e[i],10);else if(x=="y")yy=parseInt(e[i],10);}
var nv="";var j=0;for(i=0;i<e.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){z=((/[^0-9]/).test(k)&&c=="m");mm++;if((e[i].length==2&&mm<10)||(a[i].length==2&&c!="m")||(mm>1&&c=="m")||(z&&a[i].length==2)){mm="0"+mm;mm=mm.substring(mm.length-2);}
vl=String(mm).length;ml=2;nv+=mm;}else if(x=="d"){z=((/[^0-9]/).test(k)&&c=="d");if((e[i].length==2&&dd<10)||(a[i].length==2&&c!="d")||(dd>3&&c=="d")||(z&&a[i].length==2)){dd="0"+dd;dd=dd.substring(dd.length-2);}
vl=String(dd).length;ml=2;nv+=dd;}else if(x=="y"){z=((/[^0-9]/).test(k)&&c=="y");if(c=="y")yy=String(yy);else{if(a[i].length==2)yy=d.getYear();else yy=d.getFullYear();}
if((e[i].length==2&&yy<10)||(a[i].length==2&&c!="y")||(z&&a[i].length==2)){yy="0"+yy;yy=yy.substring(yy.length-2);}
ml=a[i].length;vl=String(yy).length;nv+=yy;}
if(((ml==vl||z)&&(x==c)&&(i<s.length))||(i<s.length&&x!=c))nv+=s[i];}
if(nv.length>m.length)nv=nv.substring(0,m.length);this.strippedValue=(nv=="NaN")?"":nv;return this.strippedValue;}
function qEvent(e){if(window.Event){var isKeyPress=(e.type.substring(0,3)=="key");this.keyCode=(isKeyPress)?parseInt(e.which,10):0;this.button=(!isKeyPress)?parseInt(e.which,10):0;this.srcElement=e.target;this.type=e.type;this.x=e.pageX;this.y=e.pageY;this.screenX=e.screenX;this.screenY=e.screenY;if(document.layers){this.altKey=((e.modifiers&Event.ALT_MASK)>0);this.ctrlKey=((e.modifiers&Event.CONTROL_MASK)>0);this.shiftKey=((e.modifiers&Event.SHIFT_MASK)>0);this.keyCode=this.translateKeyCode(this.keyCode);}else{this.altKey=e.altKey;this.ctrlKey=e.ctrlKey;this.shiftKey=e.shiftKey;}}else{e=window.event;this.keyCode=parseInt(e.keyCode,10);this.button=e.button;this.srcElement=e.srcElement;this.type=e.type;if(document.all){this.x=e.clientX+document.body.scrollLeft;this.y=e.clientY+document.body.scrollTop;}else{this.x=e.clientX;this.y=e.clientY;}
this.screenX=e.screenX;this.screenY=e.screenY;this.altKey=e.altKey;this.ctrlKey=e.ctrlKey;this.shiftKey=e.shiftKey;}
if(this.button==0){this.setKeyPressed(this.keyCode);this.keyChar=String.fromCharCode(this.keyCode);}}
qEvent.prototype.translateKeyCode=function(i){var l={};if(!!document.layers){if(this.keyCode>96&&this.keyCode<123)return this.keyCode-32;l={96:192,126:192,33:49,64:50,35:51,36:52,37:53,94:54,38:55,42:56,40:57,41:48,92:220,124:220,125:221,93:221,91:219,123:219,39:222,34:222,47:191,63:191,46:190,62:190,44:188,60:188,45:189,95:189,43:187,61:187,59:186,58:186,"null":null}}
return(!!l[i])?l[i]:i;}
qEvent.prototype.setKP=function(i,s){this.keyPressedCode=i;this.keyNonChar=(typeof s=="string");this.keyPressed=(this.keyNonChar)?s:String.fromCharCode(i);this.isNumeric=(parseInt(this.keyPressed,10)==this.keyPressed);this.isAlpha=((this.keyCode>64&&this.keyCode<91)&&!this.altKey&&!this.ctrlKey);return true;}
qEvent.prototype.setKeyPressed=function(i){var b=this.shiftKey;if(!b&&(i>64&&i<91))return this.setKP(i+32);if(i>95&&i<106)return this.setKP(i-48);switch(i){case 49:case 51:case 52:case 53:if(b)i=i-16;break;case 50:if(b)i=64;break;case 54:if(b)i=94;break;case 55:if(b)i=38;break;case 56:if(b)i=42;break;case 57:if(b)i=40;break;case 48:if(b)i=41;break;case 192:if(b)i=126;else i=96;break;case 189:if(b)i=95;else i=45;break;case 187:if(b)i=43;else i=61;break;case 220:if(b)i=124;else i=92;break;case 221:if(b)i=125;else i=93;break;case 219:if(b)i=123;else i=91;break;case 222:if(b)i=34;else i=39;break;case 186:if(b)i=58;else i=59;break;case 191:if(b)i=63;else i=47;break;case 190:if(b)i=62;else i=46;break;case 188:if(b)i=60;else i=44;break;case 106:case 57379:i=42;break;case 107:case 57380:i=43;break;case 109:case 57381:i=45;break;case 110:i=46;break;case 111:case 57378:i=47;break;case 8:return this.setKP(i,"[backspace]");case 9:return this.setKP(i,"[tab]");case 13:return this.setKP(i,"[enter]");case 16:case 57389:return this.setKP(i,"[shift]");case 17:case 57390:return this.setKP(i,"[ctrl]");case 18:case 57388:return this.setKP(i,"[alt]");case 19:case 57402:return this.setKP(i,"[break]");case 20:return this.setKP(i,"[capslock]");case 32:return this.setKP(i,"[space]");case 91:return this.setKP(i,"[windows]");case 93:return this.setKP(i,"[properties]");case 33:case 57371:return this.setKP(i*-1,"[pgup]");case 34:case 57372:return this.setKP(i*-1,"[pgdown]");case 35:case 57370:return this.setKP(i*-1,"[end]");case 36:case 57369:return this.setKP(i*-1,"[home]");case 37:case 57375:return this.setKP(i*-1,"[left]");case 38:case 57373:return this.setKP(i*-1,"[up]");case 39:case 57376:return this.setKP(i*-1,"[right]");case 40:case 57374:return this.setKP(i*-1,"[down]");case 45:case 57382:return this.setKP(i*-1,"[insert]");case 46:case 57383:return this.setKP(i*-1,"[delete]");case 144:case 57400:return this.setKP(i*-1,"[numlock]");}
if(i>111&&i<124)return this.setKP(i*-1,"[f"+(i-111)+"]");return this.setKP(i);}
function $addEvent(o,_e,c,_b){var e=_e.toLowerCase(),b=(typeof _b=="boolean")?_b:true,x=(o[e])?o[e].toString():"";x=x.substring(x.indexOf("{")+1,x.lastIndexOf("}"));x=((b)?(x+c):(c+x))+"\n";return o[e]=(!!window.Event)?new Function("event",x):new Function(x);};var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!='undefined');Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var id;var optionIndex=0;if(arguments.length>0){if(typeof arguments[0]=="string"){id=arguments[0];optionIndex=1;}
else
id=arguments[0]?arguments[0].id:null;}
if(!id)
id="window_"+new Date().getTime();if($(id))
alert("Window "+id+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[optionIndex]||{});if(this.options.blurClassName)
this.options.focusClassName=this.options.className;if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined")
this.options.top=this._round(Math.random()*500,this.options.gridY);if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined")
this.options.left=this._round(Math.random()*500,this.options.gridX);if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear)
this.options.showEffectOptions.to=this.options.opacity;}
if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear)
this.options.showEffectOptions.to=this.options.opacity;if(this.options.hideEffect==Effect.Fade)
this.options.hideEffectOptions.from=this.options.opacity;}
if(this.options.hideEffect==Element.hide)
this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose)this.destroy();}.bind(this)
if(this.options.parent!=document.body)
this.options.parent=$(this.options.parent);this.element=this._createWindow(id);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var that=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("top_draggable");});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(element){element.observe("mousedown",that.eventMouseDown);element.addClassName("bottom_draggable");});}
if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown);}
this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+'px'});this.useLeft=true;}
else{this.element.setStyle({right:parseFloat(this.options.right)+'px'});this.useLeft=false;}
if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+'px'});this.useTop=true;}
else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+'px'});this.useTop=false;}
this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex)
this.setZIndex(this.options.zIndex)
if(this.options.destroyOnClose)
this.setDestroyOnClose(true);this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height)
this.setSize(this.options.width,this.options.height);this.setTitle(this.options.title)
Windows.register(this);},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.options.parent,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var content=this.getContent();var originalContent=null;for(var i=0;i<content.childNodes.length;i++){originalContent=content.childNodes[i];if(originalContent.nodeType==1)
break;originalContent=null;}
if(originalContent)
this._oldParent.appendChild(originalContent);this._oldParent=null;}
if(this.sizer)
Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);if(this.options.url)
this.content.src=null
if(this.wiredElement)
this.wiredElement.remove();if(this.iefix)
Element.remove(this.iefix);Element.remove(this.element);Windows.unregister(this);},setCloseCallback:function(callback){this.options.closeCallback=callback;},getContent:function(){return this.content;},setContent:function(id,autoresize,autoposition){var element=$(id);if(null==element)throw"Unable to find element '"+id+"' in DOM";this._oldParent=element.parentNode;var d=null;var p=null;if(autoresize)
d=Element.getDimensions(element);if(autoposition)
p=Position.cumulativeOffset(element);var content=this.getContent();this.setHTMLContent("");content=this.getContent();content.appendChild(element);element.show();if(autoresize)
this.setSize(d.width,d.height);if(autoposition)
this.setLocation(p[1]-this.heightN,p[0]-this.widthW);},setHTMLContent:function(html){if(this.options.url){this.content.src=null;this.options.url=null;var content="<div id=\""+this.getId()+"_content\" class=\""+this.options.className+"_content\"> </div>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content");}
this.getContent().update(html);return this;},setAjaxContent:function(url,options,showCentered,showModal){this.showFunction=showCentered?"showCenter":"show";this.showModal=showModal||false;options=options||{};this.setHTMLContent("");this.onComplete=options.onComplete;if(!this._onCompleteHandler)
this._onCompleteHandler=this._setAjaxContent.bind(this);options.onComplete=this._onCompleteHandler;new Ajax.Request(url,options);options.onComplete=this.onComplete;},_setAjaxContent:function(originalRequest){Element.update(this.getContent(),originalRequest.responseText);if(this.onComplete)
this.onComplete(originalRequest);this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(url){if(this.options.url)
this.content.src=null;this.options.url=url;var content="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+url+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=content;this.content=$(this.element.id+"_content");},getURL:function(){return this.options.url?this.options.url:null;},refresh:function(){if(this.options.url)
$(this.element.getAttribute('id')+'_content').src=this.options.url;},setCookie:function(name,expires,path,domain,secure){name=name||this.element.id;this.cookie=[name,expires,path,domain,secure];var value=WindowUtilities.getCookie(name)
if(value){var values=value.split(',');var x=values[0].split(':');var y=values[1].split(':');var w=parseFloat(values[2]),h=parseFloat(values[3]);var mini=values[4];var maxi=values[5];this.setSize(w,h);if(mini=="true")
this.doMinimize=true;else if(maxi=="true")
this.doMaximize=true;this.useLeft=x[0]=="l";this.useTop=y[0]=="t";this.element.setStyle(this.useLeft?{left:x[1]}:{right:x[1]});this.element.setStyle(this.useTop?{top:y[1]}:{bottom:y[1]});}},getId:function(){return this.element.id;},setDestroyOnClose:function(){this.options.destroyOnClose=true;},setConstraint:function(bool,padding){this.constraint=bool;this.constraintPad=Object.extend(this.constraintPad,padding||{});if(this.useTop&&this.useLeft)
this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left));},_initDrag:function(event){if(Event.element(event)==this.sizer&&this.isMinimized())
return;if(Event.element(event)!=this.sizer&&this.isMaximized())
return;if(Prototype.Browser.IE&&this.heightN==0)
this._getWindowBorderSize();this.pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)];if(this.options.wiredDrag)
this.currentDrag=this._createWiredElement();else
this.currentDrag=this.element;if(Event.element(event)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle('bottom'));this.rightOrg=parseFloat(this.element.getStyle('right'));this._notify("onStartResize");}
else{this.doResize=false;var closeButton=$(this.getId()+'_close');if(closeButton&&Position.within(closeButton,this.pointer[0],this.pointer[1])){this.currentDrag=null;return;}
this.toFront();if(!this.options.draggable)
return;this._notify("onStartMove");}
Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen('__invisible__','__invisible__',this.overlayOpacity);document.body.ondrag=function(){return false;};document.body.onselectstart=function(){return false;};this.currentDrag.show();Event.stop(event);},_round:function(val,round){return round==1?val:val=Math.floor(val/round)*round;},_updateDrag:function(event){var pointer=[this._round(Event.pointerX(event),this.options.gridX),this._round(Event.pointerY(event),this.options.gridY)];var dx=pointer[0]-this.pointer[0];var dy=pointer[1]-this.pointer[1];if(this.doResize){var w=this.widthOrg+dx;var h=this.heightOrg+dy;dx=this.width-this.widthOrg
dy=this.height-this.heightOrg
if(this.useLeft)
w=this._updateWidthConstraint(w)
else
this.currentDrag.setStyle({right:(this.rightOrg-dx)+'px'});if(this.useTop)
h=this._updateHeightConstraint(h)
else
this.currentDrag.setStyle({bottom:(this.bottomOrg-dy)+'px'});this.setSize(w,h);this._notify("onResize");}
else{this.pointer=pointer;if(this.useLeft){var left=parseFloat(this.currentDrag.getStyle('left'))+dx;var newLeft=this._updateLeftConstraint(left);this.pointer[0]+=newLeft-left;this.currentDrag.setStyle({left:newLeft+'px'});}
else
this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle('right'))-dx+'px'});if(this.useTop){var top=parseFloat(this.currentDrag.getStyle('top'))+dy;var newTop=this._updateTopConstraint(top);this.pointer[1]+=newTop-top;this.currentDrag.setStyle({top:newTop+'px'});}
else
this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle('bottom'))-dy+'px'});this._notify("onMove");}
if(this.iefix)
this._fixIEOverlapping();this._removeStoreLocation();Event.stop(event);},_endDrag:function(event){WindowUtilities.enableScreen('__invisible__');if(this.doResize)
this._notify("onEndResize");else
this._notify("onEndMove");Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(event);this._hideWiredElement();this._saveCookie()
document.body.ondrag=null;document.body.onselectstart=null;},_updateLeftConstraint:function(left){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(left<this.constraintPad.left)
left=this.constraintPad.left;if(left+this.width+this.widthE+this.widthW>width-this.constraintPad.right)
left=width-this.constraintPad.right-this.width-this.widthE-this.widthW;}
return left;},_updateTopConstraint:function(top){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var h=this.height+this.heightN+this.heightS;if(top<this.constraintPad.top)
top=this.constraintPad.top;if(top+h>height-this.constraintPad.bottom)
top=height-this.constraintPad.bottom-h;}
return top;},_updateWidthConstraint:function(w){if(this.constraint&&this.useLeft&&this.useTop){var width=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var left=parseFloat(this.element.getStyle("left"));if(left+w+this.widthE+this.widthW>width-this.constraintPad.right)
w=width-this.constraintPad.right-left-this.widthE-this.widthW;}
return w;},_updateHeightConstraint:function(h){if(this.constraint&&this.useLeft&&this.useTop){var height=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var top=parseFloat(this.element.getStyle("top"));if(top+h+this.heightN+this.heightS>height-this.constraintPad.bottom)
h=height-this.constraintPad.bottom-top-this.heightN-this.heightS;}
return h;},_createWindow:function(id){var className=this.options.className;var win=document.createElement("div");win.setAttribute('id',id);win.className="dialog";var content;if(this.options.url)
content="<iframe frameborder=\"0\" name=\""+id+"_content\"  id=\""+id+"_content\" src=\""+this.options.url+"\"> </iframe>";else
content="<div id=\""+id+"_content\" class=\""+className+"_content\"> </div>";var closeDiv=this.options.closable?"<div class='"+className+"_close' id='"+id+"_close' onclick='Windows.close(\""+id+"\", event)'> </div>":"";var minDiv=this.options.minimizable?"<div class='"+className+"_minimize' id='"+id+"_minimize' onclick='Windows.minimize(\""+id+"\", event)'> </div>":"";var maxDiv=this.options.maximizable?"<div class='"+className+"_maximize' id='"+id+"_maximize' onclick='Windows.maximize(\""+id+"\", event)'> </div>":"";var seAttributes=this.options.resizable?"class='"+className+"_sizer' id='"+id+"_sizer'":"class='"+className+"_se'";var blank="../themes/default/blank.gif";win.innerHTML=closeDiv+minDiv+maxDiv+"\
      <table id='"+id+"_row1' class=\"top table_window\">\
        <tr>\
          <td class='"+className+"_nw'></td>\
          <td class='"+className+"_n'><div id='"+id+"_top' class='"+className+"_title title_window'>"+this.options.title+"</div></td>\
          <td class='"+className+"_ne'></td>\
        </tr>\
      </table>\
      <table id='"+id+"_row2' class=\"mid table_window\">\
        <tr>\
          <td class='"+className+"_w'></td>\
            <td id='"+id+"_table_content' class='"+className+"_content' valign='top'>"+content+"</td>\
          <td class='"+className+"_e'></td>\
        </tr>\
      </table>\
        <table id='"+id+"_row3' class=\"bot table_window\">\
        <tr>\
          <td class='"+className+"_sw'></td>\
            <td class='"+className+"_s'><div id='"+id+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>\
            <td "+seAttributes+"></td>\
        </tr>\
      </table>\
    ";Element.hide(win);this.options.parent.insertBefore(win,this.options.parent.firstChild);Event.observe($(id+"_content"),"load",this.options.onload);return win;},changeClassName:function(newClassName){var className=this.options.className;var id=this.getId();$A(["_close","_minimize","_maximize","_content"]).each(function(value){this._toggleClassName($(id+value),className+value,newClassName+value)}.bind(this));this._toggleClassName($(id+"_top"),className+"_title",newClassName+"_title");$$("#"+id+" td").each(function(td){td.className=td.className.sub(className,newClassName);});this.options.className=newClassName;this._getWindowBorderSize();this.setSize(this.width,this.height)},_toggleClassName:function(element,oldClassName,newClassName){if(element){element.removeClassName(oldClassName);element.addClassName(newClassName);}},setLocation:function(top,left){top=this._updateTopConstraint(top);left=this._updateLeftConstraint(left);var e=this.currentDrag||this.element;e.setStyle({top:top+'px'});e.setStyle({left:left+'px'});this.useLeft=true;this.useTop=true;},getLocation:function(){var location={};if(this.useTop)
location=Object.extend(location,{top:this.element.getStyle("top")});else
location=Object.extend(location,{bottom:this.element.getStyle("bottom")});if(this.useLeft)
location=Object.extend(location,{left:this.element.getStyle("left")});else
location=Object.extend(location,{right:this.element.getStyle("right")});return location;},getSize:function(){return{width:this.width,height:this.height};},setSize:function(width,height,useEffect){width=parseFloat(width);height=parseFloat(height);if(!this.minimized&&width<this.options.minWidth)
width=this.options.minWidth;if(!this.minimized&&height<this.options.minHeight)
height=this.options.minHeight;if(this.options.maxHeight&&height>this.options.maxHeight)
height=this.options.maxHeight;if(this.options.maxWidth&&width>this.options.maxWidth)
width=this.options.maxWidth;if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&useEffect){new Effect.ResizeWindow(this,null,null,width,height,{duration:Window.resizeEffectDuration});}else{this.width=width;this.height=height;var e=this.currentDrag?this.currentDrag:this.element;e.setStyle({width:width+this.widthW+this.widthE+"px"})
e.setStyle({height:height+this.heightN+this.heightS+"px"})
if(!this.currentDrag||this.currentDrag==this.element){var content=$(this.element.id+'_content');content.setStyle({height:height+'px'});content.setStyle({width:width+'px'});}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true);},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true);},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex)
this.setZIndex(Windows.maxZIndex+1);if(this.iefix)
this._fixIEOverlapping();},getBounds:function(insideOnly){if(!this.width||!this.height||!this.visible)
this.computeBounds();var w=this.width;var h=this.height;if(!insideOnly){w+=this.widthW+this.widthE;h+=this.heightN+this.heightS;}
var bounds=Object.extend(this.getLocation(),{width:w+"px",height:h+"px"});return bounds;},computeBounds:function(){if(!this.width||!this.height){var size=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className)
if(this.height)
this.width=size+5
else
this.height=size+5}
this.setSize(this.width,this.height);if(this.centered)
this._center(this.centerTop,this.centerLeft);},show:function(modal){this.visible=true;if(modal){if(typeof this.overlayOpacity=="undefined"){var that=this;setTimeout(function(){that.show(modal)},10);return;}
Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this);}
else
if(!this.element.style.zIndex)
this.setZIndex(Windows.maxZIndex+1);if(this.oldStyle)
this.getContent().setStyle({overflow:this.oldStyle});this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions)
this.options.showEffect(this.element,this.options.showEffectOptions);else
this.options.showEffect(this.element);this._checkIEOverlapping();WindowUtilities.focusedWindow=this
this._notify("onShow");},showCenter:function(modal,top,left){this.centered=true;this.centerTop=top;this.centerLeft=left;this.show(modal);},isVisible:function(){return this.visible;},_center:function(top,left){var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);var pageSize=WindowUtilities.getPageSize(this.options.parent);if(typeof top=="undefined")
top=(pageSize.windowHeight-(this.height+this.heightN+this.heightS))/2;top+=windowScroll.top
if(typeof left=="undefined")
left=(pageSize.windowWidth-(this.width+this.widthW+this.widthE))/2;left+=windowScroll.left
this.setLocation(top,left);this.toFront();},_recenter:function(event){if(this.centered){var pageSize=WindowUtilities.getPageSize(this.options.parent);var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==pageSize.windowWidth&&this.pageSize.windowHeight==pageSize.windowHeight&&this.windowScroll.left==windowScroll.left&&this.windowScroll.top==windowScroll.top)
return;this.pageSize=pageSize;this.windowScroll=windowScroll;if($('overlay_modal'))
$('overlay_modal').setStyle({height:(pageSize.pageHeight+'px')});if(this.options.recenterAuto)
this._center(this.centerTop,this.centerLeft);}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow();}
this.oldStyle=this.getContent().getStyle('overflow')||"auto"
this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix)
this.iefix.hide();if(!this.doNotNotifyHide)
this._notify("onHide");},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this))
return;if(this.options.destroyOnClose){var destroyFunc=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var func=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){func();destroyFunc()}}
else
this.options.hideEffectOptions.afterFinish=function(){destroyFunc()}}
Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose");}},minimize:function(){if(this.isMaximized()||this.resizing)
return;if(this.minimized){this.restore();return;}
var r2=$(this.getId()+"_row2");this.minimized=true;var dh=r2.getDimensions().height;this.r2Height=dh;var h=this.element.getHeight()-dh;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-dh,{duration:Window.resizeEffectDuration});}else{this.height-=dh;this.element.setStyle({height:h+"px"});r2.hide();}
if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom+dh)+'px'});}
this._notify("onMinimize");this._saveCookie()},restore:function(){if(!this.minimized||this.resizing)
return;var r2=$(this.getId()+"_row2");this.minimized=false;var dh=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+dh,{duration:Window.resizeEffectDuration});}
else{var h=this.element.getHeight()+dh;this.height+=dh;this.element.setStyle({height:h+"px"})
r2.show();}
if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom-dh)+'px'});}
this.toFront();this._saveCookie();},maximize:function(){if(this.isMinimized()||this.resizing)
return;if(Prototype.Browser.IE&&this.heightN==0)
this._getWindowBorderSize();if(this.storedLocation!=null){this._restoreLocation();if(this.iefix)
this.iefix.hide();}
else{this._storeLocation();Windows.unsetOverflow(this);var windowScroll=WindowUtilities.getWindowScroll(this.options.parent);var pageSize=WindowUtilities.getPageSize(this.options.parent);var left=windowScroll.left;var top=windowScroll.top;if(this.options.parent!=document.body){windowScroll={top:0,left:0,bottom:0,right:0};var dim=this.options.parent.getDimensions();pageSize.windowWidth=dim.width;pageSize.windowHeight=dim.height;top=0;left=0;}
if(this.constraint){pageSize.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);pageSize.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);left+=Math.max(0,this.constraintPad.left);top+=Math.max(0,this.constraintPad.top);}
var width=pageSize.windowWidth-this.widthW-this.widthE;var height=pageSize.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,top,left,width,height,{duration:Window.resizeEffectDuration});}
else{this.setSize(width,height);this.element.setStyle(this.useLeft?{left:left+"px"}:{right:left+"px"});this.element.setStyle(this.useTop?{top:top+"px"}:{bottom:top+"px"});}
this.toFront();if(this.iefix)
this._fixIEOverlapping();}
this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized;},isMaximized:function(){return(this.storedLocation!=null);},setOpacity:function(opacity){if(Element.setOpacity)
Element.setOpacity(this.element,opacity);},setZIndex:function(zindex){this.element.setStyle({zIndex:zindex});Windows.updateZindex(zindex,this);},setTitle:function(newTitle){if(!newTitle||newTitle=="")
newTitle="&nbsp;";Element.update(this.element.id+'_top',newTitle);},getTitle:function(){return $(this.element.id+'_top').innerHTML;},setStatusBar:function(element){var statusBar=$(this.getId()+"_bottom");if(typeof(element)=="object"){if(this.bottombar.firstChild)
this.bottombar.replaceChild(element,this.bottombar.firstChild);else
this.bottombar.appendChild(element);}
else
this.bottombar.innerHTML=element;},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(this.element.getStyle('position')=='absolute')){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+'_iefix');}
if(this.iefix)
setTimeout(this._fixIEOverlapping.bind(this),50);},_fixIEOverlapping:function(){this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show();},_getWindowBorderSize:function(event){var div=this._createHiddenDiv(this.options.className+"_n")
this.heightN=Element.getDimensions(div).height;div.parentNode.removeChild(div)
var div=this._createHiddenDiv(this.options.className+"_s")
this.heightS=Element.getDimensions(div).height;div.parentNode.removeChild(div)
var div=this._createHiddenDiv(this.options.className+"_e")
this.widthE=Element.getDimensions(div).width;div.parentNode.removeChild(div)
var div=this._createHiddenDiv(this.options.className+"_w")
this.widthW=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=document.createElement("div");div.className="overlay_"+this.options.className;document.body.appendChild(div);var that=this;setTimeout(function(){that.overlayOpacity=($(div).getStyle("opacity"));div.parentNode.removeChild(div);},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height;}
if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420)
this.setSize(this.width,this.height);if(this.doMaximize)
this.maximize();if(this.doMinimize)
this.minimize();},_createHiddenDiv:function(className){var objBody=document.body;var win=document.createElement("div");win.setAttribute('id',this.element.id+"_tmp");win.className=className;win.style.display='none';win.innerHTML='';objBody.insertBefore(win,objBody.firstChild);return win;},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle('top'),bottom:this.element.getStyle('bottom'),left:this.element.getStyle('left'),right:this.element.getStyle('right'),width:this.width,height:this.height};}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow)
new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration});else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height);}
Windows.resetOverflow();this._removeStoreLocation();}},_removeStoreLocation:function(){this.storedLocation=null;},_saveCookie:function(){if(this.cookie){var value="";if(this.useLeft)
value+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle('left'))
else
value+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle('right'))
if(this.useTop)
value+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle('top'))
else
value+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle('bottom'))
value+=","+(this.storedLocation?this.storedLocation.width:this.width);value+=","+(this.storedLocation?this.storedLocation.height:this.height);value+=","+this.isMinimized();value+=","+this.isMaximized();WindowUtilities.setCookie(value,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE)
this._getWindowBorderSize();var div=document.createElement("div");div.className="wired_frame "+this.options.className+"_wired_frame";div.style.position='absolute';this.options.parent.insertBefore(div,this.options.parent.firstChild);this.wiredElement=$(div);}
if(this.useLeft)
this.wiredElement.setStyle({left:this.element.getStyle('left')});else
this.wiredElement.setStyle({right:this.element.getStyle('right')});if(this.useTop)
this.wiredElement.setStyle({top:this.element.getStyle('top')});else
this.wiredElement.setStyle({bottom:this.element.getStyle('bottom')});var dim=this.element.getDimensions();this.wiredElement.setStyle({width:dim.width+"px",height:dim.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement;},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag)
return;if(this.currentDrag==this.element)
this.currentDrag=null;else{if(this.useLeft)
this.element.setStyle({left:this.currentDrag.getStyle('left')});else
this.element.setStyle({right:this.currentDrag.getStyle('right')});if(this.useTop)
this.element.setStyle({top:this.currentDrag.getStyle('top')});else
this.element.setStyle({bottom:this.currentDrag.getStyle('bottom')});this.currentDrag.hide();this.currentDrag=null;if(this.doResize)
this.setSize(this.width,this.height);}},_notify:function(eventName){if(this.options[eventName])
this.options[eventName](this);else
Windows.notify(eventName,this);}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(observer){this.removeObserver(observer);this.observers.push(observer);},removeObserver:function(observer){this.observers=this.observers.reject(function(o){return o==observer});},notify:function(eventName,win){this.observers.each(function(o){if(o[eventName])o[eventName](eventName,win);});},getWindow:function(id){return this.windows.detect(function(d){return d.getId()==id});},getFocusedWindow:function(){return this.focusedWindow;},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null;},addModalWindow:function(win){if(this.modalWindows.length==0){WindowUtilities.disableScreen(win.options.className,'overlay_modal',win.overlayOpacity,win.getId(),win.options.parent);}
else{if(Window.keepMultiModalWindow){$('overlay_modal').style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId());}
else
this.modalWindows.last().element.hide();WindowUtilities._showSelect(win.getId());}
this.modalWindows.push(win);},removeModalWindow:function(win){this.modalWindows.pop();if(this.modalWindows.length==0)
WindowUtilities.enableScreen();else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId());}
else
this.modalWindows.last().element.show();}},register:function(win){this.windows.push(win);},unregister:function(win){this.windows=this.windows.reject(function(d){return d==win});},closeAll:function(){this.windows.each(function(w){Windows.close(w.getId())});},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(win){if(win)win.close()});},minimize:function(id,event){var win=this.getWindow(id)
if(win&&win.visible)
win.minimize();Event.stop(event);},maximize:function(id,event){var win=this.getWindow(id)
if(win&&win.visible)
win.maximize();Event.stop(event);},close:function(id,event){var win=this.getWindow(id);if(win)
win.close();if(event)
Event.stop(event);},blur:function(id){var win=this.getWindow(id);if(!win)
return;if(win.options.blurClassName)
win.changeClassName(win.options.blurClassName);if(this.focusedWindow==win)
this.focusedWindow=null;win._notify("onBlur");},focus:function(id){var win=this.getWindow(id);if(!win)
return;if(this.focusedWindow)
this.blur(this.focusedWindow.getId())
if(win.options.focusClassName)
win.changeClassName(win.options.focusClassName);this.focusedWindow=win;win._notify("onFocus");},unsetOverflow:function(except){this.windows.each(function(d){d.oldOverflow=d.getContent().getStyle("overflow")||"auto";d.getContent().setStyle({overflow:"hidden"})});if(except&&except.oldOverflow)
except.getContent().setStyle({overflow:except.oldOverflow});},resetOverflow:function(){this.windows.each(function(d){if(d.oldOverflow)d.getContent().setStyle({overflow:d.oldOverflow})});},updateZindex:function(zindex,win){if(zindex>this.maxZIndex){this.maxZIndex=zindex;if(this.focusedWindow)
this.blur(this.focusedWindow.getId())}
this.focusedWindow=win;if(this.focusedWindow)
this.focus(this.focusedWindow.getId())}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.confirm);return}
content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";var cancelLabel=parameters.cancelLabel?parameters.cancelLabel:"Cancel";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'"
var cancelButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" cancel_button'"
var content="\
      <div class='"+parameters.className+"_message'>"+content+"</div>\
        <div class='"+parameters.className+"_buttons'>\
          <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
          <input type='button' value='"+cancelLabel+"' onclick='Dialog.cancelCallback()' "+cancelButtonClass+"/>\
        </div>\
    ";return this._openDialog(content,parameters)},alert:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.alert);return}
content=content||"";parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'"
var content="\
      <div class='"+parameters.className+"_message'>"+content+"</div>\
        <div class='"+parameters.className+"_buttons'>\
          <input type='button' value='"+okLabel+"' onclick='Dialog.okCallback()' "+okButtonClass+"/>\
        </div>";return this._openDialog(content,parameters)},info:function(content,parameters){if(content&&typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.info);return}
content=content||"";parameters=parameters||{};parameters=Object.extend(parameters,parameters.windowParameters||{});parameters.windowParameters=parameters.windowParameters||{};parameters.className=parameters.className||"alert";var content="<div id='modal_dialog_message' class='"+parameters.className+"_message'>"+content+"</div>";if(parameters.showProgress)
content+="<div id='modal_dialog_progress' class='"+parameters.className+"_progress'>  </div>";parameters.ok=null;parameters.cancel=null;return this._openDialog(content,parameters)},setInfoMessage:function(message){$('modal_dialog_message').update(message);},closeInfo:function(){Windows.close(this.dialogId);},_openDialog:function(content,parameters){var className=parameters.className;if(!parameters.height&&!parameters.width){parameters.width=WindowUtilities.getPageSize((parameters.options&&parameters.options.parent)||document.body).pageWidth/2;}
if(parameters.id)
this.dialogId=parameters.id;else{var t=new Date();this.dialogId='modal_dialog_'+t.getTime();parameters.id=this.dialogId;}
if(!parameters.height||!parameters.width){var size=WindowUtilities._computeSize(content,this.dialogId,parameters.width,parameters.height,5,className)
if(parameters.height)
parameters.width=size+5
else
parameters.height=size+5}
parameters.effectOptions=parameters.effectOptions;parameters.resizable=parameters.resizable||false;parameters.minimizable=parameters.minimizable||false;parameters.maximizable=parameters.maximizable||false;parameters.draggable=parameters.draggable||false;parameters.closable=parameters.closable||false;var win=new Window(parameters);if(!parameters.url){win.setHTMLContent(content);}
win.showCenter(true,parameters.top,parameters.left);win.setDestroyOnClose();win.cancelCallback=parameters.onCancel||parameters.cancel;win.okCallback=parameters.onOk||parameters.ok;return win;},_getAjaxContent:function(originalRequest){Dialog.callFunc(originalRequest.responseText,Dialog.parameters)},_runAjaxRequest:function(message,parameters,callFunc){if(message.options==null)
message.options={}
Dialog.onCompleteFunc=message.options.onComplete;Dialog.parameters=parameters;Dialog.callFunc=callFunc;message.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(message.url,message.options);},okCallback:function(){var win=Windows.focusedWindow;if(!win.okCallback||win.okCallback(win)){$$("#"+win.getId()+" input").each(function(element){element.onclick=null;})
win.close();}},cancelCallback:function(){var win=Windows.focusedWindow;$$("#"+win.getId()+" input").each(function(element){element.onclick=null})
win.close();if(win.cancelCallback)
win.cancelCallback(win);}}
if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1]);}
var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight;}
else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight}}}
return{top:T,left:L,width:W,height:H};},getPageSize:function(parent){parent=parent||document.body;var windowWidth,windowHeight;var pageHeight,pageWidth;if(parent!=document.body){windowWidth=parent.getWidth();windowHeight=parent.getHeight();pageWidth=parent.scrollWidth;pageHeight=parent.scrollHeight;}
else{var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}}
return{pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight};},disableScreen:function(className,overlayId,overlayOpacity,contentId,parent){WindowUtilities.initLightbox(overlayId,className,function(){this._disableScreen(className,overlayId,overlayOpacity,contentId)}.bind(this),parent||document.body);},_disableScreen:function(className,overlayId,overlayOpacity,contentId){var objOverlay=$(overlayId);var pageSize=WindowUtilities.getPageSize(objOverlay.parentNode);if(contentId&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(contentId);}
objOverlay.style.height=(pageSize.pageHeight+'px');objOverlay.style.display='none';if(overlayId=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){objOverlay.overlayOpacity=overlayOpacity;new Effect.Appear(objOverlay,Object.extend({from:0,to:overlayOpacity},Windows.overlayShowEffectOptions));}
else
objOverlay.style.display="block";},enableScreen:function(id){id=id||'overlay_modal';var objOverlay=$(id);if(objOverlay){if(id=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions)
new Effect.Fade(objOverlay,Object.extend({from:objOverlay.overlayOpacity,to:0},Windows.overlayHideEffectOptions));else{objOverlay.style.display='none';objOverlay.parentNode.removeChild(objOverlay);}
if(id!="__invisible__")
WindowUtilities._showSelect();}},_hideSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'select').each(function(element){if(!WindowUtilities.isDefined(element.oldVisibility)){element.oldVisibility=element.style.visibility?element.style.visibility:"visible";element.style.visibility="hidden";}});}},_showSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+'select').each(function(element){if(WindowUtilities.isDefined(element.oldVisibility)){try{element.style.visibility=element.oldVisibility;}catch(e){element.style.visibility="visible";}
element.oldVisibility=null;}
else{if(element.style.visibility)
element.style.visibility="visible";}});}},isDefined:function(object){return typeof(object)!="undefined"&&object!=null;},initLightbox:function(id,className,doneHandler,parent){if($(id)){Element.setStyle(id,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;doneHandler();}
else{var objOverlay=document.createElement("div");objOverlay.setAttribute('id',id);objOverlay.className="overlay_"+className
objOverlay.style.display='none';objOverlay.style.position='absolute';objOverlay.style.top='0';objOverlay.style.left='0';objOverlay.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;objOverlay.style.width='100%';parent.insertBefore(objOverlay,parent.firstChild);if(Prototype.Browser.WebKit&&id=="overlay_modal"){setTimeout(function(){doneHandler()},10);}
else
doneHandler();}},setCookie:function(value,parameters){document.cookie=parameters[0]+"="+escape(value)+
((parameters[1])?"; expires="+parameters[1].toGMTString():"")+
((parameters[2])?"; path="+parameters[2]:"")+
((parameters[3])?"; domain="+parameters[3]:"")+
((parameters[4])?"; secure":"");},getCookie:function(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=document.cookie.indexOf(";",begin);if(end==-1){end=dc.length;}
return unescape(dc.substring(begin+prefix.length,end));},_computeSize:function(content,id,width,height,margin,className){var objBody=document.body;var tmpObj=document.createElement("div");tmpObj.setAttribute('id',id);tmpObj.className=className+"_content";if(height)
tmpObj.style.height=height+"px"
else
tmpObj.style.width=width+"px"
tmpObj.style.position='absolute';tmpObj.style.top='0';tmpObj.style.left='0';tmpObj.style.display='none';tmpObj.innerHTML=content.stripScripts();objBody.insertBefore(tmpObj,objBody.firstChild);var size;if(height)
size=$(tmpObj).getDimensions().width+margin;else
size=$(tmpObj).getDimensions().height+margin;objBody.removeChild(tmpObj);return size;}};Effect.ResizeWindow=Class.create();Object.extend(Object.extend(Effect.ResizeWindow.prototype,Effect.Base.prototype),{initialize:function(win,top,left,width,height){this.window=win;this.window.resizing=true;var size=win.getSize();this.initWidth=parseFloat(size.width);this.initHeight=parseFloat(size.height);var location=win.getLocation();this.initTop=parseFloat(location.top);this.initLeft=parseFloat(location.left);this.width=width!=null?parseFloat(width):this.initWidth;this.height=height!=null?parseFloat(height):this.initHeight;this.top=top!=null?parseFloat(top):this.initTop;this.left=left!=null?parseFloat(left):this.initLeft;this.dx=this.left-this.initLeft;this.dy=this.top-this.initTop;this.dw=this.width-this.initWidth;this.dh=this.height-this.initHeight;this.r2=$(this.window.getId()+"_row2");this.content=$(this.window.getId()+"_content");this.contentOverflow=this.content.getStyle("overflow")||"auto";this.content.setStyle({overflow:"hidden"});if(this.window.options.wiredDrag){this.window.currentDrag=win._createWiredElement();this.window.currentDrag.show();this.window.element.hide();}
this.start(arguments[5]);},update:function(position){var width=Math.floor(this.initWidth+this.dw*position);var height=Math.floor(this.initHeight+this.dh*position);var top=Math.floor(this.initTop+this.dy*position);var left=Math.floor(this.initLeft+this.dx*position);if(window.ie){if(Math.floor(height)==0)
this.r2.hide();else if(Math.floor(height)>1)
this.r2.show();}
this.r2.setStyle({height:height});this.window.setSize(width,height);this.window.setLocation(top,left);},finish:function(position){if(this.window.options.wiredDrag){this.window._hideWiredElement();this.window.element.show();}
this.window.setSize(this.width,this.height);this.window.setLocation(this.top,this.left);this.r2.setStyle({height:null});this.content.setStyle({overflow:this.contentOverflow});this.window.resizing=false;}});Effect.ModalSlideDown=function(element){var windowScroll=WindowUtilities.getWindowScroll();var height=element.getStyle("height");element.setStyle({top:-(parseFloat(height)-windowScroll.top)+"px"});element.show();return new Effect.Move(element,Object.extend({x:0,y:parseFloat(height)},arguments[1]||{}));};Effect.ModalSlideUp=function(element){var height=element.getStyle("height");return new Effect.Move(element,Object.extend({x:0,y:-parseFloat(height)},arguments[1]||{}));};PopupEffect=Class.create();PopupEffect.prototype={initialize:function(htmlElement){this.html=$(htmlElement);this.options=Object.extend({className:"popup_effect",duration:0.4},arguments[1]||{});},show:function(element,options){var position=Position.cumulativeOffset(this.html);var size=this.html.getDimensions();var bounds=element.win.getBounds();this.window=element.win;if(!this.div){this.div=$(document.createElement("div"));this.div.className=this.options.className;this.div.style.height=size.height+"px";this.div.style.width=size.width+"px";this.div.style.top=position[1]+"px";this.div.style.left=position[0]+"px";this.div.style.position="absolute"
document.body.appendChild(this.div);}
if(this.options.fromOpacity)
this.div.setStyle({opacity:this.options.fromOpacity})
this.div.show();var style="top:"+bounds.top+";left:"+bounds.left+";width:"+bounds.width+";height:"+bounds.height;if(this.options.toOpacity)
style+=";opacity:"+this.options.toOpacity;new Effect.Morph(this.div,{style:style,duration:this.options.duration,afterFinish:this._showWindow.bind(this)});},hide:function(element,options){var position=Position.cumulativeOffset(this.html);var size=this.html.getDimensions();this.window.visible=true;var bounds=this.window.getBounds();this.window.visible=false;this.window.element.hide();this.div.style.height=bounds.height;this.div.style.width=bounds.width;this.div.style.top=bounds.top;this.div.style.left=bounds.left;if(this.options.toOpacity)
this.div.setStyle({opacity:this.options.toOpacity})
this.div.show();var style="top:"+position[1]+"px;left:"+position[0]+"px;width:"+size.width+"px;height:"+size.height+"px";if(this.options.fromOpacity)
style+=";opacity:"+this.options.fromOpacity;new Effect.Morph(this.div,{style:style,duration:this.options.duration,afterFinish:this._hideDiv.bind(this)});},_showWindow:function(){this.div.hide();this.window.element.show();},_hideDiv:function(){this.div.hide();if(this.window.options.destroyOnClose)
this.window.destroy();}};showSelectCountry=function(){Dialog.info({url:'/select_country.php'},{id:'select_country',className:'alphacube',title:'Select Your Country',width:320,height:250,zIndex:-1});return false;}
isCountrySelected=function(){if(!Get_Cookie('selected_language')){showSelectCountry();}}
submit_sl_form=function(f){Set_Cookie('selected_language',$('sl').options[$('sl').selectedIndex].value,365);return true;}
var imageSwapper=Class.create();imageSwapper.prototype={initialize:function(img,normal,hover){this.watch=img;this.normal=normal;this.hover=hover;this.enable();Event.observe(this.watch,'mouseover',this.onmouseover.bind(this));Event.observe(this.watch,'mouseout',this.onmouseout.bind(this));this.watch.disable=this.disable.bind(this);this.watch.enable=this.enable.bind(this);},onmouseover:function(){if(!this.disabled)this.watch.src=this.hover;},onmouseout:function(){if(!this.disabled)this.watch.src=this.normal;},disable:function(){this.disabled=true;},enable:function(){this.disabled=false;}}
var subcatRowHandler=Class.create();subcatRowHandler.prototype={initialize:function(e){this.watch=e;this.backgroundColor=e.style.backgroundColor;Event.observe(this.watch,'click',this.onclick.bind(this));Event.observe(this.watch,'mouseover',this.onmouseover.bind(this));Event.observe(this.watch,'mouseout',this.onmouseout.bind(this));},onclick:function(event){if(this.watch.tagName=='TR'){if(this.watch.title.indexOf('noajax')>0||true){window.location=this.watch.title;return;}
a=Builder.node('a');a.href=this.watch.title;new ajaxLink(a);a.onclick();}},onmouseover:function(event){Element.addClassName(this.watch,'hilight_active');$$('td.override_hilight').each(function(element){element.style.backgroundColor="#ffffff";});},onmouseout:function(event){Element.removeClassName(this.watch,'hilight_active');}};function enableSubcatRowHandler(){$$('.hilight').each(function(node){new subcatRowHandler(node);});}
function enableAutocompleter(){if(!$('autocomplete'))return;new Ajax.Autocompleter("autocomplete","autocomplete_choices","/search/autocomplete.php",{paramName:'qu',frequency:0.2});}
function linkMp3Samples(){$$('a.album_sample_clip').each(function(a){new mp3Sample(a);});}
var mp3Sample=Class.create();mp3Sample.prototype={watch:null,initialize:function(a){this.watch=a;a.onclick=this.onclick.bindAsEventListener(this);},onclick:function(){url='flashsample'+this.watch.href.substr(4);$('flashMixer').SetVariable("_root.jsCall",url);return false;}}
function linkMenuCheckboxes(){$$('td.cb_td').each(function(td){new menuCheckbox(td);});}
var menuCheckbox=Class.create();menuCheckbox.prototype={td:null,checkbox:null,label:null,initialize:function(td){this.td=td;info=this.td.title.evalJSON();this.td.title=info.title;this.checkbox=$(info.watch);this.label=$(info.watch+'_label');Event.observe(td,'click',this.onclick.bind(this));Event.observe(this.checkbox,'click',this.onclick.bind(this));Event.observe(this.label,'click',this.onclick.bind(this));},onclick:function(){this.checkbox.checked=!this.checkbox.checked;if(this.checkbox.checked){this.td.addClassName('hilight_perm');}else{this.td.removeClassName('hilight_perm');}}}
function linkAjaxLinks(){return true;$$('a.ajaxLink').each(function(a){new ajaxLink(a);});}
var ajaxLink=Class.create();ajaxLink.prototype={watch:null,href:null,skipHistory:null,initialize:function(a,skipHistory){this.href=a.href;this.o_href=a.href;this.watch=a;if(skipHistory==undefined)skipHistory=false;this.skipHistory=skipHistory;if(this.href.indexOf('?')>0){this.href+="&ajax=1";}else{this.href+="?ajax=1";}
this.watch.onclick=this.onclick.bindAsEventListener(this);},onclick:function(event){showAjaxHourglass();scroll(0,0)
$('main_content').innerHTML='';var i=0
$$('.main_content').each(function(block){i++;if(i>1)alert("Multiple main_content blocks found");});new Ajax.Updater('main_content',this.href,{method:'get',evalScripts:true,onComplete:function(_html,_json){enableSubcatRowHandler();enableAutocompleter();linkMp3Samples();linkButtonImageSwap();linkResizingTextareas();linkAjaxLinks();hideAjaxHourglass();return false;},onFailure:function(_req,_exception){alert('Excpetion: '+_exception);}});return false;}}
showAjaxHourglass=function(){if(Prototype.Browser.IE)return;$('main_content_clone').style.position='absolute';$('main_content_clone_text').style.marginTop=$('main_content_clone').style.height/2;Element.clonePosition($('main_content_clone'),$('main_content'));$('main_content_clone').show();}
hideAjaxHourglass=function(){$('main_content_clone').hide();}
ajaxFormHandler=function(form){form.submit();return true;showAjaxHourglass();href=form.action+'?'+form.serialize()+"&ajax=1";new Ajax.Updater('main_content',form.action,{parameters:form.serialize()+"&ajax=1",method:'get',evalScripts:true,onComplete:function(_html,_json){enableSubcatRowHandler();enableAutocompleter();linkMp3Samples();linkButtonImageSwap();linkResizingTextareas();linkAjaxLinks();hideAjaxHourglass();return false;},onFailure:function(_req,_exception){alert('Excpetion: '+exception);}});return false;}
function linkButtonImageSwap(){$$('img.swapper').each(function(node){if(node.title.indexOf('}')>0){var info=node.title.evalJSON();if(info){node.title=info.title;new imageSwapper(node,node.src,info.swap);}}});$$('img.button_play_sample').each(function(node){new imageSwapper(node,'/images/playsample.gif','/images/playsample_active.gif');});$$('img.button_add_track').each(function(node){new imageSwapper(node,'/images/addtrack.gif','/images/addtrack_active.gif');});new imageSwapper($('view_selected_tracks'),'/images/viewtracks.gif','/images/viewtracks_active.gif');}
var ResizingTextArea=Class.create();ResizingTextArea.prototype={defaultRows:0,watch:null,initialize:function(field)
{if(field.tagName.match(/textarea/i)==null)return;this.watch=field;this.defaultRows=Math.max(field.rows,1);this.watch.resizeNeeded=this.resizeNeeded.bind(this);Event.observe(this.watch,"click",this.watch.resizeNeeded);Event.observe(this.watch,"keyup",this.watch.resizeNeeded);},resizeNeeded:function()
{var lines=this.watch.value.split('\n');var newRows=lines.length+1;var oldRows=this.watch.rows;for(var i=0;i<lines.length;i++)
{var line=lines[i];if(line.length>=this.watch.cols)newRows+=Math.floor(line.length/this.watch.cols);}
if(newRows>this.watch.rows)this.watch.rows=newRows;if(newRows<this.watch.rows)this.watch.rows=Math.max(this.defaultRows,newRows);}}
function linkResizingTextareas(){$$('textarea.resizing').each(function(ta){new ResizingTextArea(ta);});}
var backButtonListener=function(newLocation,historyData){newLocation=decodeURIComponent(newLocation);if(newLocation.indexOf('noajax')>0||(!newLocation.indexOf('&ajax=1')&&!newLocation.indexOf('?ajax=1'))){window.location=newLocation;return false;}
if(!newLocation){window.location.reload();return false;}
a=Builder.node('a');a.href=newLocation;new ajaxLink(a,skipHistory=true);a.onclick();}
Event.observe(window,'load',isCountrySelected);Event.observe(window,'load',enableSubcatRowHandler);Event.observe(window,'load',enableAutocompleter);Event.observe(window,'load',linkMp3Samples);Event.observe(window,'load',linkMenuCheckboxes);Event.observe(window,'load',linkButtonImageSwap);Event.observe(window,'load',linkResizingTextareas);Event.observe(window,'load',linkAjaxLinks);;var tracklistManager={selected:null,select:function(id){this.selected=id;},remove:function(id){this.showHourglass();$$('.product_'+id).each(function(node){node.removeClassName("product_row_selected");if(node.hasClassName('product_a')){node.addClassName("product_row_a");}else if(node.hasClassName('product_a')){node.addClassName("product_row_b");}});new Ajax.Updater('tracklist','/mixer/track_remove.php',{method:'get',parameters:'id='+encodeURIComponent(id),onComplete:registerTracklist});},add:function(id){this.showHourglass();$$('.product_'+id).each(function(node){node.removeClassName("product_row_a");node.removeClassName("product_row_b");node.addClassName("product_row_selected");});new Ajax.Updater('tracklist','/mixer/track_add.php',{method:'get',parameters:'id='+encodeURIComponent(id),onComplete:function(_http,_json){if(!$('locked')){registerTracklist();}else{tracklistManager.hideHourglass();}
if(_json.error!=undefined){alert(_json.error);}
$('tracklist').highlight();tracklistManager.checkPPL();}});},reset:function(){this.selected=null;$$('#tracks .track_body').each(function(node){Element.removeClassName(node,'track_selected');});$$("#tracks .track_toggle").each(function(rm){rm.hide();});$$("#tracks .track_toggle_hide").each(function(rm){rm.show();});$$("#tracks .track_transition").each(function(transition){if(transition.visible())Effect.SlideUp(transition,{duration:0.2});});},load:function(mixid){var list=Sortable.sequence('tracks');if(list.length>0){if(!confirm("This will overwrite your existing mix.  Are you sure?"))return false;}
this.showHourglass();new Ajax.Updater('tracklist','/mixer/mixer_loadmix.php',{method:'get',parameters:'mixid='+mixid,onComplete:registerTracklist});return false;},load_tracklist:function(mixid){var list=Sortable.sequence('tracks');if(list.length>0){if(!confirm("This will overwrite your existing mix.  Are you sure?"))return false;}
this.showHourglass();new Ajax.Updater('tracklist','/mixer/mixer_load_tracklist.php',{method:'get',parameters:'mixid='+mixid,onComplete:registerTracklist});return false;},truncate:function(){if(!confirm("This will remove all tracks from your tracklist.  Are you sure?"))return false;this.showHourglass();new Ajax.Updater('tracklist','/mixer/track_truncate.php',{method:'get',onComplete:registerTracklist});return false;},sortBpm:function(direction){this.showHourglass();new Ajax.Updater('tracklist','/mixer/track_sort.php',{method:'get',parameters:'field=bpm&direction='+encodeURIComponent(direction),onComplete:registerTracklist});},addBreak:function(){this.showHourglass();new Ajax.Updater('tracklist','/mixer/track_addbreak.php',{method:'get',onComplete:registerTracklist});return;},checkPPL:function(){if($('ppl_check').value==1){Dialog.info({url:'/mixer/ppl_prompt.php',parameters:'ppl=true'},{id:'ppl_license',className:'alphacube',title:'PPL License Required',width:280,height:400,zIndex:-1});return false;}},verifyPPL:function(pick){if(pick=='no'){new Ajax.Request('/mixer/ppl_process.php',{method:'get',parameters:'ajax=1&ppl='+pick,onComplete:function(){return verifyPPL('yes');}});}else if(pick=='yes'||pick=='none'){Set_Cookie('ppl_verified',1,365);}
$('ppl_check').value=0;Windows.closeAllModalWindows();return false;},setRuntime:function(time){$('total_runtime').innerHTML=time;},setTrackRuntimes:function(json){json.runtimes.each(function(node){$('track_break_label_'+node.id).innerHTML=node.runtime;});},showHourglass:function(){if(Prototype.Browser.IE)return;$('tracklist_clone').style.position='absolute';$('tracklist_clone_text').style.marginTop=$('tracklist_clone').style.height/2;Element.clonePosition($('tracklist_clone'),$('tracks'));$('tracklist_clone').show();},hideHourglass:function(){$('tracklist_clone').hide();},showHarmonics:function(keys){var hilight=new Array();$$('div.harmonic').each(function(element){element.hide();});if(!keys)return;keys.split(',').each(function(key){if(key.length==3){var hn=key.substring(0,2);var hl=key.substring(2);}else{var hn=key.substring(0,1);var hl=key.substring(1);}
hilight[0]=key;hilight[1]=hn+((hl=='B')?'A':'B');hilight[2]=(((Number(hn)-1)<1)?12:(Number(hn)-1))+hl;hilight[3]=(((Number(hn)+1)>12)?1:(Number(hn)+1))+hl;for(i=0;i<=hilight.length;i++){$$('div.key_'+hilight[i]).each(function(element){element.show();});}});$('harmonic_'+this.selected.substring(10)).hide();},delete_tracklist:function(mixid){if(!confirm("Are you sure you wish to delete this saved tracklist?")){return;}
new Ajax.Request('/mixer/mix_delete_tracklist.php',{method:'delete',parameters:'mixid='+mixid,onSuccess:function(html,json){window.location='/saved_tracklists_listall.php';}});},save:function(){new Ajax.Request('/mixer/mixer_save_tracklist.php',{method:'get',parameters:'ajax=1',onSuccess:function(html,json){if(confirm("Your tracklist has been saved.  Would you like to clear your tracklist now?")){tracklistManager.truncate();}},onFailure:function(html,json){if(json.authurl){window.location=json.authurl;}}});}};var tracklistBpm=Class.create();tracklistBpm.prototype={initialize:function(sel){this.watch=sel;this.watch.onchange=this.onchange.bindAsEventListener(this);},onchange:function(event){var id=this.watch.id.substring(11);var bpm=this.watch.options[this.watch.selectedIndex].value;tracklistManager.setRuntime('Calculating...');new Ajax.Request('/mixer/track_changebpm.php',{parameters:'id='+encodeURIComponent(id)+'&bpm='+encodeURIComponent(bpm),onComplete:function(response,json){tracklistManager.setRuntime(json.runtime);tracklistManager.setTrackRuntimes(json);}});$('bpm_'+id).innerHTML=bpm;}};var tracklistGap=Class.create();tracklistGap.prototype={initialize:function(sel){this.watch=sel;this.id=this.watch.id.substring(16);this.tracklist=$('tracklist_'+this.id);this.watch.onchange=this.onchange.bindAsEventListener(this);},onchange:function(event){var seconds=this.watch.options[this.watch.selectedIndex].value;tracklistManager.setRuntime('Calculating...');new Ajax.Request('/mixer/track_addbreak.php',{method:'get',parameters:'length='+encodeURIComponent(seconds)+'&id='+encodeURIComponent(this.id),onComplete:this.oncomplete.bind(this)});if(seconds<10)seconds='0'+seconds;$('track_break_label_'+this.id).innerHTML='00:'+seconds;},oncomplete:function(response,json){this.tracklist.setMixerId(json.mixer_id);this.tracklist.title=json.title;tracklistManager.setRuntime(json.runtime);tracklistManager.setTrackRuntimes(json);}};var tracklistMore=Class.create();tracklistMore.prototype={close:'/images/tracklist/show_addl_tools_close.gif',open:'/images/tracklist/show_addl_tools_open.gif',isopen:false,initialize:function(img){this.watch=img;this.watch.onclick=this.onclick.bindAsEventListener(this);},onclick:function(event,noslide){if(this.isopen&&!noslide){this.watch.src=this.open;Effect.toggle($('addl_tools'),'slide',{duration:0.3});}else if(!noslide){this.watch.src=this.close;Effect.toggle($('addl_tools'),'slide',{duration:0.3});}else{$('addl_tools').show();}
this.isopen=!this.isopen;Set_Cookie('tracklistMore_open',this.isopen);}}
var tracklistMetadata={initialize:function(){this.button=$('tracklist_title_btn');this.label=$('tracklist_title_span');this.input=$('tracklist_title');if($(this.button))this.button.onclick=this.onclick.bindAsEventListener(this);this.input.onkeydown=this.onkeydown.bindAsEventListener(this);},onclick:function(event){if(this.showForm){this.label.innerHTML=this.input.value;new Ajax.Request('/mixer/track_saveall.php',{method:'post',parameters:'meta_title='+encodeURIComponent(this.input.value)});this.button.src='/skin1/images/btn_change.gif';this.button.innerHTML='Change';this.input.hide();this.label.show();}else{this.button.src='/skin1/images/btn_save.gif';this.input.show();this.label.hide();this.input.focus();this.input.select();}
this.showForm=!this.showForm;},onkeydown:function(event){if(event.keyCode=='13'){this.onclick();}}}
var tracklistItem=Class.create();tracklistItem.prototype={initialize:function(t){this.watch=t;this.id=this.watch.id.substring(10);this.watch.onclick=this.onclick.bindAsEventListener(this);this.watch.onmouseover=this.onmouseover.bindAsEventListener(this);this.watch.onmouseout=this.onmouseout.bindAsEventListener(this);if(preview=$('transition_'+this.id)){this.preview=preview;this.preview.onclick=this.previewmix.bind(this);}
this.tools=$('tools_'+this.id);var info=this.watch.title.evalJSON();this.setMixerId(info.mixer_id);this.setKeycode(info.keycode);this.watch.title=info.title;this.watch.getMixerId=this.getMixerId.bind(this);this.watch.setMixerId=this.setMixerId.bind(this);},setMixerId:function(mixer_id){this.mixer_id=mixer_id;},getMixerId:function(){return this.mixer_id;},setKeycode:function(keycode){this.keycode=keycode;},getKeycode:function(){return this.keycode;},onclick:function(event){if(tracklistManager.selected==this.watch.id){var list=Sortable.sequence('tracks');if(this.preview!=null){if(list[list.length-1]==this.watch.id.substring(10)){this.preview.src='/images/tracklist/tracklist_playmix_disabled.gif';this.preview.disable();}else{this.preview.src='/images/tracklist/tracklist_playmix.gif';this.preview.enable();}
this.tools.show();}
return false;}
tracklistManager.reset();$$('#'+this.watch.id+" .track_body").each(function(b){Element.addClassName(b,'track_selected');});$$('#'+this.watch.id+" .track_toggle").each(function(rm){rm.show();});$$('#'+this.watch.id+" .track_toggle_hide").each(function(rm){rm.hide();});var list=Sortable.sequence('tracks');if(this.preview!=null){if(list[list.length-1]==this.watch.id.substring(10)){this.preview.src='/images/tracklist/tracklist_playmix_disabled.gif';this.preview.disable();}else{this.preview.src='/images/tracklist/tracklist_playmix.gif';this.preview.enable();}}
if(this.preview){Effect.SlideDown(this.tools,{duration:0.2});}
tracklistManager.select(this.watch.id);tracklistManager.showHarmonics(this.getKeycode());},previewmix:function(){var id=this.watch.id.substring(10);var list=Sortable.sequence('tracks');index=list.indexOf(id);var next_item=$('tracklist_'+list[index+1]);if(!next_item){return false;}
request="mixindex=0&desc=";if($('bpm_'+id)){mix_bpm=parseInt($('bpm_'+id).innerHTML);}else{mix_bpm=128;}
if($('bpm_'+next_item.id.substring(10))){next_bpm=parseInt($('bpm_'+next_item.id.substring(10)).innerHTML)}else{next_bpm=128;}
obj={scmode:'m',cdburn:'fit32',tracklist:[{mix_bpm:mix_bpm,mixer_id:this.watch.getMixerId()},{mix_bpm:next_bpm,mixer_id:next_item.getMixerId()}]};request+=encodeURIComponent(Object.toJSON(obj));if($('img_'+id))
img1=$('img_'+id).src;else img1='';if($('img_'+next_item.id.substring(10)))
img2=$('img_'+next_item.id.substring(10)).src;else img2='';url="flashmix://www.mixalbum.com/webservice/clickmix/demomix?"+request+"&img1="+encodeURIComponent(img1)+"&img2="+encodeURIComponent(img2);$('flashMixer').SetVariable("_root.jsCall",url);},onmouseover:function(event){},onmouseout:function(event){}};registerTracklist=function(){tracklistManager.hideHourglass();tracklistManager.selected=null;ghosting=Prototype.Browser.IE;$$('img.PListImgBox').each(function(e){new Draggable(e,{revert:true,scroll:window,ghosting:ghosting,onStart:function(){tracklistManager.reset();}});});Droppables.add('tracks',{hoverclass:'hover',accept:'PListImgBox',onDrop:function(element){if(element.hasClassName('category_1')){alert('Products in this category may be added to your cart but are not shown in the tracklist.');}
id=element.id.substring(8);tracklistManager.add(id);}});Sortable.create('tracks',{tag:'div',only:'track_sortable',overlap:'vertical',scroll:window,onUpdate:function(){tracklistManager.setRuntime('Calculating...');new Ajax.Request('/mixer/track_reorder.php',{parameters:Sortable.serialize('tracks'),onComplete:function(response,json){tracklistManager.setRuntime(json.runtime);tracklistManager.setTrackRuntimes(json);}});}});var list=Sortable.sequence('tracks');list.each(function(id){$$('.product_'+id).each(function(node){node.removeClassName("product_row_a");node.removeClassName("product_row_b");node.addClassName("product_row_selected");});});$$('.track_sortable').each(function(node){new tracklistItem(node);});$$('.track_select_bpm').each(function(node){new tracklistBpm(node);});$$('.track_select_gap').each(function(node){new tracklistGap(node);});$$('.track_delete').each(function(node){new imageSwapper(node,'/images/tracklist/btn_delete.gif','/images/tracklist/btn_delete_active.gif');});$$('.track_preview_mix').each(function(node){new imageSwapper(node,'/images/tracklist/tracklist_playmix.gif','/images/tracklist/tracklist_playmix_active.gif');});$$('.track_preview_song').each(function(node){new imageSwapper(node,'/images/tracklist/tracklist_playsample.gif','/images/tracklist/tracklist_playsample_active.gif');});$$('.track_sort_highlow').each(function(node){new imageSwapper(node,'/images/tracklist/btn_highlow.gif','/images/tracklist/btn_highlow_active.gif');});$$('.track_sort_lowhigh').each(function(node){new imageSwapper(node,'/images/tracklist/btn_lowhigh.gif','/images/tracklist/btn_lowhigh_active.gif');});$$('.track_addgap').each(function(node){new imageSwapper(node,'/images/tracklist/btn_addgap.gif','/images/tracklist/btn_addgap_active.gif');});$$('.track_btn_change').each(function(node){new imageSwapper(node,'/images/tracklist/btn_change.gif','/images/tracklist/btn_change_active.gif');});$$('.create_mix').each(function(node){new imageSwapper(node,'/images/tracklist/create_mix.gif','/images/tracklist/create_mix_active.gif');});$$('.addl_tools').each(function(node){var tl_more=new tracklistMore(node);if(Get_Cookie('tracklistMore_open')=='true'){tl_more.onclick(null,true);}});$$('div.harmonic').each(function(element){element.hide();});linkMp3Samples();tracklistMetadata.initialize();}