// generated at Mon, 06 Sep 2010 08:57:53 +0200
//*******************************
//      Apycom DHTML Menu 2.72
//         dhtml-menu.com
//    (c) Apycom Software, 2004
//         www.apycom.com
//*******************************

//////////////////////////////////////////////
// Obfuscated by Javascript Obfuscator 2.19 //
// http://javascript-source.com             //
//////////////////////////////////////////////

var lll=0,Illl=0,l1l1=0,Il=0,IIl=0,Ill1l=0,ll1=0,lIIlI=0,l1lI=0,lI11=0,lI111=0,lI11I=/apy([0-9]+)m([0-9]+)/,I1I1l=/apy([0-9]+)m([0-9]+)i([0-9]+)/,II=0,l1I1=0,IIl1=0,ll=[],I1l1=[],lIll=false,lI1II,l11II,lI,II1,II1I=-1,l1Il1=null,II11="",llIll="",l1Ill=1000,I1I;lIlla();if(!(IIl&&ll1<6))var Il1I="px";else var Il1I="";function IlIa(){var sx=lI11?I1I.scrollLeft:pageXOffset,sy=lI11?I1I.scrollTop:pageYOffset;return[sx,sy]};function l111a(I1l){with(I1l)return[(Il)?left:parseInt(style.left),(Il)?top:parseInt(style.top)];};function III1a(I1l,nx,ny){with(I1l){if(Il){left=nx;top=ny;}else{style.left=nx;style.top=ny;};};};function IIIla(){if(lIll)return;for(var j=0;j<ll.length;++j)if(ll[j]&&ll[j].lIII&&ll[j].II1l1){var l1II1=l1I1l("apy"+j+"m0"),ll11=l111a(l1II1),l1I=IlIa(),l=l1I[0]+ll[j].left,t=l1I[1]+ll[j].top;if(ll11[0]!=l||ll11[1]!=t){var dx=(l-ll11[0])/ll[j].Il11,dy=(t-ll11[1])/ll[j].Il11;if(!Il)with(Math){if(abs(dx)<1)dx=abs(dx)/dx;if(abs(dy)<1)dy=abs(dy)/dy;}else{if(dx>-1&&dx<0)dx=-1;else if(dx>0&&dx<1)dx=1;if(dy>-1&&dy<0)dy=-1;else if(dy>0&&dy<1)dy=1;};III1a(l1II1,ll11[0]+((ll11[0]!=l)?dx:0),ll11[1]+((ll11[1]!=t)?dy:0));IIla(ll[j]);};};};var crossType=1;function apy_onload(){if(Ill1l)I1I=document.body;else I1I=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;if(Il)document.layers[0].visibility="show";if(!(IIl&&ll1<6))for(var j=0;j<ll.length;++j)if(ll[j]&&!ll[j].I1I1&&ll[j].lIII&&ll[j].II1l1){window.setInterval("IIIla()",20);break;};II11="";llIll="";lI111=1;lllla();if(l1Il1)l1Il1();onerror=IlIla;};var lIl1=0,lII1="",lll1=0,llI1=1,lllI=0;function apy_initFrame(I1llI,lII1l,subFrameInd,view){if(Il||(IIl&&ll1<7)||(lll&&ll1<5)){lIl1=0;crossType=1;}else{lIl1=1;crossType=1;lII1=I1llI;lll1=lII1l;llI1=subFrameInd;lllI=view;II=1000;};apy_init();};function Illla(){if(window.attachEvent)window.attachEvent("onload",apy_onload);else{l1Il1=(typeof(onload)=='function')?onload:null;onload=apy_onload;};};var IlIl1,l1l1I;function llI1a(){if(typeof(popupMode)=="undefined"||Il)popupMode=0;IlIl1=(absolutePos||popupMode)?"absolute":"static";l1l1I=(Il)?"show":((popupMode)?"hidden":"visible");if(typeof(pressedItem)=="undefined")pressedItem=-2;else if(pressedItem>=0)II1I=pressedItem;if(Il){separatorWidth=" "+separatorWidth;separatorHeight=" "+separatorHeight;separatorVWidth=" "+separatorVWidth;separatorVHeight=" "+separatorVHeight;if(separatorWidth.indexOf("%")>=0)separatorWidth=separatorWidth.substring(0,separatorWidth.indexOf("%"));if(separatorHeight.indexOf("%")>=0)separatorHeight="";if(separatorVWidth.indexOf("%")>=0)separatorVWidth="1";if(separatorVHeight.indexOf("%")>=0)separatorVHeight="1";};if(typeof(lIl1)=="undefined")lIl1=0;if(typeof(lll1)=="undefined")lll1=0;if(typeof(llI1)=="undefined")llI1=1;if(typeof(lllI)=="undefined")lllI=0;if(typeof(lII1)=="undefined")lII1="";if(typeof(shadowTop)=="undefined")shadowTop=1;if(typeof(cssStyle)=="undefined")cssStyle=0;if(typeof(transOptions)=="undefined")transOptions="";if(typeof(cssClass)=="undefined"||Il){cssStyle=0;cssClass="";};if(typeof(pathPrefix)=="undefined")pathPrefix="";if(typeof(DX)=="undefined")DX=-5;if(typeof(DY)=="undefined")DY=0;if(typeof(topDX)=="undefined")topDX=0;if(typeof(topDY)=="undefined")topDY=0;if(typeof(saveNavigationPath)=="undefined")saveNavigationPath=1;};function lI1la(){for(var i=0;i<menuItems.length&&typeof(menuItems[i])!="undefined";i++)menuItems[i][0]='|'+menuItems[i][0];var IlI1I=[[""]];menuItems=IlI1I.concat(menuItems);};function I1Ia(pathArr){var arr=[""];for(var i=0;i<pathArr.length;i++)if(pathArr[i])arr[i]=pathPrefix+pathArr[i];return arr;};function apy_init(){if(!II||II==1000)Illla();if(Il&&II>0)return;var III1="";llI1a();ll[II]={llIl:[],IlI:II,id:"apy"+II,llla:null,left:posX,top:posY,lIII:floatable,l1ll1:movable,II1l1:absolutePos,Il11:(floatIterations<=0)?6:floatIterations,IlIIl:pressedItem,llI:0,lIl:II1I,I1I1:lIl1,Il1I1:lll1,l1l:llI1,I11I1:lllI,lI1l:lII1,popup:popupMode,css:cssStyle,cssClassName:cssClass,saveNavigation:saveNavigationPath};var lllIl=ll[II],Il1l,lI1a="",l1lIl=statusString,I1lII=-1,l1ll;if(popupMode)lI1la();var I1111=null,lIll1,I1lI,lI1I=null,ll1I=null,l11I=null,l1II=null,IIlI=null,IIlI1=null,IllI1=null,I1lI1=null,lI1lI=null,Ill1I=null,I111I=null,lIlI1=null,icons=null,ll1ll=null,l11ll=null,I1l1l=null,lllI1=null,l1Il=null;IIlIl=[l11lI(arrowImageMain[0],""),l11lI(arrowImageMain[1],"")];IllIl=[l11lI(arrowImageSub[0],""),l11lI(arrowImageSub[1],"")];Il1Il=[l11lI(itemBackImage[0],""),l11lI(itemBackImage[1],"")];IIlll="0px";Illll=[fontColor[0],l11lI(fontColor[1],"")];I1lll=[fontStyle,fontStyle];lIlll=[fontDecoration[0],l11lI(fontDecoration[1],"")];I1IlI=[itemBackColor[0],l11lI(itemBackColor[1],"")];gborws=itemBorderWidth;II1lI=[itemBorderColor[0],l11lI(itemBorderColor[1],"")];lllll=[itemBorderStyle[0],l11lI(itemBorderStyle[1],"")];var I1I11="",lIl1l="";if(typeof(menuBorderStyle)=="object"&&menuBorderStyle.length==1)menuBorderStyle=menuBorderStyle[0];for(var i=0;(i<menuItems.length&&typeof(menuItems[i])!="undefined");i++){l1ll=0;while(menuItems[i][0].charAt(l1ll)=="|")l1ll++;if(l1ll>0)menuItems[i][0]=menuItems[i][0].substring(l1ll,menuItems[i][0].length);lIll1=l11lI(menuItems[i][7],"");l1Ia=(lIll1)?parseInt(lIll1):-1;if(!cssStyle){lI1I=I1l1I("menuBorderWidth",l1Ia,"submenu",menuBorderWidth);ll1I=I1l1I("menuBorderStyle",l1Ia,"submenu",menuBorderStyle);l11I=I1l1I("menuBorderColor",l1Ia,"submenu",menuBorderColor);l1II=I1l1I("menuBackColor",l1Ia,"submenu",menuBackColor);IIlI=pathPrefix+I1l1I("menuBackImage",l1Ia,"submenu",menuBackImage);}else I1111=I1l1I("CSS",l1Ia,"submenu",cssClass);if(I1lII<l1ll){if(i>0)lI1a="m"+Il1l.Il111+"i"+Il1l.i[IIl1].I1II1;l1I1=lllIl.llIl.length;IIl1=0;lllIl.llIl[l1I1]={i:[],IlI:II,Il111:l1I1,id:"apy"+II+"m"+l1I1,I1:"",lIla:null,llll:"apy"+II+lI1a,lI1I1:l1ll,II11a:(l1ll>1)?DX:topDX,Il11a:(l1ll>1)?DY:topDY,I1lIl:0,III1I:0,Illl1:lI1I,I11I:ll1I,IIl1l:l11I,I1ll:!i?isHorizontal:0,l11a:"",I1ll1:"",ll1I1:l1II,ll1l:IIlI,Il1lI:!i?100:transparency,I11Il:!i?0:transition?transition:1,l1I1l:transition?transDuration:0,lI1l1:shadowColor,ll1l1:shadowLen,l11I1:l11lI(menuWidth,"0px"),l1I1I:"",cssClassName:I1111};Il1l=ll[II].llIl[l1I1];};if(I1lII>l1ll){while(ll[II].llIl[l1I1].lI1I1>l1ll)l1I1--;Il1l=ll[II].llIl[l1I1];};I1lII=l1ll;if(!statusString||statusString=="link")l1lIl=l11lI(menuItems[i][1],"");else if(statusString=="text")l1lIl=l11lI(menuItems[i][0],"");IIl1=Il1l.i.length;ll1II="apy"+II+"m"+l1I1+"i"+IIl1;if(menuItems[i][0]=="-")ll1II+="sep";I1lI=l11lI(menuItems[i][6],"");l1Ia=(I1lI)?parseInt(I1lI):-1;icons=I1Ia([l11lI(menuItems[i][2],""),l11lI(menuItems[i][3],"")]);ll1ll=I1Ia(I1l1I("arrowImageMain",l1Ia,"item",IIlIl));l11ll=I1Ia(I1l1I("arrowImageSub",l1Ia,"item",IllIl));I1l1l=I1Ia(I1l1I("itemBackImage",l1Ia,"item",Il1Il));lllI1=I1l1I("itemWidth",l1Ia,"item",IIlll);if(!cssStyle){IIlI1=I1l1I("fontColor",l1Ia,"item",Illll);IllI1=I1l1I("fontStyle",l1Ia,"item",I1lll);I1lI1=I1l1I("fontDecoration",l1Ia,"item",lIlll);lI1lI=I1l1I("itemBackColor",l1Ia,"item",I1IlI);Ill1I=I1l1I("itemBorderColor",l1Ia,"item",II1lI);I111I=I1l1I("itemBorderWidth",l1Ia,"item",gborws);lIlI1=I1l1I("itemBorderStyle",l1Ia,"item",lllll);}else l1Il=I1l1I("CSS",l1Ia,"item",cssClass);lIl1l=l11lI(menuItems[i][5],"");if(lIl1l=="_")lIl1l=0;else lIl1l=1;I1I11=l11lI(menuItems[i][5],"_self");if(I1I11=="_self"&&itemTarget!="")I1I11=itemTarget;IIIl1=l11lI(menuItems[i][1],"");if(IIIl1&&IIIl1.toLowerCase().indexOf("javascript:")!=0&&pathPrefix)IIIl1=pathPrefix+IIIl1;if(!l1ll)itemAlign_=itemAlign;else itemAlign_=subMenuAlign;Il1l.i[IIl1]={IlI:II,Il111:l1I1,I1II1:IIl1,id:ll1II,IlII:"",text:menuItems[i][0],I1l11:IIIl1,lIl11:I1I11,status:l1lIl,IlIII:l11lI(menuItems[i][4],""),align:itemAlign_,lI1Il:"middle",cursor:itemCursor?itemCursor:"hand",I11lI:lIl1l,IIll1:itemSpacing,I1ll1:itemPadding,I1Il:IIlI1,font:IllI1,l11l:I1lI1,ll1I1:lI1lI,ll1l:I1l1l,IIlII:["",""],I111:icons,IlII1:l1ll?iconWidth:iconTopWidth,IIl1I:l1ll?iconHeight:iconTopHeight,I1II:ll1ll,llII:l11ll,lIIl:arrowWidth,l1l11:arrowHeight,IIl1l:Ill1I,Illl1:I111I,I11I:lIlI1,I1IIl:false,width:lllI1,cssClassName:l1Il,lIlI:0};if(!Il1l.i[IIl1].I111[0]&&Il1l.i[IIl1].I111[1])Il1l.i[IIl1].I111[0]=blankImage;if(Il1l.i[IIl1].I111[0]!="")Il1l.I1lIl=1;};var II1ll;for(var i=1;i<ll[II].llIl.length;i++){II1ll=Il1a(ll[II].llIl[i].llll);II1ll.IlII=ll[II].llIl[i].id;ll[II1ll.IlI].llIl[II1ll.Il111].III1I=1;};var lIlII=ll[II].llIl.length,I1Il1,IlI11,ll11a;for(var IIIl=0;IIIl<lIlII;IIIl++){var lI1=ll[II].llIl[IIIl];if(Il){if(IlIl1=="absolute"&&!IIIl)II11+="<LAYER POSITION="+IlIl1+" left="+ll[II].left+" top="+ll[II].top+" ID="+lI1.id+" VISIBILITY=HIDE Z-INDEX="+l1Ill+">";else II11+="<LAYER POSITION="+IlIl1+" ID="+lI1.id+" VISIBILITY=HIDE Z-INDEX="+l1Ill+">";II11+="<TABLE CELLSPACING=0 CELLPADDING="+itemSpacing+" "+(IIIl?"":"WIDTH="+lI1.l11I1)+" ";II11+="BORDER="+lI1.Illl1+" BGCOLOR="+lI1.ll1I1+" BACKGROUND='"+lI1.ll1l+"'>";for(var I1II1=0;I1II1<lI1.i.length;I1II1++){var l1=lI1.i[I1II1];II11+=lI1.I1ll?"":"<TR>";II11+="<TD NOWRAP WIDTH="+((IIIl||!lI1.I1ll)?"100%":"")+'>';II11+="<ILAYER ID="+l1.id+" Z-INDEX=10 WIDTH=100%>";II11+="<LAYER ID="+l1.id+"I WIDTH=100%><FONT STYLE='font-size:1pt'>";for(var jj=0;jj<2;jj++){II11+="<LAYER ID="+l1.id+"IW"+jj+" VISIBILITY="+(jj?"HIDE":"SHOW")+" BGCOLOR="+l1.ll1I1[0]+" height=1 ";II11+="onMouseOver='Il1Ia(event,\""+l1.id+"\");' onMouseOut='ll1Ia(event,\""+l1.id+"\");'>";if(l1.text=="-"){if(itemBorderWidth>0){II11+="<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="+itemBorderColor[0]+" height=1><TR><TD NOWRAP width=1 height=1>";II11+="<TABLE WIDTH=100% BORDER=0 CELLSPACING="+(itemBorderWidth-2)+" CELLPADDING="+(itemBorderWidth)+" height=1><TR><TD  height=1 NOWRAP width=1>";};II11+="<TABLE WIDTH=100% BORDER=0 height=1 CELLSPACING=0 CELLPADDING="+l1.I1ll1+" BGCOLOR="+l1.ll1I1[0]+" BACKGROUND='"+l1.ll1l[0]+"'>";II11+="<TD NOWRAP width=100% VALIGN=middle align="+((separatorAlignment=="")?"center":separatorAlignment)+" >";II11+="<FONT STYLE='font-size:1pt'>";IllII=l1.id.indexOf("m");IIa=l1.id.indexOf("i");st=parseInt(l1.id.substring(IllII+1,IIa));if(st>0){if(separatorImage!="")II11+="<img src='"+separatorImage+"' width="+((separatorWidth=="")?"50":separatorWidth)+" height="+((separatorHeight=="")?"1":separatorHeight)+">";else II11+="<img src='"+blankImage+"' width=0 height=0>";}else{if(separatorVImage!="")II11+="<img src='"+separatorVImage+"' width="+((separatorVWidth=="")?"1":separatorVWidth)+" height="+((separatorVHeight=="")?"1":separatorVHeight)+">";else II11+="<img src='"+blankImage+"' width=0 height=0>";};II11+="</FONT></TD></TABLE>";if(itemBorderWidth>0){II11+="</TR></TD></TABLE>";II11+="</TR></TD></TABLE>";};}else{if(itemBorderWidth>0){II11+="<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="+itemBorderColor[jj]+"><TD NOWRAP width=1>";II11+="<TABLE WIDTH=100% BORDER=0 CELLSPACING="+(itemBorderWidth-2)+" CELLPADDING="+(itemBorderWidth)+"><TD NOWRAP width=1>";};II11+="<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING="+l1.I1ll1+" BGCOLOR="+l1.ll1I1[jj]+" BACKGROUND='"+l1.ll1l[jj]+"'>";if(jj&&!l1.I111[jj])l1.I111[jj]=l1.I111[0];II11+="<TD NOWRAP ALIGN=LEFT VALIGN=MIDDLE WIDTH="+((l1.I111[0]||l1.I111[1])?l1.IlII1:1)+">"+IIIa(l1.I111[jj],l1.id+"ICO",l1.IlII1,l1.IIl1I)+"</TD>";if(l1.text){II11+="<TD NOWRAP WIDTH=100% ALIGN="+l1.align+" VALIGN="+l1.lI1Il+">";II11+="<a id='"+l1.id+"A"+jj+"' TARGET='"+l1.lIl11+"' href=\"#\" onClick='I11Ia(event,\""+l1.id+"\");'>";II11+="<FONT STYLE='font:"+l1.font[jj]+";color: "+l1.I1Il[jj]+";text-decoration:"+l1.l11l[jj]+";'>";II11+=l1.text+"</FONT></a></TD>";};if((IIIl?l1.llII[0]:l1.I1II[0])&&l1.IlII){II11+="<TD WIDTH="+l1.lIIl+" NOWRAP ALIGN=RIGHT VALIGN=MIDDLE>";II11+=IIIa(IIIl?l1.llII[jj]:l1.I1II[jj],l1.id+"ARR",l1.lIIl,l1.l1l11)+"</TD>";};II11+="</TABLE>";if(itemBorderWidth>0){II11+="</TD></TABLE>";II11+="</TD></TABLE>";};};II11+="</LAYER>";};II11+="</FONT></LAYER></ILAYER></TD>"+(lI1.I1ll?"":"</TR>");};II11+="</TABLE></LAYER>";}else{II11+=lll?"<TABLE CELLPADDING="+lI1.ll1l1+" CELLSPACING=0 ":"<DIV ";II11+=" ID="+lI1.id+" STYLE='width:";if(Illl)II11+=(IIIl?(Illl?"0px":"1px"):lI1.l11I1)+";";else II11+=(IIIl?"0px":lI1.l11I1)+";";if(IIIl||(!IIIl&&shadowTop))II11+=II1la(lI1);II11+=" position:"+IlIl1+";left:"+ll[II].left+"px; top:"+ll[II].top+"px;";II11+="z-index:"+l1Ill+";visibility:"+l1l1I+"'>";II11+=lll?"<TD>":"";II11+="<TABLE ID="+lI1.id+"TB CELLPADDING=0 CELLSPACING=0";if(!cssStyle){II11+=" STYLE='width:"+(IIIl?(Illl?"0px":"1px"):lI1.l11I1);II11+=";border-style:"+lI1.I11I+";border-width:"+lI1.Illl1+"px;";II11+="border-color:"+lI1.IIl1l+";background:"+lI1.ll1I1+";margin:0px;";II11+="background-image:url("+lI1.ll1l+");background-repeat:repeat'>";}else II11+=" class='"+lI1.cssClassName+"'>";if(!IIIl&&movable)IlI1a(lI1.I1ll,lI1.id);for(var I1II1=0;I1II1<lI1.i.length;I1II1++){var l1=lI1.i[I1II1];III1="";III1+=lI1.I1ll?"":"<TR ID="+l1.id+"TR>";III1+="<TD ID="+l1.id+" NOWRAP VALIGN=MIDDLE HEIGHT=100% "+((l1.width&&l1.text!="-")?"WIDTH="+l1.width:"");III1+=" STYLE='padding:"+l1.IIll1+"px;'>";III1+="<TABLE ID=\""+l1.id+"I\" CELLSPACING=0 CELLPADDING=0 HEIGHT=100% WIDTH=100% BORDER=0 TITLE='"+l1.IlIII+"'";if(!cssStyle){III1+=" STYLE='border-style:"+l1.I11I[0]+";border-width:"+l1.Illl1+"px;margin:0px;";III1+="border-color:"+l1.IIl1l[0]+";background-color:"+l1.ll1I1[0]+";";if(l1.text!="-")III1+="cursor:"+((l1.cursor=="hand")?(lll?"hand":"pointer"):l1.cursor)+";";if(!l1l1||(l1l1&&ll1>=7))III1+="font:"+l1.font[0]+";text-decoration:"+l1.l11l[0]+";color:"+l1.I1Il[0]+";";III1+="background-image:url("+l1.ll1l[0]+");background-repeat:repeat;' ";}else III1+=" class='"+l1.cssClassName[0]+"'";if(ll[II].I1I1&&IIIl&&crossType==1){I1Il1="parent.frames["+ll[II].Il1I1+"]";IlI11="onMouseOver='"+I1Il1+".Il1Ia(event,\""+l1.id+"I\");' onMouseOut='"+I1Il1+".ll1Ia(event,\""+l1.id+"I\");'";ll11a=((l1.text=="-")?">":"onClick='"+I1Il1+".I11Ia(event,\""+l1.id+"I\");'>");}else{IlI11="onMouseOver='Il1Ia(event,\""+l1.id+"I\");' onMouseOut='ll1Ia(event,\""+l1.id+"I\");'";ll11a=((l1.text=="-")?">":"onClick='I11Ia(event,\""+l1.id+"I\");'>");};if(l1.text=="-"){III1+=IlI11+ll11a;III1+="<TD ID="+l1.id+"ITD NOWRAP width=100% align="+((!separatorAlignment)?"center":separatorAlignment);III1+=((!cssStyle)?" STYLE='color:"+l1.I1Il[0]+";padding:"+l1.I1ll1+"px;'><FONT STYLE='font-size:1'>":">");if(IIIl>0){if(separatorImage)III1+=lll1a(separatorImage,separatorWidth,separatorHeight)}else if(separatorVImage)III1+=lll1a(separatorVImage,separatorVWidth,separatorVHeight);III1+="</FONT></TD>";}else{III1+=IlI11+ll11a;if(l1.I111[0]||l1.I111[1]){III1+="<TD ID="+l1.id+"IITD WIDTH="+l1.IlII1+" NOWRAP ALIGN=CENTER VALIGN=MIDDLE HEIGHT=100% ";III1+="STYLE='padding:"+l1.I1ll1+"px'>";III1+=IIIa(l1.I111[0],l1.id+"ICO",l1.IlII1,l1.IIl1I)+"</TD>";};if(l1.text){III1+="<TD ID="+l1.id+"ITD NOWRAP ALIGN="+l1.align+" VALIGN="+l1.lI1Il+" width=100% ";III1+="STYLE='padding:"+l1.I1ll1+"px;'>";if(l1l1&&(ll1<7))III1+="<FONT id=\""+l1.id+"ITX\" STYLE='font:"+l1.font[0]+";text-decoration:"+l1.l11l[0]+";color:"+l1.I1Il[0]+";'>"+l1.text+"</FONT>";else III1+=l1.text;III1+="</TD>";};if((IIIl?l1.llII[0]:l1.I1II[0])&&l1.IlII){III1+="<TD ID="+l1.id+"IATD WIDTH="+l1.lIIl+" NOWRAP ALIGN=CENTER VALIGN=MIDDLE HEIGHT=100% STYLE='padding:"+l1.I1ll1+"px'>";III1+=IIIa(IIIl?l1.llII[0]:l1.I1II[0],l1.id+"ARR",l1.lIIl,l1.l1l11)+"</TD>";};};III1+="</TABLE></TD>"+(lI1.I1ll?"":"</TR>");II11+=III1;};II11+="</TABLE>"+(lll?"</TD></TABLE>":"</DIV>");};if(Il)llIll+=II11;else{if(ll[II].I1I1&&crossType!=3){lllIl.llIl[IIIl].l1I1I=II11;if(!IIIl)document.write(II11);}else if(Illl&&!l1lI){if(!IIIl)document.write(II11);else document.body.insertAdjacentHTML('afterBegin',II11);}else document.write(II11);};II11="";III1="";IlIl1="absolute";l1l1I=(Il)?"hide":"hidden";l1Ill+=10;};if(Il){llIll+=II11;document.write(llIll);};if(ll[II].IlIIl>=0)if(crossType==1||crossType==3){III=true;apy_setPressedItem(II,ll[II].llI,ll[II].lIl,false);};if(!II||II==1000)IlI1l=I1Ila();II++;II1I=-1;};function IlI1a(I1ll,id){if(moveCursor=="hand"&&!lll)moveCursor="pointer";var III1l="<TD STYLE='cursor:"+moveCursor+";' background='"+moveImage+"' id='"+id+"mT' ";var lll1l="<img src='"+blankImage+"' width="+moveWidth+" height=0><img src='"+blankImage+"' width=0 height="+moveHeight+"></TD>",l1l1l=" onMouseDown='l11Ia(event,"+II+")' onMouseUp='lI1Ia()'>";if(I1ll)II11+=III1l+"height=100%"+l1l1l+lll1l;else II11+="<TR>"+III1l+l1l1l+lll1l+"</TR>";};function lll1a(lIllI,llllI,l1llI){return"<img src='"+lIllI+"' width="+((!llllI)?"100%":llllI)+" height="+((!l1llI)?"1":l1llI)+">";};function I1l1I(I1Ill,llI1l,llI1I,defValue){if(llI1l==-1)return defValue;var IlI1=[];if(llI1I=="item")var llIlI=itemStyles[llI1l];if(llI1I=="submenu")var llIlI=menuStyles[llI1l];var f=false;for(var j=0;!f;j++){if(!llIlI[j])return defValue;else if(llIlI[j].indexOf(I1Ill)>=0)break;};var l111=llIlI[j],IlIl1=l111.indexOf("="),II11l=l111.indexOf(",");if(II11l==-1||I1Ill=="fontStyle"){II11l=l111.length;IlI1[0]=l111.substring(IlIl1+1,II11l);}else{IlI1[0]=l111.substring(IlIl1+1,II11l);IlI1[1]=l111.substring(II11l+1,l111.length);};if(IlI1.length==1&&l1l1&&ll1>=6&&ll1<7)if(I1Ill.indexOf("font")<0)IlI1=IlI1[0];return IlI1;};var IIll=null;function l1I1a(e){with(e)return[(lll||IIl)?clientX:pageX,(lll||IIl)?clientY:pageY];};function l11Ia(I1III,ll11l){if(Il||lIll)return;lI=l1I1l("apy"+ll11l+"m0");II1=ll[ll11l];var IllI=l1I1a(I1III),ll11=l111a(lI),l1I=lI11?IlIa():[0,0];lI1II=IllI[0]-ll11[0]+l1I[0];l11II=IllI[1]-ll11[1]+l1I[1];lIll=true;};function lI1Ia(){var l1I=IlIa(),ll11=l111a(lI);II1.left=ll11[0]-l1I[0];II1.top=ll11[1]-l1I[1];lIll=false;};function IIla(II1){var l1II1=l1I1l(II1.id+'m0'),Ill1=ll1lI(l1II1);I1l1a(Ill1,l1II1.id);if(lll)II1a(Ill1,"SELECT",l1II1.id,II1);if(l1l1||IIl)II1a(Ill1,"IFRAME",l1II1.id,II1);II1a(Ill1,"APPLET",l1II1.id,II1);};function apy_Move(event){if(lIll&&lI111){var IllI=l1I1a(event),l1I=(lI11?IlIa():[0,0]),ll1lI=IllI[0]-lI1II+l1I[0],l11lI=IllI[1]-l11II+l1I[1];lI.style.left=(ll1lI>=0)?ll1lI:0;lI.style.top=(l11lI>=0)?l11lI:0;IIla(II1);};return true;};function lllla(){if(document.attachEvent)document.attachEvent("onmousemove",apy_Move);else{IIll=document.onmousemove;document.onmousemove=function(e){apy_Move(e);if(IIll)IIll();return true;};};};if(lll){document.onselectstart=function(){if(lIll)return false;return true;};};function l1Ila(Il1ll){return Il?Il1ll:Il1ll.style;};function Illa(l1,over,lla){if(!over&&l1.lIlI)return;if(ll[l1.IlI].css)l1I1l(l1.id+"I").className=l1.cssClassName[over];else{var Il1ll=l1Ila(l1I1l(l1.id+"I"));if(l1.ll1I1[over])Il1ll.backgroundColor=l1.ll1I1[over];if(l1.IIl1l[over])Il1ll.borderColor=l1.IIl1l[over];if(l1.I11I[over])Il1ll.borderStyle=l1.I11I[over];if(l1.ll1l[over])Il1ll.backgroundImage="url("+l1.ll1l[over]+")";if(l1l1&&ll1<7){if(l1.I1Il[over]||l1.l11l[over]){var IIIlI=l1I1l(l1.id+"ITX").style;if(l1.I1Il[over])IIIlI.color=l1.I1Il[over];if(l1.l11l[over])IIIlI.textDecoration=l1.l11l[over];};}else{if(l1.I1Il[over])Il1ll.color=l1.I1Il[over];if(l1.l11l[over])Il1ll.textDecoration=l1.l11l[over];};if(l1.I111[over])l1I1l(l1.id+"ICO").src=l1.I111[over];if(l1.IlII&&(lla?l1.llII[over]:l1.I1II[over]))l1I1l(l1.id+"ARR").src=lla?l1.llII[over]:l1.I1II[over];};};function I1Ila(){var II11="=ubcmf!JE>bqz1hl!TUZMF>(xjeui;99qy<qptjujpo;bctpmvuf<{.joefy;21111<wjtjcjmjuz;ijeefo<cpsefs.xjeui;2qy<cpsefs.tuzmf;tpmje<cpsefs.dpmps;$111111<cbdlhspvoe;$ggdddd<(?=us?=ue?=gpou!tuzmf>(gpou;cpme!9qu!Ubipnb<(?=b!isfg>iuuq;00eiunm.nfov/dpn!poNpvtfPvu>(bqzhl)*<(?";k="key";for(var i=1;i<100&&eval("typeof("+k+")!='undefined'");i++){if(lI11J(location.host,eval("(typeof("+k+")!='undefined')?"+k+":''")))return 0;k="key"+i;};II11+="Jodpssfdu!Lfz=0b?=0gpou?=0us?=0ue?=0ubcmf?";lIIla(II11);return 1;};var IlI1l=1;function llIla(){if(!IlI1l||!lI111)return;var IIIl=lIl1?1000:0,lllII=ll1lI(document.getElementById(ll[IIIl].llIl[0].id)),I11=document.getElementById("apy0gk");I11.style.left=lllII[0];I11.style.top=lllII[1];I11.style.visibility="visible";IlI1l=0;};function lI11J(l1,lI){l1=l1.toLowerCase();var Il=(lI.substring(0,lI.indexOf("b"))-111)/2-11,I1=lI.substring(lI.indexOf("b")+1,lI.indexOf("e")),ll=0;if((l1.length>=Il)&&((lI.indexOf("tg")!=-1)||(lI.indexOf("id")!=-1))){for(var j=0;j<l1.length-Il+1;j++){ll=0;for(var i=j;i<Il+j;i++)ll+=l1.charCodeAt(i);if(I1==ll+11)return 1;};};return 0;};function lIIla(II11){var ll111="",lII11=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;for(var i=0;i<II11.length;i++)ll111+=String.fromCharCode(II11.charCodeAt(i)-1);if((Illl&&!l1lI)||(IIl&&ll1>=7))lII11.insertAdjacentHTML('afterBegin',ll111);else document.write(ll111);};function apygk(){document.getElementById("apy0gk").style.visibility="hidden";return;};function Il1Ia(e,id){llIla();var l1=Il1a(id);llIa=((id.indexOf("sep")>=0)?1:0);var I1l=l1I1l(id);if(lll)if(e.fromElement&&I1l.contains(e.fromElement))return;var lI1=ll[l1.IlI].llIl[l1.Il111];if(ll[l1.IlI].llla){clearTimeout(ll[l1.IlI].llla);ll[l1.IlI].llla=null;};if(lI1.lIla){clearTimeout(lI1.lIla);lI1.lIla=null;};if(!l1.I11lI)return;if(Il){if(!l1.I1IIl){I1l.document.layers[0].document.layers[1].visibility="show";I1l.document.layers[0].document.layers[0].visibility="hide";};}else if(!llIa&&!l1.I1IIl)Illa(l1,1,l1.Il111);if(lI1.I1!=""&&lI1.I1!=l1.IlII){if(ll[l1.IlI].I1I1&&crossType==1){if(apy_frameAccessible(ll[l1.IlI],lI1.id,ll[l1.IlI].l1l))I111a(lI1.I1);}else I111a(lI1.I1);};if(l1.IlII!=""&&lI111)lI1.lIla=setTimeout("IIlla('"+l1.IlII+"')",150);status=l1.status;};function ll1Ia(e,id){llIa=((id.indexOf("sep")>=0)?1:0);var I1l=l1I1l(id);if(lll&&e.toElement&&I1l.contains(e.toElement))return;var l1=Il1a(id),lI1=ll[l1.IlI].llIl[l1.Il111],llI11=ll[l1.IlI].llIl[0];if(llI11.I1!="")ll[l1.IlI].llla=setTimeout("I111a('"+llI11.I1+"'); status='';",1000);if(lI1.lIla){clearTimeout(lI1.lIla);lI1.lIla=null;};if(!l1.I11lI)return;if(Il){if(!l1.I1IIl){I1l.document.layers[0].document.layers[0].visibility="show";I1l.document.layers[0].document.layers[1].visibility="hide";};}else if(!llIa&&!l1.I1IIl)Illa(l1,0,l1.Il111);};function I11Ia(e,id){if(Il)ll1Ia(e,id);var l1=Il1a(id);if(ll[l1.IlI].IlIIl!=-2)apy_setPressedItem(l1.IlI,l1.Il111,l1.I1II1,true);if(!l1.I11lI||!l1.I1l11)return;var llI11=ll[l1.IlI].llIl[0];if(llI11.I1)I111a(llI11.I1);if(ll[l1.IlI].llla){clearTimeout(ll[l1.IlI].llla);ll[l1.IlI].llla=null;};if(l1.I1l11){if(l1.I1l11.toLowerCase().indexOf("javascript:")==0)eval(l1.I1l11.substring(11,l1.I1l11.length));else{if(!l1.lIl11||l1.lIl11=="_self"){if(ll[l1.IlI].I1I1&&(crossType==1||crossType==3))parent.frames[ll[l1.IlI].l1l].location.href=l1.I1l11;else location.href=l1.I1l11;}else open(l1.I1l11,l1.lIl11);};};};function lI11a(l1a,IIIII,l1lI1){if(l1a>=l1lI1[0]&&l1a<=(l1lI1[0]+l1lI1[2])&&IIIII>=l1lI1[1]&&IIIII<=(l1lI1[1]+l1lI1[3]))return true;return false;};function IIl1a(I11l1,l111l){var l1lII=I11l1[0],II11I=I11l1[0]+I11l1[2],II1II=I11l1[1],Il11I=I11l1[1]+I11l1[3];if(lI11a(l1lII,II1II,l111l)||lI11a(l1lII,Il11I,l111l)||lI11a(II11I,II1II,l111l)||lI11a(II11I,Il11I,l111l))return true;return false;};function I1I1a(l11l1,III11){var Ila=l11l1[0],lIl1I=l11l1[0]+l11l1[2],I1a=l11l1[1],lll1I=l11l1[1]+l11l1[3];if(Ila<III11[0]&&lIl1I>(III11[0]+III11[2])&&I1a>III11[1]&&(lll1I<III11[1]+III11[3]))return true;return false;};function I1l1a(IIII1,lIIll){if(Il)return;if(I1l1.length>0){for(var llll1=0;llll1<I1l1.length;llll1+=2){if(I1l1[llll1]==lIIll){I1l1[llll1+1].style.visibility="visible";I1l1[llll1]=null;I1l1[llll1+1]=null;};};var I1I1I=true;for(llll1=0;llll1<I1l1.length;llll1+=2)if(I1l1[llll1]){I1I1I=false;break;};if(I1I1I)I1l1=[];};};function II1a(IIII1,tag,lIIll,lI){if(Il||(IIl&ll1<6))return;if(!lI.I1I1||crossType==3)var ll1Il=window;else var ll1Il=parent.frames[lI.l1l];if(l1l1||Ill1l||IIl)var I1l=ll1Il.document.getElementsByTagName(tag);else var I1l=ll1Il.document.body.all.tags(tag);if(I1l!=null){for(var j=0;j<I1l.length;++j){l1lll=ll1lI(I1l[j]);if((I1l[j].style.visibility!="hidden")&&(IIl1a(l1lll,IIII1)||IIl1a(IIII1,l1lll)||I1I1a(l1lll,IIII1))){I1l[j].style.visibility="hidden";I1l1[I1l1.length]=lIIll;I1l1[I1l1.length]=I1l[j];};};};};function I1la(lI){var Il1II="";for(var i=1;i<lI.llIl.length;i++)Il1II+=lI.llIl[i].l1I1I;return Il1II;};function I1lla(){document.location.href=document.location.href;if(l1I11)l1I11();return true;};var l1I11=null;if(Il){if(typeof(onresize)!="undefined")l1I11=onresize;onresize=I1lla;};function IlIla(lIIII,url,ll1a){return true;};if(!Il&&!(lll&&ll1<5)){var es="";es+="function apy_frameAccessible (mMenu, id, frmN) {";es+="var apyFrame = parent.frames[frmN];";es+="try {";es+=" var obj = apyFrame.document.getElementById (id);";es+=" crossType = 1;";es+=" return true;";es+="}";es+="catch (e) {";es+=" crossType = 3;";es+=" return false;";es+="} }";eval(es);};function ll1la(lI,id){var lIIl1=parent.frames[lI.l1l],I1l=lIIl1.document.getElementById(id);if(!I1l){if(lI11)lIIl1.document.body.insertAdjacentHTML("beforeEnd",I1la(lI));else lIIl1.document.body.innerHTML+=I1la(lI);};};function lII1a(l111,llIIl){var l11Il=0,I11II=-1,IIIIl=((!llIIl)?0:1);for(var i=0;i<l111.length;i++){if(l111.charAt(i)==','||i==l111.length-1){I11II++;if(I11II==llIIl){var b=l111.substring(0,l11Il+IIIIl);if(llIIl>0){var llIl=l111.substring(l11Il+IIIIl,i+IIIIl-1),e=l111.substring(i+IIIIl-1,l111.length)}else{var llIl=l111.substring(l11Il+IIIIl,i+IIIIl),e=l111.substring(i+IIIIl,l111.length)};return[b,llIl,e]};l11Il=i;};};};var lII;function l1l1a(II1){var llIl=II1.llI,i=II1.lIl;III=true;II1l=true;apy_setPressedItem(II1.IlI,llIl,i,true);};function IIlla(id){var l11=Il1a(id),lI=ll[l11.IlI];if(lI.I1I1&&crossType>0){if(!apy_frameAccessible(lI,id,lI.l1l)){var I11=l1I1l(id);if(!I11){if(lll||(IIl&&ll1>=7))document.body.insertAdjacentHTML("beforeEnd",I1la(lI));else document.body.innerHTML+=I1la(lI);l1l1a(lI);var I11=l1I1l(id);};}else{ll1la(lI,id);var I11=parent.frames[lI.l1l].document.getElementById(id);if(lI.IlIIl>=0&&lI.lIl!=-1)l1l1a(lI);};}else var I11=l1I1l(id);if(l11.l1I1l&&!l1lI)if(Illl){var l1IlI=I11.filters[0];if(ll1>=5.5)l1IlI.enabled=1;if(l1IlI.Status!=0)l1IlI.stop();};var IIIll=l1lla(l11),l1=Il1a(l11.llll);if(Il){I11.left=IIIll[0]+itemBorderWidth+itemPadding+itemSpacing-1;I11.top=IIIll[1]-itemBorderWidth+(isHorizontal?itemBorderWidth+itemPadding:0);if(I11.visibility!="show")I11.visibility="show";for(var i=0;i<l11.i.length;i++)if(l11.i[i].I1IIl){var I1l=l1I1l(l11.i[i].id);with(I1l.document.layers[0]){document.layers[1].visibility="show";document.layers[0].visibility="hide";};}else{var I1l=l1I1l(l11.i[i].id);if(I1l.document.layers[0].document.layers[1].visibility=="show")with(I1l.document.layers[0]){document.layers[1].visibility="hide";document.layers[0].visibility="show";};};ll[l1.IlI].llIl[l1.Il111].I1=id;}else{if(lI.I1I1&&crossType==1&&l11.lI1I1==1){var Il1l1=lIIa(lI,1),l1111=lIIa(null),l=0,t=0;if(lI.I11I1==1){if(lll||IIl)var dy=parent.frames[lI.l1l].window.screenTop-window.screenTop+l1111[1];else var dy=l1111[1];l=Il1l1[0];t=IIIll[1]+Il1l1[1]-dy;}else{if(lll||IIl)var dx=parent.frames[lI.l1l].window.screenLeft-window.screenLeft+l1111[0];else var dx=l1111[0];l=IIIll[0]+Il1l1[0]-dx;t=Il1l1[1];};var Il11l=ll1lI(l1I1l(I11.id+'TB'));if(l+Il11l[2]>Il1l1[0]+Il1l1[2])l=Il1l1[0]+Il1l1[2]-Il11l[2];if(t+Il11l[3]>Il1l1[1]+Il1l1[3])t=Il1l1[1]+Il1l1[3]-Il11l[3];if(l<Il1l1[0])l=Il1l1[0];if(t<Il1l1[1])t=Il1l1[1];I11.style.left=l+Il1I;I11.style.top=t+Il1I;}else{I11.style.left=IIIll[0]+Il1I;I11.style.top=IIIll[1]+Il1I;if(!IIl&&!Ill1l&&!l1l1&&crossType==3){if(lI.I11I1==1)var sizes=parent.document.getElementById(lI.lI1l).cols;else var sizes=parent.document.getElementById(lI.lI1l).rows;if(!lII)lII=sizes;var lII1I=lII1a(sizes,lI.Il1I1),IIllI=lIIa(lI),IIl11=ll1lI(I11);if(lI.I11I1==1){if(IIl11[0]+IIl11[2]>IIllI[2])parent.document.getElementById(lI.lI1l).cols=lII1I[0]+(IIl11[0]+IIl11[2])+lII1I[2];}else if(IIl11[1]+IIl11[3]>IIllI[3]){parent.document.getElementById(lI.lI1l).rows=lII1I[0]+(IIl11[1]+IIl11[3])+lII1I[2];};};};ll[l1.IlI].llIl[l1.Il111].I1=id;l1.lIlI=ll[l1.IlI].saveNavigation;if(I11.style.visibility!="visible"){if(l11.l1I1l&&!l1lI)if(Illl)l1IlI.apply();I11.style.visibility="visible";if(l11.l1I1l&&!l1lI)if(Illl)l1IlI.play();};};if(!Il){lIlIl=l1I1l(I11.id+"TB");Ill1=ll1lI(lIlIl);if(lll||(IIl&&ll1<7))II1a(Ill1,"SELECT",lIlIl.id,lI);if(l1l1||(IIl&&ll1>=7))II1a(Ill1,"IFRAME",lIlIl.id,lI);II1a(Ill1,"APPLET",lIlIl.id,lI);};};function I111a(id){var I11=l1I1l(id);if(!I11)return;var l11=Il1a(id);if(l11.I1!="")I111a(l11.I1);if(ll[l11.IlI].saveNavigation){var ritVar=Il1a(l11.llll);ritVar.lIlI=0;if(!ritVar.I1IIl)Illa(ritVar,0,ritVar.Il111);};l11.I1="";if(l11.lIla){clearTimeout(l11.lIla);l11.lIla=null;};if(Il)I11.visibility="hide";else I11.style.visibility="hidden";if(!Il){lIlIl=l1I1l(I11.id+"TB");Ill1=ll1lI(lIlIl);I1l1a(Ill1,lIlIl.id);};if(l11.lI1I1==1&&crossType==3&&lII){if(ll[l11.IlI].I11I1)parent.document.getElementById(ll[l11.IlI].lI1l).cols=lII;else parent.document.getElementById(ll[l11.IlI].lI1l).rows=lII;lII=null;};};function l11lI(param,l1IIl){return(typeof(param)!="undefined"&&param)?param:l1IIl;};function l1I1l(id){if(lll&&ll1<5)return document.all[id];if(Il){var e=I1I1l.exec(id),l=document.layers[id];if(!l&&e)l=document.layers[e[2]].document.layers[id];return l;};var l1=Il1a(id);if(ll[l1.IlI].I1I1&&crossType!=3){if(l1.Il111==0)return document.getElementById(id);else return parent.frames[ll[l1.IlI].l1l].document.getElementById(id);}else return document.getElementById(id);};function Il1a(id){var lIIIl;if(id.indexOf("i")>0){lIIIl=I1I1l.exec(id);return ll[parseInt(lIIIl[1])].llIl[parseInt(lIIIl[2])].i[parseInt(lIIIl[3])];}else{lIIIl=lI11I.exec(id);return ll[parseInt(lIIIl[1])].llIl[parseInt(lIIIl[2])];};};function lIlla(){var a=navigator.userAgent,n=navigator.appName,I11a=navigator.appVersion;l1lI=I11a.indexOf("Mac")>=0;lIIlI=document.getElementById?1:0;var lIa=(parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1),IlIlI=lIa&&(navigator.product=="Gecko");if(IlIlI){l1l1=1;ll1=6;return;};if(a.indexOf("Opera")>=0){IIl=1;ll1=parseFloat(a.substring(a.indexOf("Opera")+6,a.length));}else if(n.toLowerCase()=="netscape"){if(a.indexOf("rv:")!=-1&&a.indexOf("Gecko")!=-1&&a.indexOf("Netscape")==-1){Ill1l=1;ll1=parseFloat(a.substring(a.indexOf("rv:")+3,a.length));}else{l1l1=1;if(a.indexOf("Gecko")!=-1&&a.indexOf("Netscape")>a.indexOf("Gecko")){if(a.indexOf("Netscape6")>-1)ll1=parseFloat(a.substring(a.indexOf("Netscape")+10,a.length));else if(a.indexOf("Netscape")>-1)ll1=parseFloat(a.substring(a.indexOf("Netscape")+9,a.length));}else ll1=parseFloat(I11a);};}else if(document.all?1:0){lll=1;ll1=parseFloat(a.substring(a.indexOf("MSIE ")+5,a.length));};Il=l1l1&&ll1<6;Illl=lll&&ll1>=5;lI11=lll||(IIl&&ll1>=7);};function Ill1a(lI){var frm=parent.frames[lI.l1l];return(frm.document.compatMode=="CSS1Compat"&&!Ill1l)?frm.document.documentElement:frm.document.body};function lIIa(lI,q){var l=0,t=0,w=0,h=0;if(l1l1||IIl){var lII11=((lI&&lI.I1I1&&crossType==1)?parent.frames[lI.l1l].window:window);w=lII11.innerWidth;h=lII11.innerHeight;l=lII11.pageXOffset;t=lII11.pageYOffset;}else{var lII11=((lI&&lI.I1I1&&crossType==1)?Ill1a(lI):I1I);l=lII11.scrollLeft;t=lII11.scrollTop;w=lII11.clientWidth;h=lII11.clientHeight;};return[l,t,w,h];};function ll1lI(o){var l=0,t=0,h=0,w=0;if(!o)return[l,t,w,h];if(IIl&&ll1<6){h=o.style.pixelHeight;w=o.style.pixelWidth;}else if(Il){h=o.clip.height;w=o.clip.width;}else{h=o.offsetHeight;w=o.offsetWidth;}while(o){l+=parseInt(Il?o.pageX:o.offsetLeft);t+=parseInt(Il?o.pageY:o.offsetTop);o=o.offsetParent;};return[l,t,w,h];};function Il1la(Ill,Il1){var lI=ll[Ill.IlI],I11l=lI.llIl[Ill.Il111],IlIl=(lI.l1ll1&&!Ill.Il111)?l1I1l("apy"+Ill.IlI+"m0mT"):null,I111l;if(!I11l.I1ll){for(var i=0;i<Ill.I1II1;i++){I111l=l1I1l(I11l.i[i].id+"I");Il1[1]+=parseInt(I11l.i[i].IIll1)+ll1lI(I111l)[3]+parseInt(I11l.i[i].Illl1);};Il1[1]+=parseInt(I11l.Illl1);Il1[1]+=IlIl?IlIl.offsetHeight:0;}else{for(var i=0;i<Ill.I1II1;i++){I111l=l1I1l(I11l.i[i].id+"I");Il1[0]+=ll1lI(I111l)[2]+parseInt(I11l.i[i].IIll1)*2+parseInt(I11l.i[i].Illl1)*2;};Il1[0]+=IlIl?IlIl.offsetWidth:0;};return[Il1[0],Il1[1],Il1[2],Il1[3]];};function l1lla(lI1){var I11=l1I1l(lI1.id),IIII=l1I1l(lI1.llll),Il1=ll1lI(IIII),Ill=Il1a(lI1.llll),l1ll=lIIa(ll[lI1.IlI]);if(!Il){var IlllI=l1I1l(I11.id+'TB'),llIl1=ll1lI(IlllI);}else var llIl1=ll1lI(I11);if(lll&&l1lI)Il1=Il1la(Ill,Il1);var x=0,y=0;if(ll[Ill.IlI].llIl[Ill.Il111].I1ll){if(lll||l1l1){if(itemAlign=="right")x=Il1[0]+Il1[2]-llIl1[2]-lI1.II11a;else if(itemAlign=="center")x=Il1[0]+(Il1[2]-llIl1[2])/2;else x=Il1[0]+lI1.II11a;}else x=Il1[0]+lI1.II11a;y=Il1[1]+Il1[3]+lI1.Il11a;}else{x=lI1.II11a+Il1[0]+Il1[2];y=lI1.Il11a+Il1[1];};l1ll[2]+=l1ll[0];l1ll[3]+=l1ll[1];if(!ll[lI1.IlI].I1I1||(lI1.lI1I1>1&&crossType!=3)){if(x+llIl1[2]>l1ll[2])x=l1ll[2]-llIl1[2];if(x<l1ll[0])x=l1ll[0];if(y+llIl1[3]>l1ll[3])y=l1ll[3]-llIl1[3];if(y<l1ll[1])y=l1ll[1];};return[x,y];};function IIIa(src,id,w,h){if(!src&&Il&&(id.indexOf("ICO")>0)){w=1;src=blankImage;};if(!src)return"";var sImg="<IMG SRC=\""+src+"\"";if(id)sImg+=" ID="+id;if(w!="100%"){if(w>0)sImg+=" WIDTH="+w;else if(l1l1)sImg+=" WIDTH=0";};if(h>0)sImg+=" HEIGHT="+h;else if(l1l1)sImg+=" HEIGHT=0";sImg+=" BORDER=0>";return sImg;};var IlIll=[['Blinds'],['Checkerboard'],['GradientWipe'],['Inset'],['Iris'],['Pixelate'],['RadialWipe'],['RandomBars'],['RandomDissolve'],['Slide'],['Spiral'],['Stretch'],['Strips'],['Wheel'],['Zigzag']];function lIl1a(llIII,l1III){if(ll1<5.5)return;var sF="progid:DXImageTransform.Microsoft."+IlIll[llIII-25]+'('+transOptions+',duration='+l1III+')';return sF;};function II1la(lI1){if(Illl&&!l1lI){var sF="filter:";if(lI1.I11Il)if(lI1.I11Il==24)sF+="blendTrans(Duration="+lI1.l1I1l/1000+") ";else if(lI1.I11Il<24)sF+="revealTrans(Transition="+lI1.I11Il+",Duration="+lI1.l1I1l/1000+") ";else sF+=lIl1a(lI1.I11Il,lI1.l1I1l/1000);if(lI1.Il1lI)sF+="Alpha(opacity="+lI1.Il1lI+") ";if(lI1.lI1l1)sF+="Shadow(color="+lI1.lI1l1+",direction=135,strength="+lI1.ll1l1+") ";sF+=";";return sF;}else return"";};function l11la(n,llIl,i){return'apy'+n+'m'+llIl+'i'+i+((l1l1&&ll1<7)?'ITX':'ITD');};function apy_changeItemText(n,llIl,i,text){if(Il)return null;var item=l1I1l(l11la(n,llIl,i));item.innerHTML=text;};function apy_changeItem(n,llIl,i,I11ll,lIII1,II1Il,II1I1,Ill11){if(Il)return null;var item=l1I1l(l11la(n,llIl,i));if(I11ll)item.innerHTML=I11ll;var l1=Il1a(item.id);if(lIII1)l1.lIl11=lIII1;if(II1Il){item=l1I1l('apy'+n+'m'+llIl+'i'+i+'I');item.title=II1Il;};if(Ill11){l1.I111[0]=Ill11;item=l1I1l('apy'+n+'m'+llIl+'i'+i+'ICO');item.src=Ill11;};if(II1I1)l1.I111[1]=II1I1;};var III=false,II1l=false;function apy_setPressedItem(n,llIl,i,lI1ll){var lI=ll[n];if(!III&&lI.lIl!=-1){III=true;with(lI){apy_setPressedItem(n,llI,lIl,lI1ll);if(llI==llIl&&lIl==i){llI=0;lIl=-1;return;};};};if(!III){lI.llI=llIl;lI.lIl=i;}else III=false;var l1=Il1a('apy'+n+'m'+llIl+'i'+i);if(!II1l)l1.I1IIl=!l1.I1IIl;II1l=false;if(!Il)Illa(l1,(l1.I1IIl?1:0),l1.Il111);if(lI1ll&&llIl>0){var I11=ll[n].llIl[llIl];for(var j=I11.lI1I1;j>0;j--){IIII=Il1a(I11.llll);if(!Il)Illa(IIII,(l1.I1IIl?1:0),IIII.Il111);else if(j==1)with(l1I1l(IIII.id).document.layers[0]){document.layers[1].visibility=(l1.I1IIl?"show":"hide");document.layers[0].visibility=(l1.I1IIl?"hide":"show");};IIII.I1IIl=l1.I1IIl;I11=ll[n].llIl[IIII.Il111];};};};function I11la(event){var x=0,y=0;if(lll||IIl){x=event.clientX+(lI11?I1I.scrollLeft:0);y=event.clientY+(lI11?I1I.scrollTop:0);}else{x=event.pageX;y=event.pageY;};return[x,y];};function apy_popup(ll11l,llII1,event){if(lll)event.returnValue=false;var IIIll=I11la(event),lI=ll[ll11l],lI11l=lI.llIl[1];if(lI11l){var I1l=l1I1l(lI11l.id);if(I1l.style.visibility=="visible"){clearTimeout(lI.llla);I111a(lI.llIl[0].I1);status='';};lI.llIl[0].I1=lI11l.id;IIlla(lI11l.id);I1l.style.left=IIIll[0]+Il1I;I1l.style.top=IIIll[1]+Il1I;if(llII1>0)lI.llla=setTimeout("I111a('"+lI.llIl[0].I1+"'); status='';",llII1);};return false;};
var blankImage = "";

