$(document).ready(function(){if(!document.getElementById||!document.getElementsByTagName){return false;}
var hasScroller;var allTags=document.getElementsByTagName("*");var checkout1Form=document.getElementById("checkout1Form");var checkout2Form=document.getElementById("checkout2Form");var checkout3Form=document.getElementById("checkout3Form");var emailUsForm=document.getElementById("emailUsForm");var emailAttyForm=document.getElementById("emailAtty");var contactForm=document.getElementById("GetListedCommand");var simpleContactForm=document.getElementById("simpleContact");var onlineRegForm=document.getElementById("onlineRegForm");var chkout1BillCountry=document.getElementById("billCountryGeoId");var chkout1BillState=document.getElementById("billStateProvinceGeoId");var chkout1ShipCountry=document.getElementById("shipCountryGeoId");var chkout1ShipState=document.getElementById("shipStateProvinceGeoId");var sampleContent=document.getElementById("sampleContent");var ldirWidget=document.getElementById("ldirWidget");var print_icon=document.getElementById("print");var ldirSearchForm=document.getElementById("ldirSearchForm");var onlineRegBookForm=document.getElementById("onlineRegBookForm");var orderForm=document.getElementById("checkout3Form");var ldirPricingForm=document.getElementById("ldirPricingForm");if(contactForm){valLDIRContact();}
if(print_icon){printPage();}
if(ldirWidget){valLdirWidget();}
if(ldirSearchForm){valSearchLDIR();populateSearch();}
if(onlineRegBookForm){populateSearchBook();}
if(checkout1Form){billAddyToShip();}
var tabs=document.getElementById("tabs");if(tabs){handleTabs(tabs);}
var tabs=document.getElementById("tabsPopular");if(tabs){handleTabs(tabs);}
var tabs=document.getElementById("tabsFeatured");if(tabs){handleTabs(tabs);}
var tabs=document.getElementById("tabsCatFeatured");if(tabs){handle3Tabs(tabs);}
if(chkout1BillCountry&&chkout1BillState){billStateRefresh();}
if(sampleContent){initPagination(1);}
if(orderForm){submitFormOnce();checkCoupon();}
if(ldirPricingForm){initLDIRPricingForm();}
$('.clearTxt').click(function(){this.value='';});$('.switchImg').hover(function(){$(this).attr('src',$(this).attr('src').replace("_off","_on"));},function(){$(this).attr('src',$(this).attr('src').replace("_on","_off"));});function initPage(){for(var i=1;i<allTags.length;i++){var className=allTags[i].className;var tagName=allTags[i].nodeName;if(className.indexOf("jsClose")!=-1){allTags[i].onclick=function(){window.close();return false;}}}}
$('.scroller button').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});function printPage(){var icon=document.getElementById("print");icon.onclick=function(){if(window.print){window.print();}
return false;};}
function billAddyToShip(){if(checkout1Form.billToShip){checkout1Form.billToShip.onclick=function(){if(this.checked){checkout1Form.shipFirstName.value=checkout1Form.billFirstName.value;checkout1Form.shipLastName.value=checkout1Form.billLastName.value;checkout1Form.shipCompany.value=checkout1Form.billCompany.value;checkout1Form.shipAddress1.value=checkout1Form.billAddress1.value;checkout1Form.shipAddress2.value=checkout1Form.billAddress2.value;checkout1Form.shipCity.value=checkout1Form.billCity.value;checkout1Form.shipStateProvinceGeoId.value=checkout1Form.billStateProvinceGeoId.value;checkout1Form.shipPostalCode.value=checkout1Form.billPostalCode.value.substr(0,5);checkout1Form.shipPhone.value=checkout1Form.billPhone.value;}
else{checkout1Form.shipCountryGeoId.selectedIndex=0;checkout1Form.shipFirstName.value='';checkout1Form.shipLastName.value='';checkout1Form.shipCompany.value='';checkout1Form.shipAddress1.value='';checkout1Form.shipAddress2.value='';checkout1Form.shipCity.value='';checkout1Form.shipStateProvinceGeoId.value='';checkout1Form.shipPostalCode.value='';checkout1Form.shipPhone.value='';}}}}
function billStateRefresh(){var billStateValue=document.getElementById('billStateProvinceGeoIdDD').value;if(chkout1BillCountry.value=='USA'){updateElement(chkout1BillState,'getStatesForCountry?country=USA&mode=bill&state='+billStateValue,function(){if(document.getElementById('storedState').value!=''){document.getElementById('billStateList').value=document.getElementById('storedState').value;}else{document.getElementById('storedState').value=document.getElementById('billStateList').value;}
document.getElementById('billStateList').onchange=function(){var billStateList=document.getElementById('billStateList');document.getElementById('storedState').value=billStateList.value;};});}
chkout1BillCountry.onchange=function(){updateElement(chkout1BillState,'getStatesForCountry?country='+this.value+'&mode=bill');};}
function valCheck1(){checkout1Form.onsubmit=function(){if(!checkForMinValue(this.billCountryGeoId,1,"Please select a country for your billing address.")){return false;}
if(!checkForMinValue(this.billFirstName,1,"Please enter a first name for your billing address.")){return false;}
if(!checkForMinValue(this.billLastName,1,"Please enter a last name for your billing address.")){return false;}
if(!checkForMinValue(this.billAddress1,3,"Please enter an address for your billing address.")){return false;}
if(!checkForMinValue(this.billCity,2,"Please enter a city for your billing address.")){return false;}
if(this.billCountryGeoId.value=='US'){if(!checkForMinValue(this.billStateProvinceGeoId,1,"Please select a state for your billing address.")){return false;}}
if(!checkForMinValue(this.billPostalCode,1,"Please enter a zip/postal code for your billing address.")){return false;}
if(!checkForMinValue(this.billPhone,10,"Please enter a phone for your billing address.")){return false;}
if(!validateEmail(this.emailAddress,"Please enter a valid email.")){return false;}
if(this.shipCountryGeoId){if(!checkForMinValue(this.shipCountryGeoId,1,"Please select a country for your shipping address.")){return false;}}
if(this.shipFirstName){if(!checkForMinValue(this.shipFirstName,1,"Please enter a first name for your shipping address.")){return false;}}
if(this.shipLastName){if(!checkForMinValue(this.shipLastName,1,"Please enter a last name for your shipping address.")){return false;}}
if(this.shipAddress1){if(!checkForMinValue(this.shipAddress1,3,"Please enter an address for your shipping address.")){return false;}}
if(this.shipCity){if(!checkForMinValue(this.shipCity,2,"Please enter a city for your shipping address.")){return false;}}
if(this.shipCountryGeoId){if(this.shipCountryGeoId.value=='US'){if(!checkForMinValue(this.shipStateProvinceGeoId,1,"Please select a state for your shipping address.")){return false;}}}
if(this.shipPostalCode){if(!checkForMinValue(this.shipPostalCode,1,"Please enter a zip/postal code for your shipping address.")){return false;}}
if(this.shipPhone){if(!checkForMinValue(this.shipPhone,10,"Please enter a phone for your shipping address.")){return false;}}}}
function valCheck2(){checkout2Form.onsubmit=function(){if(!checkForMinValue(this.shipCountry,1,"Please select a country from the list.")){return false;}}}
function valCheck3(){checkout3Form.onsubmit=function(){var ccType=document.getElementById("ccType").value;var ccExpMonth=document.getElementById("ccExpMonth").value;var ccExpYear=document.getElementById("ccExpYear").value;if(!checkForMinValue(this.ccType,1,"Please select a card type.")){return false;}
if(!checkForMinValue(this.ccNum,16,"Please enter a valid credit card number.")){return false;}
if(!checkForMinValue(this.ccFirstName,2,"Please enter the first name on your card.")){return false;}
if(!checkForMinValue(this.ccLastName,2,"Please enter the last name on your card.")){return false;}
if(!ccExpMonth){alert("Please enter the month of your card's expiration.");document.getElementById("ccExpMonth").focus();return false;}
if(!ccExpYear){alert("Please enter the year of your card's expiration.");document.getElementById("ccExpYear").focus();return false;}
if(ccExpMonth&&ccExpYear){var ExpDate=new Date(ccExpYear,ccExpMonth-1);var results=compareDateToNow(ExpDate);if(results=="<"){alert("The expiration date for your credit card has already passed.");document.getElementById("ccExpMonth").focus();return false;}}}}
function submitFormOnce(){var formSubmit=false;orderForm.onsubmit=function(){if(formSubmit){alert("Your order has already been submitted. Please wait while it processes.");return false;}
else{formSubmit=true;return true;}}}
function checkCoupon(){var ccType=document.getElementById('ccType');var couponCode=document.getElementById('promoCode');ccType.onclick=function(){if(couponCode.value.length>0){alert('Please click the "Apply Coupon" button to apply the coupon to your order before proceeding.');return false;}}
orderForm.onsubmit=function(){if(couponCode.value.length>0){alert('Please click the "Apply Coupon" button to apply the coupon to your order before proceeding.');return false;}}}
function valLdirWidget(){ldirWidget.onsubmit=function(){var cityStateZipcode=document.getElementById("searchNear").value;var legalTopic=document.getElementById("specialtyId");if(legalTopic.value.length==0){if(!valCityStateZipcode(cityStateZipcode)){return false};}else{if(cityStateZipcode.length==0){return true;}
if(cityStateZipcode=="Enter your location"){return true;}
if(!valCityStateZipcode(cityStateZipcode)){return false};}}}
function valCityStateZipcode(cityStateZipcodeValue){if(cityStateZipcodeValue.length==5&&!isNaN(cityStateZipcodeValue)){return true;}
var stringArray=cityStateZipcodeValue.split(",");if(stringArray.length!=2){alert("Please enter a 5 digit zip code or city and state (e.g. Berkeley, CA) or leave it blank.");return false;}
var city=stringArray[0];var stateCode=stringArray[1];stateCode=stateCode.replace(/^\s+/,"");stateCode=stateCode.replace(/\s+$/,"");if(city.length==0||stateCode.length!=2){alert("Please enter a city and a two letter state code (e.g. Berkeley, CA) or a 5 digit zip code");return false;}
return true;}
function valEmailUs(){emailUsForm.onsubmit=function(){if(!checkForMinValue(this.question,1,"Please choose an email subject from the list.")){return false;}
if(!checkForMinValue(this.email,2,"Please provide your email address.")){return false;}
if(!validateEmail(this.email,"Please enter a valid email.")){return false;}
if(!checkForMaxValue(this.comments,500,"Please limit your comments to 500 characters.")){return false;}}}
function valSearchLDIR(){$('#ldirSearchForm').submit(function(){var selectBox=document.getElementById('box1View');if((selectBox.selectedIndex==-1)&&(selectBox.length!=0)){alert("Please select a legal issue from the list.");$('#hack').addClass('hackError');return false;}});}
function valEmailAtty(){emailAttyForm.onsubmit=function(){if(!checkForMinValue(this.your_name,2,"Please provide your name.")){return false;}
if(!checkForMinValue(this.your_email,2,"Please provide your email address.")){return false;}
if(!validateEmail(this.your_email,"Please enter a valid email.")){return false;}
if(!checkForMinValue(this.comments,2,"Please enter a message.")){return false;}
if(!checkForMaxValue(this.comments,2000,"Please limit your message to 2,000 characters.")){return false;}}}
function valLDIRContact(){contactForm.onsubmit=function(){if(!checkForMinValue(this.firstName,2,"Please provide your first name.")){return false;}
if(!checkForMinValue(this.lastName,2,"Please provide your last name.")){return false;}
if(!checkForMinValue(this.phone,10,"Please provide your phone number, complete with area code.")){return false;}
if(!checkForMinValue(this.email,2,"Please provide your email address.")){return false;}
if(!validateEmail(this.email,"Please enter a valid email.")){return false;}};}
function valSimpleContact(){simpleContactForm.onsubmit=function(){if(!checkForMinValue(this.contactSubject,1,"Please select a subject.")){return false;}
if(!checkForMinValue(this.contactEmail,2,"Please provide your email address so we can respond to your message.")){return false;}
if(!validateEmail(this.contactEmail,"Please enter a valid email address.")){return false;}
if(!checkForMinValue(this.contactMessage,2,"Please enter a message.")){return false;}
if(!checkForMaxValue(this.contactMessage,2000,"Please limit your message to 2,000 characters.")){return false;}}}
function valOnlineReg(){onlineRegForm.onsubmit=function(){if(!checkForMinValue(this.registerCountry,1,"Please select a country for registering your product.")){return false;}
if(!checkForMinValue(this.registerFName,1,"Please enter a first name for registering your product.")){return false;}
if(!checkForMinValue(this.registerLName,1,"Please enter a last name for registering your product.")){return false;}
if(!checkForMinValue(this.registerAddy1,3,"Please enter an address for registering your product.")){return false;}
if(!checkForMinValue(this.registerCity,2,"Please enter a city for registering your product.")){return false;}
if(this.registerCountry.value=='US'){if(!checkForMinValue(this.registerState,1,"Please select a state for registering your product.")){return false;}}
if(!checkForMinValue(this.registerZip,1,"Please enter a zip/postal code for registering your product.")){return false;}
if(!checkForMinValue(this.registerPhone,10,"Please enter a valid phone number for registering your product.")){return false;}
if(!validateEmail(this.registerEmail,"Please enter a valid email registering your product.")){return false;}
if(!checkForMinValue(this.opsys,1,"Please select an Operating System for registering your product.")){return false;}}}
function valLDIRPricingFormLegalTopic(){var legalTopicID=$('#ldirPricingLegalTopic').val();if(legalTopicID>0)
return true;else
return false;}
function valLDIRPricingFormLocation(){var locationID=$('#ldirPricingLocationID').val();if(locationID>0)
return true;else
return false;}
function valLDIRPricingFormZipCode(){var location=$('#ldirPricingLocation').val();if(location.length==5&&/^\d*$/.test(location))
return true;else
return false;}
function valLDIRPricingForm(){if(valLDIRPricingFormLegalTopic()&&(valLDIRPricingFormLocation()||valLDIRPricingFormZipCode()))
return true;else
return false;}
function initLDIRPricingForm(){setupLocationAutoComplete("ldirPricingLocation","/lawyers/pricing-locations.html","Zip Code - OR - County, State");$(ldirPricingForm).submit(function(e){if(valLDIRPricingForm()){$('#ldirPricingError').html("").hide();var formPost=serializeObject($(ldirPricingForm).serializeArray());$.post("pricingtool.html",formPost,function(data){if(data===""){$('#ldirPricingError').html("Please enter a valid 5-digit Zip Code or County, State.").show();$("#ldirPricingGrids").html("");}else{$("#ldirPricingGrids").html(data);for(i=1;i<5;i++){$('#ldirPricingRowLabel_'+i+'Link').cluetip({showTitle:true,sticky:true,activation:'click',local:true,hideLocal:true,width:400});}
$('#ldirPricingPremiumRowLabel_1Link').cluetip({showTitle:true,sticky:true,activation:'click',local:true,hideLocal:true,width:400});$('#ldirPricingPremiumRowLabel_3Link').cluetip({showTitle:true,sticky:true,activation:'click',local:true,hideLocal:true,width:400});$('#ldirPricingPremiumRowLabel_5Link').cluetip({showTitle:true,sticky:true,activation:'click',local:true,hideLocal:true,width:400});}});}else{$("#ldirPricingGrids").html("");$('#ldirPricingError').html("Please enter a valid 5-digit Zip Code or County, State.").show();}
return false;});}
function setupLocationAutoComplete(elementID,url,defaultValue){var cache={};var autoCompleteElement=$("#"+elementID);var autoCompleteElementValue=$("#"+elementID+"ID");autoCompleteElement.autocomplete({minLength:3,source:function(request,response){if(request.term in cache){response(cache[request.term]);return;}
$.ajax({url:url,dataType:"json",data:request,success:function(data){cache[request.term]=data;response(data);}});},focus:function(event,ui){autoCompleteElement.val(ui.item.label);return false;},select:function(event,ui){$(this).val(ui.item.label);autoCompleteElementValue.val(ui.item.value);return false;}}).blur(function(){if($(this).val()==""||(autoCompleteElementValue.val()==""&&!valLDIRPricingFormZipCode())){$(this).val(defaultValue);autoCompleteElementValue.val("");}else if(valLDIRPricingFormZipCode()){autoCompleteElementValue.val("");}}).focus(function(){if(!$.browser.msie){$(this).val("");autoCompleteElementValue.val("");}else if($(this).val()==defaultValue){$(this).val("");autoCompleteElementValue.val("");}});}
function handleTabs(tabName){var tabs=tabName.getElementsByTagName("a");var tabLinkIDs=Array();var tabDivIDs=Array();var tabLinkID_len;for(var i=0;i<tabs.length;i++){tabLinkIDs[i]=tabs[i].id;tabLinkID_len=tabLinkIDs[i].length;tabDivIDs[i]=tabLinkIDs[i].slice(0,tabLinkID_len-4);}
for(var i=0;i<tabLinkIDs.length;i++){document.getElementById(tabLinkIDs[i]).onclick=function(){swapDisplay(this.id);clearTimeout(t1);clearTimeout(t2);clearTimeout(t3);clearTimeout(t4);return false;}}
if(tabName.id=="tabsFeatured")
{var t1=setTimeout(function(){swapDisplay('tabFC2Link');},5000);var t2=setTimeout(function(){swapDisplay('tabFC3Link');},9000);var t3=setTimeout(function(){swapDisplay('tabFC4Link');},13000);var t4=setTimeout(function(){swapDisplay('tabFC1Link');},17000);}
function swapDisplay(linkID){var divID=linkID.slice(0,linkID.length-4);for(var i=0;i<tabDivIDs.length;i++){if(tabDivIDs[i]==divID){var divObj=document.getElementById(tabDivIDs[i]);$(divObj).removeClass('hide');var tabID=tabDivIDs[i]+'Link';var tabObj=document.getElementById(tabID);tabObj.className="tabSelected";}
else{var divObj=document.getElementById(tabDivIDs[i]);$(divObj).addClass('hide');var tabID=tabDivIDs[i]+'Link';var tabObj=document.getElementById(tabID);tabObj.className="";}}}
for(var i=0;i<tabDivIDs.length;i++){var divToHide=document.getElementById(tabDivIDs[i]);var divLink=document.getElementById(divToHide.id+'Link');if(!$(divLink).hasClass('tabSelected')){$(divToHide).addClass('hide');}}}
function handle3Tabs(tabName){var tabs=tabName.getElementsByTagName("a");var tabLinkIDs=Array();var tabDivIDs=Array();var tabLinkID_len;for(var i=0;i<tabs.length;i++){tabLinkIDs[i]=tabs[i].id;tabLinkID_len=tabLinkIDs[i].length;tabDivIDs[i]=tabLinkIDs[i].slice(0,tabLinkID_len-4);}
for(var i=0;i<tabLinkIDs.length;i++){document.getElementById(tabLinkIDs[i]).onclick=function(){swapDisplay(this.id);clearTimeout(t1);clearTimeout(t2);clearTimeout(t3);return false;}}
if(tabName.id=="tabsCatFeatured")
{var t1=setTimeout(function(){swapDisplay('tabFC2Link');},5000);var t2=setTimeout(function(){swapDisplay('tabFC3Link');},9000);var t3=setTimeout(function(){swapDisplay('tabFC1Link');},13000);}
function swapDisplay(linkID){var divID=linkID.slice(0,linkID.length-4);for(var i=0;i<tabDivIDs.length;i++){if(tabDivIDs[i]==divID){var divObj=document.getElementById(tabDivIDs[i]);$(divObj).removeClass('hide');var tabID=tabDivIDs[i]+'Link';var tabObj=document.getElementById(tabID);tabObj.className="tabSelected";}
else{var divObj=document.getElementById(tabDivIDs[i]);$(divObj).addClass('hide');var tabID=tabDivIDs[i]+'Link';var tabObj=document.getElementById(tabID);tabObj.className="";}}}
for(var i=0;i<tabDivIDs.length;i++){var divToHide=document.getElementById(tabDivIDs[i]);var divLink=document.getElementById(divToHide.id+'Link');if(!$(divLink).hasClass('tabSelected')){$(divToHide).addClass('hide');}}}
function populateSearch(){$.configureBoxes();var searchBox=document.getElementById('box1Filter');var selectBox=document.getElementById('box1View');var optionList=selectBox.options;selectBox.onclick=function(){var selected=selectBox.selectedIndex;searchBox.value=optionList[selected].text;}}
function populateSearchBook(){$.configureBoxes({sortBy:'title'});var searchBox=document.getElementById('box1Filter');var selectBox=document.getElementById('box1View');var optionList=selectBox.options;selectBox.onclick=function(){var selected=selectBox.selectedIndex;searchBox.value=optionList[selected].text;}}
function getHTTPObject(){var xhr=false;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}else if(window.ActiveXObject){try{xhr=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xhr=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){xhr=false;}}}
return xhr;}
function updateElement(element,file,fn){var request=getHTTPObject();if(request){request.onreadystatechange=function(){swapElementWithResponse(request,element,fn);};request.open("GET",file,true);request.send(null);}}
function swapElementWithResponse(request,element,fn){if(request.readyState==4){if(request.status==200||request.status==304){element.innerHTML=request.responseText;if(fn!=null){fn();}}}}
function updateFormXML(file){var request=getHTTPObject();if(request){request.onreadystatechange=function(){if(request.readyState==4&&(request.status==200||request.status==304)){var d=document.createElement("div");d.innerHTML=request.responseText;var divs=d.childNodes;for(var i=0;i<divs.length;i++){var div=divs[i];if(div.id!=null)
document.getElementById(div.id).innerHTML=div.innerHTML;}}}
request.open("GET",file);request.send(null);}}
$(".main_image .desc").show();$(".main_image .block").animate({opacity:0.85},1);$(".image_thumb ul li:first").addClass('active');$(".image_thumb ul li").click(function(){var imgAlt=$(this).find('img').attr("alt");var imgSrc=$(this).find('img').attr("src");var imgDesc=$(this).find('.block').html();var imgDescHeight=$(".main_image").find('.block').height();var link=$(this).find('a').attr("href");if($(this).is(".active")){window.location=link;}else{$(".main_image .block").animate({opacity:0,marginBottom:-imgDescHeight},250,function(){$(".main_image .block").html(imgDesc).animate({opacity:0.85,marginBottom:"0"},250);$(".main_image img").attr({src:imgSrc,alt:imgAlt});});}
$(".image_thumb ul li").removeClass('active');$(this).addClass('active');return false;}).hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});$(".prodScroller2").jCarouselLite({btnNext:".next",btnPrev:".prev",auto:25000,speed:800,visible:1});$(".prodScroller1").jCarouselLite({btnNext:".next",btnPrev:".prev",speed:400,visible:1});$(".prodScroller2_2").jCarouselLite({btnNext:".next2",btnPrev:".prev2",auto:25000,speed:800,visible:1});$(".prodScroller3").jCarouselLite({btnNext:".next",btnPrev:".prev",speed:1100,visible:3});$(".prodScroller4").jCarouselLite({btnNext:".next",btnPrev:".prev",speed:1400,visible:4});$(".prodScrollerVert").jCarouselLite({vertical:true});$('#shippingRatesLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#returnPolicyLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#internationalShippingLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#internationalShipping2Link').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#sendEmailLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#promoTipLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#debitGiftTipLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#aboutSecurityCodeLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#onlineFormsSafeLink').cluetip({showTitle:false,sticky:true,activation:'click',local:true,width:300});$('#ldirSignOnLink').cluetip({showTitle:false,sticky:true,activation:'mouseOver',local:true,width:300});function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function editCookie(name,newValue,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+newValue+expires+"; path=/";}
function checkForMinValue(obj,minChar,msg){if(obj){if(obj.value.length<minChar){alert(msg);obj.focus();return false;}
else{return true;}}
else{alert("There has been an error. An object has been called that does not exist on this page.");return false;}}
function checkIfNumeric(obj,msg){if(obj){if(isNaN(obj.value)){alert(msg);obj.focus();return false;}
else{return true;}}
else{alert("There has been an error. An object has been called that does not exist on this page.");return false;}}
function checkForMaxValue(obj,maxChar,msg){if(obj){if(obj.value.length>maxChar){alert(msg);obj.focus();return false;}
else{return true;}}
else{alert("There has been an error. An object has been called that does not exist on this page.");return false;}}
function validateEmail(emailObj,msg){var emailVal=emailObj.value;if((emailVal.search(/^[a-zA-Z0-9_=+-]+((-[a-zA-Z0-9_=+-]+)|(\.[a-zA-Z0-9_=+-]+))*\@[a-zA-Z0-9_=+-]+((\.|-)[a-zA-Z0-9_=+-]+)*\.[a-zA-Z0-9_=+-]+$/)==-1)){alert(msg);emailObj.focus();return false;}
else{return true};}
function checkCheckBoxes(obj,minChecked,msg){var isChecked=false;for(var i=0;i<obj.length;i++){if(obj[i].checked){isChecked=true;}}
if(isChecked==false){alert(msg);return false;}
else{return true};}
function compareDateToNow(date){var compareResults;var today=new Date();var todayMonth=today.getMonth();var todayYear=today.getFullYear();var today=new Date(todayYear,todayMonth);if(date.toString==today.toString){compareResults="=";}
if(date<today){compareResults="<";}
if(date>today){compareResults=">";}
return compareResults;}
function serializeObject(serializedArray){var o={};$.each(serializedArray,function(){if(o[this.name]){if(!o[this.name].push){o[this.name]=[o[this.name]];}
o[this.name].push(this.value||'');}else{o[this.name]=this.value||'';}});return o;};function initPagination(ch){var chapter=ch;var section=1;var wysiwygDiv=document.getElementById('chapterContent');var topPagDiv=document.getElementById('topPagination');var botPagDiv=document.getElementById('botPagination');var sections=returnSections(wysiwygDiv,chapter);if((!wysiwygDiv)||(!topPagDiv)||(!botPagDiv)||(sections<2)){return false;}
showSection(section,chapter,wysiwygDiv);buildNumLinks(topPagDiv,sections);buildNumLinks(botPagDiv,sections);addFwdArrows("top",topPagDiv);addFwdArrows("bot",botPagDiv);setLinkURLs(topPagDiv,chapter,wysiwygDiv,section,sections);setLinkURLs(botPagDiv,chapter,wysiwygDiv,section,sections);}
function returnSections(parentDiv,chapter){var subDivs=parentDiv.getElementsByTagName('div');var sections=0;for(var i=0;i<subDivs.length;i++){var idName=subDivs[i].getAttribute('id');var idLookUp="section_"+chapter;if(idName){if(idName.indexOf(idLookUp)>-1){sections++;}}}
return sections;}
function showSection(which,chapter,parentDiv){var subDivs=parentDiv.getElementsByTagName('div');switch(which){case'\u00BB':section++;break;case'\u00AB':section--;break;default:section=which;}
var divToShow='section_'+chapter+'_'+section;for(var i=0;i<subDivs.length;i++){if(divToShow==subDivs[i].id){$(subDivs[i]).removeClass('hide');}
else{if(!$(subDivs[i]).hasClass("sidebar")){$(subDivs[i]).addClass('hide');}}}
return section;}
function buildNumLinks(pagDiv,sections){while(pagDiv.hasChildNodes()){pagDiv.removeChild(pagDiv.lastChild);}
for(var i=1;i<=sections;i++){var numText=document.createTextNode([i]);var blank=document.createTextNode(' ');if(i===1){var strong=document.createElement('strong');strong.appendChild(numText);pagDiv.appendChild(strong);pagDiv.appendChild(blank);}
else{var numLink=document.createElement('a');numLink.setAttribute('href','');numLink.appendChild(numText);pagDiv.appendChild(numLink);pagDiv.appendChild(blank);}}}
function setLinkURLs(pagDiv,chapter,wysiwygDiv,section,sections){var links=pagDiv.getElementsByTagName('a');for(var i=0;i<links.length;i++){links[i].onclick=function(){paginate(this.firstChild.nodeValue,chapter,wysiwygDiv,section,sections);return false;}}}
function paginate(next,chapter,wysiwygDiv,section,sections){var topPagDiv=document.getElementById('topPagination');var botPagDiv=document.getElementById('botPagination');var nextSection=showSection(next,chapter,wysiwygDiv);updatePagination(topPagDiv,chapter,wysiwygDiv,section,sections,nextSection);updatePagination(botPagDiv,chapter,wysiwygDiv,section,sections,nextSection);}
function updatePagination(pagDiv,chapter,wysiwygDiv,section,sections,next){var oldStrong=pagDiv.getElementsByTagName('strong')[0];var newLink=document.createElement('a');newLink.setAttribute('href','');var linkText=document.createTextNode(oldStrong.firstChild.nodeValue);newLink.appendChild(linkText);pagDiv.replaceChild(newLink,oldStrong);var newStrong=document.createElement('strong');var strongText=document.createTextNode(next);newStrong.appendChild(strongText);var links=pagDiv.getElementsByTagName('a');for(var i=0;i<links.length;i++){if(links[i].firstChild.nodeValue==next){var oldLink=links[i];}}
pagDiv.replaceChild(newStrong,oldLink);var topPagDiv=document.getElementById('topPagination');var botPagDiv=document.getElementById('botPagination');var topfwdArrows=document.getElementById('topfwdArrows');var botfwdArrows=document.getElementById('botfwdArrows');var topbackArrows=document.getElementById('topbackArrows');var botbackArrows=document.getElementById('botbackArrows');if((!topfwdArrows)&&(next<sections)){addFwdArrows("top",topPagDiv);}
if((!botfwdArrows)&&(next<sections)){addFwdArrows("bot",botPagDiv);}
if((!topbackArrows)&&(next>1)){addBackArrows("top",topPagDiv);}
if((!botbackArrows)&&(next>1)){addBackArrows("bot",botPagDiv);}
if((topfwdArrows)&&(next==sections)){deleteFwdArrows("top",topPagDiv);}
if((botfwdArrows)&&(next==sections)){deleteFwdArrows("bot",botPagDiv);}
if((topbackArrows)&&(next==1)){deleteBackArrows("top",topPagDiv);}
if((botbackArrows)&&(next==1)){deleteBackArrows("bot",botPagDiv);}
setLinkURLs(pagDiv,chapter,wysiwygDiv,section,sections);}
function addFwdArrows(loc,pagDiv){var fwdArrowsId=document.getElementById(loc+'fwdArrows');if(!fwdArrowsId){var links=pagDiv.getElementsByTagName('a');var forwardArrows=document.createTextNode('\u00BB');var forwardLink=document.createElement('a');forwardLink.appendChild(forwardArrows);forwardLink.setAttribute('href','');forwardLink.setAttribute('id',loc+'fwdArrows');pagDiv.appendChild(forwardLink);}}
function addBackArrows(loc,pagDiv){var backArrowsId=document.getElementById(loc+'backArrows');if(!backArrowsId){var links=pagDiv.getElementsByTagName('a');var backArrowsText=document.createTextNode('\u00AB');var backLink=document.createElement('a');var blank=document.createTextNode(' ');backLink.setAttribute('href','');backLink.setAttribute('id',loc+'backArrows');backLink.appendChild(backArrowsText);pagDiv.appendChild(backLink);if(pagDiv.firstChild.nodeType==3){pagDiv.removeChild(pagDiv.firstChild);}
pagDiv.insertBefore(blank,pagDiv.firstChild);pagDiv.insertBefore(backLink,pagDiv.firstChild);}}
function deleteFwdArrows(loc,pagDiv){var fwdArrowsId=document.getElementById(loc+'fwdArrows');if(fwdArrowsId){pagDiv.removeChild(fwdArrowsId);}}
function deleteBackArrows(loc,pagDiv){var backArrowsId=document.getElementById(loc+'backArrows');if(backArrowsId){pagDiv.removeChild(backArrowsId);}}
function setChapterLinks(){if(document.getElementById("chapterList").getElementsByTagName('a')[0]){var chapLink=document.getElementById("chapterList").getElementsByTagName('a')[0];chapLink.onclick=function(){var id=this.parentNode.id;var chNum=id.substr(2,1);switchChapterLinks();initPagination(chNum);return false;}}}
function switchChapterLinks(){var strong=document.getElementById('chapterList').getElementsByTagName('strong')[0];var strongTxt=strong.firstChild.nodeValue;var chLink=document.getElementById('chapterList').getElementsByTagName('a')[0];var chLinkTxt=chLink.firstChild.nodeValue;var newStrong=document.createElement('strong');var newStrongTxt=document.createTextNode(chLinkTxt);newStrong.appendChild(newStrongTxt);var newLink=document.createElement('a');newLink.setAttribute('href','');var newLinkTxt=document.createTextNode(strongTxt);newLink.appendChild(newLinkTxt);chLink.parentNode.replaceChild(newStrong,chLink);strong.parentNode.replaceChild(newLink,strong);}
var _noloDialog=$('<div id="_noloDialog" style="display:none"></div>').appendTo('body').dialog({autoOpen:false,closeText:'Close Window',draggable:false,resizable:false,modal:true,width:500,show:'fade',hide:'fade'});$(".ui-dialog-titlebar").hide();$('.contactFormLink').click(function(){var url=this.href;_noloDialog.html('Loading...');_noloDialog.dialog('open');_noloDialog.load(url,function(responseText,textStatus,XMLHttpRequest){_noloDialog.dialog('option','position','center');});return false;});});
