$(document).ready(function(){function g(a){var b=new Image;b.src=a;return{width:b.width,height:b.height}}function h(){var a=$("#column1").sortable("toArray").join(",");$.ajax({url:"updatePositions.php",type:"POST",async:!1,data:{page_type:$("#page_type").val(),positions:a},success:function(){$("#resetHomepage").show()}})}function i(){$(".delete").click(function(a){a.preventDefault();var a=$(this).parent().parent().parent().parent().attr("id"),b=$("#"+a);$("#dialog-confirm").dialog({resizable:!1,height:200,
width:500,modal:!0,buttons:{"Remove widget":function(){$(this).dialog("close");b.hide(1E3,function(){b.remove();h()})},Cancel:function(){$(this).dialog("close")}}})})}function j(){if($("#sidebar").length>0)$.browser.msie&&$.browser.version.substr(0,1)==6&&($("#content1").css("overflow","hidden"),$("#contentMain").css("position","relative")),$.browser.msie&&$.browser.version.substr(0,1)==7&&($("#main").width($("#content1").width()),$("#pageContainer").css("overflow","none"),$("#pageContainer").css("position",
"relative")),$.browser.msie&&$.browser.version.substr(0,1)==8&&$("#column1").css("paddingLeft","45px"),$.browser.msie&&$.browser.version.substr(0,1)<=7&&$("#headerText").css("position","absolute"),$("#contentMain").width($("#content1").width()),$(".boxContainer").width($("#content1").width());else if($("#contentFullPage").length>0){if($("#contentFullPage").css("overflow","hidden"),$("#main").width($("#contentFullPage").width()),$("#contentMain").width($("#contentFullPage").width()-15),$.browser.msie&&
$.browser.version.substr(0,1)<=7&&($("#headerText").css("position","absolute"),$("#MenuBar1").height($("#MenuBar1").height())),$.browser.msie&&$.browser.version.substr(0,1)==7)if($("#MenuBar1").width()<$("#contentMain").width()-20){var a=$("#MenuBar1").width()/$("#contentMain").width()*100-5;$("#MenuBar1").width(a+"%")}else $("#MenuBar1").width("94%"),$("#MenuBar1").css("margin-left","-51px")}else $("#main").width($("#bodyContainer").width()),$("#contentMain").width($("#bodyContainer").width()),$("#contentBodyExtraLrg").css("overflow",
"hidden"),$("#main").width($("#bodyContainer").width()-50),$("#contentMain").width($("#bodyContainer").width()-50),$.browser.msie&&($("#main").width($("#bodyContainer").width()-100),$("#contentMain").width($("#bodyContainer").width()-100)),$.browser.msie&&$.browser.version.substr(0,1);$.browser.msie&&$.browser.version.substr(0,1)==8&&($("#contentFullPage").length>0?($("#contentMain").css("margin-left","-20px"),$("#editMenu").css("margin-left","20px")):$("#column1").css("margin-left","-40px"));$(".boxContainer").width($("#contentMain").width()+
35);$.browser.msie&&$.browser.version.substr(0,1)==6&&$(".boxContainer").width($("#contentMain").width()-25);$("#column1").width($(".boxContainer").width()+1);$("#content1").css("padding-left","0px");$("#contentMain").css("padding-left","0px");$("#content1").width($("#content1").width()+10);$("#contentMain").show();$(".oneColWidth").width(($(".boxContainer").width()-40)/3-13);$(".twoColWidth").width(($(".boxContainer").width()-40)/3*2-2);$(".threeColWidth").width($(".boxContainer").width()-37);$.browser.msie&&
$.browser.version.substr(0,1)==6&&($(".oneColWidth").width($(".oneColWidth").width()-2),$(".twoColWidth").width($(".twoColWidth").width()-2),$(".threeColWidth").width($(".threeColWidth").width()-4),$(".oneColWidth header").width($(".oneColWidth").width()-27),$(".twoColWidth header").width($(".twoColWidth").width()-27),$(".threeColWidth header").width($(".threeColWidth").width()-27));var b=$(".oneColWidth").width(),c=$(".twoColWidth").width(),d=$(".threeColWidth").width();$(".oneColWidth .slideshow").width(b-
20);$(".twoColWidth .slideshow").width(c-20);$(".threeColWidth .slideshow").width(d-20);$(".oneColWidth .slideshow div").width(b-20);$(".twoColWidth .slideshow div").width(c-20);$(".threeColWidth .slideshow div").width(d-20);$(".slideshow").each(function(){$(this).parent().siblings(".rotatorHeight").text()=="Y"&&$(this).closest("article").height(parseInt($(this).parent().siblings(".rotatorHeight").text())+40+"px");$(this).height($(this).parent().siblings(".rotatorHeight").text())});$(".slideshow div").each(function(){$(this).height($(this).parent().height())});
$(".oneColWidth div header img").each(function(){var a=$(this).attr("src"),a=g(a);$(this).width(a.width);$(this).width()>b?($(this).width(b-2),$.browser.msie&&$.browser.version.substr(0,1)>8?$(this).width()<=a.width+30&&$(this).parent().hasClass("round")&&$(this).corner("top"):$.browser.msie||$(this).parent().hasClass("round")&&$(this).corner("top")):($(this).uncorner(),$.browser.msie&&$.browser.version.substr(0,1)==6&&$(this).parent().width(b-7));$(this).parent().height($(this).height())});$(".twoColWidth div header img").each(function(){var a=
$(this).attr("src"),a=g(a);$(this).width(a.width);$(this).width()>c?($(this).width(c-2),$.browser.msie&&$.browser.version.substr(0,1)>8?$(this).width()<=a.width+30&&$(this).parent().hasClass("round")&&$(this).corner("top"):$.browser.msie||$(this).parent().hasClass("round")&&$(this).corner("top")):($(this).uncorner(),$.browser.msie&&$.browser.version.substr(0,1)==6&&$(this).parent().width(c-7));$(this).parent().height($(this).height())});$(".threeColWidth div header img").each(function(){var a=$(this).attr("src"),
a=g(a);$(this).width(a.width);$(this).width()>d?($(this).width(d-2),$.browser.msie&&$.browser.version.substr(0,1)>8?$(this).width()<=a.width+30&&$(this).parent().hasClass("round")&&$(this).corner("top"):$.browser.msie||$(this).parent().hasClass("round")&&$(this).corner("top")):($(this).uncorner(),$.browser.msie&&$.browser.version.substr(0,1)==6&&$(this).parent().width(d-7));$(this).parent().height($(this).height())});$(".oneColWidth .event_description_float").width(b-102);$(".twoColWidth .event_description_float").width(c-
102);$(".threeColWidth .event_description_float").width(d-102)}$("noscript").remove();$(".delete").hide();$("header, .controlsNoHeader").hover(function(){$(this).css("cursor","default")});$(".controlsNoHeader").hide();$("h4:first").css("margin-top","0px");var k=new Image;$("img").each(function(){$.browser.msie&&$.browser.version.substr(0,1)==6&&$(this).attr("src").indexOf("widget_headers")>0&&$(this).width(10);k.src=$(this).attr("src")});$(".boxContainer").after('<div id="dialog-confirm" title="Remove this Widget?" style="display:none"><p style="font-size:.75em;"><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This widget will be removed from your homepage. It can only be restored if you reset the page. Are you sure?</p></div>');
(function(){j();i();$("li div p.widgetTypeIdentifier").each(function(){if($(this).text()=="poll"){$(".ieonly").css("display","block");var a="table"+$(this).closest("li").attr("id");count=1;var b=[],c=[],d=0;$("#"+a+" tbody tr td").each(function(){b[count]=parseInt($(this).text());d+=b[count];count++});count=1;c=[];$("#"+a+" tbody tr td").each(function(){c[count]=parseInt($(this).text())/d*100;count++});var f=$("#ieonly"+$(this).closest("li").attr("id")),g=$("#"+a+" caption").text();$(this).closest("li").width();
var e='<table id="iePoll" cellspacing = "0" cellpadding = "4" style="padding:10px; border-radius: 10px; border: 1px solid silver; box-shadow: #dedede 2px 2px 2px; background:url(../images/chartbg-vanilla.png); width:98%; margin-left:7px !important; display: inline-table;" border="0"><tr><td colspan="'+(count-1)+'" height="50px" align="center"><b>'+g+"</b></td></tr><tr>";for(n=1;n<count;n++)isNaN(c[n])&&(c[n]=0),e+='<td style="text-align:center;font-size:10pt;">'+Math.round(c[n])+"%</td>";e+="</tr><tr>";
count=1;$("#"+a+" tbody tr td").each(function(){var a=0;parseInt($(this).text())!=0&&(a=parseInt($(this).text()/d*100));e+='<td valign="bottom" align="center"><img src="images/poll-bar'+count+'.png" style="border: 1px solid silver; width:30px; height:'+a+'px;"></td>';count++});e+="</tr>";$("#"+a+" tbody tr td").each(function(){e+='<td valign="bottom" align="center">'+parseInt($(this).text())+"</td>"});e+="</tr></table>";count=1;$("#"+a+" tbody tr th").each(function(){$(this).text();count++});$.browser.msie&&
$.browser.version.substr(0,1)==7&&$("#"+a).parent().parent().css("overflow","hidden");$(e).appendTo(f);$(this).siblings("article").css("padding-left","0px");$("#"+a).parent().hide()}else $(this).text()=="rotator"?$(".slideshow").each(function(){$(".slideshow img").imgCenter({scaleToFit:!1,parentSteps:2});var a=$(this),b=a.next(".caption");a.parent().siblings("p.rotatorTransitionType").text();a.cycle({fx:a.parent().siblings("p.rotatorTransitionType").text(),speed:a.parent().siblings("p.rotatorTransitionTime").text(),
timeout:a.parent().siblings("p.rotatorImageShow").text(),sync:!0,before:function(){this.title!=String.fromCharCode(160)&&b.html("<p>"+this.title+"</p>").hide().fadeIn(1E3)}})}):$(this).text()=="latestPhotos"?($(".slideshow2").each(function(){var a=$(this);a.next(".caption");$(this).siblings(".nav").children(".next").click(function(){a.cycle("next");return!1});$(this).siblings(".nav").children(".prev").click(function(){a.cycle("prev");return!1});a.cycle({fx:"fade",speed:"fast",timeout:0,after:function(){$(this).parent().parent().children(".caption").html(this.title)}})}),
$.browser.msie&&parseInt($.browser.version)==7?$("a[rel^='prettyPhoto']").prettyPhoto({theme:"light_rounded",social_tools:!1}):$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:!1})):$(this).text()=="text"&&$.browser.webkit&&$(this).siblings("article").width($(this).siblings("article").width()+5)});$("a.audioLink").click(function(a){a.preventDefault();a=$(this).attr("href");$.post("/media/updateHits.php",{mediaFile:a});window.open(a+"?rand="+Math.random()*1E8,"mediaPlayer","width=320,height=240")});
$("#column1").hide().show()})();$("#editHomepage").live("click",function(){$(this).after('<img style="display:inline" id="stopEditing" src="images/stopEditing.gif" alt="" title="Stop Editing the Homepage" />');$(this).hide();$(".controlsNoHeader").show();$("ul.connectedSortable").sortable({placeholder:"state-highlight",start:function(a,b){var c=$(b.item).attr("id");$("li#"+c+" div article").html().search(/<SCRIPT/i)!="-1"&&$("li#"+c+" div article").html("<p>The page will refresh after you drop this widget.</p>");
var d;b.item.hasClass("threeColWidth")?d="threeColWidth":b.item.hasClass("twoColWidth")&&(d="twoColWidth");b.placeholder.addClass(d);b.placeholder.height(b.item.height());b.placeholder.width(b.item.width());$.browser.msie&&$.browser.version.substr(0,1)==6&&(b.placeholder.height(b.item.height()-15),b.placeholder.width(b.item.width()-15))},change:function(){},stop:function(a,b){if(b.item.html().indexOf("The page will refresh after you drop this widget")!="-1")h(),window.location.href.indexOf("?edit=Y")==
-1?window.location.href+="?edit=Y":window.location.href=window.location.href},helper:"original",forcePlaceholderSize:!0,forceHelperSize:!0,handle:"header,span",cursor:"move",opacity:0.7,update:function(a,b){h();$(".visualize").trigger("visualizeRefresh");if(b.item.html().indexOf("The page will refresh after you drop this widget")!="-1")window.location.href.indexOf("?edit=Y")==-1?window.location.href+="?edit=Y":window.location.href=window.location.href}});$("header, .controlsNoHeader").hover(function(){$(this).css("cursor",
"move")});$(".delete").show()});$("#stopEditing").live("click",function(){$(this).replaceWith('<img style="display:inline" id="editHomepage" src="images/editHomepage.gif" alt="" title="Edit the Homepage" />');$("ul.connectedSortable").sortable("destroy");$("header, .controlsNoHeader").hover(function(){$(this).css("cursor","default")});$(".delete").hide();$(".controlsNoHeader").hide();if(location.search.substr(1)=="edit=Y")location.search=""});i();$(".submit").live("click",function(){var a=$(this).parent(),
b=a.attr("id");a.children();var c="formId="+b,d="&names=",f=!0;$(a).children().each(function(){$(this).children('input[type="text"], select, textarea').each(function(){$(this).is(".required")&&$(this).val()==""&&(f=!1)});$(this).children('input[type="radio"]').each(function(){$(this).is(".required")&&$("input:radio[name="+$(this).attr("name")+"]:checked").length==0&&(f=!1)});$(this).children('input[type="checkbox"]').each(function(){$(this).is(".required")&&$("input:checkbox[name="+$(this).attr("name")+
"]:checked").length==0&&(f=!1)})});$(a).children().each(function(){$(this).children("input, select, textarea").each(function(){$(this).attr("type")=="text"?c+="&"+$(this).attr("name").replace(b,"")+"="+$(this).val():$(this).attr("type")=="checkbox"?(c+="&"+$(this).attr("name").replace(b,"")+"=",$("input:checkbox[name="+$(this).attr("name")+"]:checked").each(function(){c+=$(this).val()+"<br>"})):c+=$(this).attr("type")=="radio"?"&"+$(this).attr("name").replace(b,"")+"="+$("input:radio[name="+$(this).attr("name")+
"]:checked").val():"&"+$(this).attr("name").replace(b,"")+"="+$(this).val()})});$(a).find("label").each(function(){d+=$(this).text().replace(":*",",").replace(":",",")});c+=d;f==!0?$.ajax({url:"/control/settings/homepagebuilder/processForm.php",type:"GET",data:c,cache:!1,success:function(b){b!="VerificationFailed"?$(a).parent().html("<p>Thank you very much for completing this form.  Your information has been submitted successfully.</p>"):(insertHtml='<p style="color:red">You failed to enter the correct Verification Code.  The form has not been submitted.</p>',
$(a).parent().children("#error").html(insertHtml))}}):(insertHtml='<p style="color:red">Please fill in all of the required fields.</p>',$(a).parent().children("#error").html(insertHtml));return!1});$("#resetHomepage").click(function(){$.ajax({url:"resetHomepage.php",type:"GET",data:{page_type:$("#page_type").val()},success:function(){location.href=location.href}})});location.search.substr(1)=="edit=Y"&&$("#editHomepage").click();$("#contentMain").show()});