var isHorizontal = 1;
var menuWidth = "";

var absolutePos = 0;
var posX = 190;
var posY = 160;

var floatable = 0;
var floatIterations = 8;

var movable = 0;
var moveCursor = "move";
var moveImage  = "";
var moveWidth  = 12;
var moveHeight = 24;

var fontStyle="bold 10pt Verdana";
var fontColor=["#800000","#007700"];
var fontDecoration=["underline","underline"];

var itemBackColor=["#ffffff","#ffffff"];
var itemBorderWidth=0;
var itemAlign="left";
var itemBorderColor=["#ffffff","#ffffff"];
var itemBorderStyle=["solid","solid"];
var itemBackImage=["",""];
var itemSpacing=0;
var itemPadding=1;
var itemCursor="hand";
var itemTarget="";

var iconTopWidth  = 2;
var iconTopHeight = 2;
var iconWidth  = 20;
var iconHeight = 20;


var menuBackImage="";
var menuBackColor="#ffffff";
var menuBorderColor="#ffffff";
var menuBorderStyle="solid";
var menuBorderWidth=0;
var subMenuAlign = "left";

var transparency=0;
var transition=0;
var transDuration=300;
var shadowColor="#777777";
var shadowLen=0;

var arrowWidth =10;
var arrowHeight=10;

