document.observe("dom:loaded",init);var initFunctions=new Array();initFunctions.push(setUpExternalLinks);initFunctions.push(setUpPrint);window.LightboxOptions={fileLoadingImage:'/gen/img/lightbox/loading.gif',fileBottomNavCloseImage:'/gen/img/lightbox/closelabel.gif',overlayOpacity:0.8,animate:true,resizeSpeed:7,borderSize:10,labelImage:"Image",labelOf:"of"};function init(){for(var i=0;i<initFunctions.length;i++)
initFunctions[i].call(this);if($("close-window"))
Event.observe("close-window","click",closeWindow);}
function getURLParam(strParamName){var strReturn="";var strHref=window.location.href;if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")).toLowerCase();strParamName=strParamName.toLowerCase();var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}}
return strReturn;}
function trimString(str){return str.replace(/^\s+|\s+$/g,"");}
function isDefined(v){return(typeof(window[v])=="undefined")?false:true;}
function IsNumeric(sText,decimalOK,spacesOK,hyphensOK,plusesOK){var ValidChars="0123456789";if(decimalOK)ValidChars=ValidChars+".";if(spacesOK)ValidChars=ValidChars+" ";if(hyphensOK)ValidChars=ValidChars+"-";if(plusesOK)ValidChars=ValidChars+"+";var IsNumber=true;var Char;if(sText.length==0)
return false;for(var i=0;i<sText.length&&IsNumber==true;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1)
IsNumber=false;}
return IsNumber;}
function toggleCheck(chkBox){chkBoxObj=$(chkBox);if(chkBoxObj.checked)
chkBoxObj.checked=false;else
chkBoxObj.checked=true;}
function activateRadio(radio){radioObj=$(radio);radioObj.checked=true;}
function roundValue(price){return Math.round(price*100)/100;}
function formatCurrency(price){var result="";var tmpPrice=price;price=Math.abs(price);var decimals=(Math.round((price-Math.floor(price))*100)).toString();if(decimals>=100){decimals="00";price=price+1;}
if(decimals.length==1)decimals="0"+decimals;var thousands=Math.floor(price/1000);if(thousands>0){price-=thousands*1000;result=thousands.toString()+",";units=Math.floor(price);if(units<10)result=result+"00"+units.toString();else if(units<100)result=result+"0"+units.toString();else result=result+units.toString();}else result=Math.floor(price).toString();result=result+"."+decimals;if(tmpPrice<0)result="-"+result;return result;}
function setUpExternalLinks(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&/\bexternal\b/.test(anchor.getAttribute("rel"))){anchor.target="_blank";if(anchor.getAttribute("title")){if(anchor.title.indexOf("(opens in a new window)")<0)anchor.title=anchor.title+' (opens in a new window)';}}}}
function setUpPrint(){var arPrints=$$("a.print-page");for(var i=0;i<arPrints.length;i++)
Event.observe(arPrints[i],"click",function(){window.print();return false;});}
function createUUID(){var s=[],itoh='0123456789ABCDEF';for(var i=0;i<36;i++)
s[i]=Math.floor(Math.random()*0x10);s[14]=4;s[19]=(s[19]&0x3)|0x8;for(var i=0;i<36;i++)
s[i]=itoh[s[i]];s[8]=s[13]=s[18]=s[23]='-';return s.join('');}
function getXmlNodeValue(xmlNode){if(typeof(xmlNode.textContent)=='string')
return xmlNode.textContent;else
return xmlNode.firstChild.nodeValue;}
function listFind(list,itemToFind){var aList=list.split(',');for(var i=0;i<aList.length;++i){if(aList[i]==itemToFind)
return i;}
return-1;}
try
{if(!window.console||typeof(window.console)!='object')
{var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i)
window.console[names[i]]=function(){}}
if(typeof CONSOLELOGGING!="undefined"&&!CONSOLELOGGING)
window.console.log=function(s){};}
catch(e){}
document.observe("dom:loaded",initStore);var ajaxURL="ajax/?uuid="+createUUID()+"&event=ajax.";function initStore(){if($("quicksearchstring"))
setUpQuickSearch();if($("subcatsList"))
setUpSubCatLinks();if($("aodOptions"))
setUpAOD();if($('adminMenu')){Event.observe("adminMenu","mouseover",function(){showAdminMenu(1)});Event.observe("adminMenu","mouseout",function(){showAdminMenu(0)});}}
function updateUnit(){$("unit-form").submit();}
function closeWindow(){window.close();}
function showAdminMenu(bShow){var menu=$('adminMenu').getElementsByTagName('ul')[0];if(bShow)
Element.show(menu);else
Element.hide(menu);}
LightboxOptions=Object.extend({fileLoadingImage:'images/loading.gif',fileBottomNavCloseImage:'images/closelabel.gif',overlayOpacity:0.8,animate:true,resizeSpeed:7,borderSize:10,labelImage:"Image",labelOf:"of"},window.LightboxOptions||{});var Lightbox=Class.create();Lightbox.prototype={imageArray:[],activeImage:undefined,initialize:function(){this.updateImageList();this.keyboardAction=this.keyboardAction.bindAsEventListener(this);if(LightboxOptions.resizeSpeed>10)LightboxOptions.resizeSpeed=10;if(LightboxOptions.resizeSpeed<1)LightboxOptions.resizeSpeed=1;this.resizeDuration=LightboxOptions.animate?((11-LightboxOptions.resizeSpeed)*0.15):0;this.overlayDuration=LightboxOptions.animate?0.2:0;var size=(LightboxOptions.animate?250:1)+'px';var objBody=$$('body')[0];objBody.appendChild(Builder.node('div',{id:'overlay'}));objBody.appendChild(Builder.node('div',{id:'lightbox'},[Builder.node('div',{id:'outerImageContainer'},Builder.node('div',{id:'imageContainer'},[Builder.node('img',{id:'lightboxImage'}),Builder.node('div',{id:'hoverNav'},[Builder.node('a',{id:'prevLink',href:'#'}),Builder.node('a',{id:'nextLink',href:'#'})]),Builder.node('div',{id:'loading'},Builder.node('a',{id:'loadingLink',href:'#'},Builder.node('img',{src:LightboxOptions.fileLoadingImage})))])),Builder.node('div',{id:'imageDataContainer'},Builder.node('div',{id:'imageData'},[Builder.node('div',{id:'imageDetails'},[Builder.node('span',{id:'caption'}),Builder.node('span',{id:'numberDisplay'})]),Builder.node('div',{id:'bottomNav'},Builder.node('a',{id:'bottomNavClose',href:'#'},Builder.node('img',{src:LightboxOptions.fileBottomNavCloseImage})))]))]));$('overlay').hide().observe('click',(function(){this.end();}).bind(this));$('lightbox').hide().observe('click',(function(event){if(event.element().id=='lightbox')this.end();}).bind(this));$('outerImageContainer').setStyle({width:size,height:size});$('prevLink').observe('click',(function(event){event.stop();this.changeImage(this.activeImage-1);}).bindAsEventListener(this));$('nextLink').observe('click',(function(event){event.stop();this.changeImage(this.activeImage+1);}).bindAsEventListener(this));$('loadingLink').observe('click',(function(event){event.stop();this.end();}).bind(this));$('bottomNavClose').observe('click',(function(event){event.stop();this.end();}).bind(this));var th=this;(function(){var ids='overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink '+'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';$w(ids).each(function(id){th[id]=$(id);});}).defer();},updateImageList:function(){this.updateImageList=Prototype.emptyFunction;document.observe('click',(function(event){var target=event.findElement('a[rel^=lightbox]')||event.findElement('area[rel^=lightbox]');if(target){event.stop();this.start(target);}}).bind(this));},start:function(imageLink){$$('select','object','embed').each(function(node){node.style.visibility='hidden'});var arrayPageSize=this.getPageSize();$('overlay').setStyle({width:arrayPageSize[0]+'px',height:arrayPageSize[1]+'px'});new Effect.Appear(this.overlay,{duration:this.overlayDuration,from:0.0,to:LightboxOptions.overlayOpacity});this.imageArray=[];var imageNum=0;if((imageLink.rel=='lightbox')){this.imageArray.push([imageLink.href,imageLink.title]);}else{this.imageArray=$$(imageLink.tagName+'[href][rel="'+imageLink.rel+'"]').collect(function(anchor){return[anchor.href,anchor.title];}).uniq();while(this.imageArray[imageNum][0]!=imageLink.href){imageNum++;}}
var arrayPageScroll=document.viewport.getScrollOffsets();var lightboxTop=arrayPageScroll[1]+(document.viewport.getHeight()/10);var lightboxLeft=arrayPageScroll[0];this.lightbox.setStyle({top:lightboxTop+'px',left:lightboxLeft+'px'}).show();this.changeImage(imageNum);},changeImage:function(imageNum){this.activeImage=imageNum;if(LightboxOptions.animate)this.loading.show();this.lightboxImage.hide();this.hoverNav.hide();this.prevLink.hide();this.nextLink.hide();this.imageDataContainer.setStyle({opacity:.0001});this.numberDisplay.hide();var imgPreloader=new Image();imgPreloader.onload=(function(){this.lightboxImage.src=this.imageArray[this.activeImage][0];this.resizeImageContainer(imgPreloader.width,imgPreloader.height);}).bind(this);imgPreloader.src=this.imageArray[this.activeImage][0];},resizeImageContainer:function(imgWidth,imgHeight){var widthCurrent=this.outerImageContainer.getWidth();var heightCurrent=this.outerImageContainer.getHeight();var widthNew=(imgWidth+LightboxOptions.borderSize*2);var heightNew=(imgHeight+LightboxOptions.borderSize*2);var xScale=(widthNew/widthCurrent)*100;var yScale=(heightNew/heightCurrent)*100;var wDiff=widthCurrent-widthNew;var hDiff=heightCurrent-heightNew;if(hDiff!=0)new Effect.Scale(this.outerImageContainer,yScale,{scaleX:false,duration:this.resizeDuration,queue:'front'});if(wDiff!=0)new Effect.Scale(this.outerImageContainer,xScale,{scaleY:false,duration:this.resizeDuration,delay:this.resizeDuration});var timeout=0;if((hDiff==0)&&(wDiff==0)){timeout=100;if(Prototype.Browser.IE)timeout=250;}
(function(){this.prevLink.setStyle({height:imgHeight+'px'});this.nextLink.setStyle({height:imgHeight+'px'});this.imageDataContainer.setStyle({width:widthNew+'px'});this.showImage();}).bind(this).delay(timeout/1000);},showImage:function(){this.loading.hide();new Effect.Appear(this.lightboxImage,{duration:this.resizeDuration,queue:'end',afterFinish:(function(){this.updateDetails();}).bind(this)});this.preloadNeighborImages();},updateDetails:function(){if(this.imageArray[this.activeImage][1]!=""){this.caption.update(this.imageArray[this.activeImage][1]).show();}
if(this.imageArray.length>1){this.numberDisplay.update(LightboxOptions.labelImage+' '+(this.activeImage+1)+' '+LightboxOptions.labelOf+' '+this.imageArray.length).show();}
new Effect.Parallel([new Effect.SlideDown(this.imageDataContainer,{sync:true,duration:this.resizeDuration,from:0.0,to:1.0}),new Effect.Appear(this.imageDataContainer,{sync:true,duration:this.resizeDuration})],{duration:this.resizeDuration,afterFinish:(function(){var arrayPageSize=this.getPageSize();this.overlay.setStyle({height:arrayPageSize[1]+'px'});this.updateNav();}).bind(this)});},updateNav:function(){this.hoverNav.show();if(this.activeImage>0)this.prevLink.show();if(this.activeImage<(this.imageArray.length-1))this.nextLink.show();this.enableKeyboardNav();},enableKeyboardNav:function(){document.observe('keydown',this.keyboardAction);},disableKeyboardNav:function(){document.stopObserving('keydown',this.keyboardAction);},keyboardAction:function(event){var keycode=event.keyCode;var escapeKey;if(event.DOM_VK_ESCAPE){escapeKey=event.DOM_VK_ESCAPE;}else{escapeKey=27;}
var key=String.fromCharCode(keycode).toLowerCase();if(key.match(/x|o|c/)||(keycode==escapeKey)){this.end();}else if((key=='p')||(keycode==37)){if(this.activeImage!=0){this.disableKeyboardNav();this.changeImage(this.activeImage-1);}}else if((key=='n')||(keycode==39)){if(this.activeImage!=(this.imageArray.length-1)){this.disableKeyboardNav();this.changeImage(this.activeImage+1);}}},preloadNeighborImages:function(){var preloadNextImage,preloadPrevImage;if(this.imageArray.length>this.activeImage+1){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];}},end:function(){this.disableKeyboardNav();this.lightbox.hide();new Effect.Fade(this.overlay,{duration:this.overlayDuration});$$('select','object','embed').each(function(node){node.style.visibility='visible'});},getPageSize:function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
return[pageWidth,pageHeight];}}
document.observe('dom:loaded',function(){new Lightbox();});function setUpQuickSearch(){var qSearch=$("quicksearchstring","quicksearchstringmirror");for(var i=0;i<qSearch.length;i++){if(qSearch[i]){presetQSearchText=qSearch[i].value;qSearch[i].onfocus=function(){qSearchFocus(this);}
qSearch[i].onblur=function(){qSearchBlur(this,presetQSearchText);}}}}
function qSearchFocus(searchInput){if(searchInput.value==presetQSearchText)
searchInput.value="";}
function qSearchBlur(searchInput,presetText){if(searchInput.value=='')
searchInput.value=presetText;}
function pickcolor(cssclass,csselement,csscookie,cssform,link,adjX,adjY){var adjustment=new Array();if(adjX)
adjustment['x']=adjX;else
adjustment['x']=0;if(adjY)
adjustment['y']=adjY;else
adjustment['y']=0;var rgb=new Array();var hsv=new Array();var hex=new Array();var offset=new Array();offset['x']=0;offset['y']=0;var H,S,V,sliderX,sliderY,dotX,dotY;var isdrag=false;var ie=document.all;var nn6=document.getElementById&&!document.all;var colorselector="default";var scrollLeftOffset='0';var scrollTopOffset='0';var detect=navigator.userAgent.toLowerCase();var OS,browser,total,thestring;var version=0;$('ColourMod').style.display="block";if($("ColourMod").style.left==0&&$("ColourMod").style.top==0){cmOffsetLeft=$('ColourMod').offsetLeft;cmOffsetTop=$('ColourMod').offsetTop;}
if(link.offsetParent){for(var posX=0,posY=0;link.offsetParent;link=link.offsetParent){offset['x']+=link.offsetLeft;offset['y']+=link.offsetTop;}}else{offset['x']=link.x;offset['y']=link.y;}
if(self.innerWidth){frameWidth=self.innerWidth;frameHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientWidth){frameWidth=document.documentElement.clientWidth;frameHeight=document.documentElement.clientHeight;}else if(document.body){frameWidth=document.body.clientWidth;frameHeight=document.body.clientHeight;}else{return;}
scrollOffset=getScrollXY();if(offset['x']+282+adjustment['x']>frameWidth+scrollOffset['x']){offset['x']=frameWidth+scrollOffset['x']-282;}else if(offset['x']+adjustment['x']<scrollOffset['x']){offset['x']=scrollOffset['x'];}else{offset['x']=offset['x']+adjustment['x'];}
if(offset['y']+220+adjustment['y']>frameHeight+scrollOffset['y']){offset['y']=frameHeight+scrollOffset['y']-220;}else if(offset['y']+adjustment['y']<scrollOffset['y']){offset['y']=scrollOffset['y'];}else{offset['y']=offset['y']+adjustment['y'];}
$('ColourMod').style.left=offset['x']+"px";$('ColourMod').style.top=offset['y']+"px";if(nn6)
$('cmHex').type="search";$('cmCloseButton').href="javascript:;";$('cmCloseButton').onmouseup=closeColourMod;$('cmHex').onkeyup=hexUpdate;function closeColourMod(){$('ColourMod').style.display="none";}
if(cssform){$('cmHex').value=$(cssform).value;hexUpdate();}
$('ColourMod').onmousedown=selectmouse;document.onmouseup=unselectmouse;function checkIt(string){place=detect.indexOf(string)+1;thestring=string;return place;}
function getScrollXY(){var scrollOffset=new Array();if(document.documentElement&&document.documentElement.scrollTop)
{scrollOffset['x']=document.documentElement.scrollLeft;scrollOffset['y']=document.documentElement.scrollTop;}
else if(document.body)
{scrollOffset['x']=document.body.scrollLeft;scrollOffset['y']=document.body.scrollTop;}
return scrollOffset;}
function selectmouse(e){document.body.style.cursor='pointer';mouseX=nn6?e.clientX:event.clientX;mouseY=nn6?e.clientY:event.clientY;scrollOffset=getScrollXY();if(!scrollOffset['y'])
scrollOffset['y']=0;if(!scrollOffset['x'])
scrollOffset['x']=0;if(checkIt('safari')){dotX=mouseX-24-$('ColourMod').offsetLeft;dotY=mouseY-53-$('ColourMod').offsetTop;sliderX=mouseX-185-$('ColourMod').offsetLeft;sliderY=mouseY-52-$('ColourMod').offsetTop;}else{dotX=mouseX-24-$('ColourMod').offsetLeft+scrollOffset['x'];dotY=mouseY-53-$('ColourMod').offsetTop+scrollOffset['y'];sliderX=mouseX-185-$('ColourMod').offsetLeft+scrollOffset['x'];sliderY=mouseY-52-$('ColourMod').offsetTop+scrollOffset['y'];}
if(0<=dotX&&dotX<=150&&0<=dotY&&dotY<=150){isdrag=true;$("cmBlueDot").style.left=dotX+"px";$("cmBlueDot").style.top=dotY+"px";arrowY=replaceString($("cmBlueArrow").style.top,'px','');H=Math.round(YToH(arrowY));S=XToS(dotX);V=YToV(dotY);$("cmHue").value=H;rgb=HSVToRGB(H,S,V);hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmHex").value=hex;$("cmColorContainer").style.backgroundColor="#"+hex;changecss(cssclass,csselement,hex,"hex",csscookie,cssform);document.onmousemove=dragSV;}else if(0<=sliderX&&sliderX<=35&&0<=sliderY&&sliderY<=150){isdrag=true;$("cmBlueArrow").style.top=dotY+"px";sliderY=replaceString($("cmBlueArrow").style.top,'px','');dotX=replaceString($('cmBlueDot').style.left,'px','');dotY=replaceString($('cmBlueDot').style.top,'px','');H=YToH(sliderY);S=XToS(dotX);V=YToV(dotY);rgb=HSVToRGB(H,'100','100');hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmSatValBg").style.backgroundColor="#"+hex;$("cmHue").value=H;rgb=HSVToRGB(H,S,V);hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmHex").value=hex;$("cmColorContainer").style.backgroundColor="#"+hex;changecss(cssclass,csselement,hex,"hex",csscookie,cssform);document.onmousemove=dragH;}else if(0<=dotX&&dotX<=150&&dotY<0){isdrag=true;dotX=mouseX-$('ColourMod').offsetLeft+scrollOffset['x'];dotY=mouseY-$('ColourMod').offsetTop+scrollOffset['y'];document.onmousemove=dragCM;}}
function unselectmouse(e){isdrag=false;document.body.style.cursor='auto';}
function hexUpdate(){hex=$('cmHex').value;if(hex.length==6){changecss(cssclass,csselement,hex,'hex',csscookie,cssform);rgb=HexToRGB(hex);hsv=RGBToHSV(rgb['red'],rgb['green'],rgb['blue']);$('cmHue').value=hsv['hue'];sliderY=HToY(hsv['hue']);dotX=SToX(hsv['sat']);dotY=VToY(hsv['val']);$("cmBlueArrow").style.top=sliderY+"px";$("cmBlueDot").style.left=dotX+"px";$("cmBlueDot").style.top=dotY+"px";$("cmColorContainer").style.backgroundColor="#"+hex;rgb=HSVToRGB(hsv['hue'],'100','100');hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmSatValBg").style.backgroundColor="#"+hex;}}
function dragSV(e){if(isdrag){mouseX=nn6?e.clientX:event.clientX;mouseY=nn6?e.clientY:event.clientY;scrollOffset=getScrollXY();if(!scrollOffset['y'])
scrollOffset['y']=0;if(!scrollOffset['x'])
scrollOffset['x']=0;if(checkIt('safari')){xlimit=mouseX-24-$('ColourMod').offsetLeft;ylimit=mouseY-53-$('ColourMod').offsetTop;}else{xlimit=mouseX-24-$('ColourMod').offsetLeft+scrollOffset['x'];ylimit=mouseY-53-$('ColourMod').offsetTop+scrollOffset['y'];}
if(xlimit<=0)
xlimit=0;else if(xlimit>=150)
xlimit=150;if(ylimit<=0)
ylimit=0;else if(ylimit>=150)
ylimit=150;$("cmBlueDot").style.left=xlimit+"px";$("cmBlueDot").style.top=ylimit+"px";H=$('cmHue').value;S=XToS(xlimit);V=YToV(ylimit);rgb=HSVToRGB(H,S,V);hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmHex").value=hex;$("cmColorContainer").style.backgroundColor="#"+hex;changecss(cssclass,csselement,hex,"hex",csscookie,cssform);}}
function dragH(e){if(isdrag){mouseY=nn6?e.clientY:event.clientY;scrollOffset=getScrollXY();if(!scrollOffset['y'])
scrollOffset['y']=0;if(!scrollOffset['x'])
scrollOffset['x']=0;if(checkIt('safari')){sliderY=mouseY-52-$('ColourMod').offsetTop;}else{sliderY=mouseY-52-$('ColourMod').offsetTop+scrollOffset['y'];}
if(sliderY<0)
sliderY=0;if(sliderY>150)
sliderY=150;$("cmBlueArrow").style.top=sliderY+"px";H=YToH(sliderY);rgb=HSVToRGB(H,'100','100');hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmSatValBg").style.backgroundColor="#"+hex;dotX=replaceString($('cmBlueDot').style.left,'px','');dotY=replaceString($('cmBlueDot').style.top,'px','');S=XToS(dotX);V=YToV(dotY);rgb=HSVToRGB(H,S,V);hex=RGBToHex(rgb['red'],rgb['green'],rgb['blue']);$("cmHex").value=hex;$("cmColorContainer").style.backgroundColor="#"+hex;changecss(cssclass,csselement,hex,"hex",csscookie,cssform);}}
function dragCM(e){if(isdrag){mouseX=nn6?e.clientX:event.clientX;mouseY=nn6?e.clientY:event.clientY;scrollOffset=getScrollXY();if(!scrollOffset['y'])
scrollOffset['y']=0;if(!scrollOffset['x'])
scrollOffset['x']=0;xlimit=mouseX-dotX-cmOffsetLeft+scrollOffset['x'];ylimit=mouseY-dotY-cmOffsetTop+scrollOffset['y'];$("ColourMod").style.left=xlimit+"px";$("ColourMod").style.top=ylimit+"px";}}
function replaceString(string,find,replace){return string.replace(find,replace);}
function XToS(dotX){return(dotX/1.5);}
function YToV(dotY){return(100-(dotY/1.5));}
function SToX(S){return S*1.5;}
function VToY(V){return(-V+100)*1.5;}
function HToY(H){return(H/360)*150;}
function YToH(sliderY){return(sliderY/150)*360;}
function HSVToRGB(H,S,V){H=H/360;S=S/100;V=V/100;if(S<=0){V=Math.round(V*255);rgb['red']=V;rgb['green']=V;rgb['blue']=V;return rgb;}else{if(H>=1.0){H=0;}
H=6*H;F=H-Math.floor(H);P=Math.round(255*V*(1.0-S));Q=Math.round(255*V*(1.0-(S*F)));T=Math.round(255*V*(1.0-(S*(1.0-F))));V=Math.round(255*V);switch(Math.floor(H)){case 0:R=V;G=T;B=P;break;case 1:R=Q;G=V;B=P;break;case 2:R=P;G=V;B=T;break;case 3:R=P;G=Q;B=V;break;case 4:R=T;G=P;B=V;break;case 5:R=V;G=P;B=Q;break;}
rgb['red']=R;rgb['green']=G;rgb['blue']=B;return rgb;}}
function RGBToHex(R,G,B){return(toHex(R)+toHex(G)+toHex(B));}
function toHex(N){if(N==null)
return"00";N=parseInt(N);if(N==0||isNaN(N))
return"00";N=Math.max(0,N);N=Math.min(N,255);N=Math.round(N);return"0123456789ABCDEF".charAt((N-N%16)/16)+"0123456789ABCDEF".charAt(N%16);}
function HexToRGB(H){hexR=H.substr(0,2);rgb['red']=parseInt((hexR).substring(0,2),16);hexG=H.substr(2,2);rgb['green']=parseInt((hexG).substring(0,2),16);hexB=H.substr(4,2);rgb['blue']=parseInt((hexB).substring(0,2),16);return rgb;}
function RGBToHSV(R,G,B){var max=Math.max(R,G,B);var min=Math.min(R,G,B);var delta=max-min;V=Math.round((max/255)*100);if(max!=0){S=Math.round(delta/max*100);}else{S=0;}
if(S==0){H=0;}else{if(R==max){H=(G-B)/delta;}else if(G==max){H=2+(B-R)/delta;}else if(B==max){H=4+(R-G)/delta;}
H=Math.round(H*60);if(H>360){H=360;}
if(H<0){H+=360;}}
hsv['hue']=H;hsv['sat']=S;hsv['val']=V;return hsv;}}
function checkBrowser(){var theRules=new Array();if(document.styleSheets[0].cssRules){return"cssRules";}else if(document.styleSheets[0].rules||document.all){return"rules";}else{return;}}
function setcsscookie(myclass,element,value,fieldvalue){var date=new Date();date.setTime(date.getTime()+(365*24*60*60*1000));var expires="; expires="+date.toGMTString();var path="; path=/";if(getCookie(myclass)){var newvalues="";var updated=false;var cvalues=getCookie(myclass);firstsplit=cvalues.split(",");for(var i=0;i<firstsplit.length;i++){secondsplit=firstsplit[i].split("|");if(secondsplit[0]==element){newvalues+=element+"|"+value+"|"+fieldvalue+",";var updated=true;}else if(secondsplit[0]!=""){newvalues+=firstsplit[i]+",";}}
if(updated==false)
newvalues+=element+"|"+value+"|"+fieldvalue+",";document.cookie=myclass+"="+newvalues+expires+path;}else{document.cookie=myclass+"="+element+"|"+value+"|"+fieldvalue+expires+path;}}
function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else{begin+=2;}
var end=document.cookie.indexOf(";",begin);if(end==-1){end=dc.length;}
return unescape(dc.substring(begin+prefix.length,end));}
function deleteCookies(){var date=new Date();date.setTime(date.getTime());var expires="; expires="+date.toGMTString();var path="; path=/";var theRules=checkBrowser();for(var j=0;j<document.styleSheets.length;j++){for(var i=0;i<document.styleSheets[j].theRules.length;i++){var myclass=theRules[i].selectorText.toLowerCase();newclass=myclass.replace(/\*\[id\"([^\"]*)\"\]/g,"\#$1");if(getCookie(newclass)){document.cookie=newclass+"="+""+" "+expires+path;}}}}
function cookiecss(){var theRules=checkBrowser();for(var k=0;k<document.styleSheets.length;k++){for(var i=0;i<document.styleSheets[j].theRules.length;i++){var myclass=theRules[i].selectorText.toLowerCase();newclass=myclass.replace(/\*\[id\"([^\"]*)\"\]/g,"\#$1");if(getCookie(newclass)){var cvalue=getCookie(newclass);firstsplit=cvalue.split(",");for(var j=0;j<firstsplit.length;j++){secondsplit=firstsplit[j].split("|");if(secondsplit[0]!=""){theRules[i].style[secondsplit[0]]=secondsplit[1];if(document.getElementById(secondsplit[2])){hex=secondsplit[1].replace(/\#/,'');document.getElementById(secondsplit[2]).value=hex;}}}}}}}
function changecss(classes,elements,values,modifiers,cookie,fields){var element,value,modifier,classvalue,fieldvalue;var elementsplit=elements.split(";");var classsplit=classes.split(";");var valuesplit=values.split(";");var modifiersplit=modifiers.split(";");var fieldsplit=fields.split(";");var lastelement="0";var lastclass="0";var lastvalue="0";var lastmodifier="0";var lastfield="0";var value;var splitlength=Math.max(elementsplit.length,classsplit.length,valuesplit.length,modifiersplit.length,fieldsplit.length)
for(var i=0;i<splitlength;i++){if(elementsplit[i]){element=elementsplit[i];lastelement=i;}else{element=elementsplit[0];}
if(valuesplit[i]){value=valuesplit[i];lastvalue=i;}else{value=valuesplit[lastvalue];}
if(modifiersplit[i]){modifier=modifiersplit[i];lastmodifier=i;}else{modifier=modifiersplit[lastmodifier];}
if(classsplit[i]){classvalue=classsplit[i];lastclass=i;}else{classvalue=classsplit[lastclass];}
if(fieldsplit[i]){fieldvalue=fieldsplit[i];lastfield=i;}else{fieldvalue=fieldsplit[lastfield];}
if(modifier=="hex"){if(value.length==3){value=value+value;}else if(value.length==2){value=value+value+value;}else if(value.length!=6){value="";}}
changecsssplit(classvalue,element,value,modifier,cookie,fieldvalue);}}
function changecsssplit(myclass,element,value,modifier,cookie,fieldvalue){if(fieldvalue)
document.getElementById(fieldvalue).value=value;if(modifier!="hex"){value=value+modifier;}else{if(value!="")
value="#"+value;}
myclass=myclass.toLowerCase();var safariclass=myclass.replace(/\#([\w\-]+)/g,"*[id\"$1\"]");for(var j=0;j<document.styleSheets.length;j++){var theRules=checkBrowser();theRules=document.styleSheets[j][theRules];for(var i=0;i<theRules.length;i++){if(theRules[i].selectorText.toLowerCase()==myclass||theRules[i].selectorText.toLowerCase()==safariclass){theRules[i].style[element]=value;if(cookie)
setcsscookie(myclass,element,value,fieldvalue);}}}}
function updatecss(myclass,element,value){myclass=myclass.toLowerCase();var safariclass=myclass.replace(/\#([\w\-]+)/g,"*[id\"$1\"]");var theRules=checkBrowser();for(var j=0;j<document.styleSheets.length;j++){for(var i=0;i<document.styleSheets[j].theRules.length;i++){if(theRules[i].selectorText.toLowerCase()==myclass||theRules[i].selectorText.toLowerCase()==safariclass){var currentValue=theRules[i].style[element];var m=currentValue.match(/^(.*?)([\d]+)(.*)$/);if(m){switch(value){case"smaller":m[2]--;break;case"bigger":m[2]++;break;}
var newValue=m[1]+m[2]+m[3];theRules[i].style[element]=newValue;setcsscookie(myclass,element,newValue);}else{alert('failed');}}}}}
initFunctions.push(initSlideshow);function initSlideshow(){if(typeof(PicLensLite)!='undefined')
{var aEls=$$('.view-as-slideshow');for(var i=0;i<aEls.length;i++)
{Element.update(aEls[i],'<a href="" title="View these images as a slideshow" class="start-slideshow">Start slideshow</a>');var aAnchors=aEls[i].getElementsByTagName('a');for(var j=0;j<aAnchors.length;j++)
Event.observe(aAnchors[j],"click",startSlideshow);}}}
function startSlideshow(e)
{if(typeof(PicLensLite)!='undefined')
{PicLensLite.setLiteURLs({lite:'http://lite.piclens.com/current/'});PicLensLite.start();}
Event.stop(e);return false;}
var PicLensLite={start:function(B){this.determineBrowserParams();clearTimeout(this.REMOVE_TIMER_ID);clearTimeout(this.AUTO_CLOSE_TIMER_ID);this.ARGS={};if(typeof B!=="undefined"&&B!==null){this.ARGS=B;if(B.feedUrl){this.THE_FEED_URL=B.feedUrl;if(this.checkForPluginAndLaunchIfPossible(B.feedUrl,B.guid)){return}if(B.loadFeedInFlash){this.showFlashUI("")}else{this.loadViaXHR(B.feedUrl)}}if(typeof B.feedData!=="undefined"){this.showFlashUI(B.feedData)}}else{var A=this.indexFeeds();if(A.length!==0){var C=A[0];this.THE_FEED_URL=C.url;if(this.checkForPluginAndLaunchIfPossible(C.url)){return}this.loadViaXHR(C.url)}}},isRunning:function(){return this.LITE_IS_RUNNING},hasClient:function(){return this.hasCooliris()},addCustomButton:function(C,B,A){this.CUSTOM_BUTTON={targetURL:C,labelText:B,iconImage:A}},setCallbacks:function(A){if(A.onNoPlugins){this.ON_NO_PLUGINS=A.onNoPlugins}if(A.onExit){this.ON_EXIT=A.onExit}},setLiteURLs:function(A){if(!this.LITE_URL){if(A.swf){this.LITE_URL=A.swf}else{if(A.lite){this.LITE_URL=A.lite+"PicLensLite.swf"}}}if(!this.BUTTON_URL){if(A.button){this.BUTTON_URL=A.button}else{if(A.lite){this.BUTTON_URL=A.lite+"NoFlash.jpg"}}}var B="";if(A.lbox){B=A.lbox}else{if(A.lite){B=A.lite+"../lytebox/"}}if(!this.LBOX_CSS_URL){if(A.lboxcss){this.LBOX_CSS_URL=A.lboxcss}else{if(B!=""){this.LBOX_CSS_URL=B+"lytebox.css"}}}if(!this.LBOX_JS_URL){if(A.lboxjs){this.LBOX_JS_URL=A.lboxjs}else{if(B!=""){this.LBOX_JS_URL=B+"lytebox.js"}}}},ARGS:{},DEBUG_NOCLIENT:false,DEBUG_NOFLASH:false,HPAD:60,VPAD:20,LITE_BG_DIV:null,LITE_FG_DIV:null,LITE_URL:null,BUTTON_URL:null,LBOX_CSS_URL:null,LBOX_JS_URL:null,LBOX_COUNT:0,SHOW_LBOX:false,OS_WIN:false,OS_MAC:false,BROWSER_FFX:false,BROWSER_SAF:false,BROWSER_IE:false,BROWSER_IE6:false,OLD_B_MARGIN:null,OLD_B_OVERFLOW:null,OLD_B_HEIGHT:null,OLD_H_OVERFLOW:null,OLD_H_HEIGHT:null,THE_FEED:"",THE_FEED_URL:"",LITE_IS_RUNNING:false,piclensIsRunning_:false,FLASH_ID_1:"pllflash1",FLASH_ID_2:"pllflash2",FLASH_VER:null,FLASH_URL:"http://www.adobe.com/go/getflashplayer",PL_URL:"http://download.piclens.com/partner/",PLC:null,LEARN_PL_URL:"http://affiliate.piclens.com/partner/",FONT:"font-family: Lucida Grande, Myriad Pro, Verdana, Helvetica, Arial, sans-serif;",KEY_HANDLERS:"",ON_NO_PLUGINS:null,ON_EXIT:null,AUTO_CLOSE_TIMER_ID:0,REMOVE_TIMER_ID:0,RESIZE_TIMER_IE6:null,RESIZE_HANDLER_EXISTS:false,CUSTOM_BUTTON:null,addKeyHandlers:function(){var A=this;if(typeof document.onkeydown!=="undefined"){this.KEY_HANDLERS=document.onkeydown}document.onkeydown=function(C){var B;if(typeof C==="undefined"||C===null){B=window.event.keyCode}else{B=C.which}var D=A.handleKeyPress(B);if(typeof C!="undefined"&&C!=null){C.returnValue=D}return D}},addMouseHandlers:function(){if(window.addEventListener){window.addEventListener("DOMMouseScroll",this.handleMouseWheel,false)}else{if(document.attachEvent){document.attachEvent("onmousewheel",this.handleMouseWheel)}else{window.onmousewheel=document.onmousewheel=this.handleMouseWheel}}},appendElementsToDocument:function(){if(this.BROWSER_FFX&&this.OS_MAC){this.LITE_BG_DIV.style.display="none"}document.body.appendChild(this.LITE_BG_DIV);document.body.appendChild(this.LITE_FG_DIV)},autoResize:function(){if(!this.isRunning()){clearInterval(this.RESIZE_TIMER_IE6);return}var C=this.getPageSize();var B=this.LITE_BG_DIV;if(B){B.style.height=C.h+"px";B.style.width=C.w+"px"}if(this.LITE_FG_DIV){var A=this.LITE_FG_DIV.style;this.resizeToPaddedBox(A);this.resizeToFitPaddedBox(A,C);this.resizeFlashToFitPaddedBox()}},checkForPluginAndLaunchIfPossible:function(B,A){if(this.hasCooliris()){if(typeof(A)!="undefined"){this.PLC.launch(B,"uid",A)}else{this.PLC.launch(B,"","")}return true}return false},createBackgroundOverlay:function(){var D=document.createElement("div");this.LITE_BG_DIV=D;D.id="lite_bg_div";var E=D.style;E.position="fixed";E.width=E.height="100%";if(this.BROWSER_IE6){var A=document.body;var C=A.currentStyle;var H=document.documentElement;var G=H.currentStyle;this.OLD_B_MARGIN=C.margin;this.OLD_B_OVERFLOW=C.overflow;this.OLD_B_HEIGHT=C.height;this.OLD_H_OVERFLOW=G.overflow;this.OLD_H_HEIGHT=G.height;this.OLD_SCROLL_Y=H.scrollTop;A.style.margin="0";A.style.overflow="auto";A.style.height="100%";H.style.overflow="auto";H.style.height="100%";E.position="absolute";var F=this.getPageSize();E.height=F.h+"px";E.width=F.w+"px"}E.left=E.right=E.top=E.bottom="0";E.backgroundColor="#000";E.zIndex=1000;E.opacity="0.5";E.filter="alpha(opacity=50)";var B=this;D.onclick=function(){B.exitPicLensLite()}},createForegroundFlashComponent:function(){var B=document.createElement("div");this.LITE_FG_DIV=B;B.id="lite_fg_div";var A=B.style;A.backgroundColor="#000";A.position="fixed";A.border="2px solid #555";A.zIndex=1001;this.resizeToPaddedBox(A);if(this.BROWSER_IE6){A.position="absolute";this.resizeToFitPaddedBox(A)}},closeFlashUI:function(C){var B=document;B.onkeydown=this.KEY_HANDLERS;window.onmousewheel=B.onmousewheel="";if(window.removeEventListener){window.removeEventListener("DOMMouseScroll",this.handleMouseWheel,false)}if(B.detachEvent){B.detachEvent("onmousewheel",this.handleMouseWheel)}this.LITE_BG_DIV.style.display=this.LITE_FG_DIV.style.display="none";this.REMOVE_TIMER_ID=setTimeout(function(){PicLensLite.removeChildren()},150);if(this.BROWSER_IE6){var A=document.body;var D=document.documentElement;A.style.margin=this.OLD_B_MARGIN;A.style.overflow=this.OLD_B_OVERFLOW;A.style.height=this.OLD_B_HEIGHT;D.style.overflow=this.OLD_H_OVERFLOW;D.style.height=this.OLD_H_HEIGHT;window.scrollTo(0,this.OLD_SCROLL_Y)}if(this.ON_EXIT!==null){this.ON_EXIT(C)}this.setRunningFlag(false)},determineBrowserParams:function(){var B=BrowserDetect.OS;var A=BrowserDetect.browser;this.OS_MAC=(B=="Mac");this.OS_WIN=(B=="Windows");this.BROWSER_FFX=(A=="Firefox");this.BROWSER_SAF=(A=="Safari");this.BROWSER_IE=(A=="Explorer");this.BROWSER_IE6=(this.BROWSER_IE&&BrowserDetect.version=="6");this.FLASH_VER=swfobjlite.getFlashPlayerVersion()},exitPicLensLite:function(){var A=this.getFlash();if(A!==null&&A.fl_exitPicLensLite){A.fl_exitPicLensLite();this.AUTO_CLOSE_TIMER_ID=setTimeout(function(){if(PicLensLite.isRunning()){PicLensLite.closeFlashUI()}},500)}else{this.closeFlashUI()}},findScriptLocation:function(){var E=document.getElementsByTagName("script");for(var C=0;C!=E.length;++C){var A=E[C];var D=A.getAttribute("type");if(D=="text/javascript"){var F=A.getAttribute("src");if(F===null){continue}var B=F.indexOf("piclens.js");if(B!=-1){this.setLiteURLs({lite:F.substring(0,B)});return}else{B=F.indexOf("piclens_optimized.js");if(B!=-1){this.setLiteURLs({lite:F.substring(0,B)});return}}}}},getPageSize:function(){var J,F,G,C;var I=document;var E=I.body;var D;if(window.innerHeight&&window.scrollMaxY){J=I.scrollWidth;F=(this.isFrame?parent.innerHeight:self.innerHeight)+(this.isFrame?parent.scrollMaxY:self.scrollMaxY)}else{if(E.scrollHeight>E.offsetHeight){J=E.scrollWidth;F=E.scrollHeight}else{D=I.getElementsByTagName("html").item(0);J=D.offsetWidth;F=D.offsetHeight;J=(J<E.offsetWidth)?E.offsetWidth:J;F=(F<E.offsetHeight)?E.offsetHeight:F}}var A=I.documentElement;if(self.innerHeight){G=(this.isFrame)?parent.innerWidth:self.innerWidth;C=(this.isFrame)?parent.innerHeight:self.innerHeight}else{if(A&&A.clientHeight){G=A.clientWidth;C=A.clientHeight}else{if(E){D=I.getElementsByTagName("html").item(0);G=D.clientWidth;C=D.clientHeight;G=(G==0)?E.clientWidth:G;C=(C==0)?E.clientHeight:C}}}var B=(F<C)?C:F;var H=(J<G)?G:J;return{pw:H,ph:B,w:G,h:C}},getElementsFromXMLFeed:function(){var B;if(window.ActiveXObject){B=new ActiveXObject("Microsoft.XMLDOM");B.async=false;B.loadXML(PicLensLite.THE_FEED)}else{var C=new DOMParser();B=C.parseFromString(PicLensLite.THE_FEED,"text/xml")}var A=B.getElementsByTagName("*");return A},getBasicSlideShowHTML:function(){if(!this.LBOX_JS_URL||!this.LBOX_CSS_URL){return""}var D=document.getElementsByTagName("head").item(0);var A=document.createElement("script");A.src=this.LBOX_JS_URL;A.type="text/javascript";D.appendChild(A);var G=document.createElement("link");G.rel="stylesheet";G.href=this.LBOX_CSS_URL;G.type="text/css";G.media="screen";D.appendChild(G);var F=this.getElementsFromXMLFeed();var C;var H="";for(C=0;C<F.length;C++){if(F[C].nodeName=="media:content"){var B=F[C].getAttribute("url");if(B.indexOf(".flv")==-1){H+='<a id="lboxImage" href="'+B+'" rel="lytebox[lite]"></a> '}}}var E="<div id='lightbox_images' align='center' style='display: none; padding-top:10px; color:#FFFFFF; font-size:.8em; "+this.FONT+" color:#999999;'>";E+='( Alternatively, <a onclick="javascript:PicLensLite.invokeLytebox();return false;" href="#" style="color:#656588">click here for a basic slideshow</a>. )';E+=H;E+="</div><br/>";return E},generateAlternativeContent:function(){var J='<div id="altContent" style="text-align:center; margin: 0 0 0 0; padding: 0 0 0 0; background-color: #000; min-width:860px;">';J+='<div align="center" style="width: 100%; padding-top:60px; '+this.FONT+'">';var I=this.FLASH_VER;var G;if(I.major>0){G="update your Flash Player from version "+I.major+"."+I.minor+"."+I.release+" to version 9.0.28 or newer"}else{G="install the most recent Flash Player"}var D="";if(this.THE_FEED!==""){D=this.getBasicSlideShowHTML()}var A=this.PL_URL;var E=this.LEARN_PL_URL;var F=this.ARGS.pid;if(F){A+=F+"/";E+=F+"/"}else{var H="000000000001/";A+=H;E+=H}if(this.SHOW_LBOX){}else{var C="<span style='padding-left:25px; color:#C6C6C6; font-size:";J+="<div style='padding:10px;'>"+C+"1.5em; font-weight: bold; "+this.FONT+"'>You're clicks away from going full screen!</span><br/>"+C+".9em; padding-bottom: 15px; "+this.FONT+"'>You must get the <a href='"+A+"' style='color:#656588'>Cooliris</a> browser plugin, or "+G+".</span></div>";if(!this.BUTTON_URL){J+='<a href="'+A+'" style="color:#ACD">Get PicLens Now!</a>'}else{var B='<area shape="rect" coords=';J+='<img src="'+this.BUTTON_URL+'" alt="" border="0" usemap="#Map"><map name="Map" id="Map">'+B+'"0,0,33,33" href="#" onclick="javascript:PicLensLite.closeFlashUI();" />'+B+'"35,35,325,325" href="'+A+'" />'+B+'"593,209,825,301" href="'+this.FLASH_URL+'" />'+B+'"327,148,448,178" href="'+E+'" /></map>'}}J+="</div>";J+=D;J+='<div align="center" style="color:#666666; font-size:11px; '+this.FONT+'">&copy; 2008 Cooliris, Inc. All trademarks are property of their respective holders.<br/><br/><br/></div>';J+="</div>";return J},generateFlashVars:function(){var C="";var B=this.ARGS;if(typeof B.guid!=="undefined"){C+="&startItemGUID="+B.guid}if(B.loadFeedInFlash){C+="&feedURL="+encodeURIComponent(this.THE_FEED_URL)}if(B.paused){C+="&paused="+B.paused}if(B.loop){C+="&loop="+B.loop}if(B.delay){C+="&delay="+B.delay}if(B.pid){C+="&pid="+B.pid}if(typeof B.maxScale!="undefined"){C+="&maxScale="+B.maxScale}if(typeof B.overlayToolbars!="undefined"){C+="&overlayToolbars="+B.overlayToolbars}var A=this.CUSTOM_BUTTON;if(A!=null){C+="&cButtonURL="+encodeURIComponent(A.targetURL);if(A.labelText!=null){C+="&cButtonLabel="+encodeURIComponent(A.labelText)}if(A.iconImage!=null){C+="&cButtonIcon="+encodeURIComponent(A.iconImage)}}C+="&swfURL="+encodeURIComponent(this.LITE_URL);C=C.substring(1);return C},getFlash:function(){if(this.BROWSER_SAF||this.BROWSER_IE){return document.getElementById(this.FLASH_ID_1)}else{return document.getElementById(this.FLASH_ID_2)}},getWindowSize:function(){var B=document.documentElement;var D=document.body;var A=0,C=0;if(typeof(window.innerWidth)=="number"){A=window.innerWidth;C=window.innerHeight}else{if(B&&(B.clientWidth||B.clientHeight)){A=B.clientWidth;C=B.clientHeight}else{if(D&&(D.clientWidth||D.clientHeight)){A=D.clientWidth;C=D.clientHeight}}}return{w:A,h:C}},handleKeyPress:function(A){if(!this.isRunning()){return true}var B=this.getFlash();if(B!=null&&B.fl_keyPressed){B.fl_keyPressed(A)}else{if(A==27){this.closeFlashUI();return false}}if(A==9||A==13){return false}return true},handleMouseWheel:function(A){var C=0;if(!A){A=window.event}if(A.wheelDelta){C=A.wheelDelta/120;if(window.opera){C=-C}}else{if(A.detail){var B=A.detail;if(Math.abs(B)<3){C=-B}else{C=-B/3}}}if(C){PicLensLite.sendMouseScrollToFlash(C)}if(A.preventDefault){A.preventDefault()}A.returnValue=false;return false},hasCooliris:function(){if(this.DEBUG_NOCLIENT){return false}var E=false;if(this.PLC){E=true}else{if(window.piclens&&window.piclens.launch){this.PLC=window.piclens;E=true}else{var B=null;if(typeof PicLensContext!="undefined"){B=new PicLensContext()}else{try{B=new ActiveXObject("PicLens.Context")}catch(D){if(navigator.mimeTypes["application/x-cooliris"]){B=document.createElement("object");B.style.display="none";B.width=0;B.height=0;B.type="application/x-cooliris";document.documentElement.appendChild(B)}else{B=null}}}this.PLC=B;if(this.PLC){E=true}}}if(E){if(this.BROWSER_SAF){return true}var A;try{A=this.PLC.version}catch(D){return false}var C=A.split(".");if(C[0]>1){return true}else{if(C[0]==1){if(C[1]>6){return true}else{if(C[1]==6){if(C[2]>0){return true}else{if(C[2]==0){if(C[3]>=824){return true}}}}}}}return false}else{return false}},invokeLytebox:function(){this.SHOW_LBOX=true;myLytebox.start(document.getElementById("lboxImage"),false,false);this.closeFlashUI()},showLyteboxLink:function(){myLytebox.updateLyteboxItems();myLytebox.doAnimations=false;var A=document.getElementById("lightbox_images");if(A!=null){A.style.display="block";if(this.SHOW_LBOX&&this.getFlash()==null){this.invokeLytebox()}}},startLytebox:function(){if(typeof myLytebox!="undefined"){this.showLyteboxLink()}else{if(typeof initLytebox!="undefined"){initLytebox();this.showLyteboxLink()}else{if(this.LBOX_COUNT>=4){return}setTimeout(function(){PicLensLite.startLytebox()},150);this.LBOX_COUNT++}}},injectFlashPlayer:function(){var A=this.LITE_FG_DIV;var D;var F;D=F="100%";if(this.BROWSER_IE6){D=F="0"}var E=this.generateFlashVars();var B=this.generateAlternativeContent();if(this.meetsReqs()){var C="<param name=";A.innerHTML='<object id="'+this.FLASH_ID_1+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%">'+C+'"movie" value="'+this.LITE_URL+'" />'+C+'"quality" value="high"/> '+C+'"bgcolor" value="#000000"/> '+C+'"allowScriptAccess" value="always"/> '+C+'"FlashVars" value="'+E+'"/> '+C+'"allowFullScreen" value="true"/> '+C+'"wmode" value="window"/> '+C+'"scale" value="noscale"/> <object type="application/x-shockwave-flash" data="'+this.LITE_URL+'" width="'+D+'" height="'+F+'" quality="high" bgcolor="#000000" id="'+this.FLASH_ID_2+'" quality="high" FlashVars="'+E+'" allowFullScreen="true" scale="noscale" wmode="window" allowScriptAccess="always">'+B+"</object></object>"}else{if(this.ON_NO_PLUGINS){this.ON_NO_PLUGINS()}else{A.innerHTML=B;A.style.minWidth="860px";A.style.minHeight="550px"}}if(this.BROWSER_SAF){this.resizeUI()}},indexFeeds:function(){var E=document.getElementsByTagName("link");var A=[];for(var B=0;B!=E.length;++B){var D=E[B],C=D.getAttribute("type");if(C=="application/rss+xml"||C=="text/xml"){A.push({title:D.getAttribute("title"),url:D.getAttribute("href")})}}return A},loadViaXHR:function(B){var A=this;var D=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP.3.0");try{D.open("GET",B,true);D.onreadystatechange=function(){if(D.readyState==4){if((D.status==200||D.status==0)){if(D.responseText){A.showFlashUI(D.responseText)}}else{if(console){console.log("PicLens Lite could not load the RSS Feed: "+B)}}}};D.send("")}catch(C){this.ARGS.loadFeedInFlash=true;this.showFlashUI("")}},meetsReqs:function(){if(this.DEBUG_NOFLASH){return false}var B=(this.FLASH_VER.major==0)&&this.BROWSER_IE;var A=swfobjlite.hasFlashPlayerVersion("9.0.28");return A||B},removeChildren:function(){this.REMOVE_TIMER_ID=0;if(this.LITE_BG_DIV!==null){document.body.removeChild(this.LITE_BG_DIV);this.LITE_BG_DIV=null}if(this.LITE_FG_DIV!==null){document.body.removeChild(this.LITE_FG_DIV);this.LITE_FG_DIV=null}},resizeFlashToFitPaddedBox:function(){var B=this.getFlash();if(B){var C=this.getPageSize();var A=C.w-this.HPAD*2;var D=C.h-this.VPAD*2;B.style.width=A;B.style.height=D;B.width=A;B.height=D}},resizeToFitPaddedBox:function(B,A){if(typeof A=="undefined"){A=this.getPageSize()}B.width=(A.w-this.HPAD*2)+"px";B.height=(A.h-this.VPAD*2)+"px"},resizeToPaddedBox:function(A){A.left=A.right=this.HPAD+"px";A.top=A.bottom=this.VPAD+"px"},resizeUI:function(){if(this.LITE_FG_DIV){var A=this.LITE_FG_DIV.style;this.resizeToPaddedBox(A);this.resizeToFitPaddedBox(A);this.resizeFlashToFitPaddedBox()}},setRunningFlag:function(A){this.LITE_IS_RUNNING=A;this.piclensIsRunning_=A},setResizeHandler:function(){if(!this.RESIZE_HANDLER_EXISTS&&this.BROWSER_SAF){var A=this;window.addEventListener("resize",function(){A.resizeUI()},false);this.RESIZE_HANDLER_EXISTS=true}},setResizeTimer:function(){if(this.BROWSER_IE6){this.RESIZE_TIMER_IE6=setInterval(function(){PicLensLite.autoResize()},1000)}},showFlashUI:function(A){this.THE_FEED=A;this.findScriptLocation();this.createBackgroundOverlay();this.createForegroundFlashComponent();if(this.BROWSER_IE){this.appendElementsToDocument()}this.injectFlashPlayer();if(!this.BROWSER_IE){this.appendElementsToDocument()}this.addKeyHandlers();this.addMouseHandlers();this.setRunningFlag(true);this.setResizeTimer();this.setResizeHandler();this.startLytebox()},sendMouseScrollToFlash:function(B){if(!this.isRunning()){return}var A=this.getFlash();if(A!=null&&A.fl_mouseMoved){A.fl_mouseMoved(B)}}};var swfobjlite=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",win=window,doc=document,nav=navigator;var ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF&&typeof doc.appendChild!=UNDEF&&typeof doc.replaceChild!=UNDEF&&typeof doc.removeChild!=UNDEF&&typeof doc.cloneNode!=UNDEF,playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d){d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof win.ActiveXObject!=UNDEF){var a=null,fp6Crash=false;try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".7")}catch(e){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".6");playerVersion=[6,0,21];a.AllowScriptAccess="always"}catch(e){if(playerVersion[0]==6){fp6Crash=true}}if(!fp6Crash){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX)}catch(e){}}}if(!fp6Crash&&a){try{d=a.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)]}}catch(e){}}}}var u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=false,windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u);return{w3cdom:w3cdom,pv:playerVersion,webkit:webkit,ie:ie,win:windows,mac:mac}}();return{hasFlashPlayerVersion:function(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10);v[2]=parseInt(v[2],10);return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false},getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]}}}}();var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"Unknown Browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Unknown Version";this.OS=this.searchString(this.dataOS)||"Unknown OS"},searchString:function(D){for(var A=0;A<D.length;A++){var B=D[A].string;var C=D[A].prop;this.versionSearchString=D[A].versionSearch||D[A].identity;if(B){if(B.indexOf(D[A].subString)!=-1){return D[A].identity}}else{if(C){return D[A].identity}}}},searchVersion:function(B){var A=B.indexOf(this.versionSearchString);if(A==-1){return}return parseFloat(B.substring(A+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();initFunctions.push(initOrderBy);function initOrderBy(){if($("orderBy"))
Event.observe("orderBy","change",doOrderBy);}
function doOrderBy(){var ob=$('orderBy');if(ob.options[ob.selectedIndex].value.length>0)
$('form-orderby').submit();}
initFunctions.push(setupSubCatToggle);function setupSubCatToggle(){var toggleLinks=$$('.toggleAllCat');if(toggleLinks.length==0)
return 0;toggleLinks.each(function(n){Event.observe(n,'click',toggleSubCats);});}
function toggleSubCats(e){var subCatWrapper=e.target.up('.categoryList');if(subCatWrapper.hasClassName('showSubCats-1')){subCatWrapper.removeClassName('showSubCats-1');subCatWrapper.addClassName('showSubCats-0');}
else{subCatWrapper.removeClassName('showSubCats-0');subCatWrapper.addClassName('showSubCats-1');}
e.stop();}
initFunctions.push(setUpCW);function setUpCW(){if($('cwNewsletter')){Event.observe($('cwNewsletter'),'click',toggleNewsletterForm);newsletterForm=$('cwNewsletterForm');Event.observe($('cwNewsletterEmail'),'click',function(){if($F('cwNewsletterEmail')=='Enter your email')$('cwNewsletterEmail').value='';});}
Event.observe($('quicksearchstring'),'click',function(){if($F('quicksearchstring')=='search')$('quicksearchstring').value='';});}
function toggleNewsletterForm(e){if(newsletterForm.visible())
newsletterForm.hide();else
newsletterForm.show();Event.stop(e);}