function newWin(link,nume,location)
{   
     window.location.href=location;     
     //window.open(link,nume);  
     window.open(link,"_blank")  
}  
function OnFocusUserInput(element,value)
{
    element.value="";
}
function OnBlurUserInput(element,value)
{
    //alert(value);
    if(element.value=="")    
        element.value=value
}

function doLogout(location)
{      
   var objInput = document.createElement("input");
   objInput.name = "portalAction";
   objInput.type = "hidden";
   objInput.value = "logout";
   document.forms[0].appendChild(objInput);
   document.forms[0].submit();
   // window.location.href=location+'?action=logout';
}


/*

Milonic DHTML Menu - JavaScript Website Navigation System.
Version 5.818 - Built: Monday March 2 2009 - 12:22
Copyright 2009 (c) Milonic Solutions Limited. All Rights Reserved.
This is a commercial software product, please visit http://www.milonic.com/ for more information.
See http://www.milonic.com/license.php for Commercial License Agreement
All Copyright statements must always remain in place in all files at all times

*******  PLEASE NOTE: THIS IS NOT FREE SOFTWARE, IT MUST BE LICENSED FOR ALL USE  ******* 

License Details:
 Number: 209059
    URL: www.carpatair.com
   Type: Professional
  Dated: Monday February 23 2009

*/