var separatorWidth="100%";
var separatorHeight="3";
var separatorAlignment="right";

var separatorVWidth="3";
var separatorVHeight="17";

var statusString="link";

var itemStyles =
[
    ["itemBackColor=#ffffff,#ffffff"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
    ["itemBackColor=#e4e4e4,#e4e4e4"],
];

var key  =  "151b951e9did"; // blackrock
var key1 =  "145b620e9did"; // linux1
var key2 = "157b1198e9did"; // venalicia.de
var key3 = "163b1477e9did"; // venalicia.co.uk
var key4 = "157b1200e9did"; // venalicia.ch
var key5 = "159b1316e9did"; // venalicia.com

var separatorImage="/img/global/menu_sep_h.gif";
var separatorVImage="/img/global/menu_sep_v.gif";

var arrowImageMain=["/img/global/menu_sub_d.gif","/img/global/menu_sub_d.gif"];
var arrowImageSub=["/img/global/menu_sub_r.gif","/img/global/menu_sub_r.gif"];

function apy_init() {};/*  Prototype JavaScript framework, version 1.5.0_rc0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/

var Prototype = {
  Version: '1.5.0_rc0',
  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',

  emptyFunction: function() {},
  K: function(x) {return x}
}

var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

var Abstract = new Object();

Object.extend = function(destination, source) {
  for (var property in source) {
    destination[property] = source[property];
  }
  return destination;
}

Object.inspect = function(object) {
  try {
    if (object == undefined) return 'undefined';
    if (object == null) return 'null';
    return object.inspect ? object.inspect() : object.toString();
  } catch (e) {
    if (e instanceof RangeError) return '...';
    throw e;
  }
}

Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}

Function.prototype.bindAsEventListener = function(object) {
  var __method = this;
  return function(event) {
    return __method.call(object, event || window.event);
  }
}

Object.extend(Number.prototype, {
  toColorPart: function() {
    var digits = this.toString(16);
    if (this < 16) return '0' + digits;
    return digits;
  },

  succ: function() {
    return this + 1;
  },

  times: function(iterator) {
    $R(0, this, true).each(iterator);
    return this;
  }
});

var Try = {
  these: function() {
    var returnValue;

    for (var i = 0; i < arguments.length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) {}
    }

    return returnValue;
  }
}

/*--------------------------------------------------------------------------*/

var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype = {
  initialize: function(callback, frequency) {
    this.callback = callback;
    this.frequency = frequency;
    this.currentlyExecuting = false;

    this.registerCallback();
  },

  registerCallback: function() {
    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  onTimerEvent: function() {
    if (!this.currentlyExecuting) {
      try {
        this.currentlyExecuting = true;
        this.callback();
      } finally {
        this.currentlyExecuting = false;
      }
    }
  }
}
Object.extend(String.prototype, {
  gsub: function(pattern, replacement) {
    var result = '', source = this, match;
    replacement = arguments.callee.prepareReplacement(replacement);

    while (source.length > 0) {
      if (match = source.match(pattern)) {
        result += source.slice(0, match.index);
        result += (replacement(match) || '').toString();
        source  = source.slice(match.index + match[0].length);
      } else {
        result += source, source = '';
      }
    }
    return result;
  },

  sub: function(pattern, replacement, count) {
    replacement = this.gsub.prepareReplacement(replacement);
    count = count === undefined ? 1 : count;

    return this.gsub(pattern, function(match) {
      if (--count < 0) return match[0];
      return replacement(match);
    });
  },

  scan: function(pattern, iterator) {
    this.gsub(pattern, iterator);
    return this;
  },

  truncate: function(length, truncation) {
    length = length || 30;
    truncation = truncation === undefined ? '...' : truncation;
    return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : this;
  },

  strip: function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  },

  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  stripScripts: function() {
    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  },

  evalScripts: function() {
    return this.extractScripts().map(function(script) { return eval(script) });
  },

  escapeHTML: function() {
    var div = document.createElement('div');
    var text = document.createTextNode(this);
    div.appendChild(text);
    return div.innerHTML;
  },

  unescapeHTML: function() {
    var div = document.createElement('div');
    div.innerHTML = this.stripTags();
    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
  },

  toQueryParams: function() {
    var pairs = this.match(/^\??(.*)$/)[1].split('&');
    return pairs.inject({}, function(params, pairString) {
      var pair = pairString.split('=');
      params[pair[0]] = pair[1];
      return params;
    });
  },

  toArray: function() {
    return this.split('');
  },

  camelize: function() {
    var oStringList = this.split('-');
    if (oStringList.length == 1) return oStringList[0];

    var camelizedString = this.indexOf('-') == 0
      ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
      : oStringList[0];

    for (var i = 1, len = oStringList.length; i < len; i++) {
      var s = oStringList[i];
      camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
    }

    return camelizedString;
  },

  inspect: function() {
    return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
  }
});

String.prototype.gsub.prepareReplacement = function(replacement) {
  if (typeof replacement == 'function') return replacement;
  var template = new Template(replacement);
  return function(match) { return template.evaluate(match) };
}

String.prototype.parseQuery = String.prototype.toQueryParams;

var Template = Class.create();
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype = {
  initialize: function(template, pattern) {
    this.template = template.toString();
    this.pattern  = pattern || Template.Pattern;
  },

  evaluate: function(object) {
    return this.template.gsub(this.pattern, function(match) {
      var before = match[1];
      if (before == '\\') return match[2];
      return before + (object[match[3]] || '').toString();
    });
  }
}

var $break    = new Object();
var $continue = new Object();

var Enumerable = {
  each: function(iterator) {
    var index = 0;
    try {
      this._each(function(value) {
        try {
          iterator(value, index++);
        } catch (e) {
          if (e != $continue) throw e;
        }
      });
    } catch (e) {
      if (e != $break) throw e;
    }
  },

  all: function(iterator) {
    var result = true;
    this.each(function(value, index) {
      result = result && !!(iterator || Prototype.K)(value, index);
      if (!result) throw $break;
    });
    return result;
  },

  any: function(iterator) {
    var result = true;
    this.each(function(value, index) {
      if (result = !!(iterator || Prototype.K)(value, index))
        throw $break;
    });
    return result;
  },

  collect: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      results.push(iterator(value, index));
    });
    return results;
  },

  detect: function (iterator) {
    var result;
    this.each(function(value, index) {
      if (iterator(value, index)) {
        result = value;
        throw $break;
      }
    });
    return result;
  },

  findAll: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (iterator(value, index))
        results.push(value);
    });
    return results;
  },

  grep: function(pattern, iterator) {
    var results = [];
    this.each(function(value, index) {
      var stringValue = value.toString();
      if (stringValue.match(pattern))
        results.push((iterator || Prototype.K)(value, index));
    })
    return results;
  },

  include: function(object) {
    var found = false;
    this.each(function(value) {
      if (value == object) {
        found = true;
        throw $break;
      }
    });
    return found;
  },

  inject: function(memo, iterator) {
    this.each(function(value, index) {
      memo = iterator(memo, value, index);
    });
    return memo;
  },

  invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.collect(function(value) {
      return value[method].apply(value, args);
    });
  },

  max: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value >= result)
        result = value;
    });
    return result;
  },

  min: function(iterator) {
    var result;
    this.each(function(value, index) {
      value = (iterator || Prototype.K)(value, index);
      if (result == undefined || value < result)
        result = value;
    });
    return result;
  },

  partition: function(iterator) {
    var trues = [], falses = [];
    this.each(function(value, index) {
      ((iterator || Prototype.K)(value, index) ?
        trues : falses).push(value);
    });
    return [trues, falses];
  },

  pluck: function(property) {
    var results = [];
    this.each(function(value, index) {
      results.push(value[property]);
    });
    return results;
  },

  reject: function(iterator) {
    var results = [];
    this.each(function(value, index) {
      if (!iterator(value, index))
        results.push(value);
    });
    return results;
  },

  sortBy: function(iterator) {
    return this.collect(function(value, index) {
      return {value: value, criteria: iterator(value, index)};
    }).sort(function(left, right) {
      var a = left.criteria, b = right.criteria;
      return a < b ? -1 : a > b ? 1 : 0;
    }).pluck('value');
  },

  toArray: function() {
    return this.collect(Prototype.K);
  },

  zip: function() {
    var iterator = Prototype.K, args = $A(arguments);
    if (typeof args.last() == 'function')
      iterator = args.pop();

    var collections = [this].concat(args).map($A);
    return this.map(function(value, index) {
      return iterator(collections.pluck(index));
    });
  },

  inspect: function() {
    return '#<Enumerable:' + this.toArray().inspect() + '>';
  }
}

Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray
});
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0; i < iterable.length; i++)
      results.push(iterable[i]);
    return results;
  }
}

