var FastInit={done:false,onload:function(){if(FastInit.done)return;FastInit.done=true;FastInit.actions.each(function(func){func();})},actions:$A([]),addOnLoad:function(){for(var x=0;x<arguments.length;x++){var func=arguments[x];if(!func||typeof func!='function')continue;FastInit.actions.push(func);}}}
if(/WebKit|khtml/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(_timer);delete _timer;FastInit.onload();}},10);}
if(document.addEventListener){document.addEventListener('DOMContentLoaded',FastInit.onload,false);FastInit.legacy=false;}
Event.observe(window,'load',FastInit.onload);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=false;this.outerBorder=false;this.resizeSpeed=10;this.maxOpacity=80;this.navType=0;this.autoResize=true;this.doAnimations=false;this.borderSize=12;this.slideInterval=4000;this.showNavigation=false;this.showClose=false;this.showDetails=false;this.showPlayPause=false;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;this.ie=false;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);};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.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 &rsaquo;</span><a href="#" id="lbNext2" class="'+this.theme+'" style="display: none;">next &rsaquo;</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('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('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="Image "+eval(this.activeSlide+1)+" of "+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="Image "+eval(this.activeImage+1)+" of "+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="Page "+eval(this.activeFrame+1)+" of "+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.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();}
var Fabtabs=Class.create();Fabtabs.prototype={initialize:function(element){this.element=$(element);if(this.element){var options=Object.extend({},arguments[1]||{});this.menu=$A(this.element.getElementsByTagName('a'));this.show(this.getInitialTab());this.menu.each(this.setupTab.bind(this));}},setupTab:function(elm){Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)},activate:function(ev){var elm=Event.findElement(ev,"a");if(elm.hasClassName("nostop"))return;if(!elm.hasClassName("anchor"))Event.stop(ev);if(elm.hasClassName("cam-trigger")){play_surfcam();}
this.show(elm);this.menu.without(elm).each(this.hide.bind(this));},hide:function(elm){try{$(elm).removeClassName('active-tab');$(this.tabID(elm)).removeClassName('active-tab-body');}catch(e){}},show:function(elm){$(elm).addClassName('active-tab');$(this.tabID(elm)).addClassName('active-tab-body');Effect.Appear($(this.tabID(elm)))},tabID:function(elm){return elm.href.match(/#(\w.+)/)[1];},getInitialTab:function(){if(this.element.getElementsByClassName("active-tab")[0]){return this.element.getElementsByClassName("active-tab")[0];}else{if(document.location.href.match(/#(\w.+)/)){var loc=RegExp.$1;var elm=this.menu.find(function(value){return value.href.match(/#(\w.+)/)[1]==loc;});return elm||this.menu.first();}else{return this.menu.first();}}}};document.observe("dom:loaded",function(){var possible_tabs=["tabs","newstabs","hometabs","searchtabs","livebuoytabs"];for(var i=0;i<possible_tabs.length;i++){if($(possible_tabs[i])){new Fabtabs(possible_tabs[i]);}}});jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};var Starboxes={options:{buttons:5,className:'default',color:false,duration:0.6,effect:{mouseover:false,mouseout:(window.Effect&&Effect.Morph)},hoverColor:false,hoverClass:'hover',ghostColor:false,ghosting:false,identity:true,indicator:true,inverse:false,locked:false,max:5,onRate:Prototype.emptyFunction,rated:false,ratedClass:'rated',rerate:false,overlay:'pointy-news.png',overlayImages:'/images/starbox/',stars:5,total:0}};eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('V.1f(h,{3m:"1.6.0.2",3l:"1.8.1",1Y:a(){3.1o("18");3.Y.2g=1;9(/^(3k?:\\/\\/|\\/)/.3i(3.5.1y)){3.1w=3.5.1y}1u{b A=/17(?:-[\\w\\d.]+)?\\.2p(.*)/;3.1w=(($$("3K 3F[v]").2j(a(B){i B.v.3p(A)})||{}).v||"").2b(A,"")+3.5.1y}},1o:a(A){9((3j 1b[A]=="3h")||(3.1q(1b[A].3e)<3.1q(3["20"+A]))){3c("36 31 "+A+" >= "+3["20"+A]);}},1q:a(A){b B=A.2b(/1v.*|\\./g,"");B=1s(B+"0".1r(4-B.2O));i A.2K("1v")>-1?B-1:B},1R:(a(B){b A=e 2B("2x ([\\\\d.]+)").2u(B);i A?(2r(A[1])<7):1P})(3I.3H),Y:a(B){B=$(B);b C=B.3E("2l"),A=1K.3C;9(C){i C}3B{C="3z"+A.2g++}3r($(C));B.3q("2l",C);i C},1F:[],3n:a(A){9(!3.1p(A.v)){3.1F.1h(A)}i A},1p:a(A){i 3.1F.2j(a(B){i B.v==A})},N:[],2a:a(A){3.N.1h(A)},1a:a(){9(!3.N[0]){3.27=25;i}3.24(3.N[0])},24:a(C){b E=[],B=C.5.23,A=3.1p(B);3.N.G(a(F){9(F.5.23==B){E.1h(F);3.N=3.N.3d(F)}}.t(3));9(!A){b D=e 3b();D.39=a(){3.1A(E,{v:B,z:D.z,I:D.I,1X:D.v})}.t(3);D.v=h.1w+B}1u{3.1A(E,A)}},1A:a(B,A){B.G(a(C){C.1e=A;C.1V()});3.1a()},1t:(a(A){i{1c:"1c",S:"S",H:(A?"2U":"H")}})(18.19.1m),2e:a(A){9(!18.19.1m){A=A.2N(a(E,D){b C=V.2L(3)?3:3.l,B=D.2I;9(B!=C&&!$A(C.2H("*")).2F(B)){E(D)}})}i A}});h.1Y();2D.1Q("2A:2y",h.1a.t(h));b 2w=2v.2t({2s:a(A,B){3.l=$(A);3.j=B;3.5=V.1f(V.2q(h.5),1K[2]||{});$w("J f u q").G(a(C){3[C]=3.5[C]}.t(3));3.W=3.5.W||(3.f&&!3.5.1O);9(!3.J){3.J=h.Y(3.l)}9(3.5.o&&(3.5.o.S||3.5.o.H)){h.1o("3G")}h.2a(3);9(h.27){h.1a()}},2o:a(){$w("H S 1c").G(a(C){b B=C.2n(),A=3["1j"+B].3D(3);3["1j"+B+"1L"]=(C=="H"&&!18.19.1m)?h.2e(A):A;3.16.1Q(h.1t[C],3["1j"+B+"1L"])}.t(3));3.M.2k("c",{2i:"3A"})},2h:a(){$w("S H 1c").G(a(A){3.16.3v(h.1t[A],3["1j"+A.2n()+"1L"])}.t(3));3.M.2k("c",{2i:"3u"})},1V:a(){3.13=3.1e.I;3.12=3.1e.z;3.1G=3.1e.1X;3.X=3.13*3.5.1n;3.14=3.X/3.5.M;3.1i=3.5.u/3.5.M;9(3.5.o){3.2d=3.11(0);3.2c=3.11(3.5.u)}b A={L:{O:"L",1l:0,s:0,I:3.X+"k",z:3.12+"k"},1E:{O:"29",I:3.X+"k",z:3.12+"k"},28:{O:"L",1l:0,s:0,I:3.13+"k",z:3.12+"k"}};3.l.U("17");3.26=e m("p",{T:3.5.T||""}).c({O:"29"}).n(3.15=e m("p").n(3.1g=e m("p").n(3.1C=e m("p",{T:"1n"}).c(V.1f({3g:"22"},A.1E)))));9(3.f){3.15.U("f")}9(3.W){3.15.U("W")}9(3.5.1S){3.1C.n(3.K=e m("p",{T:"K"}).c(A.L));9(3.5.21){3.K.c({Z:3.5.21})}9(3.5.o){3.K.x=3.K.Y()}3.R(3.K,3.j,(1b.P&&P.1B))}3.1C.n(3.r=e m("p",{T:"r"}).c(A.L)).n(e m("p").c(A.L).n(3.16=e m("p").c(A.1E)));9(3.5.1z){3.r.c({Z:3.5.1z})}9(3.5.o){3.r.x=3.r.Y()}3.5.1n.1r(a(B){b C;3.16.n(C=e m("p").c(V.1f({Z:"3a("+3.1G+") 1l s 38-37",s:3.13*B+"k"},A.28)));C.c({s:3.13*B+"k"});9(h.1R){C.c({Z:"35",34:"33:32.30.2Z(v=\'"+3.1G+"\'\', 2Y=\'2X\')"})}}.t(3));3.M=[];3.5.M.1r(a(D){b C,B=3.5.1W?3.X-3.14*(D+1):3.14*D;3.16.n(C=e m("p").c({O:"L",1l:0,s:B+"k",I:3.14+(18.19.1m?1:0)+"k",z:3.12+"k"}));C.y=3.1i*D+3.1i;3.M.1h(C)}.t(3));3.R(3.r,3.j);3.l.1Z(3.26);3.1x={};$w("j u f 1d q").G(a(B){3.l.n(3.1x[B]=e m("2W",{2V:"22",3f:3.J+"1v"+B,1U:""+(B=="1d"?!!3[B]:3[B])}))}.t(3));9(3.5.Q){3.1g.n(3.Q=e m("p",{T:"Q"}));3.1D()}9(!3.W){3.2o()}},1T:a(A){9(3.f&&3.5.1O){3.j=(3.q*3.j-3.f)/(3.q-1||1)}b B=3.f?3.q:3.q++;3.j=(3.j==0)?A:(3.j*(3.f?B-1:B)+A)/(3.f?B:B+1)},1D:a(){3.Q.1Z(e 2T(3.5.Q).2S({u:3.5.u,q:3.q,j:(3.j*10).2R()/10}))},11:a(B){b A=(3.X-(B/3.1i)*3.14);i 1s(3.5.1W?A.2Q():-1*A.3o())},R:a(A,B){9(3.5.o&&3["1I"+A.x]){P.2P.2M(A.x).3s(3["1I"+A.x])}b D=3.11(B);9(1K[2]){b C=1s(A.3t("s")),F=3.11(B);9(C==F){i}b E=((3.2c-(C-F).1H()).1H()/3.2d.1H()).2J(2);3["1I"+A.x]=e P.1B(A,{3w:{s:D+"k"},3x:{O:"3y",2G:1,x:A.x},2f:(3.5.2f*E)})}1u{A.c({s:D+"k"})}},2E:a(C){b B=C.l();9(!B.y){i}3.1T(B.y);9(3.5.Q){3.1D()}9(3.5.1S){3.R(3.K,3.j,(1b.P&&P.1B))}9(!3.f){3.15.U("f")}3.1d=!!3.f;3.f=B.y;9(!3.5.1O){3.2h();3.15.U("W");3.2m(C)}b A={};$w("j J u f 1d q").G(a(D){9(D!="J"){3.1x[D].1U=3[D]}A[D]=3[D]}.t(3));3.5.2C(3.l,A);3.l.1J("17:f",A)},2m:a(A){3.R(3.r,3.j,(3.5.o&&3.5.o.H));3.1N=1P;9(3.5.1k){3.1g.2z(3.5.1k)}9(3.5.1M){3.r.c({Z:3.5.1z})}3.l.1J("17:s")},3J:a(B){b A=B.l();9(!A.y){i}3.R(3.r,A.y,(3.5.o&&3.5.o.S));9(!3.1N&&3.5.1k){3.1g.U(3.5.1k)}3.1N=25;9(3.5.1M){3.r.c({Z:3.5.1M})}3.l.1J("17:3L",{Y:3.5.J,u:3.5.u,y:A.y,q:3.q})}});',62,234,'|||this||options||||if|function|var|setStyle||new|rated||Starboxes|return|average|px|element|Element|insert|effect|div|total|colorbar|left|bind|max|src||scope|rating|height|||||||each|mouseout|width|identity|ghost|absolute|buttons|buildQueue|position|Effect|indicator|setBarPosition|mouseover|className|addClassName|Object|locked|boxWidth|identify|background||getBarPosition|starHeight|starWidth|buttonWidth|status|starbar|starbox|Prototype|Browser|processBuildQueue|window|click|rerated|imageInfo|extend|hover|push|buttonRating|on|hoverClass|top|IE|stars|require|getCachedImage|convertVersionString|times|parseInt|useEvent|else|_|imageSource|inputs|overlayImages|color|buildBatch|Morph|wrapper|updateIndicator|base|imagecache|starSrc|abs|activeEffect_|fire|arguments|_cached|hoverColor|hovered|rerate|false|observe|fixIE|ghosting|updateAverage|value|build|inverse|fullsrc|load|update|REQUIRED_|ghostColor|hidden|overlay|cacheBuildBatch|true|container|batchLoading|star|relative|queueBuild|replace|maxPosition|zeroPosition|capture|duration|counter|disable|cursor|find|invoke|id|onMouseout|capitalize|enable|js|clone|parseFloat|initialize|create|exec|Class|Starbox|MSIE|loaded|removeClassName|dom|RegExp|onRate|document|onClick|member|limit|select|relatedTarget|toFixed|indexOf|isElement|get|wrap|length|Queues|ceil|round|evaluate|Template|mouseleave|type|input|scale|sizingMethod|AlphaImageLoader|Microsoft|requires|DXImageTransform|progid|filter|none|Lightview|repeat|no|onload|url|Image|throw|without|Version|name|overflow|undefined|test|typeof|https|REQUIRED_Scriptaculous|REQUIRED_Prototype|cacheImage|floor|match|writeAttribute|while|remove|getStyle|auto|stopObserving|style|queue|end|starbox_|pointer|do|callee|bindAsEventListener|readAttribute|script|Scriptaculous|userAgent|navigator|onMouseover|head|changed'.split('|'),0,{}));var BBcode={insert:function(f,text){f=$(f);if(document.selection){f.focus();var sel=document.selection.createRange();sel.text=text;}else if(f.selectionStart||f.selectionStart=='0'){var startPos=f.selectionStart;var endPos=f.selectionEnd;f.value=f.value.substring(0,startPos)+text+f.value.substring(endPos,f.value.length);}else{f.value+=text;}
f.focus();},tag:function(t,f){var f=$(f);var start_tag="["+t+"]";var end_tag="[\/"+t+"]";if(document.selection){f.focus();var selected=document.selection.createRange().text;var sel=document.selection.createRange();sel.text=start_tag+selected+end_tag;}else if(f.selectionStart||f.selectionStart=='0'){var startPos=f.selectionStart;var endPos=f.selectionEnd;var text=start_tag+f.value.substring(startPos,endPos)+end_tag;f.value=f.value.substring(0,startPos)+text+f.value.substring(endPos,f.value.length);}else{f.value+=start_tag+end_tag;}
f.focus();},url:function(f){var url=prompt("Please enter the url","http://");if(url){var text="[url="+url+"]"+"Link"+"[\/url]";BBcode.insert(f,text);}},image:function(f){var url=prompt("Please enter the image url","http://");if(url){var text="[img]"+url+"[\/img]";BBcode.insert(f,text);}},yvideo:function(f){var url=prompt("Please enter the youtube video url","http://");if(url){var text="[youtube]"+url+"[\/youtube]";BBcode.insert(f,text);}},gvideo:function(f){var url=prompt("Please enter the google video url","http://");if(url){var text="[gvideo]"+url+"[\/gvideo]";BBcode.insert(f,text);}}}
var num_days;function saveStar(element,memo){memo["element_id"]=element.id;new Ajax.Request('/votes/create',{parameters:memo,onComplete:function(transport){var indicator=element.down('.indicator');response=transport.responseJSON;if(response.result=="succeeded"){indicator.update('You rated '+(memo.rated).toFixed(1));window.setTimeout(function(){indicator.update('Thanks for voting!')},2000);new Effect.Highlight(indicator);window.setTimeout(function(){indicator.update(response.average+' rating from '+response.total+' votes')},4000);}else if(response.result=="not_logged_in"){indicator.update("Please sign in");}else{indicator.update('You voted already.');window.setTimeout(function(){indicator.update(response.average+' rating from '+response.total+' votes')},4000);}}});}
function day_of_week(n){switch(n){case 0:return"Sunday";break;case 1:return"Monday";break;case 2:return"Tuesday";break;case 3:return"Wednesday";break;case 4:return"Thursday";break;case 5:return"Friday";break;case 6:return"Saturday";break;}}
function ord(n){var map={1:'st',21:'st',31:'st',2:'nd',22:'nd',3:'rd',23:'rd'};return n+(map[n]||"th");}
function makeDate(year,month,day){today=new Date();today.setHours("23");today.setMinutes("59");today.setSeconds("59");today.setDate(day);today.setMonth((month-1));today.setFullYear(year);return today;}
function checkdate(days){firstDay(days)
$('date').value=yesterday.getFullYear()+"-"+(yesterday.getMonth()+1)+"-"+yesterday.getDate();$('Day').value=yesterday.getDate()
$('Month').value=yesterday.getMonth()+1;$('Year').value=yesterday.getFullYear();$('teetimes').submit();}
function addDaysToDate(myDate,days){return new Date(myDate.getTime()+days*24*60*60*1000);}
function add_image(id,title,type){$('showimages').show();var newtr=document.createElement("tr");var newtd1=document.createElement("td");var newtd2=document.createElement("td");newtd1.innerHTML="<input type='hidden' name='"+type+"[]' value='"+id+"'/><img src='"+title+"' />";newtd2.innerHTML="<div id='remove_image'><a onclick='$(this).up(\"tr\").remove(); return false;' href='#'>Remove image</a></div>";newtr.appendChild(newtd1);newtr.appendChild(newtd2);$(type).appendChild(newtr);}
function insert_tincymce_image(uri){tinyMCE.execCommand('mceInsertRawHTML',true,"<img src='"+uri+"' />");}
function insert_asset_id(id,uri,target){$('asset_id').value=id;$(target).innerHTML="<img src='"+uri+"' width='80'/>"}
function clearText(field){if(field.defaultValue==field.value)field.value='';else if(field.value=='')field.value=field.defaultValue;}
function play_surfcam(){var s1=new SWFObject("/mediaplayer/player.swf","ply","510","410","9");s1.addVariable("file",$('filename').value+".flv");s1.addVariable("streamer","rtmpt://fml.lax.0FA4.edgecastcdn.net/200FA4");s1.addVariable("autostart","true");s1.addVariable('flashvars','&backcolor=111111&frontcolor=cccccc&lightcolor=096FA7');s1.addParam("allowfullscreen","true");s1.addParam("wmode","opaque");s1.addParam("allowscriptaccess","always");s1.write("video_container");if($("video-timeout")&&$("video_container")){var timeout=120000;if(jQuery.cookie("surfcam_restart")){timeout=600000;}
setTimeout(function(){jQuery("#video_container").children().replaceWith(jQuery("#video-timeout").css({display:"block"}));},timeout);}}
function play_archived_surfcam(){var s1=new SWFObject("/mediaplayer/player.swf","ply","510","410","9");s1.addVariable("file","http://replays.swellnet.com.au"+$('directory').value+"/"+$('flvfilename').value);s1.addVariable("streamer","lighttpd");s1.addVariable("autostart","true");s1.addVariable('flashvars','&backcolor=111111&frontcolor=cccccc&lightcolor=096FA7');s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always");s1.addParam("wmode","opaque");s1.write("video_container");}
function play_video(){var s1=new SWFObject("/mediaplayer/player.swf","ply","620","369","9","#FFFFFF");s1.addVariable("file",jQuery('#filename').val());s1.addVariable("image",jQuery('#thumbnail').val());s1.addVariable('flashvars','&backcolor=111111&frontcolor=cccccc&lightcolor=096FA7');s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always");s1.addParam("wmode","opaque");s1.write("video");}
document.observe("dom:loaded",function(){if($('showtools')){Element.observe('showtools','click',function(){Effect.toggle('yourtools','blind',{duration:0.5});Element.toggleClassName('showtools','showtools');Element.toggleClassName('showtools','showtoolsopen');});$('yourtools').hide();}
if($('showtextile')){Element.observe('showtextile','click',function(){Effect.toggle('textile','blind',{duration:0.5});Element.toggleClassName('textile','showtextile');Element.toggleClassName('showtextile','showtextileopen');});$('textile').hide();}
$$("#meta a").each(function(a){a.observe("click",function(e){if(element=a.href.match(/#(\w.+)/)){$(element[1]).toggleClassName('panel');Event.stop(e);}});});if($("new_image_set")){$("new_image_set").observe("click",function(e){new Ajax.Request(this.rel,{method:'post',parameters:Form.serialize('uploadform',true),onSuccess:function(transport){var json=transport.responseText.evalJSON();if(json["image_set"]!=undefined){$("asset_image_set_id").insert("<option value=\""+json.image_set.id+"\">"+json.image_set.name+"</option>");}
$("newset").hide();}});});}
if(elements=$$('a[rel="remove_parent"]')){for(var i=0;i<elements.length;i++){elements[i].observe("click",function(e){$(this).up(this.className).remove();Event.stop(e);});}}
if(Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6){var elements=$$(".imgfilter");for(var i=0;i<elements.length;i++){var style="progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+elements[i].src+"', sizingMethod='scale');";elements[i].style.filter=style;}}
if(typeof(MediaSmart)!='undefined'){MediaSmart.area=$$("body").first().rel;MediaSmart.insertAllAds();}
jQuery("a#restart-video").live("click",function(e){e.preventDefault();pageTracker._trackPageview(location.href+"#reload");jQuery.cookie("surfcam_restart",true,(1/24));location.reload();});});var autoPlayEnabled=true;var autoPlayHandle=0;var slowSpeed=15000;var mediumSpeed=10000;var fastSpeed=5000;var fullDisplayAdvanceTime=mediumSpeed;var Gallery=function(container,items,indicators,options){this.container=container;this.items=items;this.indicators=indicators;this.options=options||{};this.current_item=0;this.current_indicator=this.indicators[0];if(this.container&&this.items.length>2)this.init();};Gallery.prototype={init:function(){if(this.indicators.length)this._setControlEvents();this._setAutoPlay();},next:function(){if((this.current_item+++1)>=this.items.length){this.current_item=0;}
this._goToItem(this.current_item);},_goToItem:function(item_index){this.current_item=item_index;this._updateIndicators();this.options.animate_method?this.options.animate_method.call(this):this._defaultAnimation();},_defaultAnimation:function(){new Effect.Morph(this.container,{style:{marginTop:(this.current_item*this.items[this.current_item].offsetHeight)*-1+"px"},duration:0.25});},_updateIndicators:function(){if(this.current_indicator)$(this.current_indicator).removeClassName("selected");this.current_indicator=this.indicators[this.current_item];$(this.current_indicator).addClassName("selected");},_setControlEvents:function(){var scope=this;for(var i=0;i<this.indicators.length;i++){$(scope.indicators[i]).observe("click",function(e){var item=parseInt(this.rel.split('-')[1])-1;scope._goToItem(item);clearInterval(scope._timeout);scope._setAutoPlay();Event.stop(e);});}},_setAutoPlay:function(){if(this.options.auto_play_timeout){var scope=this;this._timeout=setInterval(function(){scope.next()},this.options.auto_play_timeout);}}};var horizontal_gallery_anim=function(){new Effect.Morph(this.container,{style:{marginLeft:(this.current_item*this.items[this.current_item].offsetWidth+this.current_item)*-1+"px"},duration:0.25});}
new Gallery($("homecontent"),$$("#homecontent .slide"),$$("#hometabs li a"),{auto_play_timeout:5000});new Gallery($$(".story .gallery-content")[0],$$(".story .gallery-content img"),$$(".story li a"),{auto_play_timeout:5000,animate_method:horizontal_gallery_anim});new Gallery($$(".teaser .gallery-content")[0],$$(".teaser .gallery-content img"),$$(".teaser li a"),{auto_play_timeout:5000,animate_method:horizontal_gallery_anim});function addLoadingOverlay(target){var container=jQuery("<div class=\"loaderOverlay\" />");container.css({width:jQuery(target).find("img").width(),height:jQuery(target).find("img").height()});var img=jQuery("<img src=\"/images/loadingAnimation.gif\" alt=\"Loading...\" />");container.append(img);img.css({marginTop:target.height()-10});target.prepend(container);container.fadeIn();}
function removeLoadingOverlay(target){target.find(".loaderOverlay").fadeOut(function(){jQuery(this).remove();});}
jQuery(function(){jQuery("#autoplay").click(toggleAutoplay);jQuery(".speed").click(switchSpeed);jQuery("#previous").click(previousImage);jQuery("#next").click(nextImage);jQuery("#gallery_thumbs li a").click(function(e){e.preventDefault();jQuery("ul#gallery_thumbs li.current").removeClass("current");jQuery(this).parent().addClass("current");var new_image=jQuery(this).parent().attr("data-largeurl");loadNewImage(jQuery("#gallery_large_image img"),new_image);updateGalleryPosition();});if(jQuery("#gallery_thumbs li").length>1){startAutoplay();}else{jQuery("#gallery_controls").fadeOut();}});function startAutoplay(){autoPlayHandle=setTimeout("autoPlayTick()",fullDisplayAdvanceTime);autoPlayEnabled=true;jQuery("#autoplay").addClass("enabled");jQuery("#autoplay").siblings(".ui-icon").removeClass("ui-icon-pause").addClass("ui-icon-play");}
function stopAutoplay(){if(autoPlayHandle!=0){clearTimeout(autoPlayHandle);autoPlayEnabled=false;jQuery("#autoplay").removeClass("enabled");jQuery("#autoplay").siblings(".ui-icon").removeClass("ui-icon-play").addClass("ui-icon-pause");}}
function resetAutoplayTimer(){stopAutoplay();startAutoplay();}
function autoPlayTick(){autoPlayHandle=setTimeout("autoPlayTick()",fullDisplayAdvanceTime);nextImage(null);}
function toggleAutoplay(e){e.preventDefault();jQuery(this).toggleClass("enabled");if(autoPlayEnabled)
stopAutoplay();else
startAutoplay();}
function switchSpeed(e){e.preventDefault();jQuery("a.speed").parent("li").removeClass("enabled");jQuery(this).addClass("enabled");speed=jQuery(this).attr("data-speed");switch(speed){case"slow":fullDisplayAdvanceTime=slowSpeed;break;case"medium":fullDisplayAdvanceTime=mediumSpeed;break;case"fast":fullDisplayAdvanceTime=fastSpeed;break;}}
function previousImage(e){e.preventDefault();images=jQuery("ul#gallery_thumbs li");active=jQuery("ul#gallery_thumbs .current");next_image=active.prev();if(parseInt(active.attr("data-index"))==1){next_image=jQuery(images[images.length-1]);}
loadNewImage(jQuery("#gallery_large_image img"),next_image.attr("data-largeurl"));active.removeClass("current");next_image.addClass("current");}
function nextImage(e){try{e.preventDefault();}catch(ex){}
images=jQuery("ul#gallery_thumbs li");active=jQuery("ul#gallery_thumbs .current");next_image=active.next();if(parseInt(active.attr("data-index"))==images.length){next_image=jQuery(images[0]);}
loadNewImage(jQuery("#gallery_large_image img"),next_image.attr("data-largeurl"));active.removeClass("current");next_image.addClass("current");updateGalleryPosition();}
function loadNewImage(target,source){var img=new Image();jQuery(img).bind("load",function(){target.fadeOut(function(){jQuery(this).replaceWith(img);jQuery(img).fadeIn(function(){removeLoadingOverlay(jQuery("#gallery_large_image"));});});}).css({display:"none"});addLoadingOverlay(jQuery("#gallery_large_image"));jQuery(img).attr("src",source);updateGalleryPosition();}
function updateGalleryPosition(){total_images=jQuery("ul#gallery_thumbs li").length;current_position=parseInt(jQuery("ul#gallery_thumbs li.current").attr("data-index"));jQuery("li#gallery_position").text(current_position+" of "+total_images);resetAutoplayTimer();}
var emoticons={"emoticon":{"::smile":{"image":"icon2.png","emotes":{":-)":"",":-\\":"",":)":"",":]":"","=]":"","=)":"","=/":""}},"::bigSmile":{"image":"icon1.png","emotes":{":D":"","=D":"",":-D":""}},"::shock":{"image":"icon4.png","emotes":{":O":"",":0":"","=O":"",":-0":"",":-O":""}},"::frown":{"image":"icon14.png","emotes":{":-(":"","=(":"",":[":"",":<":"","=[":"",":(":""}},"::tongue":{"image":"icon11.png","emotes":{":P":"","=P":""}},"::bored":{"image":"icon10.png","emotes":{"=I":"",":/":"",":-\\":"",":|":""}},"::wink":{"image":"icon8.png","emotes":{";-)":"",";)":"",";]":""}},"::love":{"image":"icon16.png","emotes":{"<3":"","S2":"",":3":""}},"::confused":{"image":"icon9.png","emotes":{":S":"","=S":"",":\\?":""}}}};RegExp.escape=function(text){if(!arguments.callee.sRE){var specials=['/','.','*','+','?','|','(',')','[',']','{','}','\\'];arguments.callee.sRE=new RegExp('(\\'+specials.join('|\\')+')','g');}
return text.replace(arguments.callee.sRE,'\\$1');};(function($){$.fn.emoticon=function(theText){var imagePath="/images/smileys/icons/";var newText=theText;for(var a in emoticons.emoticon){emoticon=emoticons.emoticon[a];for(var emote in emoticon.emotes){emote=RegExp.escape(emote);newText=newText.replace(new RegExp(emote,'gi'),'<img src="'+imagePath+emoticon.image+'" class="smiley" />');}}
return newText;}})(jQuery);(function($){var textarea;var options;var disable_buttons=new Object();var store_event;var store_data=new Array('');var undo_pos=0;var ie_cache=null;var ie_btn=null;var lb='\n';var pause=false;$.fn.bbcodeeditor=function(opt)
{options=$.extend({},$.fn.bbcodeeditor.defaults,opt);textarea=this;if(!$.browser.opera)textarea.keydown(key_handler);else textarea.keypress(key_handler);if($.browser.msie){$(document).mousedown(function(e){if(ie_btn!=null&&ie_btn==textarea[0])ie_cache=document.selection.createRange();ie_btn=e.target;});}
if($.browser.msie||$.browser.opera)lb='\r\n';if(options.bold!=false)options.bold.click(function(){print_bbc('bold text','[b]','[/b]')});if(options.italic!=false)options.italic.click(function(){print_bbc('italic text','[i]','[/i]')});if(options.underline!=false)options.underline.click(function(){print_bbc('underline text','[u]','[/u]')});if(options.link!=false)options.link.click(add_link);if(options.quote!=false)options.quote.click(function(){print_bbc('quote','[quote]','[/quote]',true)});if(options.code!=false)options.code.click(function(){print_bbc('function(event) {','[code]','[/code]',true)});if(options.image!=false)options.image.click(add_image);if(options.nlist!=false)options.nlist.click(function(){print_bbc('list item','[list=1]'+lb+'[*]','[/list]',true)});if(options.blist!=false)options.blist.click(function(){print_bbc('list item','[list]'+lb+'[*]','[/list]',true)});if(options.litem!=false)options.litem.click(function(){print_bbc('list item','[*]','',true)});if(options.usize!=false)options.usize.click(function(){font_size(true)});try{if(options.back!=false)
{if(options.back_disable!=false)disable_buttons.back=options.back[0].className;options.back.click(go_back);enable_back(false);}
if(options.forward!=false)
{if(options.forward_disable!=false)disable_buttons.forward=options.forward[0].className;options.forward.click(go_forward);enable_forward(false);}
if(options.back!=false||options.forward!=false)textarea.keyup(backup_handler);}catch(e){}
$.fn.bbcodeeditor.preview();window.onbeforeunload=exit_page;return this;};function enable_back(bool)
{if(!bool)
{if(options.back_disable==false)
{options.back.css('opacity',0.5);}
else if(options.back!=false)
{options.back[0].className=options.back_disable;}}
else
{if(options.back_disable==false)
{options.back.css('opacity',1);}
else if(options.back!=false)
{options.back[0].className=disable_buttons.back;}}}
function enable_forward(bool)
{if(!bool)
{if(options.forward_disable==false)
{options.forward.css('opacity',0.5);}
else if(options.forward!=false)
{options.forward[0].className=options.forward_disable;}}
else
{if(options.forward_disable==false)
{options.forward.css('opacity',1);}
else if(options.forward!=false)
{options.forward[0].className=disable_buttons.forward;}}}
function exit_page(e)
{if(options.exit_warning&&!pause&&textarea[0].value!="")
{var e=e||window.event;if(e)
{e.returnValue='You have started writing a post.';}
return'You have started writing a post.';}}
function backup_handler(e)
{if($.browser.msie)ie_cache=document.selection.createRange();if(e.keyCode!=17&&!(e.ctrlKey&&(e.keyCode==89||e.keyCode==90)))
{if(textarea.val().length!=0)enable_back(true);else enable_back(false);if(undo_pos!=0)
{store_data.slice(0,store_data.length-undo_pos);enable_forward(false);undo_pos=0;}
if(e.keyCode==8||e.keyCode==13||e.keyCode==32||e.keyCode==46||(e.ctrlKey&&(e.keyCode==67||e.keyCode==86)))backup();$.fn.bbcodeeditor.preview();}}
function key_handler(e)
{if($.browser.msie)ie_cache=document.selection.createRange();if(options.keyboard&&e.ctrlKey)
{if(e.keyCode==66&&options.bold!=false)
{e.preventDefault();print_bbc('bold text','[b]','[/b]');}
else if(e.keyCode==73&&options.italic!=false)
{e.preventDefault();print_bbc('italic text','[i]','[/i]');}
else if(e.keyCode==75&&options.code!=false)
{e.preventDefault();print_bbc('function(event) {','[code]','[/code]',true);}
else if(e.keyCode==76&&options.link!=false)
{e.preventDefault();add_link();}
else if(e.keyCode==80&&options.image!=false)
{e.preventDefault();add_image();}
else if(e.keyCode==81&&options.quote!=false)
{e.preventDefault();print_bbc('quote','[quote]','[/quote]',true);}
else if(e.keyCode==85&&options.underline!=false)
{e.preventDefault();print_bbc('underline text','[u]','[/u]');}
else if(e.keyCode==89&&options.forward!=false)
{e.preventDefault();go_forward();}
else if(e.keyCode==90&&options.back!=false)
{e.preventDefault();go_back();}}
if(e.keyCode==13){var start=selection_range().start;var line=textarea[0].value.substring(0,start).lastIndexOf('\n');line=(line==-1?0:line+1);var matches=textarea[0].value.substring(line,start).match(/^\t+/g);if(matches!=null)
{e.preventDefault();var scroll_fix=fix_scroll_pre();var tabs=lb;for(var i=0;i<matches[0].length;i++)tabs+='\t';textarea[0].value=textarea[0].value.substring(0,start)+tabs+textarea[0].value.substring(start);set_focus(start+tabs.length,start+tabs.length);fix_scroll(scroll_fix);}}
else if(e.keyCode==9)
{e.preventDefault();var scroll_fix=fix_scroll_pre();backup();var range=selection_range();if(range.start!=range.end&&textarea[0].value.substr(range.start,1)=='\n')range.start++;var matches=textarea[0].value.substring(range.start,range.end).match(/\n/g);if(matches!=null)
{var index=textarea[0].value.substring(0,range.start).lastIndexOf(lb);var start_tab=(index!=-1?index:0);if(!e.shiftKey)
{var tab=textarea[0].value.substring(start_tab,range.end).replace(/\n/g,'\n\t');textarea[0].value=(index==-1?'\t':'')+textarea[0].value.substring(0,start_tab)+tab+textarea[0].value.substring(range.end);set_focus(range.start+1,range.end+matches.length+1);}
else
{var i=(textarea[0].value.substr((index!=-1?index+lb.length:0),1)=='\t'?1:0);var removed=textarea[0].value.substring(start_tab,range.end).match(/\n\t/g,'\n');if(index==-1&&textarea[0].value.substr(0,1)=='\t')
{textarea[0].value=textarea[0].value.substr(1);removed.push(0);}
var tab=textarea[0].value.substring(start_tab,range.end).replace(/\n\t/g,'\n');textarea[0].value=textarea[0].value.substring(0,start_tab)+tab+textarea[0].value.substring(range.end);set_focus(range.start-i,range.end-(removed!=null?removed.length:0));}}
else
{if(!e.shiftKey)
{textarea[0].value=textarea[0].value.substring(0,range.start)+'\t'+textarea[0].value.substring(range.start);set_focus(range.start+1,range.start+1);}
else
{var i_o=textarea[0].value.substring(0,range.start).lastIndexOf('\n');var i_s=(i_o==-1?0:i_o);var i_e=textarea[0].value.substring(i_s+1).indexOf('\n');if(i_e==-1)i_e=textarea[0].value.length;else i_e+=i_s+1;if(i_o==-1)
{var match=textarea[0].value.substring(i_s,i_e).match(/^\t/);var tab=textarea[0].value.substring(i_s,i_e).replace(/^\t/,'');}
else
{var match=textarea[0].value.substring(i_s,i_e).match(/\n\t/);var tab=textarea[0].value.substring(i_s,i_e).replace(/\n\t/,'\n');}
textarea[0].value=textarea[0].value.substring(0,i_s)+tab+textarea[0].value.substring(i_e);if(match!=null)set_focus(range.start-(range.start-1>i_o?1:0),range.end-((range.start-1>i_o||range.start!=range.end)?1:0));}}
fix_scroll(scroll_fix);}}
function fix_scroll_pre()
{return{scrollTop:textarea.scrollTop(),scrollHeight:textarea[0].scrollHeight}}
function fix_scroll(obj)
{textarea.scrollTop(obj.scrollTop+textarea[0].scrollHeight-obj.scrollHeight);}
function backup()
{undo_pos=0;enable_forward(false);enable_back(true);if(store_data[store_data.length-1]!=textarea[0].value)store_data.push(textarea[0].value);}
function go_back()
{var scrollTop=textarea.scrollTop();if(undo_pos==0)
{backup();undo_pos++;}
if(undo_pos!=store_data.length)
{undo_pos++;textarea[0].value=store_data[store_data.length-undo_pos];$.fn.bbcodeeditor.preview();enable_forward(true);if(undo_pos==store_data.length)enable_back(false);}
textarea.scrollTop(scrollTop);};function go_forward()
{var scrollTop=textarea.scrollTop();if(undo_pos>1)
{textarea[0].value=store_data[store_data.length---undo_pos];$.fn.bbcodeeditor.preview();enable_back(true);if(undo_pos==1)enable_forward(false);}
textarea.scrollTop(scrollTop);};function print_bbc(txt,open,close,clean_line)
{backup();var range=selection_range();var scroll_fix=fix_scroll_pre();if(clean_line)
{if(close!='[/list]'&&open!='[*]')open=open+lb;if(open!='[*]')close=lb+close;if(range.start!=0&&textarea[0].value.substr(range.start-1,1)!=lb.substr(0,1))open=lb+open;if(textarea[0].value.length!=range.end&&textarea[0].value.substr(range.end,1)!=lb.substr(0,1))close=close+lb;}
if(range.start!=range.end)
{txt=textarea[0].value;if(clean_line)
{var re_b=new RegExp('\\['+close.substring((lb.length==2?4:3),close.length-1)+'(.*?)'+'\\]'+lb+(close==lb+'[/list]'?'\\[\\*\\]':'')+'$');var re_a=new RegExp('^'+lb+'\\[\/'+close.substring((lb.length==2?4:3),close.length-1)+'\\]');}
else
{var re_b=new RegExp('\\['+close.substring(2,close.length-1)+'([^\\]]*?)\\]$','g');var re_a=new RegExp('^\\[\/'+close.substring(2,close.length-1)+'\\]','g');}
var m_b=txt.substring(0,range.start).match(re_b);var m_a=txt.substring(range.end).match(re_a);if(m_b!=null&&m_a!=null)
{textarea[0].value=txt.substring(0,range.start).replace(re_b,'')+txt.substring(range.start,range.end)+txt.substring(range.end).replace(re_a,'');set_focus(range.start-m_b[0].length,range.end-m_b[0].length);}
else
{textarea[0].value=textarea[0].value.substr(0,range.start)+open+textarea[0].value.substring(range.start,range.end)+close+textarea[0].value.substr(range.end);set_focus(range.start+open.length,range.end+open.length);}}
else
{textarea[0].value=textarea[0].value.substring(0,range.start)+open+txt+close+textarea[0].value.substring(range.end);set_focus(range.start+open.length,range.start+open.length+txt.length);}
fix_scroll(scroll_fix);$.fn.bbcodeeditor.preview();};function set_focus(start,end)
{if(!$.browser.msie)
{textarea[0].setSelectionRange(start,end);textarea.focus();}
else
{var m_s=textarea[0].value.substring(0,start).match(/\r/g);m_s=(m_s!=null?m_s.length:0);var m_e=textarea[0].value.substring(start,end).match(/\r/g);m_e=(m_e!=null?m_e.length:0);var range=textarea[0].createTextRange();range.collapse(true);range.moveStart('character',start-m_s);range.moveEnd('character',end-start-m_e);range.select();ie_cache=document.selection.createRange();}};function font_size(increase)
{if(increase)print_bbc('text','[size=150]','[/size]');else print_bbc('text','[size=80]','[/size]');}
function add_image()
{var link='http://';print_bbc(link,'[img]','[/img]');};function add_link(image)
{var link="http://";print_bbc('link text','[url='+link+']','[/url]');};function selection_range()
{if(!$.browser.msie)
{return{start:textarea[0].selectionStart,end:textarea[0].selectionEnd}}
else
{if(ie_cache==null)return{start:textarea[0].value.length,end:textarea[0].value.length};var selection_range=ie_cache.duplicate();var before_range=document.body.createTextRange();before_range.moveToElementText(textarea[0]);before_range.setEndPoint("EndToStart",selection_range);var after_range=document.body.createTextRange();after_range.moveToElementText(textarea[0]);after_range.setEndPoint("StartToEnd",selection_range);var before_finished=false,selection_finished=false,after_finished=false;var before_text,untrimmed_before_text,selection_text,untrimmed_selection_text,after_text,untrimmed_after_text;before_text=untrimmed_before_text=before_range.text;selection_text=untrimmed_selection_text=selection_range.text;after_text=untrimmed_after_text=after_range.text;do{if(!before_finished){if(before_range.compareEndPoints("StartToEnd",before_range)==0){before_finished=true;}else{before_range.moveEnd("character",-1)
if(before_range.text==before_text){untrimmed_before_text+="\r\n";}else{before_finished=true;}}}
if(!selection_finished){if(selection_range.compareEndPoints("StartToEnd",selection_range)==0){selection_finished=true;}else{selection_range.moveEnd("character",-1)
if(selection_range.text==selection_text){untrimmed_selection_text+="\r\n";}else{selection_finished=true;}}}
if(!after_finished){if(after_range.compareEndPoints("StartToEnd",after_range)==0){after_finished=true;}else{after_range.moveEnd("character",-1)
if(after_range.text==after_text){untrimmed_after_text+="\r\n";}else{after_finished=true;}}}}while((!before_finished||!selection_finished||!after_finished));return{start:untrimmed_before_text.length,end:untrimmed_before_text.length+untrimmed_selection_text.length};}}
$.fn.bbcodeeditor.defaults={bold:false,italic:false,underline:false,link:false,quote:false,code:false,image:false,usize:false,nsize:false,nlist:false,blist:false,litem:false,back:false,back_disable:false,forward:false,forward_disable:false,exit_warning:false,preview:false,keyboard:true};$.fn.bbcodeeditor.preview=function(){if(options.preview!=false)
{var txt=textarea.val();txt=txt.replace(/</g,'&lt;');txt=txt.replace(/>/g,'&gt;');txt=txt.replace(/[\r\n]/g,'%lb%');var find=[/\[b\](.*?)\[\/b\]/gi,/\[i\](.*?)\[\/i\]/gi,/\[u\](.*?)\[\/u\]/gi,/\[size=(8\d|9\d|1\d\d|200)](.*?)\[\/size\]/gi,/\[url(?:\=?)(.*?)\](.*?)\[\/url\]/gi,/\[img(.*?)\](.*?)\[\/img\]/gi,/(?:%lb%|\s)*\[code(?:\=?)(?:.*?)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/code\](?:%lb%|\s)*/gi,/(?:%lb%|\s)*\[quote(?:\=?)(.*?)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/quote\](?:%lb%|\s)*/gi,/\[list(.*?)\](.*?)\[\*\](.*?)(?:%lb%|\s)*(\[\*\].*?\[\/list\]|\[\/list\])/i,/(?:%lb%|\s)*\[list\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/list\](?:%lb%|\s)*/gi,/(?:%lb%|\s)*\[list=(\d)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/list\](?:%lb%|\s)*/gi,/(?:%lb%){3,}/g];var replace=['<b>$1<\/b>','<i>$1<\/i>','<u>$1<\/u>','<span style="font-size:$1%;">$2</span>','<a href="$1">$2</a>','<img $1 src="$2" />','<pre><code>$1</code></pre>','<blockquote>$2</blockquote>','[list$1]$2<li>$3</li>$4','<ul>$1</ul>','<ol start=$1>$2</ol>','%lb%%lb%'];for(var i in find)
{txt=txt.replace(find[i],replace[i]);if(i==8)while(txt.match(find[i],replace[i]))txt=txt.replace(find[i],replace[i]);}
txt=txt.replace(/%lb%/g,'<br />');if(txt.length==0){txt="Enter text to preview your post."}
options.preview.html($().emoticon(txt));}};$.fn.bbcodeeditor.pause=function(){if(!pause)pause=true;else pause=false;};})(jQuery);var featureTimeoutHandle=-1;jQuery(function(){jQuery(".user_placeholder").load("/members/current.js?r="+location.href);try{MediaSmart.insertAllAds();}catch(e){}
jQuery("a#signin_link").live("click",function(e){e.preventDefault();e.stopPropagation();jQuery("#login_dialog").fadeIn();});jQuery('a.smoothscroll').click(function(){if(jQuery(this).hasClass("postReply"))return;if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var $target=jQuery(this.hash);$target=$target.length&&$target||jQuery('[name='+this.hash.slice(1)+']');if($target.length){var targetOffset=$target.offset().top;jQuery('html,body').animate({scrollTop:targetOffset},1000);return false;}}});jQuery(".post_reply").click(function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var $target=jQuery(this.hash);$target=$target.length&&$target||jQuery('[name='+this.hash.slice(1)+']');if($target.length){var targetOffset=$target.offset().top;jQuery('html,body').animate({scrollTop:targetOffset},1000,function(){jQuery("#post_text").focus();});return false;}}});jQuery(document).bind("mouseup",function(e){if(jQuery(e.target).parents("#login, #login_dialog").length==0){jQuery("#login_dialog").fadeOut();}});jQuery("#user_login").change(function(e){jQuery(this).addClass("checking").removeClass("ok").removeClass("error");jQuery.post("/users/check_for_duplicate_login",{login:jQuery(this).val()},function(data){if(data=="OK"){jQuery("#user_login").removeClass("checking").addClass("ok");}
else{jQuery("#user_login").removeClass("checking").addClass("error");}});});jQuery("#user_email").change(function(e){jQuery(this).addClass("checking").removeClass("ok").removeClass("error");jQuery.post("/users/check_for_duplicate_email",{email:jQuery(this).val()},function(data){if(data=="OK"){jQuery("#user_email").removeClass("checking").addClass("ok");}
else{jQuery("#user_email").removeClass("checking").addClass("error");}});});jQuery("#homepage_feature #slide_numbers li").each(function(x){jQuery(this).css({zIndex:5000-x});});jQuery("#homepage_feature #slide_numbers li a span").each(function(x){var len=jQuery(this).text().length;if(len<13){jQuery(this).css({lineHeight:"25px"});}});jQuery("#homepage_feature #slide_numbers li, #homepage_feature #slide_numbers li a").click(function(e){e.preventDefault();var elem=jQuery(this);if(!elem.is("li")){elem=jQuery(this).parent("li");}
setActiveFeatureTab(elem);});jQuery("#homepage_feature #slide_numbers li").hover(function(){jQuery(".header").text(jQuery(this).children("a").attr("data-heading"));},function(){jQuery(".header").text(jQuery(this).siblings(".active").children("a").attr("data-heading"));});if(jQuery("ul#slide_numbers li").length>0){featureTimeoutHandle=setTimeout("cycleFeatureTab()",7500);}
jQuery("ul#categories li").click(function(){jQuery(this).siblings(".active").removeClass("active");jQuery(this).addClass("active");});jQuery(".gallery-item-wrapper .enlargable").live("click",function(e){e.preventDefault();var img=jQuery(this).parent(".gallery-item-wrapper").find("img");img.attr("src",img.attr("src").replace("/medium/","/large/"));jQuery(this).parents(".images").animate({width:610}).css({background:"#fff"});jQuery(this).parents(".gallery-item-wrapper, .gallery-content").css({maxHeight:227,height:"auto"}).animate({maxHeight:800});img.animate({width:608});jQuery(".gallery-item-wrapper .enlargable").addClass("shrinkable").removeClass("enlargable");jQuery(".gallery-item-wrapper span.enlarge").removeClass("enlarge").addClass("shrink").text("Click to shrink");});jQuery(".gallery-item-wrapper .shrinkable").live("click",function(e){e.preventDefault();var img=jQuery(this).parent(".gallery-item-wrapper").find("img");img.attr("src",img.attr("src").replace("/large/","/medium/"));jQuery(this).parents(".images").animate({width:302}).css({background:"#444"});jQuery(this).parents(".gallery-item-wrapper, .gallery-content").animate({maxHeight:227});img.animate({width:300});jQuery(".gallery-item-wrapper .shrinkable").addClass("enlargable").removeClass("shrinkable");jQuery(".gallery-item-wrapper span.shrink").removeClass("shrink").addClass("enlarge").text("Click to enlarge");});jQuery("div.forumpost img").each(function(){var width=jQuery(this).width();if(width>=660){jQuery(this).css({width:660});}});jQuery("#cb_male").click(function(){jQuery("#cb_female").attr("checked","");});jQuery("#cb_female").click(function(){jQuery("#cb_male").attr("checked","");});jQuery("#weatherconditions #conditions").each(function(){var loc=jQuery(this).attr("data-location");jQuery(this).load("/reports/"+loc+"/weather_conditions");});jQuery("#weatherconditions #winddata").each(function(){var loc=jQuery(this).attr("data-location");jQuery(this).load("/reports/"+loc+"/wind_data");});jQuery(".comments_form").each(function(){var path=document.location.href;if(path.endsWith("/")){path=path.substring(0,path.lastIndexOf("/"));}
path=path.replace("/images","");path=path+"/comments";jQuery(this).load(path);});jQuery("#nav li").hover(function(){jQuery(this).find('ul:first').css({visibility:"visible",display:"none"}).show(400);},function(){jQuery(this).find('ul:first').css({visibility:"hidden"});});jQuery(".showlocations").click(function(){jQuery("#locations").slideToggle();});jQuery(".post_reply").click(function(e){e.preventDefault();jQuery.get(jQuery(this).attr("href")+".js",function(data,status){jQuery("#post_text").val(data);var offset=jQuery("#post_text").offset().top;jQuery("html,body").animate({scrollTop:offset},1000);});});if(jQuery("#post_text").is("textarea")){jQuery('#post_text').bbcodeeditor({bold:jQuery('.bold'),italic:jQuery('.italic'),underline:jQuery('.underline'),link:jQuery('.link'),quote:jQuery('.quote'),code:jQuery('.code'),image:jQuery('.image'),nlist:jQuery('.nlist'),blist:jQuery('.blist'),litem:jQuery('.litem'),back:jQuery('.back'),forward:jQuery('.forward'),back_disable:'btn back_disable',forward_disable:'btn forward_disable',exit_warning:false,preview:jQuery('.preview')});}});function cycleFeatureTab(){var active_tab=jQuery("div#homepage_feature ul#slide_numbers li.active");var next=active_tab.next();if(next.length==0){next=jQuery("div#homepage_feature ul#slide_numbers li:first");}
setActiveFeatureTab(next);}
function setActiveFeatureTab(tab){var target=jQuery("#"+tab.children("a").attr("rel"));jQuery(".header").text(tab.children("a").attr("data-heading"));jQuery("#homepage_feature #feature_content .active").fadeOut(function(){jQuery(this).removeClass("active");target.fadeIn(function(){jQuery(this).addClass("active");});});tab.siblings(".active").removeClass("active");tab.addClass("active");clearTimeout(featureTimeoutHandle);featureTimeoutHandle=setTimeout("cycleFeatureTab()",7500);}
function enableModerationButtons(){var count=jQuery(".moderator_checkbox:checked").length;if(count<1){jQuery(".moderator_actions input").attr("disabled","disabled");}
if(count==1){jQuery(".moderator_actions input.single").attr("disabled","");jQuery(".moderator_actions input.multiple").attr("disabled","disabled");}
if(count>1){jQuery(".moderator_actions input.single, .moderator_actions input.multiple").attr("disabled","");}}