var active;$(document).ready(function(){active=0;$("input:first").focus();$("body").append("<div id=\"lightboxoverlay\">"+"<div id=\"lightboxcontainer\" style=\"position: absolute; z-index: 9999; display: none;\"></div>"+"<div id=\"lightboxmask\" style=\"position: absolute; z-index: 9000; display: none; background-color: #000;\"></div>"+"<div id=\"lightboxtemp\" style=\"display: none;\"></div>"+"<img src=\"loading.gif\" width=\"126\" height=\"22\" border=\"0\" style=\"display: none;\" />"+"<img src=\"loading2.gif\" width=\"16\" height=\"16\" border=\"0\" style=\"display: none;\" />"+"</div>"+"<div id=\"preloadimages\" style=\"display: none;\"></div>");jQuery(".hoverstate").each(function(){$("#preloadimages").append("<img src=\""+jQuery(this).attr('id')+"\" />")});FormFillValidators();PropagateEffects();});function PropagateEffects(){$('.lightbox').die().live('click',function(e){e.preventDefault();OpenLightBox($(this).attr('href'));});jQuery('.hoverstate').die().live('mouseover',function(){tempid=$(this).attr('id');tempsrc=$(this).attr('src');$(this).attr('src',tempid);$(this).attr('id',tempsrc);}).live('mouseout',function(){tempid=$(this).attr('id');tempsrc=$(this).attr('src');$(this).attr('src',tempid);$(this).attr('id',tempsrc);});jQuery('a').die().live('click',function(){linkid=$(this).attr('id').split("_")[0];specid=$(this).attr('id').split("_")[1];$.ajax({type:"POST",url:"viewbookmanager.php",data:"c=linkclick&l="+linkid+"&p="+specid})})}
function FormFillValidators(){if($("#franklinpierce_submit_form").val()=="1"){$("#form_phone").keypress(function(a){return KeyRestrict(a,'1234567890()- ')});$("#form_zip").keypress(function(a){return KeyRestrict(a,'1234567890')});fields=new Array("First Name","form_firstname","Last Name","form_lastname","Gender","form_gender","Address","form_address","City","form_city","State","form_state","Zip","form_zip");$("#franklinpierceform").die().live('submit',{fields:fields},ValidateForm);}else if($("#franklinpierce_submit_form").val()=="2"){$("#form_clubs1").die().live('change',function(){RemoveAllOptions("form_clubs2");$(this).children().each(function(){if($(this).attr('value')!=$(this).parent().attr('value')){AddOption("form_clubs2",$(this).attr('text'),$(this).attr('value'));}});});$("#form_activities1").die().live('change',function(){RemoveAllOptions("form_activities2");$(this).children().each(function(){if($(this).attr('value')!=$(this).parent().attr('value')){AddOption("form_activities2",$(this).attr('text'),$(this).attr('value'));}});});fields=new Array("Clubs and Organizations - Choice 1","form_clubs1","Clubs and Organizations - Choice 2","form_clubs2","Intramural Sports","form_intramurals","Weekend Activities - Choice 1","form_activities1","Weeekend Activities - Choice 2","form_activities2");$("#franklinpierceform").die().live('submit',{fields:fields},ValidateForm);}}
function OpenHouseLightbox(){$("#franklinpierce_lightbox_openhouse").die().live('submit',function(e){e.preventDefault();if($(".optional").css('display')=="none"){f=new Array("Will you be able to join us on the next Open House?","form_ohq1")}else{f=new Array("First Name","form_ohq4","Last Name","form_ohq5","Will you be able to join us on the next Open House?","form_ohq1","Address","form_ohq6")}
if(ValidateForm(f)){var d="sid="+$("#sid").val()+"&c=openhousesubmit"+"&l="+"&p="+"&form_ohq1="+$(':input[name=form_ohq1]:checked').val()+"&form_ohq2="+$(':input[name=form_ohq2]:checked').val()+"&form_ohq3="+$(':input[name=form_ohq3]:checked').val()+"&ohd="+$('#form_openHouseDate').val()+"&ohd2="+$('#form_openHouseDate2').val();var f=new Array("form_ohq4","form_ohq5","form_ohq6","form_ohq7","form_ohq8");for(i in f){d+="&"+f[i]+"="+$("#"+f[i]).val()}
$.ajax({type:"POST",url:"viewbookmanager.php",dataType:"text",data:d,cache:false,timeout:5000,success:function(a){$("#sid").val(a)},error:function(a,b,c){alert(c)}});if($.trim($("#form_ohq4").val()).length>0){$("#form_firstname").val($("#form_ohq4").val())}
if($.trim($("#form_ohq5").val()).length>0){$("#form_lastname").val($("#form_ohq5").val())}
if($.trim($("#form_ohq6").val()).length>0){$("#form_address").val($("#form_ohq6").val())}
if($.trim($("#form_ohq7").val()).length>0){$("#form_email").val($("#form_ohq7").val())}
if($.trim($("#form_ohq8").val()).length>0){$("#form_phone").val($("#form_ohq8").val())}
CloseLightBox();}})}
function OpenLightBox(e){if(active==0){active=1;$(":input").css('visibility','hidden');qry=e.split('?');if(qry[1]===undefined){w=350;h=200}else{w=parseInt(qry[1].split('width=')[1]);h=parseInt(qry[1].split('height=')[1])}
var pageSize=getPageSize();$("#lightboxmask").css({'width':pageSize[0],'height':pageSize[1],'top':0,'left':0});$("#lightboxmask").fadeIn(400);$("#lightboxmask").fadeTo("fast",0.8);var pageScroll=getPageScroll();$("#lightboxcontainer").css({'width':16,'height':16,'left':((pageSize[0]/2)-(16/2)),'top':(pageScroll[1]+(pageSize[3]/10))});$("#lightboxcontainer").html("<img src=\"loading.gif\" width=\"126\" height=\"22\" border=\"0\" />");$("#lightboxcontainer").fadeIn(500);$.ajax({url:e,cache:false,timeout:5000,success:function(a){var pageSize=getPageSize();var pageScroll=getPageScroll();$("#lightboxcontainer").css({'width':w,'height':h,'left':((pageSize[0]/2)-(w/2)),'top':(pageScroll[1]+(pageSize[3]/10))});$("#lightboxcontainer").html(a);$("#lightboxcontainer").show();$(".lightboxclose").die().live('click',function(e){e.preventDefault();CloseLightBox();FormFillValidators()});OpenHouseLightbox();PropagateEffects()},error:function(a,b,c){CloseLightBox()}});$(window).die().live('resize',function(){var pageSize=getPageSize();$("#lightboxmask").css({'width':pageSize[0],'height':pageSize[1],'top':0,'left':0});var pageScroll=getPageScroll();$("#lightboxcontainer").css({'width':w,'height':h,'left':((pageSize[0]/2)-(w/2)),'top':(pageScroll[1]+(pageSize[3]/10))});});}}
function CloseLightBox(){$("#lightboxmask, #lightboxcontainer").hide();$(":input").css('visibility','visible');active=0;PropagateEffects();if($(':input[name=form_ohq1]:checked').val()=="Y"){$("#rightgreyareasub1").css('display','block')}else{$("#rightgreyareasub2").css('display','block')}}
function getPageSize(){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;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;}
function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;}