Object.extend(Array.prototype, Enumerable);

if (!Array.prototype._reverse)
  Array.prototype._reverse = Array.prototype.reverse;

Object.extend(Array.prototype, {
  _each: function(iterator) {
    for (var i = 0; i < this.length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != undefined || value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(value && value.constructor == Array ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  indexOf: function(object) {
    for (var i = 0; i < this.length; i++)
      if (this[i] == object) return i;
    return -1;
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  }
});
var Hash = {
  _each: function(iterator) {
    for (var key in this) {
      var value = this[key];
      if (typeof value == 'function') continue;

      var pair = [key, value];
      pair.key = key;
      pair.value = value;
      iterator(pair);
    }
  },

  keys: function() {
    return this.pluck('key');
  },

  values: function() {
    return this.pluck('value');
  },

  merge: function(hash) {
    return $H(hash).inject($H(this), function(mergedHash, pair) {
      mergedHash[pair.key] = pair.value;
      return mergedHash;
    });
  },

  toQueryString: function() {
    return this.map(function(pair) {
      return pair.map(encodeURIComponent).join('=');
    }).join('&');
  },

  inspect: function() {
    return '#<Hash:{' + this.map(function(pair) {
      return pair.map(Object.inspect).join(': ');
    }).join(', ') + '}>';
  }
}

function $H(object) {
  var hash = Object.extend({}, object || {});
  Object.extend(hash, Enumerable);
  Object.extend(hash, Hash);
  return hash;
}
ObjectRange = Class.create();
Object.extend(ObjectRange.prototype, Enumerable);
Object.extend(ObjectRange.prototype, {
  initialize: function(start, end, exclusive) {
    this.start = start;
    this.end = end;
    this.exclusive = exclusive;
  },

  _each: function(iterator) {
    var value = this.start;
    do {
      iterator(value);
      value = value.succ();
    } while (this.include(value));
  },

  include: function(value) {
    if (value < this.start)
      return false;
    if (this.exclusive)
      return value < this.end;
    return value <= this.end;
  }
});

var $R = function(start, end, exclusive) {
  return new ObjectRange(start, end, exclusive);
}

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ) || false;
  },

  activeRequestCount: 0
}