lNum=209059;lURL="www.carpatair.com";lVer="5.818";_mD=2;_d=document;_dB=_d.body;_n=navigator;_L=location;_nv=$tU(_n.appVersion);_nu=$tU(_n.userAgent);_ps=parseInt(_n.productSub);_cls=_toL=X_=Y_=_n=null;_W=window;_wp=_W.createPopup;ie=(_d.all)?1:0;ie4=(!_d.getElementById&&ie)?1:0;ie5=(!ie4&&ie&&!_wp)?1:0;ie55=(!ie4&&ie&&_wp)?1:0;ie7=(_nu.indexOf("MSIE 7")!=-1)?1:0;ie8=(_nu.indexOf("MSIE 8")!=-1)?1:0;ns6=(_nu.indexOf("GECKO")!=-1)?1:0;konq=(_nu.indexOf("KONQUEROR")!=-1)?1:0;sfri=(_nu.indexOf("SAFARI")!=-1)?1:0;if(konq||sfri){_ps=0;ns6=0}ns4=(_d.layers)?1:0;ns61=(_ps>=20010726)?1:0;ns7=(_ps>=20020823)?1:0;ns72=(_ps>=20040804)?1:0;ff3=(_ps>=200800000)?1:0;op=(_W.opera)?1:0;mac=(_nv.indexOf("MAC")!=-1)?1:0;if(ns6||ns4||op||sfri)mac=0;ns60=0;if(ns6&&!ns61)ns60=1;IEDtD=0;if(!op&&((_d.all||ns7)&&_d.compatMode=="CSS1Compat")||(mac&&_d.doctype&&_d.doctype.name.indexOf(".dtd")!=-1))IEDtD=1;_jv="javascript:void(0);";inEditMode=_rstC=inDragMode=_d.dne=lcl=$R1=$mD=_mcnt=_sL=_sT=_ofMT=_oldbW=_bW=_oldbH=_bl=_el=_st=_en=_cKA=$BW=0;_mtX="";_startM=_c=1;_trueItemRef=focusedMenu=t_=_itemRef=_mn=-1;_zi=_aN=_bH=999;if(op)ie55=0;B$="absolute";$O="menu";$5="hidden";$_O="scroll";function $c(v){if(_d.getElementById)return _d.getElementById(v);if(_d.all)return _d.all[v]}function _StO(f,m){return setTimeout(f,m)}_m=[];_mi=[];_sm=[];_tsm=[];_cip=[];$S3="2E636F6D2F";$S4="646D2E706870";$S5=4048;_MT=_StO("",0);_oMT=_StO("",0);_cMT=_StO("",0);_mst=_StO("",0);_Mtip=_StO("",0);$u="undefined ";_Lhr=_L.href;$6="visible";function M_hideLayer(){}function _oTree(){}function mmMouseMove(){}function _TtM(){}function _IdM(){}function _ocURL(){}function mmClick(){}function autoOT(){}function _iF0C(){}function showtip(){}function isEditMode(){}function hidetip(){}function mmVisFunction(){}function doMenuResize(){}function _tMR(){}function _maxm(){}function _p8(a,d){var t=[];for(_a=0;_a<a.length;_a++){if(a[_a]!=d){t[t.length]=a[_a]}}return t}function copyOf(w){for(_cO in w){this[_cO]=w[_cO]}}function $tL(v){if(v)return v.toLowerCase()}function $tU(v){if(v)return v.toUpperCase()}function $pU(v){if(v)return parseInt(v)}_lDd=0;function _gLd(){if(_d.readyState&&_d.readyState!="complete"){setTimeout("_gLd()",50);return}_lDd=1;_oldbH=0}if(!_d.readyState&&!ns4)_d.addEventListener('DOMContentLoaded',_gLd,false);else setTimeout("_gLd()",50);function drawMenus(){_startM=1;_oldbH=0;_oldbW=0;_baL=0;if(_W.buildAfterLoad)_baL=1;for(_y=_mcnt;_y<_m.length;_y++)o$(_y,1,_baL);if(_W._pageIsXML){var G=$c(_menuContainer);if(!G){G=_d.createElement("div");G.id=_menuContainer;_dB.appendChild(G)}G.innerHTML=_mtX}}_$S={menu:0,text:1,url:2,showmenu:3,status:4,onbgcolor:5,oncolor:6,offbgcolor:7,offcolor:8,offborder:9,separatorcolor:10,padding:11,fontsize:12,fontstyle:13,fontweight:14,fontfamily:15,high3dcolor:16,low3dcolor:17,pagecolor:18,pagebgcolor:19,headercolor:20,headerbgcolor:21,subimagepadding:22,subimageposition:23,subimage:24,onborder:25,ondecoration:26,separatorsize:27,itemheight:28,image:29,imageposition:30,imagealign:31,overimage:32,decoration:33,type:34,target:35,align:36,imageheight:37,imagewidth:38,openonclick:39,closeonclick:40,keepalive:41,onfunction:42,offfunction:43,onbold:44,onitalic:45,bgimage:46,overbgimage:47,onsubimage:48,separatorheight:49,separatorwidth:50,separatorpadding:51,separatoralign:52,onclass:53,offclass:54,itemwidth:55,pageimage:56,targetfeatures:57,visitedcolor:58,pointer:59,imagepadding:60,valign:61,clickfunction:62,bordercolor:63,borderstyle:64,borderwidth:65,overfilter:66,outfilter:67,margin:68,pagebgimage:69,swap3d:70,separatorimage:71,pageclass:72,menubgimage:73,headerborder:74,pageborder:75,title:76,pagematch:77,rawcss:78,fileimage:79,clickcolor:80,clickbgcolor:81,clickimage:82,clicksubimage:83,imageurl:84,pagesubimage:85,dragable:86,clickclass:87,clickbgimage:88,imageborderwidth:89,onseparatorimage:90,clickseparatorimage:91,pageseparatorimage:92,menubgcolor:93,opendelay:94,tooltip:95,disabled:96,dividespan:97,tipdelay:98,tipfollow:99,tipmenu:100,menustyle:101,pageoncolor:102,id:103,onpageimage:104,nowrap:105,overflow:106,hotkey:107,leftimage:108,rightimage:109,onleftimage:110,onrightimage:111,pageleftimage:112,pagerightimage:113,nobreadcrumb:114,custom:115,subimagecss:116,onsubimagecss:117,regexmatch:118,pageonclass:119,innerbgimage:120,oninnerbgimage:121,pageinnerbgimage:122,clickinnerbgimage:123,clickrightimage:124};function mm_style(){for($i in _$S)this[$i]=_n;this.built=0}_$M={items:0,name:1,top:2,left:3,itemwidth:4,screenposition:5,style:6,alwaysvisible:7,align:8,orientation:9,keepalive:10,openstyle:11,margin:12,overflow:13,position:14,overfilter:15,outfilter:16,menuwidth:17,itemheight:18,followscroll:19,menualign:20,mm_callItem:21,mm_obj_ref:22,mm_built:23,menuheight:24,ignorecollision:25,divides:26,zindex:27,opendelay:28,resizable:29,minwidth:30,maxwidth:31,mm_fixheight:32,C:33,rawcss:34,minleft:35};function menuname(name){for($i in _$M)this[$i]=_n;this.name=$tL(name);_c=1;_mn++}function f_(i){_mi[_bl]=[];_mi[_bl][0]=_mn;i=i.split(";");_sc="";for(var a=0;a<i.length;a++){var p=i[a].indexOf("`");if(p!=-1){_sc=";";_tI=i[a];if(p==i[a].lastIndexOf("`")){for(var b=a;b<i.length;b++){if(i[b+1]){_tI+=";"+i[b+1];a++;if(i[b+1].indexOf("`")!=-1)b=i.length}}}i[a]=_tI.replace(/`/g,"")}p=i[a].indexOf("=");if(p==-1){if(i[a])_si=_si+";"+i[a]+_sc}else{_si=i[a].slice(p+1);_w=i[a].slice(0,p);if(_w=="showmenu")_si=$tL(_si)}if(i[a]&&_$S[_w])_mi[_bl][_$S[_w]]=_si}var S=_x[6];if(_mi[_bl][101])S=eval(_mi[_bl][101]);for($i in S)if(S[$i]){var v=_mi[_bl][_$S[$i]];if(!v&&v!="")_mi[_bl][_$S[$i]]=S[$i]}_m[_mn][0][_c-2]=_bl;_c++;_bl++}_c=0;function ami(t){_t=this;if(_c==1){_c++;_m[_mn]=[];_x=_m[_mn];for($i in _t)_x[_$M[$i]]=_t[$i];_x[21]=-1;_x[0]=[];if(!_x[12])_x[12]=0;var s=_m[_mn][6];var m=_m[_mn];if(m[15]==_n)m[15]=s.overfilter;if(m[16]==_n)m[16]=s.outfilter;if(m[13]==_n)m[13]=s.overflow;s[65]=(s.borderwidth)?$pU(s.borderwidth):0;s[64]=s.borderstyle;s[63]=s.bordercolor;if(_W.ignoreCollisions)m[25]=1;if(!s.built){_WzI=_zi;if(_W.menuZIndex){_WzI=_W.menuZIndex;_zi=_WzI}lcl++;var v=s.visitedcolor;if(v&&!_W._pageIsXML){_oC=s.offcolor;if(!_oC)_oC="#000000";if(!v)v="#ff0000";_d.write("<style>.g_"+lcl+":link{color:"+_oC+"}.g_"+lcl+":visited{color:"+v+"}</style>");s.g_="g_"+lcl}s.built=1}}f_(t)}menuname.prototype.aI=ami;
/*

Milonic DHTML Menu - JavaScript Website Navigation System.
Version 5.818 - Built: Monday March 2 2009 - 12:22
Copyright 2009 (c) Milonic Solutions Limited. All Rights Reserved.
This is a commercial software product, please visit http://www.milonic.com/ for more information.
See http://www.milonic.com/license.php for Commercial License Agreement
All Copyright statements must always remain in place in all files at all times

*******  PLEASE NOTE: THIS IS NOT FREE SOFTWARE, IT MUST BE LICENSED FOR ALL USE  ******* 

License Details:
 Number: 209059
    URL: www.carpatair.com
   Type: Professional
  Dated: Monday February 23 2009

*/

function $9(ap){if(ie55){try{if(ap.filters){return 1}}catch(e){}}else return false}function _p1(t){if(t._itemRef!=_itemRef)h$(t._itemRef,0,1)}function $P($){clearTimeout($);return _n}$7=0;$8=0;function _DC(){if(!_W.contextObject&&_trueItemRef==-1)$bb()}function _5($){return eval($)}function gMY(e){if(ns6){X_=e.pageX;Y_=e.pageY}else{e=event;X_=e.clientX;Y_=e.clientY}mmMouseMove();_TtM();_IdM();doMenuResize(focusedMenu)}_dC=_DC;if(_d.onmousedown)_dC=_dC+_d.onmousedown;_d.onmousedown=_dC;_TbS="<table class=milonictable border=0 cellpadding=0 cellspacing=0 style='line-height:normal;padding:0px' ";function $_E(g,t,l,h,w){_px="px";var s=g.style;if(w<0)w=0;if(h<0)h=0;if(w+" "==$u)w=_n;if(h+" "==$u)h=_n;if(w!=_n)s.width=w+_px;if(h!=_n)s.height=h+_px;if(!isNaN(t)&&t!=_n)s.top=t+_px;if(!isNaN(l)&&l!=_n)s.left=l+_px}function gcss(v,s){if(v.currentStyle)return v.currentStyle[s];else if(getComputedStyle)return document.defaultView.getComputedStyle(v,null).getPropertyValue(s)}function $D(g){if(!g)return;var h,w,o,t,l;h=g.offsetHeight;w=g.offsetWidth;o=g;t=0;l=0;while(o!=_n){t+=o.offsetTop;l+=o.offsetLeft;o=o.offsetParent}if(sfri){l-=$8;t-=$7}if(mac&&_dB){_mcdb=_dB.currentStyle;_mcf=_mcdb.marginTop;if(_mcf)t=t+$pU(_mcf);_mcf=_mcdb.marginLeft;if(_mcf)l=l+$pU(_mcf)}return(new Array(t,l,h,w))}function $2(g,m){var s,f,i,x;if($9(g)){s=g.style;f=(s.visibility==$6)?_m[m][16]:_m[m][15];if(f){if(g.filters[0])g.filters[0].stop();i="filter:";if(ie8)i="-ms-filter:";f=f.split(";");for(x=0;x<f.length;x++){i+=" progid:DXImageTransform.Microsoft."+f[x];if(_nv.indexOf("MSIE 5.5")>0)x=_aN;}s.filter=i;g.filters[0].apply();}}}function $3(g,m){if($9(g)){_flt=(g.style.visibility==$6)?_m[m][15]:_m[m][16];if(_flt)g.filters[0].play()}}function $Y(){var o,s,X,v,D,g=arguments,t,g,t,l;D=g[0];v=g[1];o=$c($O+D);if(!o)return;s=o.style;_m[D][22]=o;if(v){M_hideLayer(D,v);X=_mLt*_fLm.length+" ";if(_kLm!=Math.ceil(X.substr(0,10)))_mi=[];if(!_startM)_m[D][23]=1;t=g[2]!=_n?g[2]:_n;l=g[3]!=_n?g[3]:_n;if(t>-1||l>-1)$_E(o,t,l);if(_m[D][5])p$(D);if(s.visibility!=$6){$2(o,D);if(!_m[D][27])s.zIndex=_zi;else s.zIndex=_m[D][27];if(_m[D][31]&&_m[D][31]<o.offsetWidth)$_E(o,_n,_n,_n,_m[D][31]);s.visibility=$6;$3(o,D);$V(D,1);mmVisFunction(D,v);if(!_m[D][7])_m[D][21]=_itemRef;$mD++}$1(D)}else{if(_m[D][21]>-1&&_itemRef!=_m[D][21])d$(_m[D][21]);if(s.visibility==$6){hmL(D);$V(D,0);mmVisFunction(D,v);$2(o,D);s.visibility=$5;if(!ie)s.top="-9999px";$3(o,D);$mD--}_m[D][21]=-1}}function $Z(){var g,a,M;if(inEditMode)return;g=arguments;if(t_>-1)d$(t_,1);t_=-1;_oMT=$P(_oMT);for(a=0;a<_m.length;a++){M=_m[a];if(M&&!M[7]&&!M[10]&&g[0]!=a){$Y(a);M_hideLayer(a,0)}else{hmL(a)}}if(!_W.incZindex)_zi=_WzI;_itemRef=-1;$j=-1;if(_W.resetAutoOpen)_ocURL()}function $d(v){if(v+" "==$u)return-1;return _mi[v][0]}function $e(v){var t,x;t=$d(v);if(t==-1)return-1;for(x=0;x<_mi.length;x++)if(_mi[x]&&_mi[x][3]==_m[t][1])return _mi[x][0]}_mLt=12297.588;function $f(v){var t,x;t=$d(v);if(t==-1)return-1;for(x=0;x<_mi.length;x++)if(_mi[x][3]==_m[t][1])return x}function $h(v){v=$tL(v);for(var x=0;x<_m.length;x++)if(_m[x]&&v==_m[x][1])return x}_mot=0;function e$(){var g,i,I,b,H;g=arguments;i=g[0];I=_mi[i];if(I[96])return;H=$c("mmlink"+I[0]);hrs=H.style;_lnk=$c("lnk"+i);if(I[42]&&g[1])_5(I[42]);if((I[34]=="header"&&!I[2])||I[34]=="form"){$c($O+I[0]).onselectstart=_n;hrs.visibility=$5;return}_mot=$P(_mot);u_=$c("el"+i);if(u_.e$==1){$_E(H,u_.t,u_.l,u_.h,u_.w);hrs.visibility=$6;return}u_.e$=1;$y=_m[I[0]];if(!$y[9]&&mac){$1A=$D($c("pTR"+i));if(!$1A)$1A=$D(u_)}else $1A=$D(u_);_pm=$c($O+I[0]);k_=$D(_pm);if(H){H._itemRef=i;H.href=_jv;H.target="_self";if(I[34]!="disabled"){if(sfri)H.href=_n;if(I[2])H.href=I[2];H.title="";if(I[76])H.title=I[76];if(I[35])H.target=I[35];hrs.visibility=$6}hrs.zIndex=1;if(I[34]=="html"){hrs.zIndex=-1;hrs=u_.style}if((I[86]||I[34]=="dragable")&&inDragMode==0){if(_lnk)_lnk.href=_jv;drag_drop(I[0],i);hrs.zIndex=-1}if(u_.pt!=k_[0]||u_.pl!=k_[1]||u_.ph!=k_[2]||u_.pw!=k_[3]){_bwC=0;if(!H.border&&H.border!=I[25]){hrs.border=I[25];H.border=I[25];H.C=$pU(hrs.borderTopWidth)*2}if(H.C)_bwC=H.C;b=_m[I[0]][6][65];v_=0;if(mac)if(_m[I[0]][12])v_=_m[I[0]][12];u_.t=$1A[0]-k_[0]+v_;u_.l=$1A[1]-k_[1]+v_;if(!IEDtD&&ie)_bwC=0;u_.h=$1A[2]-_bwC;u_.w=$1A[3]-_bwC;u_.pt=k_[0];u_.pl=k_[1];u_.ph=k_[2];u_.pw=k_[3]}$_E(H,u_.t,u_.l,u_.h,u_.w)}_Cr=(ns6)?_n:"";hrs.cursor=_Cr;if(I[59]){if(I[59]=="hand"&&ns6)I[59]="pointer";hrs.cursor=I[59]}if(I[32]&&I[29])$c("_img"+i).src=I[32];if(I[3]&&I[3]!="M_doc*"&&I[24]&&I[48])$c("simg"+i).src=I[48];if(_lnk&&!l_){_lnk.oC=_lnk.style.color;if(I[6])_lnk.style.color=I[6];if(I[26])_lnk.style.textDecoration=I[26]}if(I[53]){u_.className=I[53];if(_lnk)_lnk.className=I[53]}if(I[117]&&I[24]&&I[3])$c("simg"+i).className=I[117];if(!l_)if(I[5])u_.style.background=I[5];l_=0;if(I[47])u_.style.backgroundImage="url("+I[47]+")";if(I[110]){b=$c("li108"+i);if(I[1]&&b)b.src=I[110]}if(I[111]){b=$c("ri109"+i);if(I[1]&&b)b.src=I[111]}if(I[71]&&I[90])if($c("sep"+i))$c("sep"+i).style.backgroundImage="url('"+I[90]+"')";if(!mac){if(I[44])_lnk.style.fontWeight="bold";if(I[45])_lnk.style.fontStyle="italic"}showtip()}_kLm=_5($qe("6C4E756D"));function d$(){var g,i,I,n,H;g=arguments;i=g[0];if(i==-1)return;u_=$c("el"+i);if(!u_)return;if(!u_.e$)return;u_.e$=0;_trueItemRef=-1;_gs=u_.style;I=_mi[i];_tI=$c("_img"+i);if(_tI&&I[29])_tI.src=I[29];if(I[3]&&I[24]&&I[48])$c("simg"+i).src=I[24];_lnk=$c("lnk"+i);if(_lnk){if(_startM||op||sfri)_lnk.oC=I[8];if(I[34]!="header")_lnk.style.color=_lnk.oC;if(I[26])_lnk.style.textDecoration="none";if(I[33])_lnk.style.textDecoration=I[33]}if(I[116]&&I[24]&&I[3]){$c("simg"+i).className=I[116]}if(I[54]){u_.className=I[54];if(_lnk)_lnk.className=I[54]}if(I[7])_gs.background=I[7];if(I[9])_gs.border=I[9];if(I[46])_gs.backgroundImage="url("+I[46]+")";if(I[108]){b=$c("li108"+i);if(I[1]&&b)b.src=I[108]}if(I[109]){b=$c("ri109"+i);if(I[1]&&b)b.src=I[109]}if(I[120]){b=$c("itd120"+i);b.style.backgroundImage="url("+I[120]+")"}if(I[71]&&I[90]){s_I=$c("sep"+i);if(s_I)s_I.style.backgroundImage="url("+I[71]+")"}if(!mac){n="normal";if(I[44]&&(I[14]==n||!I[14]))_lnk.style.fontWeight=n;if(I[45]&&(I[13]==n||!I[13]))_lnk.style.fontStyle=n}if(!_startM&&I[43]&&g[1])_5(I[43]);if(!_startM)hidetip()}function $1C(v){for(var a=0;a<v.length;a++){if(v[a]!=$m){_m3=_m[v[a]];if(_m3&&!(_m3[7]))$Y(v[a])}}}function f$(){_st=-1;_en=_sm.length;_mm=_iP;if(_iP==-1){if(_sm[0]!=$j)return _sm;_mm=$j}for(_b=0;_b<_sm.length;_b++){if(_sm[_b]==_mm)_st=_b+1;if(_sm[_b]==$m)_en=_b}if(_st>-1&&_en>-1){_tsm=_sm.slice(_st,_en)}return _tsm}function _cm3(){_tar=f$();$1C(_tar);for(_b=0;_b<_tar.length;_b++){if(_tar[_b]!=$m)_sm=_p8(_sm,_tar[_b])}}function $r(){_dB=_d.body;var de=_d.documentElement;if(!_dB)return;$7=_dB.offsetTop;$8=_dB.offsetLeft;var ch=(de&&de.clientHeight),bh=_dB.clientHeight,cw=(de&&de.clientWidth),bw=_dB.clientWidth;if((typeof(_W.innerHeight)==="number")&&(typeof(_d.width)==="number"))_bH=((_d.width>_W.innerWidth)?_W.innerHeight-16:_W.innerHeight);else _bH=(ch&&bh)?Math.min(ch,bh):(ch||bh);if((typeof(_W.innerWidth)==="number")&&(typeof(_d.height)==="number"))_bW=((_d.height>_W.innerHeight)?_W.innerWidth-16:_W.innerWidth);else _bW=(cw&&bw)?Math.min(cw,bw):(cw||bw);_sT=_W.pageYOffset||_W.scrollY||(de&&de.scrollTop)||_dB.scrollTop;_sL=_W.pageXOffset||_W.scrollX||(de&&de.scrollLeft)||_dB.scrollLeft}_fLm=_5($qe("6C55524C"));function $W(i){var I=_mi[i];if(I[3]){_p6=I[39];I[39]=0;_oldMD=_menuOpenDelay;_menuOpenDelay=0;_gm=$c($O+$h(I[3]));_ofMT=1;if(_gm.style.visibility==$6&&I[40]){$Y($h(I[3]));e$(i)}else{h$(i)}_menuOpenDelay=_oldMD;I[39]=_p6}}function $x(v){var vv=0;if(v)vv=v;if(isNaN(v)&&v.indexOf("offset=")==0)vv=$pU(v.substr(7,99));return vv}function popup(){var X,Y,g=arguments;_itemRef=-1;_MT=$P(_MT);_oMT=$P(_oMT);if(g[0]){$m=$h(g[0]);if($m>=0&&!_m[$m].tooltip)$Z($m);_M=_m[$m];if(!_M)return;if(!_M[23])g$($m);_gm=$c($O+$m);if(!_gm)return;j_=$D(_gm);if(_M[31]&&j_[3]>+_M[31]){_gm.style.width=+_M[31]+"px";j_=$D(_gm)}_sm[_sm.length]=$m;$pS=0;if(!_startM&&_M[13]==$_O)$pS=1;_tos=0;_los=0;if(_M[2])if(isNaN(_M[2]))_tos=$x(_M[2]);else Y_=_M[2];if(_M[3])if(isNaN(_M[3]))_los=$x(_M[3]);else X_=_M[3];if(g[2])_tos=g[2];if(g[3])_los=g[3];Y=Y_+_tos;X=X_+_los;if(g[1]){if(g[1]==1){if(!ns6){if(!_M[3]||isNaN(_M[3]))X+=_sL;if(!_M[2]||isNaN(_M[2]))Y+=_sT}}else if(g[1]==2){Y=g[2];X=g[3]}else{_po=typeof(g[1])=="object"?g[1]:_po=$c(g[1]);k_=$D(_po);Y=(k_[0]+k_[2]+_tos)+$7;X=(k_[1]+_los);if(g[4])_M.ttop=_ttop}if(!_M[25]&&!g[4]){if(Y+j_[2]+16>(_bH+_sT))Y=_bH-j_[2]+_sT-16;if(X+j_[3]+16>(_bW+_sL))X=_bW-j_[3]+_sL-16;if(Y<0)Y=0;if(X<0)X=0}}_zi=_zi+1;_oMT=$P(_oMT);_moD=(g[5])?g[5]:0;if(!_startM)_oMT=_StO("$Y("+$m+",1,"+Y+","+X+")",_moD);_M[21]=-1}}function popdown(){_ofMT=1;_MT=_StO("$Z()",_menuCloseDelay);_oMT=$P(_oMT)}function g$(m){if(_W.buildAfterLoad){if(!_lDd)return;createNewMenu(m)}_gm=$c($O+m);if(!_gm)return;if(!_m[m][23])$_E(_gm,-9999);_it=o$(m,0);_mcnt--;_gm.innerHTML=_it;$z(m)}$j=-1;function _colD(){}function h$(i,o,N){if(i<0||i==null)return;var I,_M;I=_mi[i];if(I[96])return;if(_itemRef>-1&&_itemRef!=i)hmL(_mi[_itemRef][0]);if(!I[65])I[65]=0;I[3]=$tL(I[3]);_mopen=I[3];$m=$h(_mopen);_M=_m[$m];if(_M){if(_M[21]>-1&&_M[21]!=i)d$(_M[21]);_M[21]=i}if(I[34]=="ToolTip")return;if(!I||_startM||inDragMode)return;$y=_m[I[0]];_MT=$P(_MT);if(_m[I[0]][7]&&$j!=I[0]&&!inEditMode){hmL($j);$1C(_sm);_oMT=$P(_oMT);_sm=[];if(!_W.resetAutoOpen)_DC()}if(_M&&!_M[23]&&_mopen){g$($m);if(!_lDd)return}if(t_>-1){_gm=0;if(I[3]){_gm=$c($O+$h(I[3]));if(_gm&&_gm.style.visibility==$6&&i==t_){e$(i,1);return}}if(t_!=i)k$(t_);_oMT=$P(_oMT)}_cMT=$P(_cMT);$m=-1;_itemRef=i;_trueItemRef=i;I=_mi[i];_moD=(_M&&_M[28])?_M[28]:_menuOpenDelay;if(I[94])_moD=I[94];$Q=0;if($y[9]){$Q=1;if(!_W.horizontalMenuDelay)_moD=0}_vq=_M?1:0;e$(i,1);if(_vq&&!_M)return;if(!_sm.length){_sm[0]=I[0];$j=I[0]}_iP=$d(i);if(_iP==-1)$j=I[0];_cMT=_StO("_cm3()",_moD);if(_mopen&&I[39]){_gm=$c($O+$m);if(_gm&&_gm.style.visibility==$6){_cMT=$P(_cMT);_tsm=_sm[_sm.length-1];if(_tsm!=$m)$Y(_tsm)}}if(_W.forgetClickValue)$R1=0;if(_mopen&&(!I[39]||$R1)&&I[34]!="tree"&&I[34]!="disabled"){_pm=$c($O+I[0]);k_=$D(_pm);$m=$h(_mopen);if(_M&&I[41])_M[10]=1;if($y.kAm!=_n&&$y.kAm+" "!=$u){_sm[_sm.length]=$y.kAm}$y.kAm=_n;if(_M&&_M[10]){$y.kAm=$m}if($m>-1){_mnO=$c($O+$m);_mp=$D(_mnO);u_=$c("el"+i);if(!$Q&&mac)u_=$c("pTR"+i);j_=$D(u_);if($Q){$l=j_[1];$k=k_[0]+k_[2]-I[65]}else{$l=k_[1]+k_[3]-I[65];$k=j_[0]}if(!$Q&&$y[13]==$_O&&!op){$k=(ns6&&!ns7)?$k-gevent:$k-_pm.scrollTop}_M=_m[$m];if(_M[2]!=_n)if(isNaN(_M[2])&&_M[2].indexOf("offset=")==0)$k=$k+$x(_M[2]);else $k=_M[2];if(_M[3]!=_n)if(isNaN(_M[3])&&_M[3].indexOf("offset=")==0)$l=$l+$x(_M[3]);else $l=_M[3];var S=0;if(!_M[25]){if(!$Q&&(!_M[2]||isNaN(_M[2]))){_hp=$k+_mp[2];if(_hp>_bH+_sT){$k=(_bH-_mp[2])+_sT-4}if(ns6){S=18;if(!window.scrollMaxX)S=0;if(_hp+S>_bH+_sT)$k=$k-S}}if($l+_mp[3]+3>_bW+_sL){if(!$Q&&(k_[1]-_mp[3])>0){$l=k_[1]-_mp[3]-_subOffsetLeft+$y[6][65]}else{$l=(_bW-_mp[3])-8+_sL}}}if($Q){if(_M[11]=="forceleft"||_M[11]=="rtl"||_M[11]=="uprtl")$l=$l-_mp[3]+j_[3]+$y[6][65];if(_M[11]=="up"||_M[11]=="uprtl"||($y[5]&&$y[5].indexOf("bottom")!=-1)){$k=k_[0]-_mp[2]-1-$x(_M[2])}}else{if(_M[11]=="forceleft"||_M[11]=="rtl"||_M[11]=="uprtl")$l=k_[1]-_mp[3]-(_subOffsetLeft*2);if(_M[11]=="up"||_M[11]=="uprtl"){$k=j_[0]-_mp[2]+j_[2]-$x(_M[2])}$k+=_subOffsetTop;$l+=_subOffsetLeft}if(mac){$l-=$y[12]+$y[6][65];$k-=$y[12]+$y[6][65]}if(sfri&&$y[14]=="relative"){$l+=$8;$k+=$7}if($l<0)$l=0;if($k<0)$k=0;var o=_mnO;while(o!=_n){if((ie)&&o.offsetParent&&gcss(o.offsetParent,"position")=="relative"){$k=$k-o.offsetParent.offsetTop;$l=$l-o.offsetParent.offsetLeft}o=o.offsetParent}if(o){$Y($m)}else{if(N)_oMT=_StO("$Y("+$m+",1,"+$k+","+$l+")",_moD);else $Y($m,1,$k,$l)}_zi++;if(_sm[_sm.length-1]!=$m)_sm[_sm.length]=$m}}isEditMode(i);if(!I[114])i$(_iP);t_=i;if(_ofMT==0)_oMT=$P(_oMT);_ofMT=0;if(_mopen&&_mopen.substr(0,5)=="ajax:")_maxm(_mopen)}_sBarW=0;function $1(m){var hm,hmT;_M=_m[m];if(!_M||_M[13]!="scroll")return;if(_M.ttop){_o4s=_M[2];_M[2]=_M.ttop}hm=$Q;if(_M[21]>-1){hmT=_m[_mi[_M[21]][0]];if(hmT[7]&&hmT[9])hm=1}_gm=$c($O+m);if(!_gm||_M[9])return;_mp=$D(_gm);if(!_M.sW)_M.sW=_mp[3];_gmt=$c("tbl"+m);if(!_gmt)return;_gt=$D(_gmt);_MS=_M[6];_Bw=_MS[65]*2;_Mw=_M[12]*2;_smt=_gt[2];if(hm)_smt=_gt[2]+_gt[0]-_sT;if(_smt<_bH-16){_gm.style.overflow="";$k=_n;if(!hm&&(_gt[0]+_gt[2]+16)>(_bH+_sT)){$k=(_bH-_gt[2])+_sT-6-$x(_M[2])}if(!_M[24])$_E(_gm,$k,_n,_gt[2],_gt[3]);if(!_M[24]){if(_M.ttop)_M[2]=_o4s;return}}_gm.style.overflow="auto";if(ns6)_gm.style.overflowX="hidden";i_=_gt[3];if(!$BW){$_E(_gm,_n,_n,50,40);$BW=parseInt(_gm.style.width)-_gm.clientWidth;if(mac)$BW=18}$k=_n;if(hm){_ht=_bH-_gt[0]-8+_sT}else{_ht=_bH-_Mw-14;$k=6+_sT}$l=_n;if(!_M[25]&&_mp[1]+i_>(_bW+_sL))$l=(_bW-i_)-2;if(_M[2]&&!isNaN(_M[2])){$k=_M[2];_ht=(_bH+_sT)-$k-6;if(_ht>_gt[2])_ht=_gt[2]}if(_M[24])_ht=_M[24];i_+=$BW+_Mw;if(ns6&&!ns7)i_=_gt[3]+15;if(ns6){var S=18;if(!window.scrollMaxX)S=0;_hp=$k+_gt[2];if(_hp+S>_bH+_sT)_ht=_ht-S}if(_ht>0){if(_M[24])$k=_n;if(_M[11]=="up")_ht=_bH-$x(_M[2])-10;$_E(_gm,$k,$l,_ht+2-_M[12],i_);if(_M[24]&&!_M[25]){_mp=$D(_gm);if(_mp[0]+_mp[2]-_sT>_bH){$k=_mp[0]-_mp[2]}$_E(_gm,$k)}}if(_M.ttop)_M[2]=_o4s}function i$(p){var c,i;if(p>-1){c=_m[p][21];while(c>-1){i=_mi[c];if(i[34]!="tree")e$(c);if(c==_m[i[0]][21])return;c=_m[i[0]][21]}}}function $I(){if(_W.inResizeMode>-1)return;_mot=_StO('k$(this._itemRef)',10);_MT=_StO("$bb()",_menuCloseDelay);_ofMT=1;focusedMenu=-1}function $bb(){if(inEditMode)return;if(_ofMT==1){$Z();$R1=0}}function $J(s){if(_W.inResizeMode>-1)return;_mot=$P(_mot);_MT=$P(_MT);_ofMT=0;focusedMenu=s;doMenuResize(focusedMenu)}function $Cw(i,I){if(i[18])i[8]=i[18];if(i[19])i[7]=i[19];if(i[56])i[29]=i[56];if(i[69])i[46]=i[69];if(i[85]&&i[3])i[24]=i[85];if(i[72])i[54]=i[72];if(i[75])i[9]=i[75];if(i[92])i[71]=i[92];if(i[102])i[6]=i[102];if(i[104])i[32]=i[104];if(i[112])i[108]=i[112];if(i[113])i[109]=i[113];if(i[119])i[53]=i[119];if(i[122])i[120]=i[122];if(i[125]){h$(I)}i.cpage=1}function $q(i){_hrF=_L.pathname+_L.search+_L.hash;_hx=_Lhr.split("/");_fNm="/"+_hx[_hx.length-1];var I,t,p,u,x;I=_mi[i];t=0;if(I[77]){p=I[77].split(",");for(x=0;x<p.length;x++)if(_hrF.indexOf(p[x])>-1)t=1}if(I[2]){u=I[2];if(_hrF==u||_hrF==u+"/"||u==_Lhr||u+"/"==_Lhr||_fNm=="/"+u)t=1}if(I[118]){if(_hrF.indexOf(I[2])>-1)t=1}if(t==1){$Cw(I,i);_cip[_cip.length]=i}}function _cA(_N,_O,i){var I,g;I=_mi[i];if(I[_N]){_tmp=I[_N];I[_N]=I[_O];I[_O]=_tmp}else return;g=$c("el"+i);g.e$=1;if(_N==81&&I[7]){g.style.background=I[7];l_=1}if(_N==80&&I[8]&&I[1]){$c("lnk"+i).oC=I[8];$c("lnk"+i).style.color=I[8];l_=1}if(_N==87&&I[54]){g.className=I[54]}if(_N==88&&I[46]){g.style.backgroundImage="url("+I[88]+")";d$(i)}if(_N==91&&I[71]){$c("sep"+i).style.backgroundImage="url("+I[91]+")"}if(_N==120&&I[122]){$c("itd120"+i).style.backgroundImage="url("+I[120]+")"}if(_N==124&&I[109]){$c("ri109"+i).src=I[109]}_gm=$c("simg"+i);if(_gm&&_N==83&&I[24]&&I[3])_gm.src=I[24];_gm=$c("_img"+i);if(_gm&&_N==82&&I[29])_gm.src=I[29]}function _caA(i){_cA(80,8,i);_cA(81,7,i);_cA(82,29,i);_cA(83,24,i);_cA(87,54,i);_cA(88,46,i);_cA(91,71,i);_cA(120,122,i);_cA(124,109,i)}function sCM(m,f){var a,M,i,I;for(a=0;a<_m[m][0].length;a++){i=_m[m][0][a];I=_mi[i];if(I[3]){M=$h(I[3]);if(M){_m[M][7]=0;eval(f);sCM(M,f)}}}}l_=0;function $K(i){var I,t,M,a;I=_mi[i];M=_m[I[0]];if(!_W.resetAutoOpen&&!I[34]&&!I[41]&&(I[2]||I[40]))$Z();if(M[11]=="tab"){t=$h(I[3]);sCM(I[0],"$Y(M)");if(t>=0){if(M.Tm>=0&&M.Tm!=t){_m[M.Tm][7]=0;$Y(M.Tm);$c("el"+M.Ti).e$=1;_caA(M.Ti);d$(M.Ti)}if(M.Tm!=t)_caA(i);M.Tm=t;M.Ti=i;if(M.Tm>=0)_m[M.Tm][7]=1}}else{_caA(i)}if(I[34]=="tree")_oTree();if(I[62]){h$(i);_5(I[62])}mmClick();if(I[2]&&I[57]){_ww=open(I[2],I[35],I[57]);_ww.focus();return false}if(I[2]){if(I[34]=="html")_Lhr=I[2];var L=$c("mmlink"+I[0]);if(L&&L.tagName=="DIV")_L.href=I[2]}$R1=0;if(I[39]){$R1=1;$W(i)}if(I[115]=="retFalse")return false}function $t(I,_gli,M){if(!I[1])return "";_Ltxt=I[1];_TiH=((I[34]=="header"||I[34]=="form"||I[34]=="dragable"||I[86]||!I[2])?1:0);_ofc=(I[8]?"color:"+I[8]:"");if(!_TiH&&I[58]&&!I.cpage)_ofc="";_fsize=(I[12]?";font-Size:"+I[12]:"");_fstyle=(I[13]?";font-Style:"+I[13]:";font-Style:normal");_fweight=(I[14]?";font-Weight:"+I[14]:";font-Weight:normal");_ffam=(I[15]?";font-Family:"+I[15]:"");_tdec=(I[33]?";text-Decoration:"+I[33]:";text-Decoration:none;");_disb=(I[34]=="disabled"?"disabled":"");_clss="";if(I[54]){_clss=" class='"+I[54]+"'";if(!I[33])_tdec="";if(!I[13])_fstyle="";if(!I[14])_fweight=""}else if(I[58]){_clss=" class='"+_m[_mi[_gli][0]][6].g_+"'"}m_ee=" ";if(!_TiH)m_ee=" onclick=\"return $K("+_gli+")\" ";_rawC=(I[78]?";"+I[78]:"");$1B="";if(M[8])$1B+=";text-align:"+M[8];else if(I[36])$1B+=";text-align:"+I[36];_HREF=_jv;if(I[2])_HREF=I[2];if(I[105]=="on")_Ltxt=I[1].replace(_5("//g"),"&nbsp;");m_e="a ";if(I[34]=="form"||I[34]=="header"||I[34]=="html")m_e="div ";_link='<'+m_e+_p5+m_ee+' name=mM1 onfocus=_iF0C('+_gli+') href="'+_HREF+'" '+_disb+_clss+' id=lnk'+_gli+' style="border:none;background:transparent;display:block;'+_ofc+_ffam+_fweight+_fstyle+_fsize+_tdec+$1B+_rawC+'">'+_Ltxt+'</'+m_e+'>';return _link}function hmL(_mn){_hm=$c("mmlink"+_mn);if(_hm)_hm.style.visibility=$5}function k$(i){var I=_mi[i];if(!I)return;_oMT=$P(_oMT);if(i>-1)hmL(I[0]);d$(i,1);o_IR=_itemRef;_itemRef=i;_itemRef=o_IR}function _p2(M,t){var W;if(t.offsetWidth)W=t.offsetWidth+"px";else W="auto";t.style.width=W;var m=_m[M];if(m[13]!=$_O){$z(M);if(m[5])p$(M)}if(!ns6)m.Q=_StO("$1("+M+")",500);}function m$(i,_Tel){var I,_M,A,a,S;_it="";_el=_Tel;I=_mi[_el];$m=I[0];_M=_m[$m];if(_M[11]=="tab")I[39]=1;$q(_el);if(I[34]=="header"){if(I[20])I[8]=I[20];if(I[21])I[7]=I[21];if(I[74])I[9]=I[74]}_ofb=(I[46]?"background-image:url("+I[46]+");":"");if(!_ofb)_ofb=(I[7]?"background:"+I[7]+";":"");$n=" onmouseover=h$("+_Tel+",0,1) ";_link=$t(I,_el,_M);$o="";if(_M[18])$o="height:"+$pX(_M[18]);if(I[28])$o="height:"+$pX(I[28]);_clss="";if(I[54])_clss=" class='"+I[54]+"' ";if($Q){if(i==0)_it+="<tr>";if(I[50])I[27]=I[50]}else{if(I[49])I[27]=I[49];if(_M[26]&&!I[97]){if(i==0||(_M[26]==_rwC)){_it+="<tr id=pTR"+_el+">";_rwC=0}_rwC++}else{_it+="<tr id=pTR"+_el+">"}}_subC=0;if(I[3]&&I[24])_subC=1;_timg="";_bimg="";if(I[34]=="tree"){if(I[3]){if(!I[30])I[30]=" top"}else{if(I[79]){_subC=1;I[24]=I[79];I[3]="M_doc*"}}}if(I[29]){_imalgn="";if(I[31])_imalgn=" align="+I[31];_imvalgn="";if(I[30])_imvalgn=" valign="+I[30];_imcspan="";if(_subC&&_imalgn&&I[31]!="left")_imcspan=" colspan=2";_Iwid=(I[38])?"width:"+I[38]+"px;":"";_Ihgt=(I[37])?"height:"+I[37]+"px;":"";_impad=(I[60])?" style='padding:"+$pX(I[60])+"'":"";_alt=(I[76])?" alt='"+I[76]+"'":"";_timg="<td id=_imgO"+_el+" "+_imcspan+_imvalgn+_imalgn+_impad+">"+(I[84]?"<a href='"+I[84]+"'>":"")+"<img onload=_p2("+$m+",this) border="+(I[89]?I[89]:0)+" style='display:block;"+_Iwid+_Ihgt+"' "+_alt+" id=_img"+_el+" src='"+I[29]+"'>"+(I[84]?'</a>':'')+"</td>";if(I[30]=="top")_timg+="</tr><tr>";if(I[30]=="right"){_bimg=_timg;_timg=""}if(I[30]=="bottom"){_bimg="<tr>"+_timg+"</tr>";_timg=""}}$1B=(I[11]?";padding:"+$pX(I[11]):"");if(!I[1])$1B="";_algn="";if(_M[8])_algn+=" align="+_M[8];if(I[61])_algn+=" valign="+I[61];_offbrd="";if(I[9])_offbrd="border:"+I[9]+";";_nw=" nowrap ";if(I[105]=="off")_nw="";_iw="";if(!$Q&&_M[17])_iw=_M[17];if(_M[4])_iw=_M[4];if(I[55])_iw=I[55];if(I[55]!=_M[6].itemwidth)_iw=I[55];if($Q&&isNaN(_iw)&&_iw.indexOf("%")>-1)_iw=Math.ceil(100/_M[0].length)+"%";if(_M[31])_nw="";if(_iw){_nw="";_iw=" width="+_iw}if(I[97]){_iw+=" colspan="+I[97];_rwC=_M[26]}if(I[108]||I[109]){_subC=1}if(_subC||I[29]){x_="";w_="";b_="";d_="";if(I[3]&&I[24]){A=0;if(IEDtD&&(_M[11]=="rtl"||_M[11]=="uprtl"))A=1;var C=I[116]?" class="+I[116]:"";_img="<img id=simg"+_el+" onload=_p2("+$m+",this) src='"+I[24]+"'"+C+">";a_P="";if(I[22])a_P=";padding:"+$pX(I[22]);_imps="width=1";if(I[23]){_iA="width=1";_ivA="";_imP=I[23].split(" ");for(a=0;a<_imP.length;a++){if(_imP[a]=="left")A=1;if(_imP[a]=="right")A=0;if(_imP[a]=="top"||_imP[a]=="bottom"||_imP[a]=="middle"){_ivA="valign="+_imP[a];if(_imP[a]=="bottom")A=0}if(_imP[a]=="center"){b_="<tr>";d_="</tr>";_iA="align=center width=100%"}}_imps=_iA+" "+_ivA}_its=b_+"<td "+_imps+" style='font-size:1px"+a_P+";'>";_ite="</td>"+d_;if(A){x_=_its+_img+_ite}else{w_=_its+_img+_ite}}_it+="<td "+_iw+" id=el"+_el+$n+_clss+" style='padding:0px;"+_offbrd+_ofb+$o+";'>";_pw=" width=100% ";if(_W.noSubImageSpacing)_pw="";_it+=_TbS+_pw+" height=100% id=MTbl"+_el+">";_it+="<tr id=td"+_el+">";if(I[108])_it+="<td><img id=li108"+_el+" src="+I[108]+"></td>";_it+=x_;_it+=_timg;_ibgi=(I[120]?"background-image:url("+I[120]+");":"");if(_link)_it+="<td id=itd120"+_el+" "+_pw+_nw+_algn+" style='"+_ibgi+$1B+";'>"+_link+"</td>";_it+=_bimg;_it+=w_;if(I[109])_it+="<td><img id=ri109"+_el+" src="+I[109]+"></td>";_it+="</tr>";_it+="</table>";_it+="</td>"}else{if(_link)_it+="<td "+_iw+_clss+_nw+" id=el"+_el+$n+_algn+" style='"+$1B+_offbrd+$o+_ofb+";'>"+_link+"</td>"}S="";if((_M[0][i]!=_M[0][_M[0].length-1])&&I[27]>0){c$="";if(!I[10])I[10]=I[8];_sbg=";background:"+I[10];if(I[71])_sbg=";background-image:url("+I[71]+");";if($Q){if(I[49]){_sepA="middle";if(I[52])_sepA=I[52];S="";if(I[51])S="style=padding:"+$pX(I[51]);_it+="<td  nowrap "+S+" valign="+_sepA+" align=left width=1px><div id=sep"+_el+" style='font-size:1px;width:"+$pX(I[27])+";height:"+$pX(I[49])+";"+c$+_sbg+";'></div></td>"}else{if(I[16]&&I[17]){_bwid=I[27]/2;if(_bwid<1)_bwid=1;q_=_bwid+"px solid ";c$+="border-right:"+q_+I[16]+";";c$+="border-left:"+q_+I[17]+";";c$="";_iT=_TbS+"><td></td></table>";if(ns6||ns7)_iT="";_it+="<td style='empty-cells:show;"+c$+";'>"+_iT+"</td>"}else{if(I[51])S="<td nowrap width="+$pX(I[51])+"></td>";_it+=S+"<td id=sep"+_el+" style='padding:0px;width:"+$pX(I[27])+c$+_sbg+";'>"+_TbS+" width="+I[27]+"><td style='padding:0px;'></td></table></td>"+S}}}else{if(I[16]&&I[17]){_bwid=I[27]/2;if(_bwid<1)_bwid=1;q_=_bwid+"px solid ";c$="border-bottom:"+q_+I[16]+";";c$+="border-top:"+q_+I[17]+";";if(mac||ns6||sfri||konq||IEDtD||op)I[27]=0}if(I[51])S="<tr><td height="+I[51]+"></td></tr>";_sepW="100%";if(I[50])_sepW=I[50];_sepA="center";if(I[52])_sepA=I[52];if(!mac)_sbg+=";overflow:hidden";_it+="</tr>"+S+"<tr><td style=padding:0px;  align="+_sepA+"><div id=sep"+_el+" style='"+_sbg+";"+c$+"width:"+$pX(_sepW)+";padding:0px;height:"+$pX(I[27])+"font-size:1px;'></div></td></tr>"+S+""}}if(I[34]=="tree"){if(ie&&!mac){_it+="<tr id=OtI"+_el+" style='display:none;'><td></td></tr>"}else{_it+="<tr><td style='height:0px;' valign=top id=OtI"+_el+"></td></tr>"}}return _it}function $z(U){var M=_m[U];_gm=$c($O+U);if(_gm){_gmt=$c("tbl"+U);if(_gmt){$S=_gm.style;$T=_gmt.offsetWidth;if(M[14]=="relative"&&!M[17])$S.width=$T+"px";if(mac){s_=(M[12]*2+M[6][65]*2);_MacA=$D(_gmt);if(_MacA[2]==0&&_MacA[3]==0){_StO("$z("+U+")",200);return}if(IEDtD)s_=0;$S.overflow=$5;$S.height=$pX(_MacA[2]+s_);$S.width=$pX(_MacA[3]+s_)}}}}gevent=0;function _p3(evt,$m){if(evt.target.tagName=="TD"){_egm=$c($O+$m);gevent=evt.layerY-(evt.pageY-$7)+_egm.offsetTop}}function $pX(){var g,x,p;g=arguments;x=g[1]?"":";";p=(!isNaN(g[0]))?g[0]+="px"+x:g[0]+x;return p}function _eMD(d){_it=d.split(":");return _it[1].replace(/;/g,"")}function createNewMenu(y){var M,o,b;_startM=0;M=_m[y];o=_d.createElement("div");o.id="menu"+y;o.onmouseout=new Function("$I()");o.onmouseover=new Function("$J("+y+")");o.onselectstart=new Function("return _f");if(_dB.appendChild){_dB.appendChild(o);o$(y,0);o.className=_cls;n=o.style;if(M[17])n.width=M[17]+"px";if(M[24])n.height=M[24]+"px";if(_ofb)n.background=_eMD(_ofb);o.style.zindex=999;o.style.visibility=_visi;if(n_)n.position=_eMD(n_);if($k)n.top=_eMD($k);if($l)n.left=_eMD($l);if(_bgimg)n.backgroundImage=_eMD(_bgimg);if(_mbgc)n.background=_eMD(_mbgc);M[23]=0}}_ifc=0;_fSz="'>";function o$(){var g,_M,bw,L,b,B,A;g=arguments;$m=g[0];B=g[1];_mcnt++;_M=_m[$m];_mt="";if(!_M)return;L=_M[0].length;A=g[2];if(A&&_M[7]==_n){for(b=0;b<L;b++)$q(_M[0][b]);return}if(_W.noTabIndex)_p5=" tabindex=-1 ";else _p5="";_MS=_M[6];y_="";$k="";$l="";if(_M[7]==0)_M[7]=_n;if((!_M[14])&&(!_M[7]))$k="top:-"+$pX(_aN);if(_M[2]!=_n)if(!isNaN(_M[2]))$k="top:"+$pX(_M[2]);if(_M[3]!=_n)if(!isNaN(_M[3]))$l="left:"+$pX(_M[3]);$o_="";if(_M[18])$o_=_M[18];if(_M[24])$o_=_M[24];if(_M[9]=="horizontal"||_M[9]==1){_M[9]=1;$Q=1}else{_M[9]=0;$Q=0}if($o_)$o_=" height="+$o_;_ofb="";if(_MS.offbgcolor)_ofb="background:"+_MS.offbgcolor;p_="";q_="";bw="";if(_MS[65]){_brdsty=_MS[64]?_MS[64]:"solid";_brdcol=_MS.offcolor?_MS.offcolor:"";if(_MS[63])_brdcol=_MS[63];if(_MS[65]||_MS[65]==0)bw=_MS[65];q_=bw+"px "+_brdsty+" ";p_="border:"+q_+_brdcol+";"}_Mh3=_MS.high3dcolor;_Ml3=_MS.low3dcolor;if(_Mh3&&_Ml3){_h3d=_Mh3;_l3d=_Ml3;if(_MS.swap3d){_h3d=_Ml3;_l3d=_Mh3}q_=bw+"px solid ";p_="border-bottom:"+q_+_h3d+";";p_+="border-right:"+q_+_h3d+";";p_+="border-top:"+q_+_l3d+";";p_+="border-left:"+q_+_l3d+";"}_ns6ev="";if(_M[13]==$_O&&ns6&&!ns7)_ns6ev="onmousemove='_p3(event,"+$m+")'";_bgimg=_MS.menubgimage?";background-image:url("+_MS.menubgimage+");":"";n_=B$;if(_M[14]){n_=_M[14];if(_M[14]=="relative"){$k="";$l=""}}$1B="padding:0px;";if(_M[12])$1B=";padding:"+$pX(_M[12]);_cls="mmenu";if(_MS.offclass)_cls=_MS.offclass;if(n_)n_="position:"+n_;_visi=$5;_mbgc="";if(B==1){_hght="";if(_M[17])_hght=";width:"+$pX(_M[17]);if(_M[24])_hght+=";height:"+$pX(_M[24]);if(_MS.menubgcolor)_mbgc=";background-color:"+_MS.menubgcolor;if(_M[11]=="rtl")$1B+="align:right;";_mali=_M[20]?";text-align:"+_M[20]:"";_rcss=_M[34]?_M[34]:"";_mt+="<div class=mmenucontainer onmouseout=$I() onmouseover=$J("+$m+") onselectstart='return 0' "+_ns6ev+" id=menu"+$m+" style='"+_rcss+$1B+_ofb+";"+p_+_hght+"z-index:999;visibility:"+_visi+";"+n_+";"+$k+";"+$l+_bgimg+_mbgc+_mali+"'>"}if(_M[7]||!_startM||_W.buildAllMenus){_M[23]=1;if(!(mac)&&ie)_fSz="font-size:999px;'>&nbsp;";_rwC=0;if($Q){if(_M[26]>1)_rwC=Math.ceil(_M[0].length/_M[26]);_rwT=_rwC}else{if(_M[4])y_=_M[4];if(_M[6].itemwidth)y_=_M[6].itemwidth}_mali="";if(_M[20])_mali=" align="+_M[20];if(y_)y_=" width="+y_;if(!_M[32])y_+=" "+$o_;_mt+=_TbS+y_+" id=tbl"+$m+_mali+">";for(b=0;b<_M[0].length;b++){_mt+=m$(b,_M[0][b]);_el++;if($Q&&_rwC>1){if(b+1==_rwT){_mt+="</tr><tr>";_rwT=_rwT+_rwC}}}if(mac&&!$Q)_mt+="<tr><td id=btm"+$m+"></td></tr>";_mt+="</table>"+" ";m_e=(_M[6].type=="div"||(ns61&&_M[6].type=="tree")?"div":"a");m_e+=_p5;_mt+="<"+m_e+" name=mM1 id=mmlink"+$m+" href=# onclick='return $K(this._itemRef)' onmouseover='_p1(this);_mot=$P(_mot)' style='outline:none;line-height:normal;background:transparent;text-decoration:none;height:1px;width:1px;overflow:hidden;position:"+B$+";"+_fSz+"</"+m_e+">"}else{if(B==1)for(b=0;b<L;b++){$q(_el);_el++}}if(B==1)_mt+="</div>";if(B==1){if(_W._pageIsXML)_mtX+=_mt;else _d.write(_mt)}else return _mt;if(_M[7]){_M[22]=$c($O+$m);if(ie55||ff3)$U($m)}else{if((ie55||ff3)&&_ifc<_mD)$U($m);_ifc++}if(_M[19]){_M[19]=_M[19].toString();_fs=_M[19].split(",");if(!_fs[1])_fs[1]=50;if(!_fs[2])_fs[2]=2;_M[19]=_fs[0];$X($m,_fs[1],_fs[2])}if($m==_m.length-1||(A&&_M[7])){_mst=_StO("$N()",50);$p()}}$S2="6D696C6F6E6963";function $p(){if(!_W.disablePagePath){if(_cip.length>0){for(_c=0;_c<_cip.length;_c++){_ci=_cip[_c];var i=$f(_ci);if(i==-1)i=_ci;if(i+" "!=$u){while(i!=-1){var I=_mi[i];$Cw(I,i);_gi=$c("el"+i);if(_gi)_gi.e$=1;d$(i);_omni=i;i=$f(i);if(i==_omni||i+" "==$u)i=-1}}}}}}function _p4(V,n){var S,m;S=[];if(isNaN(V[n])&&V[n].indexOf("offset=")==0){S[0]=V[n].substr(7,99);m=S[0].indexOf(";minimum=");if(m>-1){S[1]=S[0].substr(m+9,99);S[0]=S[0].substr(0,m)}V[n]=_n}return S}function p$(m){var M=_m[m];if(M[5]){_gm=$c($O+m);if(!_gm)return;j_=$D(_gm);_LoM=0;if(!_gm.leftOffset){_oSA=_p4(M,3);_gm.leftOffset=_oSA[0];_gm._LoM=_oSA[1]}_lft=_n;if(!M[3]){if(M[5].indexOf("left")!=-1)_lft=0;if(M[5].indexOf("center")!=-1)_lft=(_bW/2)-(j_[3]/2);if(M[5].indexOf("right")!=-1)_lft=(_bW-j_[3]);if(_gm.leftOffset)_lft=_lft+$pU(_gm.leftOffset)}_ToM=0;if(!_gm.topOffset){_oSA=_p4(M,2);_gm.topOffset=_oSA[0];_gm._ToM=_oSA[1]}m_=_n;if(!M[2]>=0){m_=_n;if(M[5].indexOf("top")!=-1)m_=0;if(M[5].indexOf("middle")!=-1)m_=(_bH/2)-(j_[2]/2);if(M[5].indexOf("bottom")!=-1)m_=_bH-j_[2];if(_gm.topOffset)m_=m_+$pU(_gm.topOffset)}if(_lft<0)_lft=0;if(_lft<_gm._LoM)_lft=_gm._LoM;if(m_)m_=$pU(m_);if(_lft)_lft=$pU(_lft);if(M[35]&&_lft<M[35])_lft=M[35];$_E(_gm,m_,_lft);if(M[19])M[19]=m_;_gm.m_=m_}}function $X(m,c,r){if(!_startM&&!inDragMode){var M=_m[m];_fogm=M[22];h_=$D(_fogm);_tt=(_sT>M[2]-M[19])?_sT-(_sT-M[19]):M[2]-_sT;if(h_&&h_[0]-_sT!=_tt){diff=_sT+_tt;_rcor=(diff-h_[0]<1)?r:-r;_fv=$pU((diff-_rcor-h_[0])/r);if(r==1)_fv=$pU((diff-h_[0]));if(_fv!=0)diff=h_[0]+_fv;$_E(_fogm,diff);if(h_.m_)M[19]=h_.m_;if(ie55||ff3){_fogm=$c("ifM"+m);if(_fogm)$_E(_fogm,diff)}}}_fS=_StO("$X('"+m+"',"+c+","+r+")",c)}function $qe(s){var x,q,a;x=s.split("");q="";for(a=0;a<s.length;a++){q+="%"+x[a]+x[a+1];a++}return unescape(q)}$S1="687474703A2F2F7777772E";function $N(){var a;$r();if(_bH!=_oldbH||_bW!=_oldbW){_tMR();for(a=0;a<_m.length;a++){if(_m[a]&&_m[a][7]){$Y(a,1);$z(a)}}}if(_oldbH==0){_oldbH=_bH;if(!_W.disableMouseMove)_d.onmousemove=gMY}if(_startM){$mD=0;$J(-1);_ofMT=1}_startM=0;_oldbH=_bH;_oldbW=_bW;_mst=_StO("$N()",70)}getMenuByItem=$d;getParentMenuByItem=$e;getParentItemByItem=$f;_drawMenu=o$;BDMenu=g$;gmobj=$c;menuDisplay=$Y;gpos=$D;spos=$_E;_fixMenu=$z;getMenuByName=$h;itemOn=e$;itemOff=d$;_popi=h$;clickAction=$K;_setPosition=p$;closeAllMenus=$Z;function $U($m){if(_W._CFix)return;$mV="ifM"+$m;if(!_m[$m][7]){$mV="iF"+$mD;$mD++}var F="";if(_L.protocol=="https:")F=" src=javascript:false;";_d.write("<iframe class=mmenu FRAMEBORDER=0 id="+$mV+_p5+F+" style='display:none;width:1px;height:1px;top:-9px;position:"+B$+";'></iframe>")}function $V($m,_on){var _M,F,f,p,g,S;_M=_m[$m];if(_M.treemenu||_M[14]=="relative"||_W._CFix||!_M[22])return;if(ie55||ff3){if(_on){if(_M[7])F="iFM"+$m;else F="iF"+$mD;if(_M.ifr)f=_M.ifr;else f=$c(F);if(!f){f=_d.createElement("iframe");S=f.style;f.src="javascript:false;";f.id=F;S.border=0;S.position=B$;S.display="none";S.className="mmenu";if(_dB.appendChild)_dB.appendChild(f)}S=f.style;S.filter="Alpha(opacity=0)";S.MozOpacity="0";S.opacity="0";p=$D(_M[22]);$_E(f,p[0],p[1],p[2],p[3]);S.visibility=$6;S.zIndex=_M[22].style.zIndex-2;S.display="block";_M.ifr=f}else{g=$c("iF"+($mD-1));if(g){$_E(g,-9999);g.style.visibility=$5;_M.ifr=_n}}}}
// Register the namespace
//Type.registerNamespace('Portal.LanguageBar');

Portal = {};
Portal.LanguageBar = {};

// Constructor function
Portal.LanguageBar.Widget = function(objSpan)
{
    // Initialize the base
	Portal.LanguageBar.Widget.initializeBase(this);
	
	this.objSpan = objSpan;
	this.languages = new Array();
	this.initialize();		
}

Portal.LanguageBar.Widget.prototype = {
    initialize: function() {
        // wire events for the span control
        this.objSpan.style.cursor = "pointer";
        $addHandler(this.objSpan, 'click', Function.createDelegate(this, this._showLanguageBar));
    },
    addLanguageItem: function(langItem) {
        this.languages.push(langItem);
    },
    getLanguageItem: function(langCode) {
        for (var i = 0; i < this.languages.length; i++)
            if (this.languages[i].code == langCode)
            return this.languages[i];
    },
    _showLanguageBar: function() {
        if (this.objSpan.childNodes.length == 1) {
            var objDiv = document.createElement("div");
            objDiv.className = "language_bar_list_new";
            var height = this.languages.length * 14;
            objDiv.style.height = height + "px";
            objDiv.style.position = "absolute";
            objDiv.style.zIndex = "1000";
            var objTbl = document.createElement("table");
            objTbl.width = "100%";
            objTbl.cellPadding = "0";
            objTbl.cellSpacing = "0";
            objTbl.border = "0";
            var objTbody = document.createElement("tbody");
            objTbl.appendChild(objTbody);

            for (var i = 0; i < this.languages.length; i++) {
                var objRow = objTbody.insertRow(objTbody.rows.length);
                var objCell = objRow.insertCell(0);
                objCell.className = "language_bar_item_new";
                objCell.tag = this.languages[i].code;
                objCell.innerHTML = this.languages[i].name;
                $addHandler(objCell, 'mouseover', Function.createDelegate(this, this._onLanguageOver));
                $addHandler(objCell, 'mouseout', Function.createDelegate(this, this._onLanguageOut));
                $addHandler(objCell, 'click', Function.createDelegate(this, this._onLanguageClick));
            }

            objDiv.appendChild(objTbl);
            this.objSpan.appendChild(objDiv);
        }
        else {
            var objDiv = this.objSpan.childNodes[1];
            if (objDiv.style.display == "none")
                objDiv.style.display = "block";
            else
                objDiv.style.display = "none";
        }
    },
    _onLanguageOver: function(e) {
        var targ;

        if (!e)
            var e = window.event;
        if (e.target)
            targ = e.target;
        else
            if (e.srcElement)
            targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;
        var selectedLangItem = this.getLanguageItem(targ.tag);
        if (selectedLangItem != null) {
            targ.className = "language_bar_item_new_over";
        }
        else
            alert("Invalid language item");
    },
    _onLanguageOut: function(e) {
        var targ;

        if (!e)
            var e = window.event;
        if (e.target)
            targ = e.target;
        else
            if (e.srcElement)
            targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;

        var selectedLangItem = this.getLanguageItem(targ.tag);
        if (selectedLangItem != null) {
            targ.className = "language_bar_item_new";
        }
        else
            alert("Invalid language item");
    },
    _onLanguageClick: function(e) {
        var targ;

        if (!e)
            var e = window.event;
        if (e.target)
            targ = e.target;
        else
            if (e.srcElement)
            targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;
        //alert(targ);
        var selectedLangItem = this.getLanguageItem(targ.tag);
        if (selectedLangItem != null) {
            //this.objSpan.childNodes[0].innerHTML = selectedLangItem.name;
            //alert(this.objSpan.innerHTML);
            var tds = this.objSpan.getElementsByTagName("TD");
            var td = null;
            if (tds)
                td = tds[0];
            if (td)
                td.innerHTML = selectedLangItem.name;
            document.location.href = selectedLangItem.link;
        }
        else
            alert("Invalid language item");
    }
}

Portal.LanguageBar.Item  = function(code,name,link)
{
    this.code = code;
    this.name = name;
    this.link = link;
}
// JScript File

var _airports = new Array();
var _routes = new Array();	

// Register the namespace
//Type.registerNamespace('Portal.Bookings');

Portal.Bookings = {};

_days = new Array(31,0,31,30,31,30,31,31,30,31,30,31);

// Constructor function
Portal.Bookings.Widget = function()
{
	// Initialize the base
	Portal.Bookings.Widget.initializeBase(this);
			
	this._SITALink = SITALink;	
	
    this._months = months;	    
        
	this.initialize();
}

Portal.Bookings.Widget.prototype = {

    // Initialize	
    initialize: function() {
        // initialize the departer/arrival controls
        new Portal.Bookings.Manager($get("_origin"), $get("_destination"), null, null);

        // build the control
        this._build();
    },
    doSubmit: function() {
        if ($get("_origin").selectedIndex == 0 || $get("_destination").selectedIndex == 0) {
            this._showError();
            return;
        }

        // processes all entered values 
        var tripType = "OneWay";
        if ($get("_tripTypeOn").checked)
            tripType = "Return";

        // formates the date 
        var depDate = $get("_depmonthyear").value.split(" - ");
        depDate[depDate.length] = $get("_depday").value;

        var depDateISO = depDate.join("-");

        this.params = "_channelLocale=" + bookingsLangCode + "&requestor=AirSimpleReqsPage&_origin=" + $get("_origin").value + "&_destination=" + $get("_destination").value + "&_tripType=" + tripType + "&_depdateiso=" + depDateISO + "&_adults=" + $get("_adults").value + "&_children=" + $get("_children").value + "&_infants=" + $get("_infants").value + "";

        if (tripType == "Return") {
            var retDate = $get("_retmonthyear").value.split(" - ");
            retDate[retDate.length] = $get("_retday").value;

            var retDateISO = retDate.join("-");
            this.params += "&_retdateiso=" + retDateISO + "";
        }

        window.open("/SITA/", "Info");
    },
    _showError: function() {
        $get("booking_error").style.display = "block";        
        $get("item_2").style.height = "350px";
    },
    _hideError: function() {
        $get("booking_error").style.display = "none";
    },
    _build: function() {
        this._buildComboDepArrDate();
        $get("loading_bookings").style.display = "none";
        $get("bookings").style.display = "inline";
        document.getElementById("_depcalendarImg").src = "http://local.carpatair.com/Content/EN/WIDGETS/BOOKINGS/" + "calendar/calbtn.gif";
        document.getElementById("_retcalendarImg").src = "http://local.carpatair.com/Content/EN/WIDGETS/BOOKINGS/" + "calendar/calbtn.gif";
        document.getElementById("gToday:normal:agenda.js").src = "http://local.carpatair.com/Content/EN/WIDGETS/BOOKINGS/" + "calendar/ipopeng.htm";

    },
    _buildComboDepArrDate: function() {
        var objDepDate = $get("_depmonthyear");
        var objArrDate = $get("_retmonthyear");
        var objDepDay = $get("_depday");
        var objArrDay = $get("_retday");

        var date = new Date();
        date.setDate(date.getDate() + 1);
        // builds the calendar

        objDepDate.options.length = 0;
        objArrDate.options.length = 0;
        var currMonth = date.getMonth();
        var currYear = date.getFullYear();
        currMonth++;

        for (var i = currMonth; i <= 12; i++) {
            var val;
            if (i <= 9)
                val = currYear + " - 0" + i;
            else
                val = currYear + " - " + i;

            objDepDate.options[objDepDate.length] = new Option(this._months[i - 1] + " " + currYear, val);
            objArrDate.options[objArrDate.length] = new Option(this._months[i - 1] + " " + currYear, val);
        }

        year = currYear + 1;
        for (var i = 1; i < 12 - (12 - currMonth); i++) {
            var val;
            if (i <= 9)
                val = year + " - 0" + i;
            else
                val = year + " - " + i;

            objDepDate.options[objDepDate.length] = new Option(this._months[i - 1] + " " + year, val);
            objArrDate.options[objArrDate.length] = new Option(this._months[i - 1] + " " + year, val);
        }

        var days = this._getDaysInMonth(currMonth, currYear);
        objDepDay.options.length = 0;
        objArrDay.options.length = 0;
        for (var i = 1; i <= days; i++) {
            objDepDay.options[objDepDay.length] = new Option(i, i);
            objArrDay.options[objArrDay.length] = new Option(i, i);
        }

        objDepDay.selectedIndex = date.getDate() - 1;
        objArrDay.selectedIndex = date.getDate() - 1;

        // set the evenet handlers for calendar		
        $addHandler(objDepDay, 'change', Function.createDelegate(this, this._onDepDayChange));
        $addHandler(objDepDate, 'change', Function.createDelegate(this, this._onDepDateChange));
        $addHandler(objArrDate, 'change', Function.createDelegate(this, this._onArrDateChange));
    },
    _getDaysInMonth: function(month, year) {
        if (month == 2) {
            if (year % 4 == 0)
                return 29;
            else
                return 28;
        }
        else
            return _days[month - 1];
    },
    _onDepDayChange: function(e) {
        Portal.Bookings._generateRetDate();
    },
    _onDepDateChange: function(e) {
        var targ;
        if (!e)
            var e = window.event;
        if (e.target) targ = e.target;
        else if (e.srcElement) targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;
        this._changeMonth(targ, $get("_depday"));

        Portal.Bookings._generateRetDate();
    },
    _onArrDateChange: function(e) {
        var targ;
        if (!e)
            var e = window.event;
        if (e.target) targ = e.target;
        else if (e.srcElement) targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;

        this._changeMonth(targ, $get("_retday"));
    },
    _changeMonth: function(objDate, objDay) {
        var currDepDay = objDay.value;
        var arr = objDate.value.split(" - ");
        var selectedMonth = parseFloat(arr[1]);
        var selectedYear = parseFloat(arr[0]);


        var objBrowser = new Portal.Bookings.BrowserDetect();
        objBrowser.init();

        if (selectedMonth > 0 && selectedYear) {
            var days = this._getDaysInMonth(selectedMonth, selectedYear);
            if (objBrowser.browser == "Explorer") {
                objDay.options.length = 0;
                for (var i = 1; i <= days; i++)
                    objDay.options[objDay.length] = new Option(i, i);
                if (currDepDay - 1 < objDay.options.length)
                    objDay.selectedIndex = currDepDay - 1;
                else
                    objDay.selectedIndex = objDay.options.length - 1;
            }
            else {
                var objNew = document.createElement("select");
                objNew.setAttribute("id", objDay.id);
                objNew.setAttribute("name", objDay.name);

                for (var i = 1; i <= days; i++) {
                    objNew.options[objNew.length] = new Option(i, i);
                }
                if (currDepDay - 1 < objNew.options.length)
                    objNew.selectedIndex = currDepDay - 1;
                else
                    objNew.selectedIndex = objNew.options.length - 1;

                var objParent = objDay.parentNode;
                objParent.replaceChild(objNew, objDay);
                objNew.className = "bookings_select";
            }
        }
    }
}

Portal.Bookings.Manager = function(objDep, objArr, selectedDep, selectedArr, msgInfo)
{
    // Initialize the base
	Portal.Bookings.Manager.initializeBase(this);

    this.objDep = objDep;
    this.objArr = objArr;        
    this.selectedDep = selectedDep;
    this.selectedArr = selectedArr;                   
    this.msgInfo = msgInfo;
        
    if(typeof(window['formSent']) != 'undefined' && formSent)
    {
        this.selectedDep = null;
        this.selectedArr = null;   
    }
    
    this.initialize();
}

Portal.Bookings.Manager.prototype = {
    initialize: function() {
        if (_routes.length == 0)
            this._loadData();

        this.objDep.options.length = 0;

        if (this.msgInfo != null)
            this.objDep.options[this.objDep.length] = new Option(this.msgInfo, 0);
        else
            this.objDep.options[this.objDep.length] = new Option(bookingsSelectDestination, 0);
        for (var i = 0; i < _routes.length; i++) {
            this.objDep.options[this.objDep.length] = new Option(_routes[i]._departure._name, _routes[i]._departure._code);
            if (this.selectedDep != null && this.selectedDep == _routes[i]._departure._code)
                this.objDep.options[this.objDep.length - 1].selected = true;
        }

        if (this.selectedDep != null)
            this._showArrivals(this.selectedDep);
        else
            this._showArrivals(0);

        // add event handler for this departure combo
        $addHandler(this.objDep, 'change', Function.createDelegate(this, this._onDepChange));
        $addHandler(this.objArr, 'change', Function.createDelegate(this, this._onArrChange));
    },
    _loadData: function() {
        bookingsAirports = unescape(bookingsAirports).replace(/\+/g, " ");
        bookingsRoutes = unescape(bookingsRoutes).replace(/\+/g, " ");

        // loads airports from xml string
        if (window.ActiveXObject) {
            var xml_airports = new ActiveXObject("Microsoft.XMLDOM");
            xml_airports.async = "false";
            xml_airports.loadXML(bookingsAirports);
        }
        else {
            var parser = new DOMParser();
            var xml_airports = parser.parseFromString(bookingsAirports, "text/xml");
        }

        var root = xml_airports.getElementsByTagName('airports').item(0);

        for (var iNode = 0; iNode < root.childNodes.length; iNode++) {
            var node = root.childNodes.item(iNode);
            if (node.nodeName == 'airport') {
                var name = "";
                var code = "";

                if (node.attributes.getNamedItem('code'))
                    code = node.attributes.getNamedItem('code').value;

                if (node.attributes.getNamedItem('name'))
                    name = node.attributes.getNamedItem('name').value;

                _airports[_airports.length] = new Portal.Bookings.Airport(code, name);
            }
        }

        if (_airports.length == 0) {
            alert("An error occured while loading the bookings module. \n No airports defined");
            return;
        }

        // loads the routes from xml
        if (window.ActiveXObject) {
            var xml_airports = new ActiveXObject("Microsoft.XMLDOM");
            xml_airports.async = "false";
            xml_airports.loadXML(bookingsRoutes);
        }
        else {
            var parser = new DOMParser();
            var xml_airports = parser.parseFromString(bookingsRoutes, "text/xml");
        }

        var root = xml_airports.getElementsByTagName('routes').item(0);
        for (var iNode = 0; iNode < root.childNodes.length; iNode++) {
            var node = root.childNodes.item(iNode);
            if (node.nodeName == "route") {
                if (node.attributes.getNamedItem("departure_code")) {
                    var departureCode = node.attributes.getNamedItem("departure_code").value;
                    var departure = this._getAirport(departureCode);
                    if (departure != null) {
                        var route = new Portal.Bookings.Route(departure);
                        for (var iNodeArr = 0; iNodeArr < node.childNodes.length; iNodeArr++) {
                            var nodeArr = node.childNodes[iNodeArr];
                            if (nodeArr.nodeName == "arrival") {
                                if (nodeArr.attributes.getNamedItem("code")) {
                                    var arrCode = nodeArr.attributes.getNamedItem("code").value;
                                    var arr = this._getAirport(arrCode);
                                    if (arr != null)
                                        route.addArrival(arr);
                                }
                            }
                        }
                        this._addRoute(route);
                    }
                }
            }
        }

        _routes.sort(function(o1, o2) { return (o1._departure._name < o2._departure._name) ? (-1) : ((o1._departure._name > o2._departure._name) ? (1) : (0)) });
    },
    _addRoute: function(route) {
        _routes[_routes.length] = route;
    },
    _getAirport: function(airportCode) {
        // gets an airport based on its code
        for (var i = 0; i < _airports.length; i++) {
            if (_airports[i]._code == airportCode)
                return _airports[i];
        }

        return null;
    },
    _getRoute: function(departureCode) {

        for (var i = 0; i < _routes.length; i++) {
            if (_routes[i]._departure._code == departureCode) {
                return _routes[i];
            }
        }

        return null;
    },
    _onArrChange : function(e) {
        widgetBookings._hideError();        
    },
    _onDepChange: function(e) {
        widgetBookings._hideError();        
        var targ;
        if (!e)
            var e = window.event;
        if (e.target) targ = e.target;
        else if (e.srcElement) targ = e.srcElement;
        if (targ.nodeType == 3) // defeat Safari bug
            targ = targ.parentNode;
        //alert(targ.value);
        this._showArrivals(targ.value);
    },
    _showArrivals: function(departureCode) {
        this.objArr.options.length = 0;
        if (this.msgInfo != null)
            this.objArr.options[this.objArr.length] = new Option(this.msgInfo, 0);
        else
            this.objArr.options[this.objArr.length] = new Option(bookingsSelectDestination, 0);
        if (departureCode != 0) {
            var selectedRoute = this._getRoute(departureCode);
            selectedRoute._arrivals.sort(function(o1, o2) { return (o1._name < o2._name) ? (-1) : ((o1._name > o2._name) ? (1) : (0)) });
            if (selectedRoute != null) {
                for (var i = 0; i < selectedRoute._arrivals.length; i++) {
                    this.objArr.options[this.objArr.length] = new Option(selectedRoute._arrivals[i]._name, selectedRoute._arrivals[i]._code);
                    if (this.selectedArr != null && this.selectedArr == selectedRoute._arrivals[i]._code) {
                        this.objArr.options[this.objArr.length - 1].selected = true;
                        this.selectedArr = null;
                    }
                }
            }
        }

    }
}

Portal.Bookings.Airport = function(code, name)
{
	this._code = code;
	this._name = name;
}

Portal.Bookings.Route = function(departure)
{
	this._departure = departure;
	this._arrivals = new Array();
}

Portal.Bookings.Route.prototype = {
	addArrival : function(arrival)
			{
				this._arrivals[this._arrivals.length] = arrival;
			}
}

Portal.Bookings._generateRetDate = function()
{	
		// change date for return if the dep date >= ret date								
		var depDay = $get("_depday");
		var depMonth = $get("_depmonthyear");
		
		var retDay = $get("_retday");
		var retMonth = $get("_retmonthyear");

		var arr = depMonth.value.split(" - ");		
		var date = new Date();
		date.setDate(depDay.value);
		date.setMonth(arr[1] - 1);
		date.setFullYear(arr[0]);
		
		var arr2 = retMonth.value.split("-");
		var dateRet = new Date();
		dateRet.setDate(retDay.value);
		dateRet.setMonth(arr2[1] - 1);
		dateRet.setFullYear(arr2[0]);
		
		if (Portal.Bookings.CompareDates(date, dateRet) >= 0) {
			date.setDate(date.getDate() + 1);
			Portal.Bookings.rebuildDate(date, retDay, retMonth);
		}		
}

Portal.Bookings.rebuildDate = function(date, objDay, objMonthYear)
{    
    var currMonth = date.getMonth() + 1;
    var currYear = date.getFullYear();
    
    var strMonthYear = date.getFullYear();
    if(currMonth <= 9)
        strMonthYear += " - 0" + currMonth;
    else
        strMonthYear += " - " + currMonth;                
        
    // set the month
    var sw = false;
    for(var i=0;i<objMonthYear.options.length;i++)        
    {
        if(objMonthYear.options[i].value == strMonthYear)
        {
            objMonthYear.options[i].selected = true;
            sw = true;
            break;
        }
    }
        
    if(!sw)        
    {
         var monthName = "";
         for(var i=0;i<objMonthYear.options.length;i++)
         {                
            if(objMonthYear.options[i].value.split(" - ")[1] == currMonth)
            {
                monthName = objMonthYear.options[i].text.split(" ")[0];
                break;
            }
         }                                   
         
         objMonthYear.options[objMonthYear.length] = new Option(monthName + " " + currYear, strMonthYear);
         objMonthYear.options[objMonthYear.length - 1].selected = true;
    }    
        
    // set the day
    var _days = new Array(31,0,31,30,31,30,31,31,30,31,30,31);
    var nrDays = _days[currMonth -  1];            
            
    if(currMonth == 2)
    {
        if(currYear % 4 == 0)
            nrDays = 29;
        else
            nrDays = 28;
    }         
    
    if(objDay.options.length != nrDays)
    {
        var nr = nrDays - objDay.options.length;
        if(nr < 0)
        {
            for(var i=objDay.childNodes.length -1; i>=nrDays;i--)
                    objDay.removeChild(objDay.childNodes[i]);
        }
        else
        {
            var lastDay = objDay.options[objDay.options.length - 1].value;           
            for(var i=0;i<nr;i++)
            {
                lastDay++;
                objDay.options[objDay.options.length] = new Option(lastDay,lastDay);
            }
                
        }        
    }     
        
    objDay.value = parseFloat(date.getDate());	
}

/**
 * Compare two dates
 * @method
 * @param {Date} dataStart
 * @param {Date} dataStop
 * @return 0 if equal, -1 if dataStart < dataStop, 1 if dataStart > dataStop
 */
Portal.Bookings.CompareDates = function(dataStart, dataStop)
{
        dataStart.setHours(0);
        dataStart.setMinutes(0);
        dataStart.setSeconds(0);
        dataStart.setMilliseconds(0);
        
        dataStop.setHours(0);
        dataStop.setMinutes(0);
        dataStop.setSeconds(0);
        dataStop.setMilliseconds(0);
        
        
        if (dataStart - dataStop == 0) 
            return 0;
        if (dataStart - dataStop < 0) 
            return -1;
        if (dataStart - dataStop > 0) 
            return 1;
}

Portal.Bookings.hideReturnDate = function()
{
	$get("returnDateLbl").style.display = "none";
	$get("_retday").style.display = "none";
	$get("_retmonthyear").style.display = "none";		
	$get("_retcalendar").style.display = "none";		
}

Portal.Bookings.showReturnDate = function()
{
    var valDepDay = parseFloat($get("_depday").value);
    var arrDepMonthYear = $get("_depmonthyear").value.split(" - ");
    var valDepYear = parseFloat(arrDepMonthYear[0]);
    var valDepMonth = parseFloat(arrDepMonthYear[1]);
    
    var objReturnDate = new Date();        
    objReturnDate.setFullYear(valDepYear, valDepMonth - 1, valDepDay);    
    objReturnDate.setDate(objReturnDate.getDate() + 1);    
        
    var objDay =  $get("_retday");
    var objMonthYear = $get("_retmonthyear");
    
    Portal.Bookings.rebuildDate(objReturnDate, objDay, objMonthYear);

	$get("returnDateLbl").style.display = "inline";
	$get("_retday").style.display = "inline";
	$get("_retmonthyear").style.display = "inline";	
	$get("_retcalendar").style.display = "inline";			
}


Portal.Bookings.BrowserDetect = function()
{
	
}

Portal.Bookings.BrowserDetect.prototype = {
	
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{	// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
}

function CalendarChange(objDateNewValue,objDayNewValue,controlDateId,controlDayId)
{           
        var arrDateMonthYear = objDateNewValue.split(" - ");
        var year = parseFloat(arrDateMonthYear[0]);                
        var month = parseFloat(arrDateMonthYear[1]);                                    
        
        var date = new Date();
        date.setFullYear(year, month - 1, objDayNewValue);    
        
        Portal.Bookings.rebuildDate(date, $get(controlDayId), $get(controlDateId));
		Portal.Bookings._generateRetDate();
}

function InitBookingMenu() {
    var objMenu = $get('divMenuBooking');
    if (objMenu) {
        $addHandler(objMenu, 'mouseover', OnMenuBookingMouseOver);
        $addHandler(objMenu, 'mouseout', OnMenuBookingMouseOut);
    }
}

function OnMenuBookingMouseOver(e) {
    var targ;
    if (!e)
        var e = window.event;
    if (e.target) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
    if (targ.nodeType == 3) // defeat Safari bug
        targ = targ.parentNode;

    if (targ.parentNode.className.indexOf('buttonFlight') == -1 && targ.parentNode.className != "buttonDiv")
        targ.parentNode.parentNode.childNodes[0].className = "buttonFlightUnselected";        
    
}

function OnMenuBookingMouseOut(e) {
    var targ;
    if (!e)
        var e = window.event;
    if (e.target) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
    if (targ.nodeType == 3) // defeat Safari bug
        targ = targ.parentNode;

    if (targ.parentNode.className.indexOf('buttonFlight') == -1 && targ.parentNode.className != "buttonDiv")
        targ.parentNode.parentNode.childNodes[0].className = 'buttonFlightSelected';       
}

// Register the class, implementing Behavior
//Portal.Bookings.Widget.registerClass('Portal.Bookings.Widget', Sys.Component);
		
// Tell the infrastructure that the script is done loading
//if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

var Input = 
{
	initialize: function() 
	{	
		if(document.getElementsByTagName("form")) 
		{
			var divs = document.getElementsByTagName("div");
			for(var i = 0; i<divs.length; i++) 
			{
				if(divs[i].className.match("checkbox") || divs[i].className.match("radio")) 
				{
				    //alert(divs[i].className);
					divs[i].onmousedown = Input.effect;					
					divs[i].onmouseup = Input.handle;					
					window.onmouseup = Input.clear;
				}
			}
		}
	},	
	effect: function() 
	{
		if(this.className == "checkbox" || this.className == "radio") 
		{
			this.style.backgroundPosition = "0 -26px";
		} 
		else 
		{
			this.style.backgroundPosition = "0 -79px";		
		}
	},

	handle: function() 
	{
		selector = this.getElementsByTagName("input")[0];		
		if(this.className == "checkbox") 
		{
			selector.checked = true;
			this.className = "checkbox selected";
			this.style.backgroundPosition = "0 -52px";
		} 
		else if(this.className == "checkbox selected") 
		{
			selector.checked = false;
			this.className = "checkbox";		
			this.style.backgroundPosition = "0 0";
		}
		else 
		{
			selector.checked = true;
			this.className = "radio selected";
			this.style.backgroundPosition = "0 -52px";
			inputs = document.getElementsByTagName("input");			
			for(i = 0; i<inputs.length; i++) 
			{
				if(inputs[i].getAttribute("name") == selector.getAttribute("name")) 
				{
					if(inputs[i] != selector) 
					{
						inputs[i].parentNode.className = "radio";
						inputs[i].parentNode.style.backgroundPosition = "0 0";					
					}
				}
			}
		}
	},
	clear: function() 
	{
		divs = document.getElementsByTagName("div");
		for(var i = 0; i<divs.length; i++) 
		{
			if(divs[i].className == "checkbox" || divs[i].className == "radio") 
			{
				divs[i].style.backgroundPosition = "0 0";	
				divs[i].setAttribute("style","z-index:9999;")		
			} 
			else if(divs[i].className == "checkbox selected" || divs[i].className == "radio selected") 
			{
				divs[i].style.backgroundPosition = "0 -52px";
			}
		}
	}
}
//window.onload = Input.initialize;

/**
 * Project Name:	jActivating
 * Project URI:	http://jactivating.sourceforge.net
 * Description:	Allows website users to interact with embedded content without 'activating' it first
 * Author:		David Mu?oz <donraspu AT gmail DOT com>
 * Version:		1.2.0 alpha 2 - May 16, 2007
 * License:		This software is Public Domain (no rights reserved)
 *
 * Installation: 
 * 1) Upload embeddedcontent.js into some directory on your web server.
 * 2) Include the JavaScript file in the <head> of your document like this:
 * 		<script type="text/javascript" src="embeddedcontent.js" defer="defer"></script>
 */ 
var jActivating =
{

	/**
	 * Declare constants
	 * IS_MSIE	checks for Internet Explorer 6 and later versions
	 * TAGS		array with affected HTML tags
	 */
	IS_MSIE : (document.removeNode && document.createAttribute) ? true : false,
	TAGS : ['object', 'embed', 'applet'],
	
	
	/**
	 * Activates embedded content reinserting it.
	 * @return void
	 */
	activateContent : function()
	{
		var i = 0;
		for(var _tagName; _tagName = jActivating.TAGS[i]; i++)
		{
			var j = 0;
			for(var _node; _node = document.getElementsByTagName(_tagName)[j]; j++)
			{
				if(jActivating)	
				{
				if(jActivating.IS_MSIE)
				{
					jActivating.reinsertHtml(_node);
				}
				else
				{
					jActivating.reinsertNode(_node);
				}
				}
			}
			
		}
		jActivating = null;
	},
	
	
	/**
	 * Sets outerHTML property.
	 * @param object	- The node
	 * @return void
	 */
	reinsertHtml : function(_node)
	{
	    var parent=_node.parentNode;
	    //alert(parent);
		var _htmlCode = jActivating.getHtmlCode(_node);
		if(_htmlCode)
		{   
			_node.outerHTML = _htmlCode;
		}
		//_node.parentNode.style.display="block";
		parent.style.display="inline";
	},
	
	
	/**
	 * Replaces the node for a clone.
	 * @param object - The original node
	 * @return void
	 */
	reinsertNode : function(_node)
	{
	    var parent=_node.parentNode;
		var _clone = _node.cloneNode(true);
		var _parent = _node.parentNode;
		if(_clone && _parent)
		{
			_parent.replaceChild(_clone, _node);
		}
		parent.style.display="inline";
	},
	
	
	/**
	 * Retrieves the object and its content in HTML.
	 * @param object - The analyzed node
	 * @return string - The HTML received, NULL for malformed syntax (end tag)
	 */
	getHtmlCode : function(_node)
	{
		var _htmlCode = _node.outerHTML;
		var _name = _node.nodeName.toLowerCase();
		if(_name == 'embed')
		{
			return _htmlCode;
		}
		if(_name == 'object' || _name == 'applet')
		{
			var _startTag = _htmlCode.substr(0, _htmlCode.indexOf('>') + 1);
			var _endTag = _htmlCode.substr(_htmlCode.length - 9).toLowerCase();
			// Filters malformed syntax for avoid unexpected results
			if(_endTag != '</object>' && _endTag != '</applet>')
			{
				return null;
			}
			var _innerHtml = jActivating.getInnerHtml(_node);
			_htmlCode = _startTag + _innerHtml + _endTag;
			return _htmlCode;
		}
	},
	
	
	/**
	 * Retrieves the HTML between start and end tags of the object.
	 * @param object - The analyzed node
	 * @return string - The HTML received
	 *
	 * NOTE: the innerHTML property isn't used because Internet Explorer
	 * sometimes returns a empty result.
	 */
	getInnerHtml : function(_node)
	{
		var _innerHtml = '';
		var i = 0;
		for(var _childNode; _childNode = _node.childNodes[i]; i++)
		{
			_innerHtml += _childNode.outerHTML;
		}
		return _innerHtml;
	}
}

/*
// Execute script only for Internet Explorer (6+) and Opera (9+)
if(jActivating.IS_MSIE)
{
	jActivating.activateContent();
}
else if(window.opera)
{
	document.addEventListener('DOMContentLoaded', jActivating.activateContent, false);
}*/// spica javascript libraries - spica.js -- version 0.05
// == written by Takuya Otani <takuya.otani@gmail.com> ===
// == Copyright (C) 2006 SimpleBoxes/SerendipityNZ Ltd. ==

// === array ===
if (!Array.prototype.pop)
{
	Array.prototype.pop = function()
	{
		if (!this.length) return null;
		var last = this[this.length - 1];
		--this.length;
		return last;
	}
}
if (!Array.prototype.push)
{
	Array.prototype.push = function()
	{
		for (var i=0,n=arguments.length;i<n;i++)
			this[this.length] = arguments[i];
		return this.length;
	}
}
if (!Array.prototype.indexOf)
{
	Array.prototype.indexOf = function(value,idx)
	{
		if (typeof(idx) != 'number') idx = 0;
		else if (idx < 0) idx = this.length + idx;
		for (var i=idx,n=this.length;i<n;i++)
			if (this[i] === value) return i;
		return -1;
	}
}
// === browser ===
function Browser()
{
	this.name = navigator.userAgent;
	this.isWinIE = this.isMacIE = false;
	this.isGecko = this.name.match(/Gecko\//);
	this.isSafari = this.name.match(/AppleWebKit/);
	this.isKHTML = this.isSafari || navigator.appVersion.match(/Konqueror|KHTML/);
	this.isOpera = window.opera;
	this.hasNS = (document.documentElement) ? document.documentElement.namespaceURI : null;
	if (document.all && !this.isGecko && !this.isSafari && !this.isOpera)
	{
		this.isWinIE = this.name.match(/Win/);
		this.isMacIE = this.name.match(/Mac/);
	}
}
var Browser = new Browser();
// === event ===
if (!window.Event) var Event = new Object;
Event = {
	cache : false,
	getEvent : function(evnt)
	{
		return (evnt) ? evnt : ((window.event) ? window.event : null);
	},
	getKey : function(evnt)
	{
		evnt = this.getEvent(evnt);
		return (evnt.which) ? evnt.which : evnt.keyCode;
	},
	stop : function(evnt)
	{
		try{ evnt.stopPropagation() } catch(err){};
		evnt.cancelBubble = true;
		try{ evnt.preventDefault() } catch(err){};
		return (evnt.returnValue = false);
	},
	register : function(object, type, handler)
	{
		if (type == 'keypress' && (Browser.isKHTML || object.attachEvent)) type = 'keydown';
		if (type == 'mousewheel' && Browser.isGecko) type = 'DOMMouseScroll';
		if (!this.cache) this.cache = [];
		if (object.addEventListener)
		{
			this.cache.push([object,type,handler]);
			object.addEventListener(type, handler, false);
		}
		else if (object.attachEvent)
		{
			this.cache.push([object,type,handler]);
			object.attachEvent(['on',type].join(''),handler);
		}
		else
		{
			object[['on',type].join('')] = handler;
		}
	},
	deregister : function(object, type, handler)
	{
		if (type == 'keypress' && (Browser.isKHTML || object.attachEvent)) type = 'keydown';
		if (type == 'mousewheel' && Browser.isGecko) type = 'DOMMouseScroll';
		if (object.removeEventListener)
			object.removeEventListener(type, handler, false);
		else if (object.detachEvent)
			object.detachEvent(['on',type].join(''), handler);
		else
			object[['on',type].join('')] = null;
	},
	deregisterAll : function()
	{
		if (!Event.cache) return
		for (var i=0,n=Event.cache.length;i<n;i++)
		{
			Event.deregister(Event.cache[i]);
			Event.cache[i][0] = null;
		}
		Event.cache = false;
	}
};
Event.register(window, 'unload', Event.deregisterAll);
// === dom ===
document.getElemetsByClassName = function(name,target)
{
	var result = [];
	var object  = null;
	var search = new RegExp(['(^|\\s)',name,'(\\s|$)'].join(''));
	if (target && target.getElementsByTagName)
		object = target.getElementsByTagName('*');
	if (!object)
		object = document.getElementsByTagName ? document.getElementsByTagName('*') : document.all;
	for (var i=0,n=object.length;i<n;i++)
	{
		var check = object[i].getAttribute('class') || object[i].className;
		if (check.match(search)) result.push(object[i]);
	}
	return result;
}
// === library ===
function Library()
{
	this._path = '';
	this._cache = [];
	this.lang = '';
	this.base = '';
	return this._init();
}
Library.prototype = {
	_init : function()
	{
		var rs_path = document.getElementsByName('X-Resource-Dir')[0];
		var js_path = document.getElementsByName('X-Script-Dir')[0];
		if (rs_path)
		{
			this.base = this._check_path(rs_path.getAttribute('content'));
			if (!js_path) this._path = [this.base,'js/'].join('');
		}
		if (js_path)
			this._path = this._check_path(js_path.getAttribute('content'));
		return this;
	},
	_initLang : function()
	{
		var html = document.getElementsByTagName('html')[0];
		if (!html) return;
		this.lang = html.getAttribute('xml:lang') || html.getAttribute('lang');
	},
	_check_path : function(path)
	{
		if (!path) return '';
		if (!path.match(/\/$/)) path = [path,'/'].join('');
		return path;
	},
	require : function(libs)
	{
		var pre  = '\n<script type="text/javascript" src="';
		var post = '.js"></script>';
		for (var i=0,n=libs.length;i<n;i++)
		{
			if (this._cache.indexOf(libs[i]) > -1) continue;
			document.write([pre,this._path,libs[i],post].join(''));
			this._cache.push(libs[i]);
		}
	},
	path : function(path)
	{
		this._path = this._check_path(path);
	}
}
var Library = new Library();
Event.register(window,'load',function() { Library._initLang() });
// lightbox_plus.js
// == written by Takuya Otani <takuya.otani@gmail.com> ===
// == Copyright (C) 2006 SimpleBoxes/SerendipityNZ Ltd. ==
/*
	Copyright (C) 2006 Takuya Otani/SimpleBoxes - http://serennz.cool.ne.jp/sb/
	Copyright (C) 2006 SerendipityNZ - http://serennz.cool.ne.jp/snz/
	
	This script is licensed under the Creative Commons Attribution 2.5 License
	http://creativecommons.org/licenses/by/2.5/
	
	basically, do anything you want, just leave my name and link.
*/
/*
	Original script : Lightbox JS : Fullsize Image Overlays
	Copyright (C) 2005 Lokesh Dhakar - http://www.huddletogether.com
	For more information on this script, visit:
	http://huddletogether.com/projects/lightbox/
*/
// ver. 20061027 - fixed a bug ( not work at xhml documents on Netscape7 )
// ver. 20061026 - fixed bugs
// ver. 20061010 - implemented image set feature
// ver. 20060921 - fixed a bug / added overall view
// ver. 20060920 - added flag to prevent mouse wheel event
// ver. 20060919 - fixed a bug
// ver. 20060918 - implemented functionality of wheel zoom & drag'n drop
// ver. 20060131 - fixed a bug to work correctly on Internet Explorer for Windows
// ver. 20060128 - implemented functionality of echoic word
// ver. 20060120 - implemented functionality of caption and close button
function WindowSize()
{ // window size object
	this.w = 0;
	this.h = 0;
	return this.update();
}
WindowSize.prototype.update = function()
{
	var d = document;
	this.w = 
	  (window.innerWidth) ? window.innerWidth
	: (d.documentElement && d.documentElement.clientWidth) ? d.documentElement.clientWidth
	: d.body.clientWidth;
	this.h = 
	  (window.innerHeight) ? window.innerHeight
	: (d.documentElement && d.documentElement.clientHeight) ? d.documentElement.clientHeight
	: d.body.clientHeight;
	return this;
};
function PageSize()
{ // page size object
	this.win = new WindowSize();
	this.w = 0;
	this.h = 0;
	return this.update();
}
PageSize.prototype.update = function()
{
	var d = document;
	this.w = 
	  (window.innerWidth && window.scrollMaxX) ? window.innerWidth + window.scrollMaxX
	: (d.body.scrollWidth > d.body.offsetWidth) ? d.body.scrollWidth
	: d.body.offsetWidt;
	this.h = 
	  (window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY
	: (d.body.scrollHeight > d.body.offsetHeight) ? d.body.scrollHeight
	: d.body.offsetHeight;
	this.win.update();
	if (this.w < this.win.w) this.w = this.win.w;
	if (this.h < this.win.h) this.h = this.win.h;
	return this;
};
function PagePos()
{ // page position object
	this.x = 0;
	this.y = 0;
	return this.update();
}
PagePos.prototype.update = function()
{
	var d = document;
	this.x =
	  (window.pageXOffset) ? window.pageXOffset
	: (d.documentElement && d.documentElement.scrollLeft) ? d.documentElement.scrollLeft
	: (d.body) ? d.body.scrollLeft
	: 0;
	this.y =
	  (window.pageYOffset) ? window.pageYOffset
	: (d.documentElement && d.documentElement.scrollTop) ? d.documentElement.scrollTop
	: (d.body) ? d.body.scrollTop
	: 0;
	return this;
};
function LightBox(option)
{
	var self = this;
	self._imgs = new Array();
	self._sets = new Array();
	self._wrap = null;
	self._iframe = null;
	self._box  = null;
	self._img  = null;
	self._open = -1;
	self._page = new PageSize();
	self._pos  = new PagePos();
	self._zoomimg = null;
	self._expandable = false;
	self._expanded = false;
	self._funcs = {'move':null,'up':null,'drag':null,'wheel':null,'dbl':null};
	self._level = 1;
	self._curpos = {x:0,y:0};
	self._imgpos = {x:0,y:0};
	self._minpos = {x:0,y:0};
	self._expand = option.expandimg;
	self._shrink = option.shrinkimg;
	self._resizable = option.resizable;
	self._timer = null;
	self._indicator = null;
	self._overall = null;
	self._openedset = null;
	self._prev = null;
	self._next = null;
	self._hiding = [];
	self._first = false;
	return self._init(option);
}
LightBox.prototype = {
	_init : function(option)
	{
		var self = this;
		var d = document;
		if (!d.getElementsByTagName) return;
		if (Browser.isMacIE) return self;
		var links = d.getElementsByTagName("a");
		for (var i=0;i<links.length;i++)
		{
			var anchor = links[i];
			var num = self._imgs.length;
			var rel = String(anchor.getAttribute("rel")).toLowerCase();
			if (!anchor.getAttribute("href") || !rel.match('lightbox')) continue;
			// initialize item
			self._imgs[num] = {
				src:anchor.getAttribute("href"),
				w:-1,
				h:-1,
				title:'',
				cls:anchor.className,
				set:rel
			};
			if (anchor.getAttribute("title"))
				self._imgs[num].title = anchor.getAttribute("title");
			else if ( anchor.firstChild 
			       && anchor.firstChild.getAttribute 
			       && anchor.firstChild.getAttribute("title"))
				self._imgs[num].title = anchor.firstChild.getAttribute("title");
			anchor.onclick = self._genOpener(num); // set closure to onclick event
			if (rel != 'lightbox')
			{
				if (!self._sets[rel]) self._sets[rel] = new Array();
				self._sets[rel].push(num);
			}
		}
		var body = d.getElementsByTagName("body")[0];
				
		self._iframe = self._createIframeOn(body,option.loadingimg);
		//alert(self._iframe.src);
		//body.appendChild(self._iframe)
		self._wrap = self._createWrapOn(body,option.loadingimg);
		self._box  = self._createBoxOn(body,option);
		self._img  = self._box.firstChild;
		self._zoomimg = d.getElementById('actionImage');
		return self;
	},
	_genOpener : function(num)
	{
		var self = this;
		return function() { self._show(num); return false; }
	},
	
	_createIframeOn : function(obj,imagePath)
	{
		var self = this;
		if (!obj) return null;
		
		 var myWidth = 0, myHeight = 0;         
        if( typeof( window.innerWidth ) == 'number' ) 
        { 
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;            
        }
        else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
        {
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;            
        } 
        else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
        {
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;  
        }             
		
		// create wrapper object, translucent background
		var wrap = document.createElement('iframe');
		obj.appendChild(wrap);
		wrap.id = 'iframe';		
		wrap.style.display = 'none';
		wrap.src = 'about:blank';
		wrap.style.position = "absolute"; 
		wrap.style.top = '0px';
		wrap.style.left = '0px';
		/*wrap.style.zIndex = '50';
		wrap.style.width = "0px";
		wrap.style.height = "0px"; 
		*/
		
		wrap.style.border = 'solid 0px blue'; 		
		var opacity=10;
		opacity = (opacity == 100)?99.999:opacity;              
      // IE/Win
      wrap.style.filter = "alpha(opacity:"+opacity+")";              
      // Safari<1.2, Konqueror
      wrap.style.KHTMLOpacity = opacity/100;              
      // Older Mozilla and Firefox
      wrap.style.MozOpacity = opacity/100;              
      // Safari 1.2, newer Firefox and Mozilla, CSS3
      wrap.style.opacity = opacity/100;

		
		/*
		if (Browser.isWinIE) wrap.style.position = 'absolute';		
		Event.register(wrap,"click",function(evt) { self._close(evt); });
		// create loading image, animated image
		var imag = new Image;
		imag.onload = function() {
			var spin = document.createElement('img');
			wrap.appendChild(spin);
			spin.id = 'loadingImage';
			spin.src = imag.src;
			//spin.style.position = 'relative';
			spin.style.position = 'absolute';
			self._set_cursor(spin);
			Event.register(spin,'click',function(evt) { self._close(evt); });
			imag.onload = function(){};
		};
		*/
		//if (imagePath != '') imag.src = imagePath;
		return wrap;
	},
	
	_createWrapOn : function(obj,imagePath)
	{
		var self = this;
		if (!obj) return null;
		
		
		
		
		
		// create wrapper object, translucent background
		var wrap = document.createElement('div');
		obj.appendChild(wrap);
		wrap.id = 'overlay';
		wrap.style.display = 'none';
		wrap.style.position = 'fixed';
		wrap.style.top = '0px';
		wrap.style.left = '0px';
		wrap.style.zIndex = '1050';
		wrap.style.width = '100%';
		wrap.style.height = '100%';
		if (Browser.isWinIE) wrap.style.position = 'absolute';
		Event.register(wrap,"click",function(evt) { self._close(evt); });
		// create loading image, animated image
		var imag = new Image;
		imag.onload = function() {
			var spin = document.createElement('img');
			wrap.appendChild(spin);
			spin.id = 'loadingImage';
			if(imag.src)
			    spin.src = imag.src;
			//spin.style.position = 'relative';
			spin.style.position = 'absolute';
			self._set_cursor(spin);
			Event.register(spin,'click',function(evt) { self._close(evt); });
			imag.onload = function(){};
		};		
		if (imagePath && imagePath != '') imag.src = imagePath;
		return wrap;
	},
	_createBoxOn : function(obj,option)
	{
		var self = this;
		if (!obj) return null;
		// create lightbox object, frame rectangle
		var box = document.createElement('div');
		obj.appendChild(box);
		box.id = 'lightbox';
		box.style.display = 'none';
		box.style.position = 'absolute';
		box.style.zIndex = '1060';
		// create image object to display a target image
		var img = document.createElement('img');
		box.appendChild(img);
		img.id = 'lightboxImage';
		self._set_cursor(img);
		Event.register(img,'mouseover',function() { self._show_action(); });
		Event.register(img,'mouseout',function() { self._hide_action(); });
		Event.register(img,'click',function(evt) { self._close(evt); });
		// create hover navi - prev
		if (option.previmg)
		{
			var prevLink = document.createElement('img');
			box.appendChild(prevLink);
			prevLink.id = 'prevLink';
			prevLink.style.display = 'none';
			prevLink.style.position = 'absolute';
			prevLink.style.left = '9px';
			prevLink.style.zIndex = '1070';
			prevLink.src = option.previmg;
			self._prev = prevLink;
			Event.register(prevLink,'mouseover',function() { self._show_action(); });
			Event.register(prevLink,'click',function() { self._show_next(-1); });
		}
		// create hover navi - next
		if (option.nextimg)
		{
			var nextLink = document.createElement('img');
			box.appendChild(nextLink);
			nextLink.id = 'nextLink';
			nextLink.style.display = 'none';
			nextLink.style.position = 'absolute';
			nextLink.style.right = '9px';
			nextLink.style.zIndex = '1070';
			nextLink.src = option.nextimg;
			self._next = nextLink;
			Event.register(nextLink,'mouseover',function() { self._show_action(); });
			Event.register(nextLink,'click',function() { self._show_next(+1); });
		}
		// create zoom indicator
		var zoom = document.createElement('img');
		box.appendChild(zoom);
		zoom.id = 'actionImage';
		zoom.style.display = 'none';
		zoom.style.position = 'absolute';
		zoom.style.top = '15px';
		zoom.style.left = '15px';
		zoom.style.zIndex = '1070';
		self._set_cursor(zoom);
		if(self._expand)
			zoom.src = self._expand;
		Event.register(zoom,'mouseover',function() { self._show_action(); });
		Event.register(zoom,'click', function() { self._zoom(); });
		Event.register(window,'resize',function() { self._set_size(true); });
		// create close button
		if (option.closeimg)
		{
			var btn = document.createElement('img');
			box.appendChild(btn);
			btn.id = 'closeButton';
			btn.style.display = 'inline';
			btn.style.position = 'absolute';
			btn.style.right = '9px';
			btn.style.top = '10px';
			btn.style.zIndex = '1080';
			btn.src = option.closeimg;
			self._set_cursor(btn);
			Event.register(btn,'click',function(evt) { self._close(evt); });
		}
		// caption text
		var caption = document.createElement('span');
		box.appendChild(caption);
		caption.id = 'lightboxCaption';
		caption.style.display = 'none';
		caption.style.position = 'absolute';
		caption.style.zIndex = '1080';
		// create effect image
		if (!option.effectpos)
			option.effectpos = {x:0,y:0};
		else
		{
			if (option.effectpos.x == '') option.effectpos.x = 0;
			if (option.effectpos.y == '') option.effectpos.y = 0;
		}
		var effect = new Image;
		effect.onload = function()
		{
			var effectImg = document.createElement('img');
			box.appendChild(effectImg);
			effectImg.id = 'effectImage';
			effectImg.src = effect.src;
			if (option.effectclass) effectImg.className = option.effectclass;
			effectImg.style.position = 'absolute';
			effectImg.style.display = 'none';
			effectImg.style.left = [option.effectpos.x,'px'].join('');;
			effectImg.style.top = [option.effectpos.y,'px'].join('');
			effectImg.style.zIndex = '1090';
			self._set_cursor(effectImg);
			Event.register(effectImg,'click',function() { effectImg.style.display = 'none'; });
		};
		if (option.effectimg && option.effectimg != '') effect.src = option.effectimg;
		if (self._resizable)
		{
			var overall = document.createElement('div');
			obj.appendChild(overall);
			overall.id = 'lightboxOverallView';
			overall.style.display = 'none';
			overall.style.position = 'absolute';
			overall.style.zIndex = '1070';
			self._overall = overall;
			var indicator = document.createElement('div');
			obj.appendChild(indicator);
			indicator.id = 'lightboxIndicator';
			indicator.style.display = 'none';
			indicator.style.position = 'absolute';
			indicator.style.zIndex = '1080';
			self._indicator = indicator;
		}
		return box;
	},
	_set_photo_size : function()
	{
		var self = this;
		if (self._open == -1) return;
		var targ = { w:self._page.win.w - 30, h:self._page.win.h - 30 };
		var zoom = { x:15, y:15 };
		var navi = { p:9, n:9, y:0 };
		/*
		if (!self._expanded)
		{ // shrink image with the same aspect
			var orig = { w:self._imgs[self._open].w, h:self._imgs[self._open].h };
			var ratio = 1.0;
			if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w)
				ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h;
			self._img.width  = Math.floor(orig.w * ratio);
			self._img.height = Math.floor(orig.h * ratio);
			self._expandable = (ratio < 1.0) ? true : false;
			if (self._resizable) self._expandable = true;
			if (Browser.isWinIE) self._box.style.display = "block";
			self._imgpos.x = self._pos.x + (targ.w - self._img.width) / 2;
			self._imgpos.y = self._pos.y + (targ.h - self._img.height) / 2;
			navi.y = Math.floor(self._img.height / 2) - 10;
			self._show_caption(true);
			self._show_overall(false);
			
			self._iframe.style.left= self._imgpos.x;
			self._iframe.style.top = self._imgpos.y;
			
			self._iframe.width= self._img.width ;
			self._iframe.height = self._img.height;
			
			
		}
		else
		{
		*/
		 // zoomed or actual sized image
			var width  = parseInt(self._imgs[self._open].w * self._level);
			var height = parseInt(self._imgs[self._open].h * self._level);
			self._minpos.x = self._pos.x + targ.w - width;
			self._minpos.y = self._pos.y + targ.h - height;
			if (width <= targ.w)
				self._imgpos.x = self._pos.x + (targ.w - width) / 2;
			else
			{
				if (self._imgpos.x > self._pos.x) self._imgpos.x = self._pos.x;
				else if (self._imgpos.x < self._minpos.x) self._imgpos.x = self._minpos.x;
				zoom.x = 15 + self._pos.x - self._imgpos.x;
				navi.p = self._pos.x - self._imgpos.x - 5;
				navi.n = width - self._page.win.w + self._imgpos.x + 25;
				if (Browser.isWinIE) navi.n -= 10;
			}
			if (height <= targ.h)
			{
				self._imgpos.y = self._pos.y + (targ.h - height) / 2;
				navi.y = Math.floor(self._img.height / 2) - 10;
			}
			else
			{
				if (self._imgpos.y > self._pos.y) self._imgpos.y = self._pos.y;
				else if (self._imgpos.y < self._minpos.y) self._imgpos.y = self._minpos.y;
				zoom.y = 15 + self._pos.y - self._imgpos.y;
				navi.y = Math.floor(targ.h / 2) - 10 + self._pos.y - self._imgpos.y;
			}
			self._img.width  = width;
			self._img.height = height;
			
			self._iframe.width= width;
			self._iframe.height = height;
			
			self._show_caption(false);
			self._show_overall(true);
		//}
		self._box.style.left = [self._imgpos.x,'px'].join('');
		self._box.style.top  = [self._imgpos.y,'px'].join('');
		
		self._iframe.style.left= [self._imgpos.x,'px'].join('');;
		self._iframe.style.top = [self._imgpos.y,'px'].join('');
		
		//alert(self._iframe.style.left);
		//alert(self._iframe.height);
		
		self._zoomimg.style.left = [zoom.x,'px'].join('');
		self._zoomimg.style.top  = [zoom.y,'px'].join('');
		self._wrap.style.left = self._pos.x;
		if (self._prev && self._next)
		{
			self._prev.style.left  = [navi.p,'px'].join('');
			self._next.style.right = [navi.n,'px'].join('');
			self._prev.style.top = self._next.style.top = [navi.y,'px'].join('');
		}
	},
	_show_overall : function(visible)
	{
		var self = this;
		if (self._overall == null) return;
		if (visible)
		{
			if (self._open == -1) return;
			var base = 100;
			var outer = { w:0, h:0, x:0, y:0 };
			var inner = { w:0, h:0, x:0, y:0 };
			var orig = { w:self._img.width , h:self._img.height };
			var targ = { w:self._page.win.w - 30, h:self._page.win.h - 30 };
			var max = orig.w;
			if (max < orig.h) max = orig.h;
			if (max < targ.w) max = targ.w;
			if (max < targ.h) max = targ.h;
			if (max < 1) return;
			outer.w = parseInt(orig.w / max * base);
			outer.h = parseInt(orig.h / max * base);
			inner.w = parseInt(targ.w / max * base);
			inner.h = parseInt(targ.h / max * base);
			outer.x = self._pos.x + targ.w - base - 20;
			outer.y = self._pos.y + targ.h - base - 20;
			inner.x = outer.x - parseInt((self._imgpos.x - self._pos.x) / max * base);
			inner.y = outer.y - parseInt((self._imgpos.y - self._pos.y) / max * base);
			self._overall.style.left = [outer.x,'px'].join('');
			self._overall.style.top  = [outer.y,'px'].join('');
			self._overall.style.width  = [outer.w,'px'].join('');
			self._overall.style.height = [outer.h,'px'].join('');			
			self._indicator.style.left = [inner.x,'px'].join('');
			self._indicator.style.top  = [inner.y,'px'].join('');
			self._indicator.style.width  = [inner.w,'px'].join('');
			self._indicator.style.height = [inner.h,'px'].join('');
			self._overall.style.display = 'none'
			self._indicator.style.display = 'none';
		}
		else
		{
			self._overall.style.display = 'none';
			self._indicator.style.display = 'none';
		}
	},
	_set_size : function(onResize)
	{
		var self = this;
		if (self._open == -1) return;
		self._page.update();
		self._pos.update();
		var spin = self._wrap.firstChild;
		if (spin)
		{
			var top = (self._page.win.h - spin.height) / 2;
			if (self._wrap.style.position == 'absolute') top += self._pos.y;
			spin.style.top  = [top,'px'].join('');
			spin.style.left = [(self._page.win.w - spin.width - 30) / 2,'px'].join('');
		}
		if (Browser.isWinIE)
		{
			self._wrap.style.width  = [self._page.win.w,'px'].join('');
			self._wrap.style.height = [self._page.win.h,'px'].join('');
			self._wrap.style.top = [self._pos.y,'px'].join('');
			
		}
		if (onResize) self._set_photo_size();
	},
	_set_cursor : function(obj)
	{
		var self = this;
		//if (Browser.isWinIE && !Browser.isNewIE) return;
		obj.style.cursor = 'pointer';
	},
	_current_setindex : function()
	{
		var self = this;
		if (!self._openedset) return -1;
		var list = self._sets[self._openedset];
		for (var i=0,n=list.length;i<n;i++)
		{
			if (list[i] == self._open) return i;
		}
		return -1;
	},
	_get_setlength : function()
	{
		var self = this;
		if (!self._openedset) return -1;
		return self._sets[self._openedset].length;
	},
	_show_action : function()
	{
		var self = this;
		if (self._open == -1 || !self._expandable) return;
		if (!self._zoomimg) return;
		self._zoomimg.src = (self._expanded) ? self._shrink : self._expand;
		self._zoomimg.style.display = 'inline';
		var check = self._current_setindex();
		if (check > -1)
		{
			if (check > 0) self._prev.style.display = 'inline';
			if (check < self._get_setlength() - 1) self._next.style.display = 'inline';
		}
	},
	_hide_action : function()
	{
		var self = this;
		if (self._zoomimg) self._zoomimg.style.display = 'none';
		if (self._open > -1 && self._expanded) self._dragstop(null);
		if (self._prev) self._prev.style.display = 'none';
		if (self._next) self._next.style.display = 'none';
	},
	_zoom : function()
	{
		var self = this;
		var closeBtn = document.getElementById('closeButton');
		if (self._expanded)
		{
			self._reset_func();
			self._expanded = false;
			if (closeBtn) closeBtn.style.display = 'inline';
		}
		else if (self._open > -1)
		{
			self._level = 1;
			self._imgpos.x = self._pos.x;
			self._imgpos.y = self._pos.y;
			self._expanded = true;
			self._funcs.drag  = function(evt) { self._dragstart(evt) };
			self._funcs.dbl   = function(evt) { self._close(null) };
			if (self._resizable)
			{
				self._funcs.wheel = function(evt) { self._onwheel(evt) };
				Event.register(self._box,'mousewheel',self._funcs.wheel);
			}
			Event.register(self._img,'mousedown',self._funcs.drag);
			Event.register(self._img,'dblclick',self._funcs.dbl);
			if (closeBtn) closeBtn.style.display = 'none';
		}
		self._set_photo_size();
		self._show_action();
	},
	_reset_func : function()
	{
		var self = this;
		if (self._funcs.wheel != null) Event.deregister(self._box,'mousewheel',self._funcs.wheel);
		if (self._funcs.move  != null) Event.deregister(self._img,'mousemove',self._funcs.move);
		if (self._funcs.up    != null) Event.deregister(self._img,'mouseup',self._funcs.up);
		if (self._funcs.drag  != null) Event.deregister(self._img,'mousedown',self._funcs.drag);
		if (self._funcs.dbl   != null) Event.deregister(self._img,'dblclick',self._funcs.dbl);
		self._funcs = {'move':null,'up':null,'drag':null,'wheel':null,'dbl':null};
	},
	_onwheel : function(evt)
	{
		var self = this;
		var delta = 0;
		evt = Event.getEvent(evt);
		if (evt.wheelDelta)  delta = event.wheelDelta/-120;
		else if (evt.detail) delta = evt.detail/3;
		if (Browser.isOpera) delta = - delta;
		var step =
			  (self._level < 1) ? 0.1
			: (self._level < 2) ? 0.25
			: (self._level < 4) ? 0.5
			: 1;
		self._level = (delta > 0) ? self._level + step : self._level - step;
		if (self._level > 8) self._level = 8;
		else if (self._level < 0.5) self._level = 0.5;
		self._set_photo_size();
		return Event.stop(evt);
	},
	_dragstart : function(evt)
	{
		var self = this;
		evt = Event.getEvent(evt);
		self._curpos.x = evt.screenX;
		self._curpos.y = evt.screenY;
		self._funcs.move = function(evnt) { self._dragging(evnt); };
		self._funcs.up   = function(evnt) { self._dragstop(evnt); };
		Event.register(self._img,'mousemove',self._funcs.move);
		Event.register(self._img,'mouseup',self._funcs.up);
		return Event.stop(evt);
	},
	_dragging : function(evt)
	{
		var self = this;
		evt = Event.getEvent(evt);
		self._imgpos.x += evt.screenX - self._curpos.x;
		self._imgpos.y += evt.screenY - self._curpos.y;
		self._curpos.x = evt.screenX;
		self._curpos.y = evt.screenY;
		self._set_photo_size();
		return Event.stop(evt);
	},
	_dragstop : function(evt)
	{
		var self = this;
		evt = Event.getEvent(evt);
		if (self._funcs.move  != null) Event.deregister(self._img,'mousemove',self._funcs.move);
		if (self._funcs.up    != null) Event.deregister(self._img,'mouseup',self._funcs.up);
		self._funcs.move = null;
		self._funcs.up   = null;
		self._set_photo_size();
		return (evt) ? Event.stop(evt) : false;
	},
	_show_caption : function(enable)
	{
		var self = this;
		var caption = document.getElementById('lightboxCaption');
		if (!caption) return;
		if (caption.innerHTML.length == 0 || !enable)
		{
			caption.style.display = 'none';
		}
		else
		{ // now display caption
			caption.style.top = [self._img.height + 10,'px'].join(''); // 10 is top margin of lightbox
			caption.style.left = '0px';
			caption.style.width = [self._img.width + 20,'px'].join(''); // 20 is total side margin of lightbox
			caption.style.display = 'block';
		}
	},
	_toggle_wrap : function(flag)
	{
		var self = this;
		self._iframe.style.display = flag ? "block" : "none";
		//alert(self._iframe.style.display);
		self._wrap.style.display = flag ? "block" : "none";
		
		if (self._hiding.length == 0 && !self._first)
		{ 
			
			//alert(self._iframe.st);
			//self._iframe.style.display="block";
			//alert(self._iframe.style.display);
			// some objects may overlap on overlay, so we hide them temporarily.
			/*
			var tags = ['select','embed','object'];
			for (var i=0,n=tags.length;i<n;i++)
			{	
				var elem = document.getElementsByTagName(tags[i]);
				for (var j=0,m=elem.length;j<m;j++)
				{ // check the original value at first. when alredy hidden, dont touch them
					var check = elem[j].style.visibility;
					if (!check)
					{
						if (elem[j].currentStyle)
							check = elem[j].currentStyle['visibility'];
						else if (document.defaultView)
							check = document.defaultView.getComputedStyle(elem[j],'').getPropertyValue('visibility');
					}
					if (check == 'hidden') continue;
					self._hiding.push(elem[j]);
				}
			}
			*/
			self._first = true;
			
		}
		/*
		for (var i=0,n=self._hiding.length;i<n;i++)
			self._hiding[i].style.visibility = flag ? "hidden" : "visible";
			*/
	},
	_show : function(num)
	{
		var self = this;
		var imag = new Image;
		if (num < 0 || num >= self._imgs.length) return;
		var loading = document.getElementById('loadingImage');
		var caption = document.getElementById('lightboxCaption');
		var effect = document.getElementById('effectImage');
		self._open = num; // set opened image number
		self._set_size(false); // calc and set wrapper size
		self._toggle_wrap(true);
		if (loading) loading.style.display = 'inline';
		imag.onload = function() {
			if (self._imgs[self._open].w == -1)
			{ // store original image width and height
				self._imgs[self._open].w = imag.width;
				self._imgs[self._open].h = imag.height;
			}
			if (effect)
			{
				effect.style.display = (!effect.className || self._imgs[self._open].cls == effect.className)
					? 'block' : 'none';
			}
			if (caption)
				try { caption.innerHTML = self._imgs[self._open].title; } catch(e) {}
			self._set_photo_size(); // calc and set lightbox size
			self._hide_action();
			self._box.style.display = "block";
			self._img.src = imag.src;
			self._img.setAttribute('title',self._imgs[self._open].title);
			self._timer = window.setInterval( function() { self._set_size(true) } , 100);
			if (loading) loading.style.display = 'none';
			if (self._imgs[self._open].set != 'lightbox')
			{
				var set = self._imgs[self._open].set;
				if (self._sets[set].length > 1) self._openedset = set;
				if (!self._prev || !self._next) self._openedset = null;
			}
		};
		self._expandable = false;
		self._expanded = false;
		imag.src = self._imgs[self._open].src;
	},
	_close_box : function()
	{
		var self = this;
		self._open = -1;
		self._openedset = null;
		self._hide_action();
		self._hide_action();
		self._reset_func();
		self._show_overall(false);
		self._box.style.display  = "none";
		if (self._timer != null)
		{
 			window.clearInterval(self._timer);
 			self._timer = null;
		}
	},
	_show_next : function(direction)
	{
		var self = this;
		if (!self._openedset) return self._close(null);
		var index = self._current_setindex() + direction;
		var targ = self._sets[self._openedset][index];
		self._close_box();
		self._show(targ);
	},
	_close : function(evt)
	{
		var self = this;
		if (evt != null)
		{
			evt = Event.getEvent(evt);
			var targ = evt.target || evt.srcElement;
			if (targ && targ.getAttribute('id') == 'lightboxImage' && self._expanded) return;
		}
		self._close_box();
		self._toggle_wrap(false);
	}
};
Event.register(window,"load",function() {
	var lightbox = new LightBox({
		loadingimg:"/"+"Lib/lightbox_plus/loading.gif",
		//expandimg:"/"+"Lib/lightbox_plus/expand.gif",
		//shrinkimg: "/"+"Lib/lightbox_plus/shrink.gif",
		//previmg:"/"+"Lib/lightbox_plus/prev.gif",
		//nextimg:"/"+"Lib/lightbox_plus/next.gif",
		//effectimg:"/"+"Lib/lightbox_plus/zzoop.gif",
		effectpos:{x:-40,y:-20},
		effectclass:'effectable',
		closeimg:"/"+"Lib/lightbox_plus/close.gif",
		resizable:true
	});
});
