function refresh(){window.location.reload(false)}function expand(id){if(document.getElementById(id+"_content").style.display=="none"){document.getElementById(id+"_content").style.display="block";document.getElementById(id+"_link").setAttribute(document.all?"className":"class","collapse")}else{document.getElementById(id+"_content").style.display="none";document.getElementById(id+"_link").setAttribute(document.all?"className":"class","expand")}document.getElementById("contentLeft").style.height="100%"}function showSecondaryNav(nav){nav=$(nav);var dd=$("ul",nav),items=$("li",dd);if($("#headerLinks").css("min-height")=="400px"){dd.css({left:0-nav.position().left+nav.outerWidth(),top:0});dd.stop(true,true).slideDown(300);nav.hover(function(){},function(){dd.stop(true,true).delay(500).slideUp(300)})}else{dd.stop(true,true).slideDown(250);dd.css({left:0,top:$("a",nav).outerHeight()});nav.hover(function(){},function(){dd.stop(true,true).slideUp("slow")})}}function launchApp(url,swfID){var w=screen.width-15,h=screen.height-90,xPos=(screen.width-w)/2,yPos=(screen.height-h)/2,newWin=window.open(url,"app","fullscreen=no,menubar=no,location=no,toolbar=no,resizable=yes,status=no,width="+w+",height="+h+",left="+xPos+",top="+yPos+"");if(!newWin)document.getElementById(swfID).openWindowFromSwf(url);else{if(typeof newWin!="undefined"&&!newWin.closed)newWin.blur();else var newWin=window.open(url,"app","fullscreen=no,menubar=no,location=no,toolbar=no,resizable=yes,status=no,width="+w+",height="+h+",left="+xPos+",top="+yPos+"");newWin.moveTo(xPos,yPos);newWin.focus()}return false}function getURLVar(urlVarName){var urlHalves=String(document.location).split("?"),urlVarValue="";if(urlHalves[1]){var urlVars=urlHalves[1].split("&");for(i=0;i<=urlVars.length;i++)if(urlVars[i]){var urlVarPair=urlVars[i].split("=");if(urlVarPair[0]&&urlVarPair[0]==urlVarName)urlVarValue=urlVarPair[1]}}return urlVarValue}function logout(){var info="action=userLogout";sendReq("/resources/php/ajax.php","LogoutStatus(req.responseText)",info)}function LogoutStatus(status){refresh()}function buttonFix(btn){btn.find("ul.button").width(btn.find("ul.button").width()+10);btn.width(btn.find("ul.button").width())}$(window).load(function(){$(".buttonWrapper").each(function(s){buttonFix($(this))});secureForms();createPhotoGrid();createAlbumLinks();$(".slideshow").slideshow();!$.browser.msie&&$(".rounded-img").wrap(function(){return '<span style="background-image:url('+$(this).attr("src")+"); height: "+$(this).height()+"px; width: "+$(this).width()+'px;" class="rounded" />'})});function secureForms(){$(".warning").remove();$.get("/resources/site/utils/token.php",function(txt){$(".secure").append('<input type="hidden" name="ts" value="'+txt+'" />')})}function checkContactForm(form){var form=$("#"+form);$(".submitButton",form).hide();var action="contactForm",formArray=["name","email","content"],valueArray=[],err="none";for(i=0;i<formArray.length;i++)if($("[name="+formArray[i]+"]",form).val()==""){$("[name="+formArray[i]+"]",form).removeClass().addClass("req");err="error"}else{$("[name="+formArray[i]+"]",form).removeClass().addClass("formInput");valueArray.push($("[name="+formArray[i]+"]",form).val())}if(err=="none"){formArray.push("phone");valueArray.push($("[name=phone]",form).val());formArray.push("titleArray");valueArray.push($("[name=titleArray]",form).val());formArray.push("userID");valueArray.push("<?=$this->site->userID?>");formArray.push("ts");valueArray.push($("[name=ts]",form).val());formArray.push("to");valueArray.push($("[name=to]",form).val());formArray.push("subject");valueArray.push($("[name=subject]",form).val());var info="action="+action;for(i=0;i<formArray.length;i++)info+="&"+formArray[i]+"="+valueArray[i];$.post("/resources/site/utils/ajax.php",info,function(status){if(status=="suspicious"){$("#status",form).fadeIn(300);$("#status",form).html("<div class='alert_error'>This email could not be sent at this time.</div>")}else if(status=="time"){("#status",form).fadeIn(300);$("#status",form).html("<div class='alert_error'>Please refresh this page and try again.</div>")}else if(status=="success"){$("#status",form).fadeIn(300);$("#status",form).html("<div class='alert_success'>Your message was sent.</div>");$(".formContent",form).hide()}else{$("#status",form).fadeIn(300);$("#status",form).html("<div class='alert_error'>An error occurred. Please try again later.</div>")}$(".submitButton",form).show()})}else{$("#status",form).fadeIn(300);$("#status",form).html("<div class='alert_attention'>Please fill in all the required fields.</div>");$(".submitButton",form).show()}}function createPhotoGrid(){$(".imageGrid").each(function(s){var gridID=$(this).attr("id").split("imageGrid_").join(""),currentSize=$(this).find(".scale-image").first().width(),currentScale=currentSize/150;$(this).find("#imageGridSlider").slider({value:currentScale,step:.01,round:2,from:.25,to:1,limits:false,onstatechange:function(ui){scaleIt(ui,$("#imageGrid_"+gridID))}});positionThumbs($("#imageGrid_"+gridID));$("#imageGrid_"+gridID).find(".scale-image").fadeIn(600);$("#imageGrid_"+gridID).find(".scale-image").hover(function(){$(this).stop().animate({marginTop:"-10px"},200)},function(){$(this).stop().animate({marginTop:"0px"},300)});$("a[rel='group"+gridID+"']").colorbox({current:"{current} of {total}"})})}function scaleIt(v,grid){floorSize=.26;ceilingSize=1;grid.find(".scale-image").each(function(s){$(this).width(v*150);$(this).height(v*150)});positionThumbs(grid)}function positionThumbs(g){var grid=g.find(".grid").first(),thumbs=g.find(".scale-image"),rowCount=0,xPos=0,yPos=0,pad=10;thumbs.each(function(s){var thumb=$(this);thumb.css({top:yPos,left:xPos});xPos+=thumb.width()+pad;rowCount++;grid.height(yPos+thumb.height()+15);if(xPos+thumb.width()+pad>grid.outerWidth()){rowCount=0;xPos=0;yPos+=thumb.height()+pad}});g.find(".photoGridControls").css("display")=="block"&&grid.height(grid.height()+g.find(".photoGridControls").outerHeight())}var currentAlbumPage=0,totalAlbumPages=0;function createAlbumLinks(){$(".albumLinks").each(function(s){var main=$(".albumLinks"),mask=$(".album-links-mask"),thumbs=$(".album-link"),controls=$(".album-links-controls",main),pad=10,w=$(".album-link").width()+pad,maskWidth=main.parent().width(),maskHeight=maskWidth>300?150:470,labels=$(".album-links-label").css("display")=="block"?true:false;if(!labels&&maskHeight==470)maskHeight=410;else if(!labels)maskHeight=100;var rowHeight=labels?115:100,perRow=Math.floor(maskWidth/w),perColumn=Math.floor(maskHeight/rowHeight),perPage=perColumn*perRow;totalAlbumPages=Math.ceil(thumbs.length/perPage);var rows=0,columns=0,count=0;if(totalAlbumPages>1)$(".album-links-pages").html(currentAlbumPage+1+" of "+totalAlbumPages);else{$(".album-links-pages").hide();$(".rightArrow",controls).hide();$(".leftArrow",controls).hide()}mask.css({overflow:"hidden"});mask.height(maskHeight);mask.width(maskWidth);thumbs.each(function(s){var thumb=$(this);thumb.css({top:rows*rowHeight,left:count*w+columns*maskWidth});if(count==perRow-1){count=0;rows++;if(rows==perColumn){rows=0;columns++}}else count++});mask.find(".album-link").fadeIn(300);mask.find(".album-link").hover(function(){$(this).stop().animate({marginTop:"-5px"},200)},function(){$(this).stop().animate({marginTop:"0px"},300)})})}function changeAlbumLinksPage(type){var controls=$(".album-links-controls");if(type=="next"){if(currentAlbumPage<totalAlbumPages-1){currentAlbumPage++;$(".leftArrow",controls).show();if(currentAlbumPage>=totalAlbumPages-1)$(".rightArrow",controls).hide();else $(".rightArrow",controls).show()}}else{if(currentAlbumPage>0)currentAlbumPage--;$(".rightArrow",controls).show();if(currentAlbumPage<=0)$(".leftArrow",controls).hide();else $(".leftArrow",controls).show()}$(".album-links-pages").html(currentAlbumPage+1+" of "+totalAlbumPages);$(".album-links-holder").stop().animate({left:0-currentAlbumPage*$(".album-links-mask").width()},200)}