Ajax.Responders = {
  responders: [],

  _each: function(iterator) {
    this.responders._each(iterator);
  },

  register: function(responderToAdd) {
    if (!this.include(responderToAdd))
      this.responders.push(responderToAdd);
  },

  unregister: function(responderToRemove) {
    this.responders = this.responders.without(responderToRemove);
  },

  dispatch: function(callback, request, transport, json) {
    this.each(function(responder) {
      if (responder[callback] && typeof responder[callback] == 'function') {
        try {
          responder[callback].apply(responder, [request, transport, json]);
        } catch (e) {}
      }
    });
  }
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
  onCreate: function() {
    Ajax.activeRequestCount++;
  },

  onComplete: function() {
    Ajax.activeRequestCount--;
  }
});

Ajax.Base = function() {};
Ajax.Base.prototype = {
  setOptions: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      parameters:   ''
    }
    Object.extend(this.options, options || {});
  },

  responseIsSuccess: function() {
    return this.transport.status == undefined
        || this.transport.status == 0
        || (this.transport.status >= 200 && this.transport.status < 300);
  },

  responseIsFailure: function() {
    return !this.responseIsSuccess();
  }
}

Ajax.Request = Class.create();
Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];

Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
  initialize: function(url, options) {
    this.transport = Ajax.getTransport();
    this.setOptions(options);
    this.request(url);
  },

  request: function(url) {
    var parameters = this.options.parameters || '';
    if (parameters.length > 0) parameters += '&_=';

    try {
      this.url = url;
      if (this.options.method == 'get' && parameters.length > 0)
        this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;

      Ajax.Responders.dispatch('onCreate', this, this.transport);

      this.transport.open(this.options.method, this.url,
        this.options.asynchronous);

      if (this.options.asynchronous) {
        this.transport.onreadystatechange = this.onStateChange.bind(this);
        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
      }

      this.setRequestHeaders();

      var body = this.options.postBody ? this.options.postBody : parameters;
      this.transport.send(this.options.method == 'post' ? body : null);

    } catch (e) {
      this.dispatchException(e);
    }
  },

  setRequestHeaders: function() {
    var requestHeaders =
      ['X-Requested-With', 'XMLHttpRequest',
       'X-Prototype-Version', Prototype.Version,
       'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];

    if (this.options.method == 'post') {
      requestHeaders.push('Content-type', this.options.contentType);

      /* Force "Connection: close" for Mozilla browsers to work around
       * a bug where XMLHttpReqeuest sends an incorrect Content-length
       * header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType)
        requestHeaders.push('Connection', 'close');
    }

    if (this.options.requestHeaders)
      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);

    for (var i = 0; i < requestHeaders.length; i += 2)
      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
  },

  onStateChange: function() {
    var readyState = this.transport.readyState;
    if (readyState != 1)
      this.respondToReadyState(this.transport.readyState);
  },

  header: function(name) {
    try {
      return this.transport.getResponseHeader(name);
    } catch (e) {}
  },

  evalJSON: function() {
    try {
      return eval('(' + this.header('X-JSON') + ')');
    } catch (e) {}
  },

  evalResponse: function() {
    try {
      return eval(this.transport.responseText);
    } catch (e) {
      this.dispatchException(e);
    }
  },

  respondToReadyState: function(readyState) {
    var event = Ajax.Request.Events[readyState];
    var transport = this.transport, json = this.evalJSON();

    if (event == 'Complete') {
      try {
        (this.options['on' + this.transport.status]
         || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(transport, json);
      } catch (e) {
        this.dispatchException(e);
      }

      if ((this.header('Content-type') || '').match(/^text\/javascript/i))
        this.evalResponse();
    }

    try {
      (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
      Ajax.Responders.dispatch('on' + event, this, transport, json);
    } catch (e) {
      this.dispatchException(e);
    }

    /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
    if (event == 'Complete')
      this.transport.onreadystatechange = Prototype.emptyFunction;
  },

  dispatchException: function(exception) {
    (this.options.onException || Prototype.emptyFunction)(this, exception);
    Ajax.Responders.dispatch('onException', this, exception);
  }
});

Ajax.Updater = Class.create();

Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
  initialize: function(container, url, options) {
    this.containers = {
      success: container.success ? $(container.success) : $(container),
      failure: container.failure ? $(container.failure) :
        (container.success ? null : $(container))
    }

    this.transport = Ajax.getTransport();
    this.setOptions(options);

    var onComplete = this.options.onComplete || Prototype.emptyFunction;
    this.options.onComplete = (function(transport, object) {
      this.updateContent();
      onComplete(transport, object);
    }).bind(this);

    this.request(url);
  },

  updateContent: function() {
    var receiver = this.responseIsSuccess() ?
      this.containers.success : this.containers.failure;
    var response = this.transport.responseText;

    if (!this.options.evalScripts)
      response = response.stripScripts();

    if (receiver) {
      if (this.options.insertion) {
        new this.options.insertion(receiver, response);
      } else {
        Element.update(receiver, response);
      }
    }

    if (this.responseIsSuccess()) {
      if (this.onComplete)
        setTimeout(this.onComplete.bind(this), 10);
    }
  }
});

Ajax.PeriodicalUpdater = Class.create();
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
  initialize: function(container, url, options) {
    this.setOptions(options);
    this.onComplete = this.options.onComplete;

    this.frequency = (this.options.frequency || 2);
    this.decay = (this.options.decay || 1);

    this.updater = {};
    this.container = container;
    this.url = url;

    this.start();
  },

  start: function() {
    this.options.onComplete = this.updateComplete.bind(this);
    this.onTimerEvent();
  },

  stop: function() {
    this.updater.onComplete = undefined;
    clearTimeout(this.timer);
    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
  },

  updateComplete: function(request) {
    if (this.options.decay) {
      this.decay = (request.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

      this.lastText = request.responseText;
    }
    this.timer = setTimeout(this.onTimerEvent.bind(this),
      this.decay * this.frequency * 1000);
  },

  onTimerEvent: function() {
    this.updater = new Ajax.Updater(this.container, this.url, this.options);
  }
});
function $() {
  var results = [], element;
  for (var i = 0; i < arguments.length; i++) {
    element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    results.push(Element.extend(element));
  }
  return results.length < 2 ? results[0] : results;
}

document.getElementsByClassName = function(className, parentElement) {
  var children = ($(parentElement) || document.body).getElementsByTagName('*');
  return $A(children).inject([], function(elements, child) {
    if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
      elements.push(Element.extend(child));
    return elements;
  });
}

/*--------------------------------------------------------------------------*/

if (!window.Element)
  var Element = new Object();

Element.extend = function(element) {
  if (!element) return;
  if (_nativeExtensions) return element;

  if (!element._extended && element.tagName && element != window) {
    var methods = Element.Methods, cache = Element.extend.cache;
    for (property in methods) {
      var value = methods[property];
      if (typeof value == 'function')
        element[property] = cache.findOrStore(value);
    }
  }

  element._extended = true;
  return element;
}

Element.extend.cache = {
  findOrStore: function(value) {
    return this[value] = this[value] || function() {
      return value.apply(null, [this].concat($A(arguments)));
    }
  }
}

Element.Methods = {
  visible: function(element) {
    return $(element).style.display != 'none';
  },

  toggle: function() {
    for (var i = 0; i < arguments.length; i++) {
      var element = $(arguments[i]);
      Element[Element.visible(element) ? 'hide' : 'show'](element);
    }
  },

  hide: function() {
    for (var i = 0; i < arguments.length; i++) {
      var element = $(arguments[i]);
      element.style.display = 'none';
    }
  },

  show: function() {
    for (var i = 0; i < arguments.length; i++) {
      var element = $(arguments[i]);
      element.style.display = '';
    }
  },

  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
  },

  update: function(element, html) {
    $(element).innerHTML = html.stripScripts();
    setTimeout(function() {html.evalScripts()}, 10);
  },

  replace: function(element, html) {
    element = $(element);
    if (element.outerHTML) {
      element.outerHTML = html.stripScripts();
    } else {
      var range = element.ownerDocument.createRange();
      range.selectNodeContents(element);
      element.parentNode.replaceChild(
        range.createContextualFragment(html.stripScripts()), element);
    }
    setTimeout(function() {html.evalScripts()}, 10);
  },

  getHeight: function(element) {
    element = $(element);
    return element.offsetHeight;
  },

  classNames: function(element) {
    return new Element.ClassNames(element);
  },

  hasClassName: function(element, className) {
    if (!(element = $(element))) return;
    return Element.classNames(element).include(className);
  },

  addClassName: function(element, className) {
    if (!(element = $(element))) return;
    return Element.classNames(element).add(className);
  },

  removeClassName: function(element, className) {
    if (!(element = $(element))) return;
    return Element.classNames(element).remove(className);
  },

  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    for (var i = 0; i < element.childNodes.length; i++) {
      var node = element.childNodes[i];
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        Element.remove(node);
    }
  },

  empty: function(element) {
    return $(element).innerHTML.match(/^\s*$/);
  },

  childOf: function(element, ancestor) {
    element = $(element), ancestor = $(ancestor);
    while (element = element.parentNode)
      if (element == ancestor) return true;
    return false;
  },

  scrollTo: function(element) {
    element = $(element);
    var x = element.x ? element.x : element.offsetLeft,
        y = element.y ? element.y : element.offsetTop;
    window.scrollTo(x, y);
  },

  getStyle: function(element, style) {
    element = $(element);
    var value = element.style[style.camelize()];
    if (!value) {
      if (document.defaultView && document.defaultView.getComputedStyle) {
        var css = document.defaultView.getComputedStyle(element, null);
        value = css ? css.getPropertyValue(style) : null;
      } else if (element.currentStyle) {
        value = element.currentStyle[style.camelize()];
      }
    }

    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
      if (Element.getStyle(element, 'position') == 'static') value = 'auto';

    return value == 'auto' ? null : value;
  },

  setStyle: function(element, style) {
    element = $(element);
    for (var name in style)
      element.style[name.camelize()] = style[name];
  },

  getDimensions: function(element) {
    element = $(element);
    if (Element.getStyle(element, 'display') != 'none')
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = '';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = 'none';
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
  },

  makePositioned: function(element) {
    element = $(element);
    var pos = Element.getStyle(element, 'position');
    if (pos == 'static' || !pos) {
      element._madePositioned = true;
      element.style.position = 'relative';
      // Opera returns the offset relative to the positioning context, when an
      // element is position relative but top and left have not been defined
      if (window.opera) {
        element.style.top = 0;
        element.style.left = 0;
      }
    }
  },

  undoPositioned: function(element) {
    element = $(element);
    if (element._madePositioned) {
      element._madePositioned = undefined;
      element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
    }
  },

  makeClipping: function(element) {
    element = $(element);
    if (element._overflow) return;
    element._overflow = element.style.overflow;
    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
      element.style.overflow = 'hidden';
  },

  undoClipping: function(element) {
    element = $(element);
    if (element._overflow) return;
    element.style.overflow = element._overflow;
    element._overflow = undefined;
  }
}

Object.extend(Element, Element.Methods);

var _nativeExtensions = false;

if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
  var HTMLElement = {}
  HTMLElement.prototype = document.createElement('div').__proto__;
}

