Array.prototype.removeDuplicates=function(){for(var i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1);}}}
Array.prototype.empty=function(){for(var i=0;i<=this.length;i++){this.shift();}}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');}
function LyteBox(){this.theme='grey';this.hideFlash=true;this.outerBorder=true;this.resizeSpeed=8;this.maxOpacity=80;this.navType=1;this.autoResize=true;this.doAnimations=true;this.borderSize=12;this.slideInterval=10000;this.showNavigation=true;this.showClose=true;this.showDetails=true;this.showPlayPause=true;this.autoEnd=true;this.pauseOnNextClick=false;this.pauseOnPrevClick=true;if(this.resizeSpeed>10){this.resizeSpeed=10;}
if(this.resizeSpeed<1){resizeSpeed=1;}
this.resizeDuration=(11-this.resizeSpeed)*0.15;this.resizeWTimerArray=new Array();this.resizeWTimerCount=0;this.resizeHTimerArray=new Array();this.resizeHTimerCount=0;this.showContentTimerArray=new Array();this.showContentTimerCount=0;this.overlayTimerArray=new Array();this.overlayTimerCount=0;this.imageTimerArray=new Array();this.imageTimerCount=0;this.timerIDArray=new Array();this.timerIDCount=0;this.slideshowIDArray=new Array();this.slideshowIDCount=0;this.imageArray=new Array();this.activeImage=null;this.slideArray=new Array();this.activeSlide=null;this.frameArray=new Array();this.activeFrame=null;this.checkFrame();this.isSlideshow=false;this.isLyteframe=false;/*@cc_on
  /*@if (@_jscript)
   this.ie = (document.all && !window.opera) ? true : false;
  /*@else @*/this.ie=false;/*@end
 @*/this.ie7=(this.ie&&window.XMLHttpRequest);this.initialize();}