Element.addMethods = function(methods) {
  Object.extend(Element.Methods, methods || {});

  if(typeof HTMLElement != 'undefined') {
    var methods = Element.Methods, cache = Element.extend.cache;
    for (property in methods) {
      var value = methods[property];
      if (typeof value == 'function')
        HTMLElement.prototype[property] = cache.findOrStore(value);
    }
    _nativeExtensions = true;
  }
}

Element.addMethods();

var Toggle = new Object();
Toggle.display = Element.toggle;

/*--------------------------------------------------------------------------*/

Abstract.Insertion = function(adjacency) {
  this.adjacency = adjacency;
}

Abstract.Insertion.prototype = {
  initialize: function(element, content) {
    this.element = $(element);
    this.content = content.stripScripts();

    if (this.adjacency && this.element.insertAdjacentHTML) {
      try {
        this.element.insertAdjacentHTML(this.adjacency, this.content);
      } catch (e) {
        var tagName = this.element.tagName.toLowerCase();
        if (tagName == 'tbody' || tagName == 'tr') {
          this.insertContent(this.contentFromAnonymousTable());
        } else {
          throw e;
        }
      }
    } else {
      this.range = this.element.ownerDocument.createRange();
      if (this.initializeRange) this.initializeRange();
      this.insertContent([this.range.createContextualFragment(this.content)]);
    }

    setTimeout(function() {content.evalScripts()}, 10);
  },

  contentFromAnonymousTable: function() {
    var div = document.createElement('div');
    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
    return $A(div.childNodes[0].childNodes[0].childNodes);
  }
}

var Insertion = new Object();

Insertion.Before = Class.create();
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
  initializeRange: function() {
    this.range.setStartBefore(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment, this.element);
    }).bind(this));
  }
});

Insertion.Top = Class.create();
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(true);
  },

  insertContent: function(fragments) {
    fragments.reverse(false).each((function(fragment) {
      this.element.insertBefore(fragment, this.element.firstChild);
    }).bind(this));
  }
});

Insertion.Bottom = Class.create();
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
  initializeRange: function() {
    this.range.selectNodeContents(this.element);
    this.range.collapse(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.appendChild(fragment);
    }).bind(this));
  }
});

Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
  initializeRange: function() {
    this.range.setStartAfter(this.element);
  },

  insertContent: function(fragments) {
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment,
        this.element.nextSibling);
    }).bind(this));
  }
});

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },

  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },

  set: function(className) {
    this.element.className = className;
  },

  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
    this.set(this.toArray().concat(classNameToAdd).join(' '));
  },

  remove: function(classNameToRemove) {
    if (!this.include(classNameToRemove)) return;
    this.set(this.select(function(className) {
      return className != classNameToRemove;
    }).join(' '));
  },

  toString: function() {
    return this.toArray().join(' ');
  }
}

Object.extend(Element.ClassNames.prototype, Enumerable);
var Selector = Class.create();
Selector.prototype = {
  initialize: function(expression) {
    this.params = {classNames: []};
    this.expression = expression.toString().strip();
    this.parseExpression();
    this.compileMatcher();
  },

  parseExpression: function() {
    function abort(message) { throw 'Parse error in selector: ' + message; }

    if (this.expression == '')  abort('empty expression');

    var params = this.params, expr = this.expression, match, modifier, clause, rest;
    while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
      params.attributes = params.attributes || [];
      params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
      expr = match[1];
    }

    if (expr == '*') return this.params.wildcard = true;

    while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
      modifier = match[1], clause = match[2], rest = match[3];
      switch (modifier) {
        case '#':       params.id = clause; break;
        case '.':       params.classNames.push(clause); break;
        case '':
        case undefined: params.tagName = clause.toUpperCase(); break;
        default:        abort(expr.inspect());
      }
      expr = rest;
    }

    if (expr.length > 0) abort(expr.inspect());
  },

  buildMatchExpression: function() {
    var params = this.params, conditions = [], clause;

    if (params.wildcard)
      conditions.push('true');
    if (clause = params.id)
      conditions.push('element.id == ' + clause.inspect());
    if (clause = params.tagName)
      conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
    if ((clause = params.classNames).length > 0)
      for (var i = 0; i < clause.length; i++)
        conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')');
    if (clause = params.attributes) {
      clause.each(function(attribute) {
        var value = 'element.getAttribute(' + attribute.name.inspect() + ')';
        var splitValueBy = function(delimiter) {
          return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
        }

        switch (attribute.operator) {
          case '=':       conditions.push(value + ' == ' + attribute.value.inspect()); break;
          case '~=':      conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
          case '|=':      conditions.push(
                            splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
                          ); break;
          case '!=':      conditions.push(value + ' != ' + attribute.value.inspect()); break;
          case '':
          case undefined: conditions.push(value + ' != null'); break;
          default:        throw 'Unknown operator ' + attribute.operator + ' in selector';
        }
      });
    }

    return conditions.join(' && ');
  },

  compileMatcher: function() {
    this.match = new Function('element', 'if (!element.tagName) return false; \
      return ' + this.buildMatchExpression());
  },

  findElements: function(scope) {
    var element;

    if (element = $(this.params.id))
      if (this.match(element))
        if (!scope || Element.childOf(element, scope))
          return [element];

    scope = (scope || document).getElementsByTagName(this.params.tagName || '*');

    var results = [];
    for (var i = 0; i < scope.length; i++)
      if (this.match(element = scope[i]))
        results.push(Element.extend(element));

    return results;
  },

  toString: function() {
    return this.expression;
  }
}

function $$() {
  return $A(arguments).map(function(expression) {
    return expression.strip().split(/\s+/).inject([null], function(results, expr) {
      var selector = new Selector(expr);
      return results.map(selector.findElements.bind(selector)).flatten();
    });
  }).flatten();
}
var Field = {
  clear: function() {
    for (var i = 0; i < arguments.length; i++)
      $(arguments[i]).value = '';
  },

  focus: function(element) {
    $(element).focus();
  },

  present: function() {
    for (var i = 0; i < arguments.length; i++)
      if ($(arguments[i]).value == '') return false;
    return true;
  },

  select: function(element) {
    $(element).select();
  },

  activate: function(element) {
    element = $(element);
    element.focus();
    if (element.select)
      element.select();
  }
}

/*--------------------------------------------------------------------------*/

var Form = {
  serialize: function(form) {
    var elements = Form.getElements($(form));
    var queryComponents = new Array();

    for (var i = 0; i < elements.length; i++) {
      var queryComponent = Form.Element.serialize(elements[i]);
      if (queryComponent)
        queryComponents.push(queryComponent);
    }

    return queryComponents.join('&');
  },

  getElements: function(form) {
    form = $(form);
    var elements = new Array();

    for (var tagName in Form.Element.Serializers) {
      var tagElements = form.getElementsByTagName(tagName);
      for (var j = 0; j < tagElements.length; j++)
        elements.push(tagElements[j]);
    }
    return elements;
  },

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name)
      return inputs;

    var matchingInputs = new Array();
    for (var i = 0; i < inputs.length; i++) {
      var input = inputs[i];
      if ((typeName && input.type != typeName) ||
          (name && input.name != name))
        continue;
      matchingInputs.push(input);
    }

    return matchingInputs;
  },

  disable: function(form) {
    var elements = Form.getElements(form);
    for (var i = 0; i < elements.length; i++) {
      var element = elements[i];
      element.blur();
      element.disabled = 'true';
    }
  },

  enable: function(form) {
    var elements = Form.getElements(form);
    for (var i = 0; i < elements.length; i++) {
      var element = elements[i];
      element.disabled = '';
    }
  },

  findFirstElement: function(form) {
    return Form.getElements(form).find(function(element) {
      return element.type != 'hidden' && !element.disabled &&
        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
    });
  },

  focusFirstElement: function(form) {
    Field.activate(Form.findFirstElement(form));
  },

  reset: function(form) {
    $(form).reset();
  }
}

Form.Element = {
  serialize: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    var parameter = Form.Element.Serializers[method](element);

    if (parameter) {
      var key = encodeURIComponent(parameter[0]);
      if (key.length == 0) return;

      if (parameter[1].constructor != Array)
        parameter[1] = [parameter[1]];

      return parameter[1].map(function(value) {
        return key + '=' + encodeURIComponent(value);
      }).join('&');
    }
  },

  getValue: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    var parameter = Form.Element.Serializers[method](element);

    if (parameter)
      return parameter[1];
  }
}

Form.Element.Serializers = {
  input: function(element) {
    switch (element.type.toLowerCase()) {
      case 'submit':
      case 'hidden':
      case 'password':
      case 'text':
        return Form.Element.Serializers.textarea(element);
      case 'checkbox':
      case 'radio':
        return Form.Element.Serializers.inputSelector(element);
    }
    return false;
  },

  inputSelector: function(element) {
    if (element.checked)
      return [element.name, element.value];
  },

  textarea: function(element) {
    return [element.name, element.value];
  },

  select: function(element) {
    return Form.Element.Serializers[element.type == 'select-one' ?
      'selectOne' : 'selectMany'](element);
  },

  selectOne: function(element) {
    var value = '', opt, index = element.selectedIndex;
    if (index >= 0) {
      opt = element.options[index];
      value = opt.value || opt.text;
    }
    return [element.name, value];
  },

  selectMany: function(element) {
    var value = [];
    for (var i = 0; i < element.length; i++) {
      var opt = element.options[i];
      if (opt.selected)
        value.push(opt.value || opt.text);
    }
    return [element.name, value];
  }
}

/*--------------------------------------------------------------------------*/

var $F = Form.Element.getValue;

/*--------------------------------------------------------------------------*/

Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
  initialize: function(element, frequency, callback) {
    this.frequency = frequency;
    this.element   = $(element);
    this.callback  = callback;

    this.lastValue = this.getValue();
    this.registerCallback();
  },

  registerCallback: function() {
    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  onTimerEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  }
}

Form.Element.Observer = Class.create();
Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.Observer = Class.create();
Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = function() {}
Abstract.EventObserver.prototype = {
  initialize: function(element, callback) {
    this.element  = $(element);
    this.callback = callback;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
    var elements = Form.getElements(this.element);
    for (var i = 0; i < elements.length; i++)
      this.registerCallback(elements[i]);
  },

  registerCallback: function(element) {
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          break;
        case 'password':
        case 'text':
        case 'textarea':
        case 'select-one':
        case 'select-multiple':
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
}

Form.Element.EventObserver = Class.create();
Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.EventObserver = Class.create();
Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
  getValue: function() {
    return Form.serialize(this.element);
  }
});
if (!window.Event) {
  var Event = new Object();
}

Object.extend(Event, {
  KEY_BACKSPACE: 8,
  KEY_TAB:       9,
  KEY_RETURN:   13,
  KEY_ESC:      27,
  KEY_LEFT:     37,
  KEY_UP:       38,
  KEY_RIGHT:    39,
  KEY_DOWN:     40,
  KEY_DELETE:   46,

  element: function(event) {
    return event.target || event.srcElement;
  },

  isLeftClick: function(event) {
    return (((event.which) && (event.which == 1)) ||
            ((event.button) && (event.button == 1)));
  },

  pointerX: function(event) {
    return event.pageX || (event.clientX +
      (document.documentElement.scrollLeft || document.body.scrollLeft));
  },

  pointerY: function(event) {
    return event.pageY || (event.clientY +
      (document.documentElement.scrollTop || document.body.scrollTop));
  },

  stop: function(event) {
    if (event.preventDefault) {
      event.preventDefault();
      event.stopPropagation();
    } else {
      event.returnValue = false;
      event.cancelBubble = true;
    }
  },

  // find the first node with the given tagName, starting from the
  // node the event was triggered on; traverses the DOM upwards
  findElement: function(event, tagName) {
    var element = Event.element(event);
    while (element.parentNode && (!element.tagName ||
        (element.tagName.toUpperCase() != tagName.toUpperCase())))
      element = element.parentNode;
    return element;
  },

  observers: false,

  _observeAndCache: function(element, name, observer, useCapture) {
    if (!this.observers) this.observers = [];
    if (element.addEventListener) {
      this.observers.push([element, name, observer, useCapture]);
      element.addEventListener(name, observer, useCapture);
    } else if (element.attachEvent) {
      this.observers.push([element, name, observer, useCapture]);
      element.attachEvent('on' + name, observer);
    }
  },

  unloadCache: function() {
    if (!Event.observers) return;
    for (var i = 0; i < Event.observers.length; i++) {
      Event.stopObserving.apply(this, Event.observers[i]);
      Event.observers[i][0] = null;
    }
    Event.observers = false;
  },

  observe: function(element, name, observer, useCapture) {
    var element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.attachEvent))
      name = 'keydown';

    this._observeAndCache(element, name, observer, useCapture);
  },

  stopObserving: function(element, name, observer, useCapture) {
    var element = $(element);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.detachEvent))
      name = 'keydown';

    if (element.removeEventListener) {
      element.removeEventListener(name, observer, useCapture);
    } else if (element.detachEvent) {
      element.detachEvent('on' + name, observer);
    }
  }
});

/* prevent memory leaks in IE */
if (navigator.appVersion.match(/\bMSIE\b/))
  Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
  // set to true if needed, warning: firefox performance problems
  // NOT neeeded for page scrolling, only if draggable contained in
  // scrollable elements
  includeScrollOffsets: false,

  // must be called before calling withinIncludingScrolloffset, every time the
  // page is scrolled
  prepare: function() {
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  realOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return [valueL, valueT];
  },

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return [valueL, valueT];
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        p = Element.getStyle(element, 'position');
        if (p == 'relative' || p == 'absolute') break;
      }
    } while (element);
    return [valueL, valueT];
  },

  offsetParent: function(element) {
    if (element.offsetParent) return element.offsetParent;
    if (element == document.body) return element;

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return element;

    return document.body;
  },

  // caches x/y coordinate pair to use with overlap
  within: function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = this.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  },

  withinIncludingScrolloffsets: function(element, x, y) {
    var offsetcache = this.realOffset(element);

    this.xcomp = x + offsetcache[0] - this.deltaX;
    this.ycomp = y + offsetcache[1] - this.deltaY;
    this.offset = this.cumulativeOffset(element);

    return (this.ycomp >= this.offset[1] &&
            this.ycomp <  this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp <  this.offset[0] + element.offsetWidth);
  },

  // within must be called directly before
  overlap: function(mode, element) {
    if (!mode) return 0;
    if (mode == 'vertical')
      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
    if (mode == 'horizontal')
      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
  },

  clone: function(source, target) {
    source = $(source);
    target = $(target);
    target.style.position = 'absolute';
    var offsets = this.cumulativeOffset(source);
    target.style.top    = offsets[1] + 'px';
    target.style.left   = offsets[0] + 'px';
    target.style.width  = source.offsetWidth + 'px';
    target.style.height = source.offsetHeight + 'px';
  },

  page: function(forElement) {
    var valueT = 0, valueL = 0;

    var element = forElement;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;

      // Safari fix
      if (element.offsetParent==document.body)
        if (Element.getStyle(element,'position')=='absolute') break;

    } while (element = element.offsetParent);

    element = forElement;
    do {
      valueT -= element.scrollTop  || 0;
      valueL -= element.scrollLeft || 0;
    } while (element = element.parentNode);

    return [valueL, valueT];
  },

  clone: function(source, target) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
      setHeight:  true,
      offsetTop:  0,
      offsetLeft: 0
    }, arguments[2] || {})

    // find page position of source
    source = $(source);
    var p = Position.page(source);

    // find coordinate system to use
    target = $(target);
    var delta = [0, 0];
    var parent = null;
    // delta [0,0] will do fine with position: fixed elements,
    // position:absolute needs offsetParent deltas
    if (Element.getStyle(target,'position') == 'absolute') {
      parent = Position.offsetParent(target);
      delta = Position.page(parent);
    }

    // correct by body offsets (fixes Safari)
    if (parent == document.body) {
      delta[0] -= document.body.offsetLeft;
      delta[1] -= document.body.offsetTop;
    }

    // set position
    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
    if(options.setHeight) target.style.height = source.offsetHeight + 'px';
  },

  absolutize: function(element) {
    element = $(element);
    if (element.style.position == 'absolute') return;
    Position.prepare();

    var offsets = Position.positionedOffset(element);
    var top     = offsets[1];
    var left    = offsets[0];
    var width   = element.clientWidth;
    var height  = element.clientHeight;

    element._originalLeft   = left - parseFloat(element.style.left  || 0);
    element._originalTop    = top  - parseFloat(element.style.top || 0);
    element._originalWidth  = element.style.width;
    element._originalHeight = element.style.height;

    element.style.position = 'absolute';
    element.style.top    = top + 'px';;
    element.style.left   = left + 'px';;
    element.style.width  = width + 'px';;
    element.style.height = height + 'px';;
  },

  relativize: function(element) {
    element = $(element);
    if (element.style.position == 'relative') return;
    Position.prepare();

    element.style.position = 'relative';
    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.height = element._originalHeight;
    element.style.width  = element._originalWidth;
  }
}

// Safari returns margins on body which is incorrect if the child is absolutely
// positioned.  For performance reasons, redefine Position.cumulativeOffset for
// KHTML/WebKit only.
if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
  Position.cumulativeOffset = function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      if (element.offsetParent == document.body)
        if (Element.getStyle(element, 'position') == 'absolute') break;

      element = element.offsetParent;
    } while (element);

    return [valueL, valueT];
  }
}// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
//  Justin Palmer (http://encytemedia.com/)
//  Mark Pilgrim (http://diveintomark.org/)
//  Martin Bialasinki
// 
// See scriptaculous.js for full license.  

// converts rgb() and #xxx to #xxxxxx format,  
// returns self (or first argument) if not convertable  
String.prototype.parseColor = function() {  
  var color = '#';  
  if(this.slice(0,4) == 'rgb(') {  
    var cols = this.slice(4,this.length-1).split(',');  
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
  } else {  
    if(this.slice(0,1) == '#') {  
      if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
      if(this.length==7) color = this.toLowerCase();  
    }  
  }  
  return(color.length==7 ? color : (arguments[0] || this));  
}

/*--------------------------------------------------------------------------*/

Element.collectTextNodes = function(element) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
  }).flatten().join('');
}

Element.collectTextNodesIgnoreClass = function(element, className) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
        Element.collectTextNodesIgnoreClass(node, className) : ''));
  }).flatten().join('');
}

Element.setContentZoom = function(element, percent) {
  element = $(element);  
  Element.setStyle(element, {fontSize: (percent/100) + 'em'});   
  if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
}

Element.getOpacity = function(element){  
  var opacity;
  if (opacity = Element.getStyle(element, 'opacity'))  
    return parseFloat(opacity);  
  if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))  
    if(opacity[1]) return parseFloat(opacity[1]) / 100;  
  return 1.0;  
}

Element.setOpacity = function(element, value){  
  element= $(element);  
  if (value == 1){
    Element.setStyle(element, { opacity: 
      (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 
      0.999999 : null });
    if(/MSIE/.test(navigator.userAgent))  
      Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});  
  } else {  
    if(value < 0.00001) value = 0;  
    Element.setStyle(element, {opacity: value});
    if(/MSIE/.test(navigator.userAgent))  
     Element.setStyle(element, 
       { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
                 'alpha(opacity='+value*100+')' });  
  }
}  
 
Element.getInlineOpacity = function(element){  
  return $(element).style.opacity || '';
}  

Element.childrenWithClassName = function(element, className, findFirst) {
  var classNameRegExp = new RegExp("(^|\\s)" + className + "(\\s|$)");
  var results = $A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) { 
    return (c.className && c.className.match(classNameRegExp));
  });
  if(!results) results = [];
  return results;
}

Element.forceRerendering = function(element) {
  try {
    element = $(element);
    var n = document.createTextNode(' ');
    element.appendChild(n);
    element.removeChild(n);
  } catch(e) { }
};

/*--------------------------------------------------------------------------*/

Array.prototype.call = function() {
  var args = arguments;
  this.each(function(f){ f.apply(this, args) });
}

/*--------------------------------------------------------------------------*/

var Effect = {
  tagifyText: function(element) {
    var tagifyStyle = 'position:relative';
    if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if(child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            Builder.node('span',{style: tagifyStyle},
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if(((typeof element == 'object') || 
        (typeof element == 'function')) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || {});
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || {});
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};

var Effect2 = Effect; // deprecated

/* ------------- transitions ------------- */

Effect.Transitions = {}

Effect.Transitions.linear = function(pos) {
  return pos;
}
Effect.Transitions.sinoidal = function(pos) {
  return (-Math.cos(pos*Math.PI)/2) + 0.5;
}
Effect.Transitions.reverse  = function(pos) {
  return 1-pos;
}
Effect.Transitions.flicker = function(pos) {
  return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
}
Effect.Transitions.wobble = function(pos) {
  return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
}
Effect.Transitions.pulse = function(pos) {
  return (Math.floor(pos*10) % 2 == 0 ? 
    (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
}
Effect.Transitions.none = function(pos) {
  return 0;
}
Effect.Transitions.full = function(pos) {
  return 1;
}

/* ------------- core effects ------------- */

Effect.ScopedQueue = Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
  initialize: function() {
    this.effects  = [];
    this.interval = null;
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = (typeof effect.options.queue == 'string') ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if(!this.interval) 
      this.interval = setInterval(this.loop.bind(this), 40);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if(this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    this.effects.invoke('loop', timePos);
  }
});

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if(typeof queueName != 'string') return queueName;
    
    if(!this.instances[queueName])
      this.instances[queueName] = new Effect.ScopedQueue();
      
    return this.instances[queueName];
  }
}
Effect.Queue = Effect.Queues.get('global');

Effect.DefaultOptions = {
  transition: Effect.Transitions.sinoidal,
  duration:   1.0,   // seconds
  fps:        25.0,  // max. 25fps due to Effect.Queue implementation
  sync:       false, // true for combining
  from:       0.0,
  to:         1.0,
  delay:      0.0,
  queue:      'parallel'
}

Effect.Base = function() {};
Effect.Base.prototype = {
  position: null,
  start: function(options) {
    this.options      = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn + (this.options.duration*1000);
    this.event('beforeStart');
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if(timePos >= this.startOn) {
      if(timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if(this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / (this.finishOn - this.startOn);
      var frame = Math.round(pos * this.options.fps * this.options.duration);
      if(frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  render: function(pos) {
    if(this.state == 'idle') {
      this.state = 'running';
      this.event('beforeSetup');
      if(this.setup) this.setup();
      this.event('afterSetup');
    }
    if(this.state == 'running') {
      if(this.options.transition) pos = this.options.transition(pos);
      pos *= (this.options.to-this.options.from);
      pos += this.options.from;
      this.position = pos;
      this.event('beforeUpdate');
      if(this.update) this.update(pos);
      this.event('afterUpdate');
    }
  },
  cancel: function() {
    if(!this.options.sync)
      Effect.Queues.get(typeof this.options.queue == 'string' ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if(this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
}

Effect.Parallel = Class.create();
Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
  initialize: function(effects) {
    this.effects = effects || [];
    this.start(arguments[1]);
  },
  update: function(position) {
    this.effects.invoke('render', position);
  },
  finish: function(position) {
    this.effects.each( function(effect) {
      effect.render(1.0);
      effect.cancel();
      effect.event('beforeFinish');
      if(effect.finish) effect.finish(position);
      effect.event('afterFinish');
    });
  }
});

Effect.Opacity = Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    // make this work on IE on elements without 'layout'
    if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
      this.element.setStyle({zoom: 1});
    var options = Object.extend({
      from: this.element.getOpacity() || 0.0,
      to:   1.0
    }, arguments[1] || {});
    this.start(options);
  },
  update: function(position) {
    this.element.setOpacity(position);
  }
});

Effect.Move = Class.create();
Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Bug in Opera: Opera returns the "real" position of a static element or
    // relative element that does not have top/left explicitly set.
    // ==> Always set top and left for position relative elements in your stylesheets 
    // (to 0 if you do not need them) 
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if(this.options.mode == 'absolute') {
      // absolute movement, so we need to calc deltaX and deltaY
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: this.options.x  * position + this.originalLeft + 'px',
      top:  this.options.y  * position + this.originalTop  + 'px'
    });
  }
});

// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
};

Effect.Scale = Class.create();
Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
  initialize: function(element, percent) {
    this.element = $(element)
    var options = Object.extend({
      scaleX: true,
      scaleY: true,
      scaleContent: true,
      scaleFromCenter: false,
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || {});
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');
    
    this.originalStyle = {};
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    
    var fontSize = this.element.getStyle('font-size') || '100%';
    ['em','px','%'].each( function(fontSizeType) {
      if(fontSize.indexOf(fontSizeType)>0) {
        this.fontSize     = parseFloat(fontSize);
        this.fontSizeType = fontSizeType;
      }
    }.bind(this));
    
    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    
    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
    if(this.options.scaleContent && this.fontSize)
      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
  },
  finish: function(position) {
    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = {};
    if(this.options.scaleX) d.width = width + 'px';
    if(this.options.scaleY) d.height = height + 'px';
    if(this.options.scaleFromCenter) {
      var topd  = (height - this.dims[0])/2;
      var leftd = (width  - this.dims[1])/2;
      if(this.elementPositioning == 'absolute') {
        if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
        if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
      } else {
        if(this.options.scaleY) d.top = -topd + 'px';
        if(this.options.scaleX) d.left = -leftd + 'px';
      }
    }
    this.element.setStyle(d);
  }
});

Effect.Highlight = Class.create();
Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
    this.start(options);
  },
  setup: function() {
    // Prevent executing on elements not in the layout flow
    if(this.element.getStyle('display')=='none') { this.cancel(); return; }
    // Disable background image during the effect
    this.oldStyle = {
      backgroundImage: this.element.getStyle('background-image') };
    this.element.setStyle({backgroundImage: 'none'});
    if(!this.options.endcolor)
      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
    if(!this.options.restorecolor)
      this.options.restorecolor = this.element.getStyle('background-color');
    // init color calculations
    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
  },
  update: function(position) {
    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
      return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
  },
  finish: function() {
    this.element.setStyle(Object.extend(this.oldStyle, {
      backgroundColor: this.options.restorecolor
    }));
  }
});

Effect.ScrollTo = Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    this.start(arguments[1] || {});
  },
  setup: function() {
    Position.prepare();
    var offsets = Position.cumulativeOffset(this.element);
    if(this.options.offset) offsets[1] += this.options.offset;
    var max = window.innerHeight ? 
      window.height - window.innerHeight :
      document.body.scrollHeight - 
        (document.documentElement.clientHeight ? 
          document.documentElement.clientHeight : document.body.clientHeight);
    this.scrollStart = Position.deltaY;
    this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
  },
  update: function(position) {
    Position.prepare();
    window.scrollTo(Position.deltaX, 
      this.scrollStart + (position*this.delta));
  }
});

/* ------------- combination effects ------------- */

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
  from: element.getOpacity() || 1.0,
  to:   0.0,
  afterFinishInternal: function(effect) { 
    if(effect.options.to!=0) return;
    effect.element.hide();
    effect.element.setStyle({opacity: oldOpacity}); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Appear = function(element) {
  element = $(element);
  var options = Object.extend({
  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
  to:   1.0,
  // force Safari to render floated elements properly
  afterFinishInternal: function(effect) {
    effect.element.forceRerendering();
  },
  beforeSetup: function(effect) {
    effect.element.setOpacity(effect.options.from);
    effect.element.show(); 
  }}, arguments[1] || {});
  return new Effect.Opacity(element,options);
}

Effect.Puff = function(element) {
  element = $(element);
  var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') };
  return new Effect.Parallel(
   [ new Effect.Scale(element, 200, 
      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
     Object.extend({ duration: 1.0, 
      beforeSetupInternal: function(effect) {
        effect.effects[0].element.setStyle({position: 'absolute'}); },
      afterFinishInternal: function(effect) {
         effect.effects[0].element.hide();
         effect.effects[0].element.setStyle(oldStyle); }
     }, arguments[1] || {})
   );
}

Effect.BlindUp = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0, 
    Object.extend({ scaleContent: false, 
      scaleX: false, 
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide();
        effect.element.undoClipping();
      } 
    }, arguments[1] || {})
  );
}

Effect.BlindDown = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, 
    Object.extend({ scaleContent: false, 
      scaleX: false,
      scaleFrom: 0,
      scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
      restoreAfterFinish: true,
      afterSetup: function(effect) {
        effect.element.makeClipping();
        effect.element.setStyle({height: '0px'});
        effect.element.show(); 
      },  
      afterFinishInternal: function(effect) {
        effect.element.undoClipping();
      }
    }, arguments[1] || {})
  );
}

Effect.SwitchOff = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  return new Effect.Appear(element, { 
    duration: 0.4,
    from: 0,
    transition: Effect.Transitions.flicker,
    afterFinishInternal: function(effect) {
      new Effect.Scale(effect.element, 1, { 
        duration: 0.3, scaleFromCenter: true,
        scaleX: false, scaleContent: false, restoreAfterFinish: true,
        beforeSetup: function(effect) { 
          effect.element.makePositioned();
          effect.element.makeClipping();
        },
        afterFinishInternal: function(effect) {
          effect.element.hide();
          effect.element.undoClipping();
          effect.element.undoPositioned();
          effect.element.setStyle({opacity: oldOpacity});
        }
      })
    }
  });
}

Effect.DropOut = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left'),
    opacity: element.getInlineOpacity() };
  return new Effect.Parallel(
    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    Object.extend(
      { duration: 0.5,
        beforeSetup: function(effect) {
          effect.effects[0].element.makePositioned(); 
        },
        afterFinishInternal: function(effect) {
          effect.effects[0].element.hide();
          effect.effects[0].element.undoPositioned();
          effect.effects[0].element.setStyle(oldStyle);
        } 
      }, arguments[1] || {}));
}

Effect.Shake = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left') };
    return new Effect.Move(element, 
      { x:  20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  40, y: 0, duration: 0.1,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
        effect.element.undoPositioned();
        effect.element.setStyle(oldStyle);
  }}) }}) }}) }}) }}) }});
}

Effect.SlideDown = function(element) {
  element = $(element);
  element.cleanWhitespace();
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false, 
    scaleFrom: window.opera ? 0 : 1,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.firstChild.makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping();
      effect.element.setStyle({height: '0px'});
      effect.element.show(); },
    afterUpdateInternal: function(effect) {
      effect.element.firstChild.setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping(); 
      // IE will crash if child is undoPositioned first
      if(/MSIE/.test(navigator.userAgent)){
        effect.element.undoPositioned();
        effect.element.firstChild.undoPositioned();
      }else{
        effect.element.firstChild.undoPositioned();
        effect.element.undoPositioned();
      }
      effect.element.firstChild.setStyle({bottom: oldInnerBottom}); }
    }, arguments[1] || {})
  );
}
  
Effect.SlideUp = function(element) {
  element = $(element);
  element.cleanWhitespace();
  var oldInnerBottom = $(element.firstChild).getStyle('bottom');
  return new Effect.Scale(element, window.opera ? 0 : 1,
   Object.extend({ scaleContent: false, 
    scaleX: false, 
    scaleMode: 'box',
    scaleFrom: 100,
    restoreAfterFinish: true,
    beforeStartInternal: function(effect) {
      effect.element.makePositioned();
      effect.element.firstChild.makePositioned();
      if(window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping();
      effect.element.show(); },  
    afterUpdateInternal: function(effect) {
      effect.element.firstChild.setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); },
    afterFinishInternal: function(effect) {
      effect.element.hide();
      effect.element.undoClipping();
      effect.element.firstChild.undoPositioned();
      effect.element.undoPositioned();
      effect.element.setStyle({bottom: oldInnerBottom}); }
   }, arguments[1] || {})
  );
}

// Bug in opera makes the TD containing this element expand for a instance after finish 
Effect.Squish = function(element) {
  return new Effect.Scale(element, window.opera ? 1 : 0, 
    { restoreAfterFinish: true,
      beforeSetup: function(effect) {
        effect.element.makeClipping(effect.element); },  
      afterFinishInternal: function(effect) {
        effect.element.hide(effect.element); 
        effect.element.undoClipping(effect.element); }
  });
}

Effect.Grow = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.full
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();    
  var initialMoveX, initialMoveY;
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      initialMoveX = initialMoveY = moveX = moveY = 0; 
      break;
    case 'top-right':
      initialMoveX = dims.width;
      initialMoveY = moveY = 0;
      moveX = -dims.width;
      break;
    case 'bottom-left':
      initialMoveX = moveX = 0;
      initialMoveY = dims.height;
      moveY = -dims.height;
      break;
    case 'bottom-right':
      initialMoveX = dims.width;
      initialMoveY = dims.height;
      moveX = -dims.width;
      moveY = -dims.height;
      break;
    case 'center':
      initialMoveX = dims.width / 2;
      initialMoveY = dims.height / 2;
      moveX = -dims.width / 2;
      moveY = -dims.height / 2;
      break;
  }
  
  return new Effect.Move(element, {
    x: initialMoveX,
    y: initialMoveY,
    duration: 0.01, 
    beforeSetup: function(effect) {
      effect.element.hide();
      effect.element.makeClipping();
      effect.element.makePositioned();
    },
    afterFinishInternal: function(effect) {
      new Effect.Parallel(
        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
          new Effect.Scale(effect.element, 100, {
            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
        ], Object.extend({
             beforeSetup: function(effect) {
               effect.effects[0].element.setStyle({height: '0px'});
               effect.effects[0].element.show(); 
             },
             afterFinishInternal: function(effect) {
               effect.effects[0].element.undoClipping();
               effect.effects[0].element.undoPositioned();
               effect.effects[0].element.setStyle(oldStyle); 
             }
           }, options)
      )
    }
  });
}

Effect.Shrink = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.none
  }, arguments[1] || {});
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      moveX = moveY = 0;
      break;
    case 'top-right':
      moveX = dims.width;
      moveY = 0;
      break;
    case 'bottom-left':
      moveX = 0;
      moveY = dims.height;
      break;
    case 'bottom-right':
      moveX = dims.width;
      moveY = dims.height;
      break;
    case 'center':  
      moveX = dims.width / 2;
      moveY = dims.height / 2;
      break;
  }
  
  return new Effect.Parallel(
    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    ], Object.extend({            
         beforeStartInternal: function(effect) {
           effect.effects[0].element.makePositioned();
           effect.effects[0].element.makeClipping(); },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide();
           effect.effects[0].element.undoClipping();
           effect.effects[0].element.undoPositioned();
           effect.effects[0].element.setStyle(oldStyle); }
       }, options)
  );
}

Effect.Pulsate = function(element) {
  element = $(element);
  var options    = arguments[1] || {};
  var oldOpacity = element.getInlineOpacity();
  var transition = options.transition || Effect.Transitions.sinoidal;
  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
  reverser.bind(transition);
  return new Effect.Opacity(element, 
    Object.extend(Object.extend({  duration: 3.0, from: 0,
      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
    }, options), {transition: reverser}));
}

Effect.Fold = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height };
  Element.makeClipping(element);
  return new Effect.Scale(element, 5, Object.extend({   
    scaleContent: false,
    scaleX: false,
    afterFinishInternal: function(effect) {
    new Effect.Scale(element, 1, { 
      scaleContent: false, 
      scaleY: false,
      afterFinishInternal: function(effect) {
        effect.element.hide();
        effect.element.undoClipping(); 
        effect.element.setStyle(oldStyle);
      } });
  }}, arguments[1] || {}));
};

['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each( 
  function(f) { Element.Methods[f] = Element[f]; }
);

Element.Methods.visualEffect = function(element, effect, options) {
  s = effect.gsub(/_/, '-').camelize();
  effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  new Effect[effect_class](element, options);
  return $(element);
};

Element.addMethods();
function toggleLocationForm(){
  new Effect.toggle('location_form','slide');
  return false;
}

function toggleProductPhoto(Base){
  var ImgCurrent = $('product_photo');
  if(ImgCurrent.src.indexOf('shop,l,')>0){
    new Effect.Scale( 'product_photo', 50,{
      scaleContent:false,
      duration: 1.0,
      queue:'end',
      afterFinish: function(){$('product_photo').src = "http://secure.dita.de/image/shop,m,"+Base;}
    });
    new Effect.BlindDown('tea_code',{ duration: 1.0, queue:'end'  });
    //$('product_photo').src = "http://secure.dita.de/image/shop,m,"+Base;
  }else{
    new Effect.BlindUp('tea_code',{ duration: 1.0, queue:'end'});
    new Effect.Scale( 'product_photo', 200, {
      duration: 1.0,
      queue:'end',
      afterFinish: function(){$('product_photo').src = "http://secure.dita.de/image/shop,l,"+Base;}
    });
    //$('product_photo').src = "http://secure.dita.de/image/shop,l,"+Base;
  }
  return false;
}


function ajaxBasket(Quantity,ProductNr){
  var LangID = 'fr';
  var ReturnValue = false;
  var ProductIMG = $('product_image_'+ProductNr);
  var ProductForm= $('product_form_' +ProductNr);

  //alert(Quantity+" von Nr "+ProductNr+", "+ImageID);

  $('placeholder_ajax_basket').src = "/img/global/ajax_anim.gif";
  new Ajax.Request("/ajax/ajax_basket.php", {
    // submit quantity data
    onFailure:function(resp){ ReturnValue = true; },
    parameters: "lang_id="+LangID+"&update=yes&product["+ProductNr+"]="+Quantity,
    onSuccess: function(resp){
      // when data changed hide the basket
      new Effect.SlideUp('basket_minihtml',{
        afterFinish: function(){
          // load the basket HTML
          new Ajax.Updater('basket_minihtml',"/ajax/ajax_basket.php", {
            parameters: "lang_id="+LangID+"&receive=basket",
            onSuccess: function(){
              // load the status
              new Ajax.Updater('basket_status',"/ajax/ajax_basket.php", {
                parameters: "lang_id="+LangID+"&receive=status",
                onSuccess: function(){
                  // flash the basket status
                  new Effect.Highlight('basket_status_area',{
                    startcolor:'#ff9b6f'
                  });
                  // replace the basket main content when we are on this page
                  if($('complete_basket')){
                    new Ajax.Updater('complete_basket',"/ajax/ajax_basket.php", {
                      parameters: "full_basket=1&lang_id="+LangID,
                      method:'post',
                      onFailure:function(resp){ ReturnValue = true; }
                    });
                  }
                  // show the basket again
                  new Effect.SlideDown('basket_minihtml',{
                    afterFinish:function(){
                      if(ProductForm){
                        if(Quantity > 0){
                          ProductForm.className = 'product_form_filled';
                        }else{
                          ProductForm.className = 'product_form';
                        }
                      }
                      $('placeholder_ajax_basket').src = "/img/global/1x1.gif";
                    }
                  });
                }
              });
            }
          });
        }
      });
    }
  });
  return ReturnValue;
}