LyteBox.prototype.initialize=function(){this.updateLyteboxItems();var objBody=this.doc.getElementsByTagName("body").item(0);if(this.doc.getElementById('lbOverlay')){objBody.removeChild(this.doc.getElementById("lbOverlay"));objBody.removeChild(this.doc.getElementById("lbMain"));}
var objOverlay=this.doc.createElement("div");objOverlay.setAttribute('id','lbOverlay');objOverlay.setAttribute((this.ie?'className':'class'),this.theme);if((this.ie&&!this.ie7)||(this.ie7&&this.doc.compatMode=='BackCompat')){objOverlay.style.position='absolute';}
objOverlay.style.display='none';objBody.appendChild(objOverlay);var objLytebox=this.doc.createElement("div");objLytebox.setAttribute('id','lbMain');objLytebox.style.display='none';objBody.appendChild(objLytebox);var objOuterContainer=this.doc.createElement("div");objOuterContainer.setAttribute('id','lbOuterContainer');objOuterContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objOuterContainer);var objIframeContainer=this.doc.createElement("div");objIframeContainer.setAttribute('id','lbIframeContainer');objIframeContainer.style.display='none';objOuterContainer.appendChild(objIframeContainer);var objIframe=this.doc.createElement("iframe");objIframe.setAttribute('id','lbIframe');objIframe.setAttribute('name','lbIframe');objIframe.style.display='none';objIframeContainer.appendChild(objIframe);var objImageContainer=this.doc.createElement("div");objImageContainer.setAttribute('id','lbImageContainer');objOuterContainer.appendChild(objImageContainer);var objLyteboxImage=this.doc.createElement("img");objLyteboxImage.setAttribute('id','lbImage');objImageContainer.appendChild(objLyteboxImage);var objLoading=this.doc.createElement("div");objLoading.setAttribute('id','lbLoading');objOuterContainer.appendChild(objLoading);var objDetailsContainer=this.doc.createElement("div");objDetailsContainer.setAttribute('id','lbDetailsContainer');objDetailsContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objDetailsContainer);var objDetailsData=this.doc.createElement("div");objDetailsData.setAttribute('id','lbDetailsData');objDetailsData.setAttribute((this.ie?'className':'class'),this.theme);objDetailsContainer.appendChild(objDetailsData);var objDetails=this.doc.createElement("div");objDetails.setAttribute('id','lbDetails');objDetailsData.appendChild(objDetails);var objCaption=this.doc.createElement("span");objCaption.setAttribute('id','lbCaption');objDetails.appendChild(objCaption);var objHoverNav=this.doc.createElement("div");objHoverNav.setAttribute('id','lbHoverNav');objImageContainer.appendChild(objHoverNav);var objBottomNav=this.doc.createElement("div");objBottomNav.setAttribute('id','lbBottomNav');objDetailsData.appendChild(objBottomNav);var objPrev=this.doc.createElement("a");objPrev.setAttribute('id','lbPrev');objPrev.setAttribute((this.ie?'className':'class'),this.theme);objPrev.setAttribute('href','#');objHoverNav.appendChild(objPrev);var objNext=this.doc.createElement("a");objNext.setAttribute('id','lbNext');objNext.setAttribute((this.ie?'className':'class'),this.theme);objNext.setAttribute('href','#');objHoverNav.appendChild(objNext);var objNumberDisplay=this.doc.createElement("span");objNumberDisplay.setAttribute('id','lbNumberDisplay');objDetails.appendChild(objNumberDisplay);var objNavDisplay=this.doc.createElement("span");objNavDisplay.setAttribute('id','lbNavDisplay');objNavDisplay.style.display='none';objDetails.appendChild(objNavDisplay);var objClose=this.doc.createElement("a");objClose.setAttribute('id','lbClose');objClose.setAttribute((this.ie?'className':'class'),this.theme);objClose.setAttribute('href','#');objBottomNav.appendChild(objClose);var objPause=this.doc.createElement("a");objPause.setAttribute('id','lbPause');objPause.setAttribute((this.ie?'className':'class'),this.theme);objPause.setAttribute('href','#');objPause.style.display='none';objBottomNav.appendChild(objPause);var objPlay=this.doc.createElement("a");objPlay.setAttribute('id','lbPlay');objPlay.setAttribute((this.ie?'className':'class'),this.theme);objPlay.setAttribute('href','#');objPlay.style.display='none';objBottomNav.appendChild(objPlay);var objPrint=this.doc.createElement("a");objPrint.setAttribute('id','lbPrint');objPrint.setAttribute((this.ie?'className':'class'),this.theme);objPrint.setAttribute('href','#');objPrint.style.display='none';objBottomNav.appendChild(objPrint);};LyteBox.prototype.updateLyteboxItems=function(){var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];var relAttribute=String(anchor.getAttribute('rel'));if(anchor.getAttribute('href')){if(relAttribute.toLowerCase().match('lytebox')){anchor.onclick=function(){myLytebox.start(this,false,false);return false;}}else if(relAttribute.toLowerCase().match('lyteshow')){anchor.onclick=function(){myLytebox.start(this,true,false);return false;}}else if(relAttribute.toLowerCase().match('lyteframe')){anchor.onclick=function(){myLytebox.start(this,false,true);return false;}}}}};LyteBox.prototype.start=function(imageLink,doSlide,doFrame){if(this.ie&&!this.ie7){this.toggleSelects('hide');}
if(this.hideFlash){this.toggleFlash('hide');}
this.isLyteframe=(doFrame?true:false);var pageSize=this.getPageSize();var objOverlay=this.doc.getElementById('lbOverlay');var objBody=this.doc.getElementsByTagName("body").item(0);objOverlay.style.height=pageSize[1]+"px";objOverlay.style.display='';this.appear('lbOverlay',(this.doAnimations?0:this.maxOpacity));var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');if(this.isLyteframe){this.frameArray=[];this.frameNum=0;if((imageLink.getAttribute('rel')=='lyteframe')){var rev=imageLink.getAttribute('rev');this.frameArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title'),(rev==null||rev==''?'width: 400px; height: 400px; scrolling: auto;':rev)));}else{if(imageLink.getAttribute('rel').indexOf('lyteframe')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){var rev=anchor.getAttribute('rev');this.frameArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title'),(rev==null||rev==''?'width: 400px; height: 400px; scrolling: auto;':rev)));}}
this.frameArray.removeDuplicates();while(this.frameArray[this.frameNum][0]!=imageLink.getAttribute('href')){this.frameNum++;}}}}else{this.imageArray=[];this.imageNum=0;this.slideArray=[];this.slideNum=0;if((imageLink.getAttribute('rel')=='lytebox')){this.imageArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title')));}else{if(imageLink.getAttribute('rel').indexOf('lytebox')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.imageArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.imageArray.removeDuplicates();while(this.imageArray[this.imageNum][0]!=imageLink.getAttribute('href')){this.imageNum++;}}
if(imageLink.getAttribute('rel').indexOf('lyteshow')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.slideArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.slideArray.removeDuplicates();while(this.slideArray[this.slideNum][0]!=imageLink.getAttribute('href')){this.slideNum++;}}}}
var object=this.doc.getElementById('lbMain');object.style.top=(this.getPageScroll()+(pageSize[3]/15))+"px";object.style.display='';if(!this.outerBorder){this.doc.getElementById('lbOuterContainer').style.border='none';this.doc.getElementById('lbDetailsContainer').style.border='none';}else{this.doc.getElementById('lbOuterContainer').style.borderBottom='';this.doc.getElementById('lbOuterContainer').setAttribute((this.ie?'className':'class'),this.theme);}
this.doc.getElementById('lbOverlay').onclick=function(){myLytebox.end();return false;}
this.doc.getElementById('lbMain').onclick=function(e){var e=e;if(!e){if(window.parent.frames[window.name]&&(parent.document.getElementsByTagName('frameset').length<=0)){e=window.parent.window.event;}else{e=window.event;}}
var id=(e.target?e.target.id:e.srcElement.id);if(id=='lbMain'){myLytebox.end();return false;}}
this.doc.getElementById('lbClose').onclick=function(){myLytebox.end();return false;}
this.doc.getElementById('lbPause').onclick=function(){myLytebox.togglePlayPause("lbPause","lbPlay");return false;}
this.doc.getElementById('lbPlay').onclick=function(){myLytebox.togglePlayPause("lbPlay","lbPause");return false;}
this.doc.getElementById('lbPrint').onclick=function(){myLytebox.printImg();return false;}
this.isSlideshow=doSlide;this.isPaused=(this.slideNum!=0?true:false);if(this.isSlideshow&&this.showPlayPause&&this.isPaused){this.doc.getElementById('lbPlay').style.display='';this.doc.getElementById('lbPause').style.display='none';}
if(this.isLyteframe){this.changeContent(this.frameNum);}else{if(this.isSlideshow){this.changeContent(this.slideNum);}else{this.changeContent(this.imageNum);}}};LyteBox.prototype.changeContent=function(imageNum){if(this.isSlideshow){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
this.activeImage=this.activeSlide=this.activeFrame=imageNum;if(!this.outerBorder){this.doc.getElementById('lbOuterContainer').style.border='none';this.doc.getElementById('lbDetailsContainer').style.border='none';}else{this.doc.getElementById('lbOuterContainer').style.borderBottom='';this.doc.getElementById('lbOuterContainer').setAttribute((this.ie?'className':'class'),this.theme);}
this.doc.getElementById('lbLoading').style.display='';this.doc.getElementById('lbImage').style.display='none';this.doc.getElementById('lbIframe').style.display='none';this.doc.getElementById('lbPrev').style.display='none';this.doc.getElementById('lbNext').style.display='none';this.doc.getElementById('lbIframeContainer').style.display='none';this.doc.getElementById('lbDetailsContainer').style.display='none';this.doc.getElementById('lbNumberDisplay').style.display='none';if(this.navType==2||this.isLyteframe){object=this.doc.getElementById('lbNavDisplay');object.innerHTML='&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="'+this.theme+'">&laquo; prev</span><a href="#" id="lbPrev2" class="'+this.theme+'" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="'+this.theme+'">||</b> <span id="lbNext2_Off" style="display: none;" class="'+this.theme+'">next &raquo;</span><a href="#" id="lbNext2" class="'+this.theme+'" style="display: none;">next &raquo;</a>';object.style.display='none';}
if(this.isLyteframe){var iframe=myLytebox.doc.getElementById('lbIframe');var styles=this.frameArray[this.activeFrame][2];var aStyles=styles.split(';');for(var i=0;i<aStyles.length;i++){if(aStyles[i].indexOf('width:')>=0){var w=aStyles[i].replace('width:','');iframe.width=w.trim();}else if(aStyles[i].indexOf('height:')>=0){var h=aStyles[i].replace('height:','');iframe.height=h.trim();}else if(aStyles[i].indexOf('scrolling:')>=0){var s=aStyles[i].replace('scrolling:','');iframe.scrolling=s.trim();}else if(aStyles[i].indexOf('border:')>=0){}}
this.resizeContainer(parseInt(iframe.width),parseInt(iframe.height));}else{imgPreloader=new Image();imgPreloader.onload=function(){var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(myLytebox.autoResize){var pagesize=myLytebox.getPageSize();var x=pagesize[2]-150;var y=pagesize[3]-150;if(imageWidth>x){imageHeight=Math.round(imageHeight*(x/imageWidth));imageWidth=x;if(imageHeight>y){imageWidth=Math.round(imageWidth*(y/imageHeight));imageHeight=y;}}else if(imageHeight>y){imageWidth=Math.round(imageWidth*(y/imageHeight));imageHeight=y;if(imageWidth>x){imageHeight=Math.round(imageHeight*(x/imageWidth));imageWidth=x;}}}
var lbImage=myLytebox.doc.getElementById('lbImage')
lbImage.src=(myLytebox.isSlideshow?myLytebox.slideArray[myLytebox.activeSlide][0]:myLytebox.imageArray[myLytebox.activeImage][0]);lbImage.width=imageWidth;lbImage.height=imageHeight;myLytebox.resizeContainer(imageWidth,imageHeight);imgPreloader.onload=function(){};}
imgPreloader.src=(this.isSlideshow?this.slideArray[this.activeSlide][0]:this.imageArray[this.activeImage][0]);}};LyteBox.prototype.resizeContainer=function(imgWidth,imgHeight){this.wCur=this.doc.getElementById('lbOuterContainer').offsetWidth;this.hCur=this.doc.getElementById('lbOuterContainer').offsetHeight;this.xScale=((imgWidth+(this.borderSize*2))/this.wCur)*100;this.yScale=((imgHeight+(this.borderSize*2))/this.hCur)*100;var wDiff=(this.wCur-this.borderSize*2)-imgWidth;var hDiff=(this.hCur-this.borderSize*2)-imgHeight;if(!(hDiff==0)){this.hDone=false;this.resizeH('lbOuterContainer',this.hCur,imgHeight+this.borderSize*2,this.getPixelRate(this.hCur,imgHeight));}else{this.hDone=true;}
if(!(wDiff==0)){this.wDone=false;this.resizeW('lbOuterContainer',this.wCur,imgWidth+this.borderSize*2,this.getPixelRate(this.wCur,imgWidth));}else{this.wDone=true;}
if((hDiff==0)&&(wDiff==0)){if(this.ie){this.pause(250);}else{this.pause(100);}}
this.doc.getElementById('lbPrev').style.height=imgHeight+"px";this.doc.getElementById('lbNext').style.height=imgHeight+"px";this.doc.getElementById('lbDetailsContainer').style.width=(imgWidth+(this.borderSize*2)+(this.ie&&this.doc.compatMode=="BackCompat"&&this.outerBorder?2:0))+"px";this.showContent();};LyteBox.prototype.showContent=function(){if(this.wDone&&this.hDone){for(var i=0;i<this.showContentTimerCount;i++){window.clearTimeout(this.showContentTimerArray[i]);}
if(this.outerBorder){this.doc.getElementById('lbOuterContainer').style.borderBottom='none';}
this.doc.getElementById('lbLoading').style.display='none';if(this.isLyteframe){this.doc.getElementById('lbIframe').style.display='';this.appear('lbIframe',(this.doAnimations?0:100));}else{this.doc.getElementById('lbImage').style.display='';this.appear('lbImage',(this.doAnimations?0:100));this.preloadNeighborImages();}
if(this.isSlideshow){if(this.activeSlide==(this.slideArray.length-1)){if(this.autoEnd){this.slideshowIDArray[this.slideshowIDCount++]=setTimeout("myLytebox.end('slideshow')",this.slideInterval);}}else{if(!this.isPaused){this.slideshowIDArray[this.slideshowIDCount++]=setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")",this.slideInterval);}}
this.doc.getElementById('lbHoverNav').style.display=(this.showNavigation&&this.navType==1?'':'none');this.doc.getElementById('lbClose').style.display=(this.showClose?'':'none');this.doc.getElementById('lbDetails').style.display=(this.showDetails?'':'none');this.doc.getElementById('lbPause').style.display=(this.showPlayPause&&!this.isPaused?'':'none');this.doc.getElementById('lbPlay').style.display=(this.showPlayPause&&!this.isPaused?'none':'');this.doc.getElementById('lbPrint').style.display='';this.doc.getElementById('lbNavDisplay').style.display=(this.showNavigation&&this.navType==2?'':'none');}else{this.doc.getElementById('lbHoverNav').style.display=(this.navType==1&&!this.isLyteframe?'':'none');if((this.navType==2&&!this.isLyteframe&&this.imageArray.length>1)||(this.frameArray.length>1&&this.isLyteframe)){this.doc.getElementById('lbNavDisplay').style.display='';}else{this.doc.getElementById('lbNavDisplay').style.display='none';}
this.doc.getElementById('lbClose').style.display='';this.doc.getElementById('lbDetails').style.display='';this.doc.getElementById('lbPause').style.display='none';this.doc.getElementById('lbPlay').style.display='none';this.doc.getElementById('lbPrint').style.display='';}
this.doc.getElementById('lbImageContainer').style.display=(this.isLyteframe?'none':'');this.doc.getElementById('lbIframeContainer').style.display=(this.isLyteframe?'':'none');try{this.doc.getElementById('lbIframe').src=this.frameArray[this.activeFrame][0];}catch(e){}}else{this.showContentTimerArray[this.showContentTimerCount++]=setTimeout("myLytebox.showContent()",200);}};LyteBox.prototype.updateDetails=function(){var object=this.doc.getElementById('lbCaption');var sTitle=(this.isSlideshow?this.slideArray[this.activeSlide][1]:(this.isLyteframe?this.frameArray[this.activeFrame][1]:this.imageArray[this.activeImage][1]));object.style.display='';object.innerHTML=(sTitle==null?'':sTitle);this.updateNav();this.doc.getElementById('lbDetailsContainer').style.display='';object=this.doc.getElementById('lbNumberDisplay');if(this.isSlideshow&&this.slideArray.length>1){object.style.display='';object.innerHTML="Imagem "+eval(this.activeSlide+1)+" de "+this.slideArray.length;this.doc.getElementById('lbNavDisplay').style.display=(this.navType==2&&this.showNavigation?'':'none');}else if(this.imageArray.length>1&&!this.isLyteframe){object.style.display='';object.innerHTML="Imagem "+eval(this.activeImage+1)+" de "+this.imageArray.length;this.doc.getElementById('lbNavDisplay').style.display=(this.navType==2?'':'none');}else if(this.frameArray.length>1&&this.isLyteframe){object.style.display='';object.innerHTML="Pagina "+eval(this.activeFrame+1)+" de "+this.frameArray.length;this.doc.getElementById('lbNavDisplay').style.display='';}else{this.doc.getElementById('lbNavDisplay').style.display='none';}
this.appear('lbDetailsContainer',(this.doAnimations?0:100));};LyteBox.prototype.updateNav=function(){if(this.isSlideshow){if(this.activeSlide!=0){var object=(this.navType==2?this.doc.getElementById('lbPrev2'):this.doc.getElementById('lbPrev'));object.style.display='';object.onclick=function(){if(myLytebox.pauseOnPrevClick){myLytebox.togglePlayPause("lbPause","lbPlay");}
myLytebox.changeContent(myLytebox.activeSlide-1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbPrev2_Off').style.display='';}}
if(this.activeSlide!=(this.slideArray.length-1)){var object=(this.navType==2?this.doc.getElementById('lbNext2'):this.doc.getElementById('lbNext'));object.style.display='';object.onclick=function(){if(myLytebox.pauseOnNextClick){myLytebox.togglePlayPause("lbPause","lbPlay");}
myLytebox.changeContent(myLytebox.activeSlide+1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbNext2_Off').style.display='';}}}else if(this.isLyteframe){if(this.activeFrame!=0){var object=this.doc.getElementById('lbPrev2');object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeFrame-1);return false;}}else{this.doc.getElementById('lbPrev2_Off').style.display='';}
if(this.activeFrame!=(this.frameArray.length-1)){var object=this.doc.getElementById('lbNext2');object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeFrame+1);return false;}}else{this.doc.getElementById('lbNext2_Off').style.display='';}}else{if(this.activeImage!=0){var object=(this.navType==2?this.doc.getElementById('lbPrev2'):this.doc.getElementById('lbPrev'));object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeImage-1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbPrev2_Off').style.display='';}}
if(this.activeImage!=(this.imageArray.length-1)){var object=(this.navType==2?this.doc.getElementById('lbNext2'):this.doc.getElementById('lbNext'));object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeImage+1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbNext2_Off').style.display='';}}}
this.enableKeyboardNav();};LyteBox.prototype.enableKeyboardNav=function(){document.onkeydown=this.keyboardAction;};LyteBox.prototype.disableKeyboardNav=function(){document.onkeydown='';};LyteBox.prototype.keyboardAction=function(e){var keycode=key=escape=null;keycode=(e==null)?event.keyCode:e.which;key=String.fromCharCode(keycode).toLowerCase();escape=(e==null)?27:e.DOM_VK_ESCAPE;if((key=='x')||(key=='c')||(keycode==escape)){myLytebox.end();}else if((key=='p')||(keycode==37)){if(myLytebox.isSlideshow){if(myLytebox.activeSlide!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeSlide-1);}}else if(myLytebox.isLyteframe){if(myLytebox.activeFrame!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeFrame-1);}}else{if(myLytebox.activeImage!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeImage-1);}}}else if((key=='n')||(keycode==39)){if(myLytebox.isSlideshow){if(myLytebox.activeSlide!=(myLytebox.slideArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeSlide+1);}}else if(myLytebox.isLyteframe){if(myLytebox.activeFrame!=(myLytebox.frameArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeFrame+1);}}else{if(myLytebox.activeImage!=(myLytebox.imageArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeImage+1);}}}};LyteBox.prototype.preloadNeighborImages=function(){if(this.isSlideshow){if((this.slideArray.length-1)>this.activeSlide){preloadNextImage=new Image();preloadNextImage.src=this.slideArray[this.activeSlide+1][0];}
if(this.activeSlide>0){preloadPrevImage=new Image();preloadPrevImage.src=this.slideArray[this.activeSlide-1][0];}}else{if((this.imageArray.length-1)>this.activeImage){preloadNextImage=new Image();preloadNextImage.src=this.imageArray[this.activeImage+1][0];}
if(this.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=this.imageArray[this.activeImage-1][0];}}};LyteBox.prototype.togglePlayPause=function(hideID,showID){if(this.isSlideshow&&hideID=="lbPause"){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
this.doc.getElementById(hideID).style.display='none';this.doc.getElementById(showID).style.display='';if(hideID=="lbPlay"){this.isPaused=false;if(this.activeSlide==(this.slideArray.length-1)){this.end();}else{this.changeContent(this.activeSlide+1);}}else{this.isPaused=true;}};LyteBox.prototype.printImg=function(){window.open("http://www.plastimo.co.pt/siroco/barcos/print_fotos.php?img_url="+$("lbImage").src,"print_img");}
LyteBox.prototype.end=function(caller){var closeClick=(caller=='slideshow'?false:true);if(this.isSlideshow&&this.isPaused&&!closeClick){return;}
this.disableKeyboardNav();this.doc.getElementById('lbMain').style.display='none';this.fade('lbOverlay',(this.doAnimations?this.maxOpacity:0));this.toggleSelects('visible');if(this.hideFlash){this.toggleFlash('visible');}
if(this.isSlideshow){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
if(this.isLyteframe){this.initialize();}};LyteBox.prototype.checkFrame=function(){if(window.parent.frames[window.name]&&(parent.document.getElementsByTagName('frameset').length<=0)){this.isFrame=true;this.lytebox="window.parent."+window.name+".myLytebox";this.doc=parent.document;}else{this.isFrame=false;this.lytebox="myLytebox";this.doc=document;}};LyteBox.prototype.getPixelRate=function(cur,img){var diff=(img>cur)?img-cur:cur-img;if(diff>=0&&diff<=100){return 10;}
if(diff>100&&diff<=200){return 15;}
if(diff>200&&diff<=300){return 20;}
if(diff>300&&diff<=400){return 25;}
if(diff>400&&diff<=500){return 30;}
if(diff>500&&diff<=600){return 35;}
if(diff>600&&diff<=700){return 40;}
if(diff>700){return 45;}};LyteBox.prototype.appear=function(id,opacity){var object=this.doc.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+(opacity+10)+")";if(opacity==100&&(id=='lbImage'||id=='lbIframe')){try{object.removeAttribute("filter");}catch(e){}
this.updateDetails();}else if(opacity>=this.maxOpacity&&id=='lbOverlay'){for(var i=0;i<this.overlayTimerCount;i++){window.clearTimeout(this.overlayTimerArray[i]);}
return;}else if(opacity>=100&&id=='lbDetailsContainer'){try{object.removeAttribute("filter");}catch(e){}
for(var i=0;i<this.imageTimerCount;i++){window.clearTimeout(this.imageTimerArray[i]);}
this.doc.getElementById('lbOverlay').style.height=this.getPageSize()[1]+"px";}else{if(id=='lbOverlay'){this.overlayTimerArray[this.overlayTimerCount++]=setTimeout("myLytebox.appear('"+id+"', "+(opacity+20)+")",1);}else{this.imageTimerArray[this.imageTimerCount++]=setTimeout("myLytebox.appear('"+id+"', "+(opacity+10)+")",1);}}};LyteBox.prototype.fade=function(id,opacity){var object=this.doc.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";if(opacity<=0){try{object.display='none';}catch(err){}}else if(id=='lbOverlay'){this.overlayTimerArray[this.overlayTimerCount++]=setTimeout("myLytebox.fade('"+id+"', "+(opacity-20)+")",1);}else{this.timerIDArray[this.timerIDCount++]=setTimeout("myLytebox.fade('"+id+"', "+(opacity-10)+")",1);}};LyteBox.prototype.resizeW=function(id,curW,maxW,pixelrate,speed){if(!this.hDone){this.resizeWTimerArray[this.resizeWTimerCount++]=setTimeout("myLytebox.resizeW('"+id+"', "+curW+", "+maxW+", "+pixelrate+")",100);return;}
var object=this.doc.getElementById(id);var timer=speed?speed:(this.resizeDuration/2);var newW=(this.doAnimations?curW:maxW);object.style.width=(newW)+"px";if(newW<maxW){newW+=(newW+pixelrate>=maxW)?(maxW-newW):pixelrate;}else if(newW>maxW){newW-=(newW-pixelrate<=maxW)?(newW-maxW):pixelrate;}
this.resizeWTimerArray[this.resizeWTimerCount++]=setTimeout("myLytebox.resizeW('"+id+"', "+newW+", "+maxW+", "+pixelrate+", "+(timer+0.02)+")",timer+0.02);if(parseInt(object.style.width)==maxW){this.wDone=true;for(var i=0;i<this.resizeWTimerCount;i++){window.clearTimeout(this.resizeWTimerArray[i]);}}};LyteBox.prototype.resizeH=function(id,curH,maxH,pixelrate,speed){var timer=speed?speed:(this.resizeDuration/2);var object=this.doc.getElementById(id);var newH=(this.doAnimations?curH:maxH);object.style.height=(newH)+"px";if(newH<maxH){newH+=(newH+pixelrate>=maxH)?(maxH-newH):pixelrate;}else if(newH>maxH){newH-=(newH-pixelrate<=maxH)?(newH-maxH):pixelrate;}
this.resizeHTimerArray[this.resizeHTimerCount++]=setTimeout("myLytebox.resizeH('"+id+"', "+newH+", "+maxH+", "+pixelrate+", "+(timer+.02)+")",timer+.02);if(parseInt(object.style.height)==maxH){this.hDone=true;for(var i=0;i<this.resizeHTimerCount;i++){window.clearTimeout(this.resizeHTimerArray[i]);}}};LyteBox.prototype.getPageScroll=function(){if(self.pageYOffset){return this.isFrame?parent.pageYOffset:self.pageYOffset;}else if(this.doc.documentElement&&this.doc.documentElement.scrollTop){return this.doc.documentElement.scrollTop;}else if(document.body){return this.doc.body.scrollTop;}};LyteBox.prototype.getPageSize=function(){var xScroll,yScroll,windowWidth,windowHeight;if(window.innerHeight&&window.scrollMaxY){xScroll=this.doc.scrollWidth;yScroll=(this.isFrame?parent.innerHeight:self.innerHeight)+(this.isFrame?parent.scrollMaxY:self.scrollMaxY);}else if(this.doc.body.scrollHeight>this.doc.body.offsetHeight){xScroll=this.doc.body.scrollWidth;yScroll=this.doc.body.scrollHeight;}else{xScroll=this.doc.getElementsByTagName("html").item(0).offsetWidth;yScroll=this.doc.getElementsByTagName("html").item(0).offsetHeight;xScroll=(xScroll<this.doc.body.offsetWidth)?this.doc.body.offsetWidth:xScroll;yScroll=(yScroll<this.doc.body.offsetHeight)?this.doc.body.offsetHeight:yScroll;}
if(self.innerHeight){windowWidth=(this.isFrame)?parent.innerWidth:self.innerWidth;windowHeight=(this.isFrame)?parent.innerHeight:self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=this.doc.documentElement.clientWidth;windowHeight=this.doc.documentElement.clientHeight;}else if(document.body){windowWidth=this.doc.getElementsByTagName("html").item(0).clientWidth;windowHeight=this.doc.getElementsByTagName("html").item(0).clientHeight;windowWidth=(windowWidth==0)?this.doc.body.clientWidth:windowWidth;windowHeight=(windowHeight==0)?this.doc.body.clientHeight:windowHeight;}
var pageHeight=(yScroll<windowHeight)?windowHeight:yScroll;var pageWidth=(xScroll<windowWidth)?windowWidth:xScroll;return new Array(pageWidth,pageHeight,windowWidth,windowHeight);};LyteBox.prototype.toggleFlash=function(state){var objects=this.doc.getElementsByTagName("object");for(var i=0;i<objects.length;i++){objects[i].style.visibility=(state=="hide")?'hidden':'visible';}
var embeds=this.doc.getElementsByTagName("embed");for(var i=0;i<embeds.length;i++){embeds[i].style.visibility=(state=="hide")?'hidden':'visible';}
if(this.isFrame){for(var i=0;i<parent.frames.length;i++){try{objects=parent.frames[i].window.document.getElementsByTagName("object");for(var j=0;j<objects.length;j++){objects[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}
try{embeds=parent.frames[i].window.document.getElementsByTagName("embed");for(var j=0;j<embeds.length;j++){embeds[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}}}};LyteBox.prototype.toggleSelects=function(state){var selects=this.doc.getElementsByTagName("select");for(var i=0;i<selects.length;i++){selects[i].style.visibility=(state=="hide")?'hidden':'visible';}
if(this.isFrame){for(var i=0;i<parent.frames.length;i++){try{selects=parent.frames[i].window.document.getElementsByTagName("select");for(var j=0;j<selects.length;j++){selects[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}}}};LyteBox.prototype.pause=function(numberMillis){var now=new Date();var exitTime=now.getTime()+numberMillis;while(true){now=new Date();if(now.getTime()>exitTime){return;}}};if(window.addEventListener){window.addEventListener("load",initLytebox,false);}else if(window.attachEvent){window.attachEvent("onload",initLytebox);}else{window.onload=function(){initLytebox();}}
function initLytebox(){myLytebox=new LyteBox();};if(!window.Modalbox)
var Modalbox=new Object();Modalbox.Methods={overrideAlert:false,focusableElements:new Array,currFocused:0,initialized:false,active:true,options:{title:"ModalBox Window",overlayClose:true,width:500,height:90,overlayOpacity:.65,overlayDuration:.25,slideDownDuration:.5,slideUpDuration:.5,resizeDuration:.25,inactiveFade:true,transitions:true,loadingString:"Please wait. Loading...",closeString:"Close window",closeValue:"&times;",params:{},method:'get',autoFocusing:true,aspnet:false},_options:new Object,setOptions:function(options){Object.extend(this.options,options||{});},_init:function(options){Object.extend(this._options,this.options);this.setOptions(options);this.MBoverlay=new Element("div",{id:"MB_overlay",opacity:"0"});this.MBwindow=new Element("div",{id:"MB_window",style:"display: none"}).update(this.MBframe=new Element("div",{id:"MB_frame"}).update(this.MBheader=new Element("div",{id:"MB_header"}).update(this.MBcaption=new Element("div",{id:"MB_caption"}))));this.MBclose=new Element("a",{id:"MB_close",title:this.options.closeString,href:"#"}).update("<span>"+this.options.closeValue+"</span>");this.MBheader.insert({'bottom':this.MBclose});this.MBcontent=new Element("div",{id:"MB_content"}).update(this.MBloading=new Element("div",{id:"MB_loading"}).update(this.options.loadingString));this.MBframe.insert({'bottom':this.MBcontent});var injectToEl=this.options.aspnet?$(document.body).down('form'):$(document.body);injectToEl.insert({'top':this.MBwindow});injectToEl.insert({'top':this.MBoverlay});this.initScrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;this.initScrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;this.hideObserver=this._hide.bindAsEventListener(this);this.kbdObserver=this._kbdHandler.bindAsEventListener(this);this._initObservers();this.initialized=true;},show:function(content,options){if(!this.initialized)this._init(options);this.content=content;this.setOptions(options);if(this.options.title)
$(this.MBcaption).update(this.options.title);else{$(this.MBheader).hide();$(this.MBcaption).hide();}
if(this.MBwindow.style.display=="none"){this._appear();this.event("onShow");}
else{this._update();this.event("onUpdate");}},hide:function(options){if(this.initialized){if(options&&typeof options.element!='function')Object.extend(this.options,options);this.event("beforeHide");if(this.options.transitions)
Effect.SlideUp(this.MBwindow,{duration:this.options.slideUpDuration,transition:Effect.Transitions.sinoidal,afterFinish:this._deinit.bind(this)});else{$(this.MBwindow).hide();this._deinit();}}else throw("Modalbox is not initialized.");},_hide:function(event){event.stop();if(event.element().id=='MB_overlay'&&!this.options.overlayClose)return false;this.hide();},alert:function(message){var html='<div class="MB_alert"><p>'+message+'</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';Modalbox.show(html,{title:'Alert: '+document.title,width:300});},_appear:function(){if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){window.scrollTo(0,0);this._prepareIE("100%","hidden");}
this._setWidth();this._setPosition();if(this.options.transitions){$(this.MBoverlay).setStyle({opacity:0});new Effect.Fade(this.MBoverlay,{from:0,to:this.options.overlayOpacity,duration:this.options.overlayDuration,afterFinish:function(){new Effect.SlideDown(this.MBwindow,{duration:this.options.slideDownDuration,transition:Effect.Transitions.sinoidal,afterFinish:function(){this._setPosition();this.loadContent();}.bind(this)});}.bind(this)});}else{$(this.MBoverlay).setStyle({opacity:this.options.overlayOpacity});$(this.MBwindow).show();this._setPosition();this.loadContent();}
this._setWidthAndPosition=this._setWidthAndPosition.bindAsEventListener(this);Event.observe(window,"resize",this._setWidthAndPosition);},resize:function(byWidth,byHeight,options){var wHeight=$(this.MBwindow).getHeight();var wWidth=$(this.MBwindow).getWidth();var hHeight=$(this.MBheader).getHeight();var cHeight=$(this.MBcontent).getHeight();var newHeight=((wHeight-hHeight+byHeight)<cHeight)?(cHeight+hHeight-wHeight):byHeight;if(options)this.setOptions(options);if(this.options.transitions){new Effect.ScaleBy(this.MBwindow,byWidth,newHeight,{duration:this.options.resizeDuration,afterFinish:function(){this.event("_afterResize");this.event("afterResize");}.bind(this)});}else{this.MBwindow.setStyle({width:wWidth+byWidth+"px",height:wHeight+newHeight+"px"});setTimeout(function(){this.event("_afterResize");this.event("afterResize");}.bind(this),1);}},resizeToContent:function(options){var byHeight=this.options.height-this.MBwindow.offsetHeight;if(byHeight!=0){if(options)this.setOptions(options);Modalbox.resize(0,byHeight);}},resizeToInclude:function(element,options){var el=$(element);var elHeight=el.getHeight()+parseInt(el.getStyle('margin-top'))+parseInt(el.getStyle('margin-bottom'))+parseInt(el.getStyle('border-top-width'))+parseInt(el.getStyle('border-bottom-width'));if(elHeight>0){if(options)this.setOptions(options);Modalbox.resize(0,elHeight);}},_update:function(){$(this.MBcontent).update("");this.MBcontent.appendChild(this.MBloading);$(this.MBloading).update(this.options.loadingString);this.currentDims=[this.MBwindow.offsetWidth,this.MBwindow.offsetHeight];Modalbox.resize((this.options.width-this.currentDims[0]),(this.options.height-this.currentDims[1]),{_afterResize:this._loadAfterResize.bind(this)});},loadContent:function(){if(this.event("beforeLoad")!=false){if(typeof this.content=='string'){var htmlRegExp=new RegExp(/<\/?[^>]+>/gi);if(htmlRegExp.test(this.content)){this._insertContent(this.content.stripScripts());this._putContent(function(){this.content.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}.bind(this));}else
new Ajax.Request(this.content,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);this._insertContent(transport.responseText.stripScripts());this._putContent(function(){response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));});}.bind(this),onException:function(instance,exception){Modalbox.hide();throw('Modalbox Loading Error: '+exception);}});}else if(typeof this.content=='object'){this._insertContent(this.content);this._putContent();}else{Modalbox.hide();throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');}}},_insertContent:function(content){$(this.MBcontent).hide().update("");if(typeof content=='string'){setTimeout(function(){this.MBcontent.update(content);}.bind(this),1);}else if(typeof content=='object'){var _htmlObj=content.cloneNode(true);if(content.id)content.id="MB_"+content.id;$(content).select('*[id]').each(function(el){el.id="MB_"+el.id;});this.MBcontent.appendChild(_htmlObj);this.MBcontent.down().show();if(Prototype.Browser.IE)
$$("#MB_content select").invoke('setStyle',{'visibility':''});}},_putContent:function(callback){if(this.options.height==this._options.height){setTimeout(function(){Modalbox.resize(0,$(this.MBcontent).getHeight()-$(this.MBwindow).getHeight()+$(this.MBheader).getHeight(),{afterResize:function(){this.MBcontent.show().makePositioned();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}.bind(this)});}.bind(this),1);}else{this._setWidth();this.MBcontent.setStyle({overflow:'auto',height:$(this.MBwindow).getHeight()-$(this.MBheader).getHeight()-13+'px'});this.MBcontent.show();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}},activate:function(options){this.setOptions(options);this.active=true;$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);$(this.MBclose).show();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Appear(this.MBwindow,{duration:this.options.slideUpDuration});},deactivate:function(options){this.setOptions(options);this.active=false;$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);$(this.MBclose).hide();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,to:.75});},_initObservers:function(){$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);if(Prototype.Browser.IE)
Event.observe(document,"keydown",this.kbdObserver);else
Event.observe(document,"keypress",this.kbdObserver);},_removeObservers:function(){$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);if(Prototype.Browser.IE)
Event.stopObserving(document,"keydown",this.kbdObserver);else
Event.stopObserving(document,"keypress",this.kbdObserver);},_loadAfterResize:function(){this._setWidth();this._setPosition();this.loadContent();},_setFocus:function(){if(this.focusableElements.length>0&&this.options.autoFocusing==true){var firstEl=this.focusableElements.find(function(el){return el.tabIndex==1;})||this.focusableElements.first();this.currFocused=this.focusableElements.toArray().indexOf(firstEl);firstEl.focus();}else if($(this.MBclose).visible())
$(this.MBclose).focus();},_findFocusableElements:function(){this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName','MB_focusable');return this.MBcontent.select('.MB_focusable');},_kbdHandler:function(event){var node=event.element();switch(event.keyCode){case Event.KEY_TAB:event.stop();if(node!=this.focusableElements[this.currFocused])
this.currFocused=this.focusableElements.toArray().indexOf(node);if(!event.shiftKey){if(this.currFocused==this.focusableElements.length-1){this.focusableElements.first().focus();this.currFocused=0;}else{this.currFocused++;this.focusableElements[this.currFocused].focus();}}else{if(this.currFocused==0){this.focusableElements.last().focus();this.currFocused=this.focusableElements.length-1;}else{this.currFocused--;this.focusableElements[this.currFocused].focus();}}
break;case Event.KEY_ESC:if(this.active)this._hide(event);break;case 32:this._preventScroll(event);break;case 0:if(event.which==32)this._preventScroll(event);break;case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_PAGEDOWN:case Event.KEY_PAGEUP:case Event.KEY_HOME:case Event.KEY_END:if(Prototype.Browser.WebKit&&!["textarea","select"].include(node.tagName.toLowerCase()))
event.stop();else if((node.tagName.toLowerCase()=="input"&&["submit","button"].include(node.type))||(node.tagName.toLowerCase()=="a"))
event.stop();break;}},_preventScroll:function(event){if(!["input","textarea","select","button"].include(event.element().tagName.toLowerCase()))
event.stop();},_deinit:function()
{this._removeObservers();Event.stopObserving(window,"resize",this._setWidthAndPosition);if(this.options.transitions){Effect.toggle(this.MBoverlay,'appear',{duration:this.options.overlayDuration,afterFinish:this._removeElements.bind(this)});}else{this.MBoverlay.hide();this._removeElements();}
$(this.MBcontent).setStyle({overflow:'',height:''});},_removeElements:function(){$(this.MBoverlay).remove();$(this.MBwindow).remove();if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){this._prepareIE("","");window.scrollTo(this.initScrollX,this.initScrollY);}
if(typeof this.content=='object'){if(this.content.id&&this.content.id.match(/MB_/)){this.content.id=this.content.id.replace(/MB_/,"");}
this.content.select('*[id]').each(function(el){el.id=el.id.replace(/MB_/,"");});}
this.initialized=false;this.event("afterHide");this.setOptions(this._options);},_setWidth:function(){$(this.MBwindow).setStyle({width:this.options.width+"px",height:this.options.height+"px"});},_setPosition:function(){$(this.MBwindow).setStyle({left:Math.round((Element.getWidth(document.body)-Element.getWidth(this.MBwindow))/2)+"px"});},_setWidthAndPosition:function(){$(this.MBwindow).setStyle({width:this.options.width+"px"});this._setPosition();},_getScrollTop:function(){var theTop;if(document.documentElement&&document.documentElement.scrollTop)
theTop=document.documentElement.scrollTop;else if(document.body)
theTop=document.body.scrollTop;return theTop;},_prepareIE:function(height,overflow){$$('html, body').invoke('setStyle',{width:height,height:height,overflow:overflow});$$("select").invoke('setStyle',{'visibility':overflow});},event:function(eventName){if(this.options[eventName]){var returnValue=this.options[eventName]();this.options[eventName]=null;if(returnValue!=undefined)
return returnValue;else
return true;}
return true;}};Object.extend(Modalbox,Modalbox.Methods);if(Modalbox.overrideAlert)window.alert=Modalbox.alert;Effect.ScaleBy=Class.create();Object.extend(Object.extend(Effect.ScaleBy.prototype,Effect.Base.prototype),{initialize:function(element,byWidth,byHeight,options){this.element=$(element)
var options=Object.extend({scaleFromTop:true,scaleMode:'box',scaleByWidth:byWidth,scaleByHeight:byHeight},arguments[3]||{});this.start(options);},setup:function(){this.elementPositioning=this.element.getStyle('position');this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];this.deltaY=this.options.scaleByHeight;this.deltaX=this.options.scaleByWidth;},update:function(position){var currentHeight=this.dims[0]+(this.deltaY*position);var currentWidth=this.dims[1]+(this.deltaX*position);currentHeight=(currentHeight>0)?currentHeight:0;currentWidth=(currentWidth>0)?currentWidth:0;this.setDimensions(currentHeight,currentWidth);},setDimensions:function(height,width){var d={};d.width=width+'px';d.height=height+'px';var topd=Math.round((height-this.dims[0])/2);var leftd=Math.round((width-this.dims[1])/2);if(this.elementPositioning=='absolute'||this.elementPositioning=='fixed'){if(!this.options.scaleFromTop)d.top=this.originalTop-topd+'px';d.left=this.originalLeft-leftd+'px';}else{if(!this.options.scaleFromTop)d.top=-topd+'px';d.left=-leftd+'px';}
this.element.setStyle(d);}});;var CropDraggable=Class.create();Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){this.options=Object.extend({drawMethod:function(){}},arguments[1]||{});this.element=$(_1);this.handle=this.element;this.delta=this.currentDelta();this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},draw:function(_2){var _3=Position.cumulativeOffset(this.element);var d=this.currentDelta();_3[0]-=d[0];_3[1]-=d[1];var p=[0,1].map(function(i){return(_2[i]-_3[i]-this.offset[i]);}.bind(this));this.options.drawMethod(p);}});var Cropper={};Cropper.Img=Class.create();Cropper.Img.prototype={initialize:function(_7,_8){this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true,onloadCoords:null,maxWidth:0,maxHeight:0},_8||{});this.img=$(_7);this.clickCoords={x:0,y:0};this.dragging=false;this.resizing=false;this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);this.isIE=/MSIE/.test(navigator.userAgent);this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);this.ratioX=0;this.ratioY=0;this.attached=false;this.fixedWidth=(this.options.maxWidth>0&&(this.options.minWidth>=this.options.maxWidth));this.fixedHeight=(this.options.maxHeight>0&&(this.options.minHeight>=this.options.maxHeight));if(typeof this.img=="undefined"){return;}
$A(document.getElementsByTagName("script")).each(function(s){if(s.src.match(/cropper\.js/)){var _a=s.src.replace(/cropper\.js(.*)?/,"");var _b=document.createElement("link");_b.rel="stylesheet";_b.type="text/css";_b.href=_a+"cropper.css";_b.media="screen";document.getElementsByTagName("head")[0].appendChild(_b);}});if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);this.ratioX=this.options.ratioDim.x/_c;this.ratioY=this.options.ratioDim.y/_c;}
this.subInitialize();if(this.img.complete||this.isWebKit){this.onLoad();}else{Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));}},getGCD:function(a,b){if(b==0){return a;}
return this.getGCD(b,a%b);},onLoad:function(){var _f="imgCrop_";var _10=this.img.parentNode;var _11="";if(this.isOpera8){_11=" opera8";}
this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);var _12=[this.north,this.east,this.south,this.west];this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);this.imgWrap.appendChild(this.img);this.imgWrap.appendChild(this.dragArea);this.dragArea.appendChild(this.selArea);this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));_10.appendChild(this.imgWrap);this.startDragBind=this.startDrag.bindAsEventListener(this);Event.observe(this.dragArea,"mousedown",this.startDragBind);this.onDragBind=this.onDrag.bindAsEventListener(this);Event.observe(document,"mousemove",this.onDragBind);this.endCropBind=this.endCrop.bindAsEventListener(this);Event.observe(document,"mouseup",this.endCropBind);this.resizeBind=this.startResize.bindAsEventListener(this);this.handles=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];this.registerHandles(true);if(this.options.captureKeys){this.keysBind=this.handleKeys.bindAsEventListener(this);Event.observe(document,"keypress",this.keysBind);}
new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});this.setParams();},registerHandles:function(_13){for(var i=0;i<this.handles.length;i++){var _15=$(this.handles[i]);if(_13){var _16=false;if(this.fixedWidth&&this.fixedHeight){_16=true;}else{if(this.fixedWidth||this.fixedHeight){var _17=_15.className.match(/([S|N][E|W])$/);var _18=_15.className.match(/(E|W)$/);var _19=_15.className.match(/(N|S)$/);if(_17){_16=true;}else{if(this.fixedWidth&&_18){_16=true;}else{if(this.fixedHeight&&_19){_16=true;}}}}}
if(_16){_15.hide();}else{Event.observe(_15,"mousedown",this.resizeBind);}}else{_15.show();Event.stopObserving(_15,"mousedown",this.resizeBind);}}},setParams:function(){this.imgW=this.img.width;this.imgH=this.img.height;$(this.north).setStyle({height:0});$(this.east).setStyle({width:0,height:0});$(this.south).setStyle({height:0});$(this.west).setStyle({width:0,height:0});$(this.imgWrap).setStyle({"width":this.imgW+"px","height":this.imgH+"px"});$(this.selArea).hide();var _1a={x1:0,y1:0,x2:0,y2:0};var _1b=false;if(this.options.onloadCoords!=null){_1a=this.cloneCoords(this.options.onloadCoords);_1b=true;}else{if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){_1a.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);_1a.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);_1a.x2=_1a.x1+this.options.ratioDim.x;_1a.y2=_1a.y1+this.options.ratioDim.y;_1b=true;}}
this.setAreaCoords(_1a,false,false,1);if(this.options.displayOnInit&&_1b){this.selArea.show();this.drawArea();this.endCrop();}
this.attached=true;},remove:function(){if(this.attached){this.attached=false;this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);this.imgWrap.parentNode.removeChild(this.imgWrap);Event.stopObserving(this.dragArea,"mousedown",this.startDragBind);Event.stopObserving(document,"mousemove",this.onDragBind);Event.stopObserving(document,"mouseup",this.endCropBind);this.registerHandles(false);if(this.options.captureKeys){Event.stopObserving(document,"keypress",this.keysBind);}}},reset:function(){if(!this.attached){this.onLoad();}else{this.setParams();}
this.endCrop();},handleKeys:function(e){var dir={x:0,y:0};if(!this.dragging){switch(e.keyCode){case(37):dir.x=-1;break;case(38):dir.y=-1;break;case(39):dir.x=1;break;case(40):dir.y=1;break;}
if(dir.x!=0||dir.y!=0){if(e.shiftKey){dir.x*=10;dir.y*=10;}
this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);Event.stop(e);}}},calcW:function(){return(this.areaCoords.x2-this.areaCoords.x1);},calcH:function(){return(this.areaCoords.y2-this.areaCoords.y1);},moveArea:function(_1e){this.setAreaCoords({x1:_1e[0],y1:_1e[1],x2:_1e[0]+this.calcW(),y2:_1e[1]+this.calcH()},true,false);this.drawArea();},cloneCoords:function(_1f){return{x1:_1f.x1,y1:_1f.y1,x2:_1f.x2,y2:_1f.y2};},setAreaCoords:function(_20,_21,_22,_23,_24){if(_21){var _25=_20.x2-_20.x1;var _26=_20.y2-_20.y1;if(_20.x1<0){_20.x1=0;_20.x2=_25;}
if(_20.y1<0){_20.y1=0;_20.y2=_26;}
if(_20.x2>this.imgW){_20.x2=this.imgW;_20.x1=this.imgW-_25;}
if(_20.y2>this.imgH){_20.y2=this.imgH;_20.y1=this.imgH-_26;}}else{if(_20.x1<0){_20.x1=0;}
if(_20.y1<0){_20.y1=0;}
if(_20.x2>this.imgW){_20.x2=this.imgW;}
if(_20.y2>this.imgH){_20.y2=this.imgH;}
if(_23!=null){if(this.ratioX>0){this.applyRatio(_20,{x:this.ratioX,y:this.ratioY},_23,_24);}else{if(_22){this.applyRatio(_20,{x:1,y:1},_23,_24);}}
var _27=[this.options.minWidth,this.options.minHeight];var _28=[this.options.maxWidth,this.options.maxHeight];if(_27[0]>0||_27[1]>0||_28[0]>0||_28[1]>0){var _29={a1:_20.x1,a2:_20.x2};var _2a={a1:_20.y1,a2:_20.y2};var _2b={min:0,max:this.imgW};var _2c={min:0,max:this.imgH};if((_27[0]!=0||_27[1]!=0)&&_22){if(_27[0]>0){_27[1]=_27[0];}else{if(_27[1]>0){_27[0]=_27[1];}}}
if((_28[0]!=0||_28[0]!=0)&&_22){if(_28[0]>0&&_28[0]<=_28[1]){_28[1]=_28[0];}else{if(_28[1]>0&&_28[1]<=_28[0]){_28[0]=_28[1];}}}
if(_27[0]>0){this.applyDimRestriction(_29,_27[0],_23.x,_2b,"min");}
if(_27[1]>1){this.applyDimRestriction(_2a,_27[1],_23.y,_2c,"min");}
if(_28[0]>0){this.applyDimRestriction(_29,_28[0],_23.x,_2b,"max");}
if(_28[1]>1){this.applyDimRestriction(_2a,_28[1],_23.y,_2c,"max");}
_20={x1:_29.a1,y1:_2a.a1,x2:_29.a2,y2:_2a.a2};}}}
this.areaCoords=_20;},applyDimRestriction:function(_2d,val,_2f,_30,_31){var _32;if(_31=="min"){_32=((_2d.a2-_2d.a1)<val);}else{_32=((_2d.a2-_2d.a1)>val);}
if(_32){if(_2f==1){_2d.a2=_2d.a1+val;}else{_2d.a1=_2d.a2-val;}
if(_2d.a1<_30.min){_2d.a1=_30.min;_2d.a2=val;}else{if(_2d.a2>_30.max){_2d.a1=_30.max-val;_2d.a2=_30.max;}}}},applyRatio:function(_33,_34,_35,_36){var _37;if(_36=="N"||_36=="S"){_37=this.applyRatioToAxis({a1:_33.y1,b1:_33.x1,a2:_33.y2,b2:_33.x2},{a:_34.y,b:_34.x},{a:_35.y,b:_35.x},{min:0,max:this.imgW});_33.x1=_37.b1;_33.y1=_37.a1;_33.x2=_37.b2;_33.y2=_37.a2;}else{_37=this.applyRatioToAxis({a1:_33.x1,b1:_33.y1,a2:_33.x2,b2:_33.y2},{a:_34.x,b:_34.y},{a:_35.x,b:_35.y},{min:0,max:this.imgH});_33.x1=_37.a1;_33.y1=_37.b1;_33.x2=_37.a2;_33.y2=_37.b2;}},applyRatioToAxis:function(_38,_39,_3a,_3b){var _3c=Object.extend(_38,{});var _3d=_3c.a2-_3c.a1;var _3e=Math.floor(_3d*_39.b/_39.a);var _3f;var _40;var _41=null;if(_3a.b==1){_3f=_3c.b1+_3e;if(_3f>_3b.max){_3f=_3b.max;_41=_3f-_3c.b1;}
_3c.b2=_3f;}else{_3f=_3c.b2-_3e;if(_3f<_3b.min){_3f=_3b.min;_41=_3f+_3c.b2;}
_3c.b1=_3f;}
if(_41!=null){_40=Math.floor(_41*_39.a/_39.b);if(_3a.a==1){_3c.a2=_3c.a1+_40;}else{_3c.a1=_3c.a1=_3c.a2-_40;}}
return _3c;},drawArea:function(){var _42=this.calcW();var _43=this.calcH();var px="px";var _45=[this.areaCoords.x1+px,this.areaCoords.y1+px,_42+px,_43+px,this.areaCoords.x2+px,this.areaCoords.y2+px,(this.img.width-this.areaCoords.x2)+px,(this.img.height-this.areaCoords.y2)+px];var _46=this.selArea.style;_46.left=_45[0];_46.top=_45[1];_46.width=_45[2];_46.height=_45[3];var _47=Math.ceil((_42-6)/2)+px;var _48=Math.ceil((_43-6)/2)+px;this.handleN.style.left=_47;this.handleE.style.top=_48;this.handleS.style.left=_47;this.handleW.style.top=_48;this.north.style.height=_45[1];var _49=this.east.style;_49.top=_45[1];_49.height=_45[3];_49.left=_45[4];_49.width=_45[6];var _4a=this.south.style;_4a.top=_45[5];_4a.height=_45[7];var _4b=this.west.style;_4b.top=_45[1];_4b.height=_45[3];_4b.width=_45[0];this.subDrawArea();this.forceReRender();},forceReRender:function(){if(this.isIE||this.isWebKit){var n=document.createTextNode(" ");var d,el,fixEL,i;if(this.isIE){fixEl=this.selArea;}else{if(this.isWebKit){fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];d=Builder.node("div","");d.style.visibility="hidden";var _4e=["SE","S","SW"];for(i=0;i<_4e.length;i++){el=document.getElementsByClassName("imgCrop_handle"+_4e[i],this.selArea)[0];if(el.childNodes.length){el.removeChild(el.childNodes[0]);}
el.appendChild(d);}}}
fixEl.appendChild(n);fixEl.removeChild(n);}},startResize:function(e){this.startCoords=this.cloneCoords(this.areaCoords);this.resizing=true;this.resizeHandle=Event.element(e).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");Event.stop(e);},startDrag:function(e){this.selArea.show();this.clickCoords=this.getCurPos(e);this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y},false,false,null);this.dragging=true;this.onDrag(e);Event.stop(e);},getCurPos:function(e){var el=this.imgWrap,wrapOffsets=Position.cumulativeOffset(el);while(el.nodeName!="BODY"){wrapOffsets[1]-=el.scrollTop||0;wrapOffsets[0]-=el.scrollLeft||0;el=el.parentNode;}
return curPos={x:Event.pointerX(e)-wrapOffsets[0],y:Event.pointerY(e)-wrapOffsets[1]};},onDrag:function(e){if(this.dragging||this.resizing){var _54=null;var _55=this.getCurPos(e);var _56=this.cloneCoords(this.areaCoords);var _57={x:1,y:1};if(this.dragging){if(_55.x<this.clickCoords.x){_57.x=-1;}
if(_55.y<this.clickCoords.y){_57.y=-1;}
this.transformCoords(_55.x,this.clickCoords.x,_56,"x");this.transformCoords(_55.y,this.clickCoords.y,_56,"y");}else{if(this.resizing){_54=this.resizeHandle;if(_54.match(/E/)){this.transformCoords(_55.x,this.startCoords.x1,_56,"x");if(_55.x<this.startCoords.x1){_57.x=-1;}}else{if(_54.match(/W/)){this.transformCoords(_55.x,this.startCoords.x2,_56,"x");if(_55.x<this.startCoords.x2){_57.x=-1;}}}
if(_54.match(/N/)){this.transformCoords(_55.y,this.startCoords.y2,_56,"y");if(_55.y<this.startCoords.y2){_57.y=-1;}}else{if(_54.match(/S/)){this.transformCoords(_55.y,this.startCoords.y1,_56,"y");if(_55.y<this.startCoords.y1){_57.y=-1;}}}}}
this.setAreaCoords(_56,false,e.shiftKey,_57,_54);this.drawArea();Event.stop(e);}},transformCoords:function(_58,_59,_5a,_5b){var _5c=[_58,_59];if(_58>_59){_5c.reverse();}
_5a[_5b+"1"]=_5c[0];_5a[_5b+"2"]=_5c[1];},endCrop:function(){this.dragging=false;this.resizing=false;this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});},subInitialize:function(){},subDrawArea:function(){}};Cropper.ImgWithPreview=Class.create();Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){this.hasPreviewImg=false;if(typeof(this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){this.previewWrap=$(this.options.previewWrap);this.previewImg=this.img.cloneNode(false);this.previewImg.id="imgCrop_"+this.previewImg.id;this.options.displayOnInit=true;this.hasPreviewImg=true;this.previewWrap.addClassName("imgCrop_previewWrap");this.previewWrap.setStyle({width:this.options.minWidth+"px",height:this.options.minHeight+"px"});this.previewWrap.appendChild(this.previewImg);}},subDrawArea:function(){if(this.hasPreviewImg){var _5d=this.calcW();var _5e=this.calcH();var _5f={x:this.imgW/_5d,y:this.imgH/_5e};var _60={x:_5d/this.options.minWidth,y:_5e/this.options.minHeight};var _61={w:Math.ceil(this.options.minWidth*_5f.x)+"px",h:Math.ceil(this.options.minHeight*_5f.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_60.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_60.y)+"px"};var _62=this.previewImg.style;_62.width=_61.w;_62.height=_61.h;_62.left=_61.x;_62.top=_61.y;}}});;if(typeof Prototype=='undefined'||!Prototype.Version.match("1.6"))
throw("Prototype-UI library require Prototype library >= 1.6.0");if(Prototype.Browser.WebKit){Prototype.Browser.WebKitVersion=parseFloat(navigator.userAgent.match(/AppleWebKit\/([\d\.\+]*)/)[1]);Prototype.Browser.Safari2=(Prototype.Browser.WebKitVersion<420);}
if(Prototype.Browser.IE){Prototype.Browser.IEVersion=parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1]);Prototype.Browser.IE6=Prototype.Browser.IEVersion==6;Prototype.Browser.IE7=Prototype.Browser.IEVersion==7;}
Prototype.falseFunction=function(){return false};Prototype.trueFunction=function(){return true};var UI={Abstract:{},Ajax:{}};Object.extend(Class.Methods,{extend:Object.extend.methodize(),addMethods:Class.Methods.addMethods.wrap(function(proceed,source){if(!source)return this;if(!source.hasOwnProperty('methodsAdded'))
return proceed(source);var callback=source.methodsAdded;delete source.methodsAdded;proceed(source);callback.call(source,this);source.methodsAdded=callback;return this;}),addMethod:function(name,lambda){var methods={};methods[name]=lambda;return this.addMethods(methods);},method:function(name){return this.prototype[name].valueOf();},classMethod:function(){$A(arguments).flatten().each(function(method){this[method]=(function(){return this[method].apply(this,arguments);}).bind(this.prototype);},this);return this;},undefMethod:function(name){this.prototype[name]=undefined;return this;},removeMethod:function(name){delete this.prototype[name];return this;},aliasMethod:function(newName,name){this.prototype[newName]=this.prototype[name];return this;},aliasMethodChain:function(target,feature){feature=feature.camelcase();this.aliasMethod(target+"Without"+feature,target);this.aliasMethod(target,target+"With"+feature);return this;}});Object.extend(Number.prototype,{snap:function(round){return parseInt(round==1?this:(this/round).floor()*round);}});Object.extend(String.prototype,{camelcase:function(){var string=this.dasherize().camelize();return string.charAt(0).toUpperCase()+string.slice(1);},makeElement:function(){var wrapper=new Element('div');wrapper.innerHTML=this;return wrapper.down();}});Object.extend(Array.prototype,{empty:function(){return!this.length;},extractOptions:function(){return this.last().constructor===Object?this.pop():{};},removeAt:function(index){var object=this[index];this.splice(index,1);return object;},remove:function(object){var index;while((index=this.indexOf(object))!=-1)
this.removeAt(index);return object;},insert:function(index){var args=$A(arguments);args.shift();this.splice.apply(this,[index,0].concat(args));return this;}});Element.addMethods({getScrollDimensions:function(element){return{width:element.scrollWidth,height:element.scrollHeight}},getScrollOffset:function(element){return Element._returnOffset(element.scrollLeft,element.scrollTop);},setScrollOffset:function(element,offset){element=$(element);if(arguments.length==3)
offset={left:offset,top:arguments[2]};element.scrollLeft=offset.left;element.scrollTop=offset.top;return element;},getNumStyle:function(element,style){var value=parseFloat($(element).getStyle(style));return isNaN(value)?null:value;},appendText:function(element,text){element=$(element);text=String.interpret(text);element.appendChild(document.createTextNode(text));return element;}});document.whenReady=function(callback){if(document.loaded)
callback.call(document);else
document.observe('dom:loaded',callback);};Object.extend(document.viewport,{getScrollOffset:document.viewport.getScrollOffsets,setScrollOffset:function(offset){Element.setScrollOffset(Prototype.Browser.WebKit?document.body:document.documentElement,offset);},getScrollDimensions:function(){return Element.getScrollDimensions(Prototype.Browser.WebKit?document.body:document.documentElement);}});(function(){UI.Options={methodsAdded:function(klass){klass.classMethod($w(' setOptions allOptions optionsGetter optionsSetter optionsAccessor '));},setOptions:function(options){if(!this.hasOwnProperty('options'))
this.options=this.allOptions();this.options=Object.extend(this.options,options||{});},allOptions:function(){var superclass=this.constructor.superclass,ancestor=superclass&&superclass.prototype;return(ancestor&&ancestor.allOptions)?Object.extend(ancestor.allOptions(),this.options):Object.clone(this.options);},optionsGetter:function(){addOptionsAccessors(this,arguments,false);},optionsSetter:function(){addOptionsAccessors(this,arguments,true);},optionsAccessor:function(){this.optionsGetter.apply(this,arguments);this.optionsSetter.apply(this,arguments);}};function addOptionsAccessors(receiver,names,areSetters){names=$A(names).flatten();if(names.empty())
names=Object.keys(receiver.allOptions());names.each(function(name){var accessorName=(areSetters?'set':'get')+name.camelcase();receiver[accessorName]=receiver[accessorName]||(areSetters?function(value){return this.options[name]=value}:function(){return this.options[name]});});}})();UI.Carousel=Class.create(UI.Options,{options:{direction:"horizontal",previousButton:".previous_button",nextButton:".next_button",container:".container",scrollInc:"auto",disabledButtonSuffix:'_disabled',overButtonSuffix:'_over'},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.id=this.element.id;this.container=this.element.down(this.options.container).firstDescendant();this.elements=this.container.childElements();this.previousButton=this.options.previousButton==false?null:this.element.down(this.options.previousButton);this.nextButton=this.options.nextButton==false?null:this.element.down(this.options.nextButton);this.posAttribute=(this.options.direction=="horizontal"?"left":"top");this.dimAttribute=(this.options.direction=="horizontal"?"width":"height");this.elementSize=this.computeElementSize();this.nbVisible=this.currentSize()/this.elementSize;var scrollInc=this.options.scrollInc;if(scrollInc=="auto")
scrollInc=Math.floor(this.nbVisible);[this.previousButton,this.nextButton].each(function(button){if(!button)return;var className=(button==this.nextButton?"next_button":"previous_button")+this.options.overButtonSuffix;button.clickHandler=this.scroll.bind(this,(button==this.nextButton?-1:1)*scrollInc*this.elementSize);button.observe("click",button.clickHandler).observe("mouseover",function(){button.addClassName(className)}.bind(this)).observe("mouseout",function(){button.removeClassName(className)}.bind(this));},this);this.updateButtons();},destroy:function($super){[this.previousButton,this.nextButton].each(function(button){if(!button)return;button.stopObserving("click",button.clickHandler);},this);this.element.remove();this.fire('destroyed');},fire:function(eventName,memo){memo=memo||{};memo.carousel=this;return this.element.fire('carousel:'+eventName,memo);},observe:function(eventName,handler){this.element.observe('carousel:'+eventName,handler.bind(this));return this;},stopObserving:function(eventName,handler){this.element.stopObserving('carousel:'+eventName,handler);return this;},checkScroll:function(position,updatePosition){if(position>0)
position=0;else{var limit=this.elements.last().positionedOffset()[this.posAttribute]+this.elementSize;var carouselSize=this.currentSize();if(position+limit<carouselSize)
position+=carouselSize-(position+limit);position=Math.min(position,0);}
if(updatePosition)
this.container.style[this.posAttribute]=position+"px";return position;},scroll:function(deltaPixel){if(this.animating)
return this;var position=this.currentPosition()+deltaPixel;position=this.checkScroll(position,false);deltaPixel=position-this.currentPosition();if(deltaPixel!=0){this.animating=true;this.fire("scroll:started");var that=this;this.container.morph("opacity:0.5",{duration:0.2,afterFinish:function(){that.container.morph(that.posAttribute+": "+position+"px",{duration:0.4,delay:0.2,afterFinish:function(){that.container.morph("opacity:1",{duration:0.2,afterFinish:function(){that.animating=false;that.updateButtons().fire("scroll:ended",{shift:deltaPixel/that.currentSize()});}});}});}});}
return this;},scrollTo:function(index){if(this.animating||index<0||index>this.elements.length||index==this.currentIndex()||isNaN(parseInt(index)))
return this;return this.scroll((this.currentIndex()-index)*this.elementSize);},updateButtons:function(){this.updatePreviousButton();this.updateNextButton();return this;},updatePreviousButton:function(){var position=this.currentPosition();var previousClassName="previous_button"+this.options.disabledButtonSuffix;if(this.previousButton.hasClassName(previousClassName)&&position!=0){this.previousButton.removeClassName(previousClassName);this.fire('previousButton:enabled');}
if(!this.previousButton.hasClassName(previousClassName)&&position==0){this.previousButton.addClassName(previousClassName);this.fire('previousButton:disabled');}},updateNextButton:function(){var lastPosition=this.currentLastPosition();var size=this.currentSize();var nextClassName="next_button"+this.options.disabledButtonSuffix;if(this.nextButton.hasClassName(nextClassName)&&lastPosition!=size){this.nextButton.removeClassName(nextClassName);this.fire('nextButton:enabled');}
if(!this.nextButton.hasClassName(nextClassName)&&lastPosition==size){this.nextButton.addClassName(nextClassName);this.fire('nextButton:disabled');}},computeElementSize:function(){return this.elements.first().getDimensions()[this.dimAttribute];},currentIndex:function(){return-this.currentPosition()/this.elementSize;},currentLastPosition:function(){if(this.container.childElements().empty())
return 0;return this.currentPosition()+
this.elements.last().positionedOffset()[this.posAttribute]+
this.elementSize;},currentPosition:function(){return this.container.getNumStyle(this.posAttribute);},currentSize:function(){return this.container.parentNode.getDimensions()[this.dimAttribute];},updateSize:function(){this.nbVisible=this.currentSize()/this.elementSize;var scrollInc=this.options.scrollInc;if(scrollInc=="auto")
scrollInc=Math.floor(this.nbVisible);[this.previousButton,this.nextButton].each(function(button){if(!button)return;button.stopObserving("click",button.clickHandler);button.clickHandler=this.scroll.bind(this,(button==this.nextButton?-1:1)*scrollInc*this.elementSize);button.observe("click",button.clickHandler);},this);this.checkScroll(this.currentPosition(),true);this.updateButtons().fire('sizeUpdated');return this;}});UI.Ajax.Carousel=Class.create(UI.Carousel,{options:{elementSize:-1,url:null},initialize:function($super,element,options){if(!options.url)
throw("url option is required for UI.Ajax.Carousel");if(!options.elementSize)
throw("elementSize option is required for UI.Ajax.Carousel");$super(element,options);this.endIndex=0;this.hasMore=true;this.updateHandler=this.update.bind(this);this.updateAndScrollHandler=function(nbElements,transport,json){this.update(transport,json);this.scroll(nbElements);}.bind(this);this.runRequest.bind(this).defer({parameters:{from:0,to:Math.ceil(this.nbVisible)-1},onSuccess:this.updateHandler});},runRequest:function(options){this.requestRunning=true;new Ajax.Request(this.options.url,Object.extend({method:"GET"},options));this.fire("request:started");return this;},scroll:function($super,deltaPixel){if(this.animating||this.requestRunning)
return this;var nbElements=(-deltaPixel)/this.elementSize;if(this.hasMore&&nbElements>0&&this.currentIndex()+this.nbVisible+nbElements-1>this.endIndex){var from=this.endIndex+1;var to=Math.ceil(from+this.nbVisible-1);this.runRequest({parameters:{from:from,to:to},onSuccess:this.updateAndScrollHandler.curry(deltaPixel).bind(this)});return this;}
else
$super(deltaPixel);},update:function(transport,json){this.requestRunning=false;this.fire("request:ended");if(!json)
json=transport.responseJSON;this.hasMore=json.more;this.endIndex=Math.max(this.endIndex,json.to);this.elements=this.container.insert({bottom:json.html}).childElements();return this.updateButtons();},computeElementSize:function(){return this.options.elementSize;},updateSize:function($super){var nbVisible=this.nbVisible;$super();if(Math.floor(this.nbVisible)-Math.floor(nbVisible)>=1&&this.hasMore){if(this.currentIndex()+Math.floor(this.nbVisible)>=this.endIndex){var nbNew=Math.floor(this.currentIndex()+Math.floor(this.nbVisible)-this.endIndex);this.runRequest({parameters:{from:this.endIndex+1,to:this.endIndex+nbNew},onSuccess:this.updateHandler});}}
return this;},updateNextButton:function($super){var lastPosition=this.currentLastPosition();var size=this.currentSize();var nextClassName="next_button"+this.options.disabledButtonSuffix;if(this.nextButton.hasClassName(nextClassName)&&lastPosition!=size){this.nextButton.removeClassName(nextClassName);this.fire('nextButton:enabled');}
if(!this.nextButton.hasClassName(nextClassName)&&lastPosition==size&&!this.hasMore){this.nextButton.addClassName(nextClassName);this.fire('nextButton:disabled');}}});;(function(){if(!Prototype)return;var get_uid=function(){var uid=0;return function(){return uid++;}}();window.Ajax_upload=Class.create({initialize:function(button,options){if(typeof button=="string"){button=$$(button)[0];}
this.button=button;this.wrapper=null;this.form=null;this.input=null;this.iframe=null;this.disabled=false;this.submitting=false;this.settings=$H({action:'upload.php',name:'userfile',data:{},onSubmit:function(file,extension){},onComplete:function(file,response){}}).update(options);this.create_wrapper();this.create_input();this.create_iframe();},set_data:function(data){this.settings.set('data',data);},disable:function(){this.disabled=true;if(!this.submitting){this.input.writeAttribute('disabled',true);this.button.removeClassName('hover');}},enable:function(){this.disabled=false;this.input.writeAttribute('disabled',false);},create_wrapper:function(){var button=this.button,wrapper;wrapper=this.wrapper=new Element('div');button.insert({after:wrapper});wrapper.insert(button);setTimeout(function(){var dimensions=button.getDimensions();wrapper.setStyle({position:'relative',display:'block',overflow:'hidden',height:dimensions.height,width:dimensions.width});},1);var self=this;wrapper.observe('mousemove',function(e){if(!self.input){return;}
self.input.setStyle({top:e.pageY-wrapper.cumulativeOffset().top-5+'px',left:e.pageX-wrapper.cumulativeOffset().left-170+'px'});});},create_input:function(){var self=this;this.input=new Element('input',{type:'file',name:this.settings.get('name')});this.input.setStyle({position:'absolute',margin:0,padding:0,width:'220px',height:'10px',opacity:0});this.wrapper.insert(this.input);this.input.observe('change',function(){if($(self.input).readAttribute('value')==''){return;}
self.submitting=true;self.submit();if(self.disabled){self.disable();}
self.submitting=false;});this.input.observe('mouseover',function(){self.button.addClassName('hover');});this.input.observe('mouseout',function(){self.button.removeClassName('hover');});if(this.disabled){this.input.writeAttribute('disabled','disabled');}},create_iframe:function(){var id='valumsl8mh6sdc_'+get_uid();this.iframe=new Element('iframe',{id:id,name:id});this.iframe.setStyle({display:'none'});$(document.body).insert(this.iframe);},submit:function(){var self=this,settings=this.settings;var file=this.file_from_path(this.input.value);if(settings.get('onSubmit').call(this,file,this.get_ext(file))===false){return;}
this.create_form();this.form.insert(this.input);this.form.submit();this.input.remove();this.input=null;this.form.remove();this.form=null;this.submitting=false;this.create_input();var iframe=this.iframe;iframe.observe('load',function(){var doc=iframe.contentDocument?iframe.contentDocument:frames[iframe.id].document;var response=doc.body.innerHTML;settings.get('onComplete').call(self,file,response);setTimeout(function(){iframe.remove();},1);});this.create_iframe();},create_form:function(){var form_id='valumsl86jtegr'+get_uid();var form_html='<form id="'+form_id+'" method="post" enctype="multipart/form-data"></form>';$(document.body).insert(form_html);this.form=$(form_id);this.form.writeAttribute({action:this.settings.get('action'),target:this.iframe.name});for(var i in this.settings.get('data')){this.form.insert(new Element('input',{type:'hidden',name:i,value:this.settings.get('data')[i]}));}},file_from_path:function(file){return file.replace(/.*(\/|\\)/,"");},get_ext:function(file){return(/[.]/.exec(file))?/[^.]+$/.exec(file.toLowerCase()):'';},make_parent_opaque:function(){return;this.button.add(this.button.parents()).each(function(){var color=$(this).css('backgroundColor');var image=$(this).css('backgroundImage');if(color!='transparent'||image!='none'){$(this).css('opacity',1);return false;}});}});})();;window.dhtmlHistory={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(options){var that=this;var UA=navigator.userAgent.toLowerCase();var platform=navigator.platform.toLowerCase();var vendor=navigator.vendor||"";if(vendor==="KDE"){this.isKonqueror=true;this.isSupported=false;}else if(typeof window.opera!=="undefined"){this.isOpera=true;this.isSupported=true;}else if(typeof document.all!=="undefined"){this.isIE=true;this.isSupported=true;}else if(vendor.indexOf("Apple Computer, Inc.")>-1){this.isSafari=true;this.isSupported=(platform.indexOf("mac")>-1);}else if(UA.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true;}
window.historyStorage.setup(options);if(this.isSafari){this.createSafari();}else if(this.isOpera){this.createOpera();}
var initialHash=this.getCurrentLocation();this.currentLocation=initialHash;if(this.isIE){this.createIE(initialHash);}
var unloadHandler=function(){that.firstLoad=null;};this.addEventListener(window,'unload',unloadHandler);if(this.isIE){this.ignoreLocationChange=true;}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true);}else{this.ignoreLocationChange=false;this.fireOnNewListener=true;}}
var locationHandler=function(){that.checkLocation();};setInterval(locationHandler,100);},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true);}
else{this.fireOnNewListener=true;this.firstLoad=false;}}},addListener:function(listener){this.listener=listener;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false;}},addEventListener:function(o,e,l){if(o.addEventListener){o.addEventListener(e,l,false);}else if(o.attachEvent){o.attachEvent('on'+e,function(){l(window.event);});}},add:function(newLocation,historyData){if(this.isSafari){newLocation=this.removeHash(newLocation);historyStorage.put(newLocation,historyData);this.currentLocation=newLocation;window.location.hash=newLocation;this.putSafariState(newLocation);}else{var that=this;var addImpl=function(){if(that.currentWaitTime>0){that.currentWaitTime=that.currentWaitTime-that.waitTime;}
newLocation=that.removeHash(newLocation);if(document.getElementById(newLocation)&&that.debugMode){var e="Exception: History locations can not have the same value as _any_ IDs that might be in the document,"
+" due to a bug in IE; please ask the developer to choose a history location that does not match any HTML"
+" IDs in this document. The following ID is already taken and cannot be a location: "+newLocation;throw new Error(e);}
historyStorage.put(newLocation,historyData);that.ignoreLocationChange=true;that.ieAtomicLocationChange=true;that.currentLocation=newLocation;window.location.hash=newLocation;if(that.isIE){that.iframe.src="blank.html?"+newLocation;}
that.ieAtomicLocationChange=false;};window.setTimeout(addImpl,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime;}},isFirstLoad:function(){return this.firstLoad;},getVersion:function(){return"0.6";},getCurrentLocation:function(){var r=(this.isSafari?this.getSafariState():this.getCurrentHash());return r;},getCurrentHash:function(){var r=window.location.href;var i=r.indexOf("#");return(i>=0?r.substr(i+1):"");},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(initialHash){this.waitTime=400;var styles=(historyStorage.debugMode?'width: 800px;height:80px;border:1px solid black;':historyStorage.hideStyles);var iframeID="rshHistoryFrame";var iframeHTML='<iframe frameborder="0" id="'+iframeID+'" style="'+styles+'" src="blank.html?'+initialHash+'"></iframe>';document.write(iframeHTML);this.iframe=document.getElementById(iframeID);},createOpera:function(){this.waitTime=400;var imgHTML='<img src="javascript:location.href=\'javascript:dhtmlHistory.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(imgHTML);},createSafari:function(){var formID="rshSafariForm";var stackID="rshSafariStack";var lengthID="rshSafariLength";var formStyles=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var inputStyles=(historyStorage.debugMode?'width:800px;height:20px;border:1px solid black;margin:0;padding:0;':historyStorage.hideStyles);var safariHTML='<form id="'+formID+'" style="'+formStyles+'">'
+'<input type="text" style="'+inputStyles+'" id="'+stackID+'" value="[]"/>'
+'<input type="text" style="'+inputStyles+'" id="'+lengthID+'" value=""/>'
+'</form>';document.write(safariHTML);this.safariStack=document.getElementById(stackID);this.safariLength=document.getElementById(lengthID);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint;}else{this.safariHistoryStartPoint=this.safariLength.value;}},getSafariStack:function(){var r=this.safariStack.value;return historyStorage.fromJSON(r);},getSafariState:function(){var stack=this.getSafariStack();var state=stack[history.length-this.safariHistoryStartPoint-1];return state;},putSafariState:function(newLocation){var stack=this.getSafariStack();stack[history.length-this.safariHistoryStartPoint]=newLocation;this.safariStack.value=historyStorage.toJSON(stack);},fireHistoryEvent:function(newHash){var historyData=historyStorage.get(newHash);this.listener.call(null,newHash,historyData);},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return;}
if(!this.isIE&&this.ieAtomicLocationChange){return;}
var hash=this.getCurrentLocation();if(hash==this.currentLocation){return;}
this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=hash){this.iframe.src="blank.html?"+hash;}
else if(this.isIE){return;}
this.currentLocation=hash;this.ieAtomicLocationChange=false;this.fireHistoryEvent(hash);},getIframeHash:function(){var doc=this.iframe.contentWindow.document;var hash=String(doc.location.search);if(hash.length==1&&hash.charAt(0)=="?"){hash="";}
else if(hash.length>=2&&hash.charAt(0)=="?"){hash=hash.substring(1);}
return hash;},removeHash:function(hashValue){var r;if(hashValue===null||hashValue===undefined){r=null;}
else if(hashValue===""){r="";}
else if(hashValue.length==1&&hashValue.charAt(0)=="#"){r="";}
else if(hashValue.length>1&&hashValue.charAt(0)=="#"){r=hashValue.substring(1);}
else{r=hashValue;}
return r;},iframeLoaded:function(newLocation){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return;}
var hash=String(newLocation.search);if(hash.length==1&&hash.charAt(0)=="?"){hash="";}
else if(hash.length>=2&&hash.charAt(0)=="?"){hash=hash.substring(1);}
window.location.hash=hash;this.fireHistoryEvent(hash);}};window.historyStorage={setup:function(options){if(typeof options!=="undefined"){if(options.debugMode){this.debugMode=options.debugMode;}
if(options.toJSON){this.toJSON=options.toJSON;}
if(options.fromJSON){this.fromJSON=options.fromJSON;}}
var formID="rshStorageForm";var textareaID="rshStorageField";var formStyles=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var textareaStyles=(historyStorage.debugMode?'width: 800px;height:80px;border:1px solid black;':historyStorage.hideStyles);var textareaHTML='<form id="'+formID+'" style="'+formStyles+'">'
+'<textarea id="'+textareaID+'" style="'+textareaStyles+'"></textarea>'
+'</form>';document.write(textareaHTML);this.storageField=document.getElementById(textareaID);if(typeof window.opera!=="undefined"){this.storageField.focus();}},put:function(key,value){this.assertValidKey(key);if(this.hasKey(key)){this.remove(key);}
this.storageHash[key]=value;this.saveHashTable();},get:function(key){this.assertValidKey(key);this.loadHashTable();var value=this.storageHash[key];if(value===undefined){value=null;}
return value;},remove:function(key){this.assertValidKey(key);this.loadHashTable();delete this.storageHash[key];this.saveHashTable();},reset:function(){this.storageField.value="";this.storageHash={};},hasKey:function(key){this.assertValidKey(key);this.loadHashTable();return(typeof this.storageHash[key]!=="undefined");},isValidKey:function(key){return(typeof key==="string");},showStyles:'border:0;margin:0;padding:0;',hideStyles:'left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;',debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(key){var isValid=this.isValidKey(key);if(!isValid&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+key+".");}},loadHashTable:function(){if(!this.hashLoaded){var serializedHashTable=this.storageField.value;if(serializedHashTable!==""&&serializedHashTable!==null){this.storageHash=this.fromJSON(serializedHashTable);this.hashLoaded=true;}}},saveHashTable:function(){this.loadHashTable();var serializedHashTable=this.toJSON(this.storageHash);this.storageField.value=serializedHashTable;},toJSON:function(o){return o.toJSONString();},fromJSON:function(s){return s.parseJSON();}};;var ImageUploader=Class.create({initialize:function(){alert('entrar');this.limitFotos=5;this.activeFile=0;this.fotos=new Hash();this.order_index=0;this.current_file="";this.formFieldName="json_fotos";this.listElement="listFotos";this.draw();},setNewLimit:function(limit){if(Object.isNumber(limit))
this.limitFotos=limit;},mainImage:function mainImage(coords,dimensions){if(this.fotos.get(this.current_file)==undefined){this.fotos.set(this.current_file,new Hash());this.fotos.get(this.current_file).set("filename",this.current_file);}
this.fotos.get(this.current_file).set("x1",coords.x1);this.fotos.get(this.current_file).set("y1",coords.y1);this.fotos.get(this.current_file).set("x2",coords.x2);this.fotos.get(this.current_file).set("y2",coords.y2);this.fotos.get(this.current_file).set("order",this.order_index);this.uploader.enable();},removeImage:function(file){image_order=this.fotos.get(file).get("order");this.fotos.each(function(item){if(item.value.get("order")>image_order)
item.value.set("order",item.value.get("order")-1);});this.fotos.unset(file);$(file).remove();this.order_index=eval(this.order_index)-1;$("rightUploader").update("");$("rightUploader").insert(new Element("p",{className:"cor_azul02 strong"}).update("Use o bot\343o na parte esquerda da janela para carregar as suas fotografias.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode fazer upload de ficheiros do tipo JPG, GIF (Por favor, n\343o envie imagens com direitos de autor)")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode enviar um m\341ximo de 5 imagens.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Use o link remover \340 esquerda para retirar uma imagem da lista. Use as setas por baixo de cada imagem para ordenar a listagem"));if(!this.order_index)
this.hideTerminateButton();},move_up:function(file){self=this;image_order=this.fotos.get(file).get("order");if(image_order){this.fotos.get(file).set("order",image_order-1);this.fotos.each(function(item){if(item.value.get("order")==image_order-1){item.value.set("order",image_order+1);return;}});var tmp=$(file).innerHTML;var tmp_id=$(file).id;var tmp_id2="dummy";var tmp_id3=$(file).previous().id;$(file).innerHTML=$(file).previous().innerHTML;$(file).previous().innerHTML=tmp;$(file).id=tmp_id2;$(tmp_id2).previous().id=tmp_id;$(tmp_id2).id=tmp_id3;$(file+"up").observe("click",function(){self.move_up(file)})
$(file+"down").observe("click",function(){self.move_down(file)})
$(file+"remove").observe("click",function(){self.removeImage(file)})
$($(tmp_id3).id+"up").observe("click",function(){self.move_up($(tmp_id3).id)})
$($(tmp_id3).id+"down").observe("click",function(){self.move_down($(tmp_id3).id)})
$($(tmp_id3).id+"remove").observe("click",function(){self.removeImage($(tmp_id3).id)})}},move_down:function(file){image_order=this.fotos.get(file).get("order");if(image_order<this.order_index){this.fotos.get(file).set("order",image_order+1);this.fotos.each(function(item){if(item.value.get("order")==image_order+1){item.value.set("order",image_order-1);return;}});var tmp=$(file).innerHTML;var tmp_id=$(file).id;var tmp_id2="dummy";var tmp_id3=$(file).next().id;$(file).innerHTML=$(file).next().innerHTML;$(file).next().innerHTML=tmp;$(file).id=tmp_id2;$(tmp_id2).next().id=tmp_id;$(tmp_id2).id=tmp_id3;$(file+"up").observe("click",function(){self.move_up(file)})
$(file+"down").observe("click",function(){self.move_down(file)})
$(file+"remove").observe("click",function(){self.removeImage(file)})
$($(tmp_id3).id+"up").observe("click",function(){self.move_up($(tmp_id3).id)})
$($(tmp_id3).id+"down").observe("click",function(){self.move_down($(tmp_id3).id)})
$($(tmp_id3).id+"remove").observe("click",function(){self.removeImage($(tmp_id3).id)})}},showTerminateButton:function(){$("terminate_button").style.display="";slf=this;$$("#terminate_button a")[0].stopObserving("click");$$("#terminate_button a")[0].observe("click",function(){slf.finalize()});},hideTerminateButton:function(){$("terminate_button").style.display="none";},save_image:function(){file_li=$$('#uploader .files')[0];selfObj=this;is_checked=""
file=selfObj.current_file;if(file_li.innerHTML=="")
is_checked="checked";newLi=new Element('li',{id:selfObj.current_file}).update(file+"&nbsp;");newLi.insert(new Element("br"));newLi.insert(new Element("a",{href:"#",className:"remov",id:file+"remove"}).update("remover").observe("click",function(){selfObj.removeImage(file)}));newLi.insert("&nbsp;");newLi.insert(new Element("a",{href:"#",title:"descer",id:selfObj.current_file+"down"}).update(new Element("img",{src:"backend/img/ico_arrow_down_new.gif",border:0})).observe("click",function(){selfObj.move_down(file)}));newLi.insert("&nbsp;");newLi.insert(new Element("a",{href:"#",title:"subir",id:selfObj.current_file+"up"}).update(new Element("img",{src:"backend/img/ico_arrow_up_new.gif",border:0})).observe("click",function(){selfObj.move_up(file)}));newLi.id=this.current_file;file_li.insert(newLi);this.order_index++;this.fotos.get(this.current_file).set("saved",true);if(this.order_index==1)
this.showTerminateButton();this.resetCanvas();},resetCanvas:function(){$("rightUploader").innerHTML="";if(this.order_index<this.limitFotos){$("rightUploader").insert(new Element("p",{className:"cor_azul02 strong"}).update("Use o bot\343o na parte esquerda da janela para carregar as suas fotografias.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode fazer upload de ficheiros do tipo JPG, GIF (Por favor, n\343o envie imagens com direitos de autor)")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode enviar um m\341ximo de 5 imagens.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Use o link remover \340 esquerda para retirar uma imagem da lista. Use as setas por baixo de cada imagem para ordenar a listagem")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Quando terminar, carregue no bot\343o 'Gravar' que estar\341 vis\355vel sempre que tiver imagens carregadas."));}else{$("rightUploader").insert(new Element("p",{className:"cor_azul02 strong"}).update("Atingiu o limite de imagens."));}},finalize:function(){var index=1;listElement=this.listElement;formFieldName=this.formFieldName;this.fotos.each(function(item){if(item.value.get("saved")==undefined)
this.fotos.unset(item.value.get("filename"));else{if(index>1)
$(listElement).insert(new Element("br"));$(listElement).insert(index+". "+item.value.get("filename"));index++;}});$(formFieldName).value=this.fotos.toJSON();Modalbox.hide();},draw:function(){selfIn=this;this.mainDiv=new Element("div",{className:"mainUpload"}).update(inputDiv=new Element("div",{className:"boxOportunidades",style:"height:auto;float:left;padding-right:10px;padding-bottom:10px;width:247px;",id:"leftUploader"}));inputDiv.insert(ul_uploader=new Element("ul",{style:"margin-left: 0px; list-style-type: none; float: left;"}).update(li_uploader=new Element("li",{id:"uploader",className:"uploader_class"}).update(new Element("div",{className:"wrapper"}).insert(new Element("div",{id:"upload_button",className:"divLoadFotos"}).update("Carregar Imagem")))));li_uploader.insert(new Element("p",{className:"uper font size11 float menu_w m_top10 cor_menu01 t_alignRight cor_branco p_Right5 strong"}).update("Imagens Carregadas:")).insert(new Element("div",{className:"clear"}));li_uploader.insert(new Element("ol",{className:"files"})).insert(new Element("div",{className:"divLoadFotos",id:"terminate_button"}).update(new Element("a",{className:"remov",href:"#"}).update("Gravar").observe("click",function(){selfIn.finalize()})));this.mainDiv.insert(canvasDiv=new Element("div",{id:"rightUploader",align:"center"}).insert(new Element("p",{className:"cor_azul02 strong"}).update("Use o bot\343o na parte esquerda da janela para carregar as suas fotografias.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode fazer upload de ficheiros do tipo JPG, GIF (Por favor, n\343o envie imagens com direitos de autor)")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Pode enviar um m\341ximo de 5 imagens.")).insert(new Element("p",{className:"m_top4 justify cor_cinza999 lineHeight18"}).update("Quando terminar, carregue no bot\343o 'Gravar' que estar\341 vis\355vel sempre que tiver imagens carregadas.")));var self=this;Modalbox.show(this.mainDiv,{title:"Carregamento de Imagens",width:1200,height:1000,afterLoad:function(){self.init_cropper()}});},init_cropper:function(){$("terminate_button").style.display="none";var button=$('upload_button'),interval;var self=this;this.uploader=new Ajax_upload(button,{action:'/backend/barcos/upload.php',name:'userfile',onSubmit:function(file,ext){if(!(ext&&/^(jpg|png|jpeg|gif)$/.test(ext))){writeError('upload_button','Ficheiro inválido');return false;}
button.update('A Carregar Ficheiros');this.disable();interval=window.setInterval(function(){var text=button.innerHTML;if(text.length<24){button.update(text+'.');}else{button.update('A Carregar Ficheiros');}},200);},onComplete:function(file,response){button.update('Carregar Fotos');window.clearInterval(interval);session_id=response;self.current_file=file;$("rightUploader").innerHTML="";$("rightUploader").insert(new Element("p",{className:"cor_azul02 strong"}).update("Arraste a caixa para escolher a \341rea que pretende manter e use as arestas e v\351rtices para aumentar ou reduzir o tamanho da sele\347\343o"));$("rightUploader").insert(new Element("div",{className:"divLoadFotos"}).update(new Element("a",{className:"greylink",href:"#",id:"save_link"}).update("Gravar Imagem").observe("click",function(){self.save_image()})));$("rightUploader").insert(new Element("div",{style:"float:left;"}).update(new Element("img",{src:"backend/images/"+session_id+"/"+file,id:"mainImg",border:0,alt:"Imagem Carregada",style:"max-width:800px;max-height:800px;min-width:237px;min-height:177px;"})));$("leftUploader").insert(new Element("div",{style:"clear:both;"})).insert(new Element("div",{id:"previewWrap",style:"margin-left:10px; float:left;"}));new Cropper.ImgWithPreview("mainImg",{ratioDim:{x:237,y:177},displayOnInit:true,minWidth:237,minHeight:177,previewWrap:'previewWrap',onEndCrop:function(coords,dimensions){self.mainImage(coords,dimensions)},onloadCoords:{x1:0,y1:0,x2:2000,y2:2000}});Modalbox.resizeToContent();}});}});;String.prototype.trim=function(){return this.replace(/^\s\s*/,'').replace(/\s\s*$/,'');}
String.prototype.isInteger=function(){return /^\d+$/.test(this);}
String.prototype.isFloat=function(){return /^\d+\.?\d*$/.test(this);}
Number.prototype.isInteger=function(){return /^\d+$/.test(this);}
String.prototype.isValidDate=function(){return /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2})$/.test(this);}
String.prototype.isEmail=function(){return /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i.test(this);}
function isInteger(s){return(s.toString().search(/^[0-9]+$/)==0);}
function waiting(divID,height){if(!height)
height=600;var html="<div style='margin:auto;text-align:center;background:#FFFFFF;height:"+height+"px'>";if(height==600)
html+="<br><br><br><br><br><br><br><br><br>"
html+="<img src='images/load.gif' border='0' /><br/><br/>"
+"<div class='font size11 cor_azul strong'>A carregar... </div>"
+"</div>";document.getElementById(divID).innerHTML=html;}
function loadDiv(divID,file_src){if(file_src=='login/doLogout.php'){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/"+file_src;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById(divID).innerHTML=xmlhttp.responseText;}}}else{window.location='http://www.siroco-nautica.pt/?div='+divID+'&q='+file_src+'';}}
function loadPage(){var div=null;var q=null;var str=window.location.toString();try{theleft=str.indexOf("=")+1;theright=str.indexOf("&");div=(str.substring(theleft,theright));aux=(str.substring(theleft,str.length));point=aux.indexOf("=");q=(aux.substring(point+1,str.length));}catch(err){div='links';q='main.php';}
if(div==null||q==null||div==''||q==''){div='links';q='main.php';}
var aux1=new String(q);var aux2="classificados/pesquisa.php&msg";var aux3=aux1.substring(0,30);if(aux2==aux3){alert("\""+aux1.substring(31,aux1.length)+"\"");q='classificados/pesquisa.php';}
waiting(div,600);var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/"+q;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById(div).innerHTML=xmlhttp.responseText;}}}
function advSrcLoadTipologia(tipo){$("tipologiaPesq").options.length=0;if(tipo!='Vela'&&tipo!='Motor'){$("tipologiaPesq").options[0]=new Option("Seleccione o tipo ... ","");return;}
$("tipologiaPesq").options[0]=new Option("Tipologia","");if(tipo=='Vela'){$("tipologiaPesq").options[1]=new Option("Veleiro Cruzeiro","Veleiro Cruzeiro");$("tipologiaPesq").options[2]=new Option("Veleiro Regata","Veleiro Regata");$("tipologiaPesq").options[3]=new Option("Catamaran","Catamaran");$("tipologiaPesq").options[4]=new Option("Motor Sail","Motor Sail");$("tipologiaPesq").options[5]=new Option("Veleiro Cruzeiro-Regata","Veleiro Cruzeiro-Regata");$("tipologiaPesq").options[6]=new Option("Trimaran","Trimaran");}
if(tipo=='Motor'){$("tipologiaPesq").options[1]=new Option("Cabinado","Cabinado");$("tipologiaPesq").options[2]=new Option("Sun Bridge","Sun Bridge");$("tipologiaPesq").options[3]=new Option("Fly Bridge","Fly Bridge");$("tipologiaPesq").options[4]=new Option("Trawler","Trawler");$("tipologiaPesq").options[5]=new Option("Proa Aberta","Proa Aberta");$("tipologiaPesq").options[6]=new Option("Proa Fechada","Proa Fechada");}}
function compra_venda(){opr=$F("opr");submit_it=true;if(opr=="comprar"){act='comprar.php';}else{act='vender.php';}
loadDiv("links",'compra_venda/'+act);}
function increment_faves(){var num_faves=Number($("num_faves").innerHTML);$("num_faves").innerHTML=num_faves+1;}
function decrement_faves(){var num_faves=Number($("num_faves").innerHTML);$("num_faves").innerHTML=num_faves-1;}
function submitAdvancedSearch(){marca=document.getElementById("marca").value;modelo=document.getElementById("modelo").value;ref=document.getElementById("ref").value;tipo=document.getElementById("tipo").value;tipologia="";comprimento=document.getElementById("comprimento").value;preco=document.getElementById("preco").value;var file_src2="barcos/listagem.php?marca="+marca+"&modelo="+modelo+"&ref="+ref+"&tipo="+tipo+"&tipo"+tipo+"&comprimento="+comprimento+"&preco="+preco;loadDiv('links',file_src2);}
function writeError(divID,errorMsg){if(!document.getElementById(divID+"_error")){lineBr=document.createElement("br");errorNode=document.createElement("span");errorNode.className="divAlert m_top10 font size10 cor_verde ";errorNode.id=divID+"_error";message=document.createTextNode(errorMsg);errorNode.appendChild(message);$(divID).parentNode.insertBefore(errorNode,$(divID).nextSibling);$(divID).parentNode.insertBefore(lineBr,errorNode);}else{document.getElementById(divID+"_error").style.display="";document.getElementById(divID+"_error").innerHTML=errorMsg;}}
function disableError(divID){if(document.getElementById(divID+"_error"))
document.getElementById(divID+"_error").style.display="none";}
function isDate(ano,mes,dia){if(!dia.isInteger()||!mes.isInteger()||!ano.isInteger())
return false;if(mes<1||mes>12||dia<1||dia>31)
return false;if((mes==4||mes==6||mes==9||mes==11)&&dia==31)
return false;if(mes==2){isLeapYear=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap))
return false;}
return true;}
function submitPedidoInfo_motor(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}else
disableError("email");if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail Incorrecto");submit_it=false;}else
disableError("email");}
if(submit_it){var nome=$("nome").value;var email=$("email").value;var id_barco=$("id_barco").value;var texto=$F("texto");var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/enviaPedidoInfo_motor.php?nome="+nome+"&email="+email+"&id_barco="+id_barco+"&texto="+texto;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitPedidoInfo_vela(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}else
disableError("email");if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail Incorrecto");submit_it=false;}else
disableError("email");}
if(submit_it){var nome=$("nome").value;var email=$("email").value;var id_barco=$("id_barco").value;var texto=$F("texto");var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/enviaPedidoInfo_vela.php?nome="+nome+"&email="+email+"&id_barco="+id_barco+"&texto="+texto;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitVisita_motor(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("tele").value.trim()!=""){if(!$("tele").value.isInteger()){writeError("tele","Telefone incorrecto");submit_it=false;}else
disableError("tele")}else
disableError("tele");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}else
disableError("email");if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail Incorrecto");submit_it=false;}else
disableError("email");}
if(submit_it){nome=$("nome").value;email=$("email").value;id_barco=$("id_barco").value;tele=$("tele").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/visita_motor.php?nome="+nome+"&email="+email+"&id_barco="+id_barco+"&tele="+tele;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitVisita_vela(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("tele").value.trim()!=""){if(!$("tele").value.isInteger()){writeError("tele","Telefone incorrecto");submit_it=false;}else
disableError("tele")}else
disableError("tele");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}else
disableError("email");if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail Incorrecto");submit_it=false;}else
disableError("email");}
if(submit_it){nome=$("nome").value;email=$("email").value;id_barco=$("id_barco").value;tele=$("tele").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/Visita_vela.php?nome="+nome+"&email="+email+"&id_barco="+id_barco+"&tele="+tele;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitEnviaBarcoAmigo_motor(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}
if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail incorrecto");submit_it=false;}else
disableError("email");}
if($("email_0").value.trim()==""){writeError("email_0","E-mail Incorrecto");submit_it=false;}
if($("email_0").value.trim()!=""){if(!$("email_0").value.isEmail()){writeError("email_0","E-Mail incorrecto");submit_it=false;}else
disableError("email_0");}
if($("email_1").value.trim()!=""){if(!$("email_1").value.isEmail()){writeError("email_1","E-Mail incorrecto");submit_it=false;}else
disableError("email_1");}
if(submit_it){nome=$("nome").value;email=$("email").value;email_0=$("email_0").value;email_1=$("email_1").value;id_barco=$("id_barco").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/enviaBarcoAmigo_motor.php?nome="+nome+"&email="+email+"&email_0="+email_0+"&email_1="+email_1+"&id_barco="+id_barco;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitEnviaBarcoAmigo_vela(){var submit_it=true;if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("email").value.trim()==""){writeError("email","E-mail Incorrecto");submit_it=false;}
if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail incorrecto");submit_it=false;}else
disableError("email");}
if($("email_0").value.trim()==""){writeError("email_0","E-mail Incorrecto");submit_it=false;}
if($("email_0").value.trim()!=""){if(!$("email_0").value.isEmail()){writeError("email_0","E-Mail incorrecto");submit_it=false;}else
disableError("email_0");}
if($("email_1").value.trim()!=""){if(!$("email_1").value.isEmail()){writeError("email_1","E-Mail incorrecto");submit_it=false;}else
disableError("email_1");}
if(submit_it){nome=$("nome").value;email=$("email").value;email_0=$("email_0").value;email_1=$("email_1").value;id_barco=$("id_barco").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/enviarBarcoAmigo_vela.php?nome="+nome+"&email="+email+"&email_0="+email_0+"&email_1="+email_1+"&id_barco="+id_barco;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function submitCartaoPrestige(){var date=false;var submit_it=true;if($("yacht").checked==false&&$("seaway").checked==false&&$("plastimo").checked==false){writeError("yacht","Escolha o tipo de Cliente");submit_it=false;}else
disableError("yacht");if($("seaway").checked==true)
var seaway="Sea Way";if($("yacht").checked==true)
var yacht="Siroco Yacht Brokers";if($("plastimo").checked==true)
var plastimo="Plastimo";if($("nome").value.trim()==""){writeError("nome","Por favor insira o seu nome sff");submit_it=false;}else
disableError("nome");if($("morada").value.trim()==""){writeError("morada","Por favor insira o a morada sff");submit_it=false;}else
disableError("morada");if(($("cp01").value.trim()=="")||($("cp02").value.trim()=="")||(!$("cp01").value.trim().isInteger())||(!$("cp02").value.trim().isInteger())||(($("cp01").value.trim().isInteger())&&($("cp01").value.length!=4))||(($("cp02").value.trim().isInteger())&&($("cp02").value.length!=3))){writeError("cp02","C\363digo Postal incorrecto");submit_it=false;}else
disableError("cp02");if($("localidade").value.trim()==""){writeError("localidade","Por favor insira a Localidade sff");submit_it=false;}else
disableError("localidade");if($("dia").value.trim()!=""&&$("mes").value.trim()!=""&&$("ano").value.trim()!=""){if(isDate(date=$("ano").value,$("mes").value,$("dia").value)){date=$("ano").value+"-"+$("mes").value+"-"+$("dia").value;disableError("labelDate");}
else{writeError("labelDate","Data incorrecta");submit_it=false;}}else
disableError("labelDate");if($("telefone").value.trim()!=""){if(!$("telefone").value.isInteger()||$("telefone").value.isInteger()&&$("telefone").value.length!=9){writeError("telefone","Telefone incorrecto");submit_it=false;}else
disableError("telefone")}else
disableError("telefone");if($("telemovel").value.trim()!=""){if(!$("telemovel").value.isInteger()||$("telemovel").value.isInteger()&&$("telemovel").value.length!=9){writeError("telemovel","Telemovel incorrecto");submit_it=false;}else
disableError("telemovel")}else
disableError("telemovel");if($("email").value.trim()!=""){if(!$("email").value.isEmail()){writeError("email","E-Mail incorrecto");submit_it=false;}else
disableError("email");}
if($("email").value.trim()=="")
disableError("email");if($("tamanho").value.trim()==""){writeError("tamanho","Por favor insira o tamanho do Barco sff");submit_it=false;}else
disableError("tamanho");if(!$("tamanho").value.isInteger()){writeError("tamanho","Por favor insira um valor num\341rico sff");submit_it=false;}else
disableError("tamanho")
if($("nome_barco").value.trim()==""){writeError("nome_barco","Por favor insira o nome do barco sff");submit_it=false;}else
disableError("nome_barco");if($("dia_aq").value.trim()==""||$("mes_aq").value.trim()==""||$("ano_aq").value.trim()==""){writeError("labelDate2","Por favor insira a data de aquisi\347\343o ");submit_it=false;}else
disableError("labelDate2");if($("dia_aq").value.trim()!=""&&$("mes_aq").value.trim()!=""&&$("ano_aq").value.trim()!=""){if(isDate(date=$("ano_aq").value,$("mes_aq").value,$("dia_aq").value)){data_aq=$("ano_aq").value+"-"+$("mes_aq").value+"-"+$("dia_aq").value;disableError("labelDate2");}
else{writeError("labelDate2","Data incorrecta");submit_it=false;}}else
disableError("labelDate");if($("folhetos").checked==true)
var folhetos="Folhetos Promocionais";if($("sms").checked==true)
var sms="SMS";if($("revista").checked==true)
var revista="Revista";if($("news").checked==true)
var newsletter="Newsletter";if(submit_it){nome=$("nome").value;morada=$("morada").value;cp1=$("cp01").value;cp2=$("cp02").value;email=$("email").value;localidade=$("localidade").value;telefone=$("telefone").value;telemovel=$("telemovel").value;tamanho=$("tamanho").value;nome_barco=$("nome_barco").value;nr_agregado=$("nr_agregado").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/enviaCartaoPrestige.php?seaway="+seaway+"&yacht="+yacht+"&plastimo="+plastimo+"&nome="+nome+"&morada="+morada+"&cp1="+cp1+"&cp2="+cp2+"&date="+date+"&data_aq="+data_aq+"&email="+email+"&localidade="+localidade+"&nome_barco="+nome_barco+"&tamanho="+tamanho+"&nr_agregado="+nr_agregado+"&telefone="+telefone+"&telemovel="+telemovel+"&folhetos="+folhetos+"&sms="+sms+"&revista="+revista+"&newsletter="+newsletter;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{var resp=xmlhttp.responseText;loadDiv('links','cartaoPrestige.php');}}}}
function submitRegister(){var date=false;var submit_it=true;if($("reg_name").value.trim()==""){writeError("reg_name","Por favor insira o seu nome sff");submit_it=false;}else
disableError("reg_name");if($("reg_day").value.trim()!=""&&$("reg_month").value.trim()!=""&&$("reg_year").value.trim()!=""){if(isDate(date=$("reg_year").value,$("reg_month").value,$("reg_day").value)){date=$("reg_year").value+"-"+$("reg_month").value+"-"+$("reg_day").value;disableError("reg_labelDate");}else{writeError("reg_labelDate","Data incorrecta");submit_it=false;}}else
disableError("reg_labelDate");if(!$("reg_email").value.isEmail()){writeError("reg_email","E-Mail Incorrecto");submit_it=false;}else
disableError("reg_email");if($("reg_codPostal1").value.trim()!=""&&$("reg_codPostal2").value.trim()!=""&&$("reg_localidade").value.trim()!=""){if(!$("reg_codPostal1").value.trim().isInteger()||!$("reg_codPostal2").value.trim().isInteger()){writeError("reg_localidade","C\363digo Postal incorrecto");submit_it=false;}else
disableError("reg_localidade");}else
disableError("reg_localidade");if($("reg_telefone").value.trim()!=""){if(!$("reg_telefone").value.isInteger()&&$("reg_telefone").value.length>9){writeError("reg_telefone","Telefone incorrecto");submit_it=false;}else
disableError("reg_telefone")}else
disableError("reg_telefone");if($("reg_username").value.trim()==""){writeError("reg_username","Por favor, insira o seu username");submit_it=false;}else
disableError("reg_username");if($("reg_password").value.trim()==""){writeError("reg_password","Por favor, insira a sua password");submit_it=false;}else
disableError("reg_password");if($("reg_password").value.trim()!=$("reg_conf_password").value.trim()){writeError("reg_conf_password","Confirme a sua password");submit_it=false;}else
disableError("reg_conf_password");if(submit_it){var name=$("reg_name").value;var email=$("reg_email").value;var cod_postal1=$("reg_codPostal1").value;var cod_postal2=$("reg_codPostal2").value;var localidade=$("reg_localidade").value;var telefone=$("reg_telefone").value;var reg_username=$("reg_username").value;var password=$("reg_password").value;var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/register.php?name="+name+"&date="+date+"&email="+email+"&cod_postal1="+cod_postal1+"&cod_postal2="+cod_postal2+"&localidade="+localidade+"&telefone="+telefone+"&reg_username="+reg_username+"&password="+password;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function doNewsletter(endereco,morada){var submit_it=false;if($("endereco").value.trim()==""){writeError("endereco","E-mail: Formato Errado.");return;}
if($("endereco").value.trim().length>50){writeError("endereco","Excedeu o número máximo de caracteres possiveis(50)!");return;}
if($("endereco").value.trim()!=""&&!$("endereco").value.isEmail()){writeError("endereco","E-mail: Formato Errado.");}else{disableError("endereco");var submit_it=true;}
if(submit_it){$("endereco").value="";var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/registaNewsletter.php?endereco="+endereco;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{writeError("endereco",xmlhttp.responseText);}}}}
function limpaFormNewsletter(){document.getElementsByTagName('morada')
document.getElementById('promo').checked=false;}
function doLogin(username,password,is_register){var submit_it=true;if(username.trim()==''&&is_register){writeError("username","Por favor insira o nome de utilizador");submit_it=false;}
if(password.trim()==''&&is_register){writeError("password","Por favor insira uma password");submit_it=false;}
if(submit_it){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/login/doLogin.php?username="+username+"&password="+password;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('login').innerHTML=xmlhttp.responseText;}}}}
function decideDisplayDiv(){if(document.getElementById("pesquisar").style.display==""){document.getElementById("pesquisar").style.display="none";document.getElementById("inserir").style.display="block";document.getElementById("pesq_label").className="float btnPesq btnPesq02 font size11 cor_branco uper";document.getElementById("ins_label").className="float btnPesq btnPesq01 font size11 cor_branco uper";}
else{document.getElementById("pesquisar").style.display="";document.getElementById("inserir").style.display="none";document.getElementById("pesq_label").className="float btnPesq btnPesq01 font size11 cor_branco uper";document.getElementById("ins_label").className="float btnPesq btnPesq02 font size11 cor_branco uper";}}
function submitPesquisaClassificados(){tipo=$("tipoP").value;ano=$("anoP").value;preco=$("precoP").value;var url='classificados/listagem.php?tipo='+tipo+'&ano='+ano+'&preco='+preco;loadDiv('links',url);}
function addFavorite(user,boat){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/barcos/addFavorite.php?user="+user+"&boat="+boat;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}
function HideContent(d){document.getElementById(d).style.display="none";}
function ShowContent(d){document.getElementById(d).style.display="block";}
function ShowHide(d){ReverseDisplay(d);var i=0;while(document.getElementById("var"+i)!=null){if(i!=d){if(document.getElementById("var"+i).style.display=="block"){document.getElementById("var"+i).style.display="none";}}
i++;}}
function ReverseDisplay(d){if(document.getElementById("var"+d).style.display=="none"){document.getElementById("var"+d).style.display="block";}
else{document.getElementById("var"+d).style.display="none";}}
function submitSugestao(){nome=$("name").value;texto=$("texto").value;email=$("email").value;submit_it=true;if(nome.trim()==""){writeError("name","Por favor insira um nome");submit_it=false;}
if(texto.trim()==""){writeError("texto","Por favor insira um texto");submit_it=false;}
if(submit_it){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/envia_sugestao.php?nome="+nome+"&texto="+texto+"&email="+email;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function validaForm(){msg="";if(document.getElementById('tipoPesq').value=="Tipo"||document.getElementById('tipoPesq').value==""){msg+="Indique o Tipo\n";}
if(document.getElementById('tipologiaPesq').value=="Escolha o Tipo sff ..."||document.getElementById('tipologiaPesq').value==""){msg+="Indique o Tipologia\n";}
if(document.getElementById('marca_pesq').value==""||(document.getElementById('marca_pesq').value==""&&document.getElementById('marcaPesqNova').value=="Insira Aqui a Nova Marca")){msg+="Indique a Marca\n";}
if(document.getElementById('modeloPesq').value==""&&document.getElementById('modeloNovoPesq').value=="Insira Aqui o Novo Modelo"){msg+="Indique o Modelo\n";}
if(document.getElementById('bandeira').value=="Bandeira"||document.getElementById('bandeira').value==""){msg+="Indique a Bandeira\n";}
if(document.getElementById('anoPesq').value=="ano"||document.getElementById('anoPesq').value==""){msg+="Indique o Ano\n";}
if(document.getElementById('precoPesq').value==""){msg+="Indique o Pre\u00E7o \n";}else{if(!isInteger(document.getElementById('precoPesq').value)){msg+="Pre\u00E7o incorrecto.\n";}}
if(document.getElementById('nomeToSend').value==""){msg+="Indique o Nome\n";}
if(document.getElementById('emailToSend').value==""){msg+="Indique o Email\n";}else{aux1=document.getElementById('emailToSend').value.indexOf("@");aux2=document.getElementById('emailToSend').value.lastIndexOf(".");if(aux1<1||aux2-aux1<2){msg+="Email Incorrecto\n";}}
if(document.getElementById('telefoneToSend').value==""){msg+="Indique o Telefone\n";}else{if(!isInteger(document.getElementById('telefoneToSend').value)){msg+="Telefone incorrecto\n";}}
if(msg==""){document.forms["myform"].submit();}else{alert(msg);}}
function submitNewClassificado(){url="http://www.siroco-nautica.pt/classificados/insere.php";var poststr="marca="+encodeURI(document.getElementById("marca_pesq").value)+"&modelo="+encodeURI(document.getElementById("modeloPesq").value)+"&texto="+encodeURI(document.getElementById("texto").value)+"&ano="+encodeURI(document.getElementById("anoPesq").value)+"&bandeira="+encodeURI(document.getElementById("bandeira").value)+"&tipologia="+encodeURI(document.getElementById("tipologiaPesq").value)+"&tipo="+encodeURI(document.getElementById("tipoPesq").value)+"&nomeToSend="+encodeURI(document.getElementById("nomeToSend").value)+"&emailToSend="+encodeURI(document.getElementById("emailToSend").value)+"&telefoneToSend="+encodeURI(document.getElementById("telefoneToSend").value)+"&preco="+encodeURI(document.getElementById("precoPesq").value);makePOSTRequest(url,poststr);function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=alertContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function alertContents(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById('links').innerHTML=result;}else{alert('There was a problem with the request.');}}}}
function toggleMarca(){if($("isNovaMarcaPesq").checked){$("marcaPesqNew").style.display="";$("marca_pesq").style.display="none";$("modeloPesq").style.display="none";$("modeloNew").style.display="";$("divIsNewModelPesq").style.display="none";$("isNovoModeloPesq").checked="checked";$F("modeloNewPesq")="Por favor insira o modelo";}else{$("marcaPesqNew").style.display="none";$("marca_pesq").style.display="";$("divIsNewModelPesq").style.display="";if(!$("isNovoModeloPesq").checked&&$F("marca").trim()!=""){$("isNovoModeloPesq").checked=false;updateModelosList();}else
$("isNovoModeloPesq").checked="checked";}}
function toggleModelo(){if($("isNovoModeloPesq").checked){$("modeloNew").style.display="";$("modeloPesq").style.display="none";}else{$("modeloNew").style.display="none";$("modeloPesq").style.display="";if($F("marca_pesq").trim()!=""){updateModelosList();}}}
function updateModelosList(){marca=$F("marca_pesq");if(!marca.isInteger()){return}
new Ajax.Request("backend/barcos/bin/get_model.php",{method:"get",parameters:{id_marca:marca},onFailure:function(){$("modeloPesq").style.display="none";$("modeloNew").style.display="";$("divIsNewModelPesq").style.display="none";$F("modeloNovoPesq")="Por favor insira o modelo";},onComplete:function(transport){xmlObj=transport.responseXML;if(!xmlObj.hasChildNodes()){try{xmlObj.loadXML(obj.responseText);}catch(e){alert('Can not parse XML.');return false;}}
var dataArray=xmlObj.getElementsByTagName("modelo");var num_results=dataArray.length;if(num_results>=1){$("modeloPesq").options.length=1;$("modeloPesq").options[0].text="Modelo";for(i=0;i<num_results;i++){var item=dataArray[i];var id_modelo=item.getElementsByTagName("id_modelo")[0].firstChild.data;var nome=item.getElementsByTagName("nome")[0].firstChild.data;var newModelo=new Option(nome,id_modelo);$("modeloPesq").options.add(newModelo);}
$("divIsNewModelPesq").style.display="";}
else{$("modeloPesq").style.display="none";$("modeloNew").style.display="";$("divIsNewModelPesq").style.display="none";$F("modeloNovoPesq")="Por favor insira o modelo";}}});}
function sendBuyRequest(){var marca=$F("marcaC");var modelo=$F("modeloC");var tipo=$F("tipoC");var tipologia=$F("tipologiaPesq");var comprimento=$F("comprimentoC");var preco=$F("precoC");var nome=$F("nomeC");var contacto=$F("contactoC");var submit_it=true;if(marca.trim()==""){writeError("marcaC","Por favor insira a marca");submit_it=false;}else
disableError("marcaC");if(modelo.trim()==""){writeError("modeloC","Por favor insira a marca");submit_it=false;}else
disableError("modeloC");if(comprimento.trim()!=""){if(!comprimento.isFloat()){writeError("comprimentoC","Comprimento incorrecto");submit_it=false;}else
disableError("comprimentoC");}else
disableError("comprimentoC");if(preco.trim()!=""){if(!preco.isFloat()){writeError("precoC","Pre\343o incorrecto");submit_it=false;}else
disableError("precoC");}else
disableError("precoC");if(nome.trim()==""){writeError("nomeC","Por favor insira o seu nome");submit_it=false;}else
disableError("nomeC");if(contacto.trim()==""){writeError("contactoC","Por favor insira um contacto");submit_it=false;}else
disableError("contactoC");if(submit_it){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/compra_venda/envia.php?marca="+marca+"&modelo="+modelo+"&tipo="+tipo+"&tipologia="+tipologia+"&comprimento="+comprimento+"&preco="+preco+"&nome="+nome+"&contacto="+contacto;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}}
function sendSellRequest(){var marca=$F("marcaV");var modelo=$F("modeloV");var tipo=$F("tipoV");var tipologia=$F("tipologiaPesq");var preco=$F("precoV");var nome=$F("nomeV");var contacto=$F("contactoV");var observacoes=$F("observacoesV");var submit_it=true;if(marca.trim()==""){writeError("marcaV","Por favor insira a marca");submit_it=false;}else
disableError("marcaV");if(modelo.trim()==""){writeError("modeloV","Por favor insira a marca");submit_it=false;}else
disableError("modeloV");if(preco.trim()!=""){if(!preco.isFloat()){writeError("precoV","Pre\343o incorrecto");submit_it=false;}else
disableError("precoV");}else
disableError("precoV");if(nome.trim()==""){writeError("nomeV","Por favor insira o seu nome");submit_it=false;}else
disableError("nomeV");if(contacto.trim()==""){writeError("contactoV","Por favor insira um contacto");submit_it=false;}else
disableError("contactoV");if(submit_it){var xmlhttp;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else
{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
var url="http://www.siroco-nautica.pt/compra_venda/envia_v.php?marca="+marca+"&modelo="+modelo+"&tipo="+tipo+"&tipologia="+tipologia+"&preco="+preco+"&nome="+nome+"&contacto="+contacto+"&observacoes="+observacoes;xmlhttp.open("GET",url,true);xmlhttp.send(null);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{document.getElementById('links').innerHTML=xmlhttp.responseText;}}}};var Shadower={shadow:function(element)
{element=$(element);var options=Object.extend({distance:8,angle:130,opacity:0.7,nestedShadows:4,color:'#000000'},arguments[1]||{});var positionStyle=Element.getStyle(element,'position');var parent=element.parentNode;if(!element.shadowZIndex)
{if(positionStyle!='absolute'&&positionStyle!='fixed')
{var placeHolder=this.idSafeClone(element);placeHolder.id=null;parent.insertBefore(placeHolder,element);Position.absolutize(element);element.style.top="120px";Position.clone(placeHolder,element);element.style.margin='0';placeHolder.style.visibility='hidden';positionStyle='absolute';}
element.shadowZIndex=new Number(Element.getStyle(element,'zIndex')?Element.getStyle(element,'zIndex'):1);element.style.zIndex=element.shadowZIndex+options.nestedShadows;}
if(arguments[2])
this.deshadow(element);if(!element.shadows)
{element.shadows=new Array(options.nestedShadows);for(var i=0;i<options.nestedShadows;i++)
{var shadow=document.createElement('div');Element.hide(shadow);shadow.appendChild(document.createTextNode(' '));if(parent)
parent.appendChild(shadow);shadow.style.position=positionStyle;shadow.style.backgroundColor=options.color;Element.setOpacity(shadow,options.opacity/options.nestedShadows);shadow.style.zIndex=element.shadowZIndex+i;element.shadows[i]=shadow;}}
var legendHeight=this.getLegendHeight(element);Position.prepare();var offsets=Position.positionedOffset(element);var topOffset=-Math.cos(-options.angle*Math.PI/180)*options.distance;var leftOffset=-Math.sin(-options.angle*Math.PI/180)*options.distance;element.shadows.each(function(shadow,i)
{shadow.style.top=Math.ceil(offsets[1]+topOffset+i+(legendHeight/2))+'px';shadow.style.left=(offsets[0]+leftOffset+i)+'px';shadow.style.width=(element.offsetWidth-(2*i))+'px';shadow.style.height=(element.offsetHeight-(2*i)-(legendHeight/2))+'px';Element.show(shadow);});},idSafeClone:function(node)
{var clone=node.cloneNode(false);if(clone.hasAttribute&&clone.hasAttribute('id'))
clone.removeAttribute('id');var clonedChildren=$A(node.childNodes).collect(this.idSafeClone.bind(this));clonedChildren.each(function(child)
{clone.appendChild(child);});return clone;},getLegendHeight:function(element)
{if(element.nodeName.toLowerCase()=='fieldset')
{var legend;$A(element.childNodes).each(function(child)
{if(child.nodeName.toLowerCase()=='legend')
{legend=child;throw $break;}});if(legend)
return Element.getDimensions(legend).height;}
return 0;},deshadow:function(element)
{element=$(element);if(element.shadows)
{element.shadows.each(Element.remove);element.shadows=null;}},shadowWithClass:function(cssClass,options)
{$$('.'+cssClass).each(function(element)
{this.shadow(element,options);}.bind(this));}}
if((typeof Prototype=='undefined')||(typeof Element=='undefined')||(typeof Element.Methods=='undefined')||parseFloat(Prototype.Version.split(".")[0]+"."+
Prototype.Version.split(".")[1])<1.5)
throw("Shadower requires the Prototype JavaScript framework >= 1.5.0");Element.getOpacity=function(element)
{var opacity;if(opacity=Element.getStyle(element,'opacity'))
return parseFloat(opacity);if(opacity=(Element.getStyle(element,'filter')||'').match(/alpha\(opacity=(.*)\)/))
if(opacity[1])return parseFloat(opacity[1])/100;return 1.0;}
Element.setOpacity=function(element,value)
{element=$(element);if(value==1)
{Element.setStyle(element,{opacity:(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});}
else
{if(value<0.00001)value=0;Element.setStyle(element,{opacity:value});if(/MSIE/.test(navigator.userAgent))
Element.setStyle(element,{filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+value*100+')'});}}