// JavaScript Document
function roll_over(img_name, img_src)
	{
	document[img_name].src = img_src;
	}

function Mover( elem )
	{
		var temp = elem.src;
		//
		var res = temp.replace(".png","_hover.png");
		
		elem.src = res;
		//alert(res);
		
	}
function Mout(elem)
	{
		var temp = elem.src;
		//alert(temp);
		var res = temp.replace("_hover.png",".png");
		elem.src = res;
	}

function LMover( elem )
	{
		var temp = elem.src;
		//
		var res = temp.replace(".jpg","_hover.jpg");
		elem.src = res;
		//alert(res);
		
	}

function  LMout(elem)
	{
		var temp = elem.src;
		//alert(temp);
		var res = temp.replace("_hover.jpg",".jpg");
		elem.src = res;
	}
	
function GMover( elem )
	{
		var temp = elem.src;
		//
		var res = temp.replace(".gif","_hover.gif");
		elem.src = res;
		//alert(res);
		
	}

function  GMout(elem)
	{
		var temp = elem.src;
		//alert(temp);
		var res = temp.replace("_hover.gif",".gif");
		elem.src = res;
	}

var win1Open = null
var win2Open = null
		
function openPopUp(windowURL, windowName, scrollbarStatus, windowWidth, windowHeight)
	{
 		var winHandle = window.open(windowURL,windowName,"toolbar=no,resizable=no,scrollbars=" + scrollbarStatus + ",width=" + windowWidth + ",height=" + windowHeight)
	  		
		return winHandle
  	}
			
	function winClose()
	{   
 		if(win1Open != null) win1Open.close() 
  		if(win2Open != null) win2Open.close()     
  	}
		
function openPopUpWindow(){}  // does nothing but required by JavaScript & shows in status bar
			
// improved openPopUp function for Netscape 3+ 
function openPopUp(windowURL, windowName, scrollbarStatus, windowWidth, windowHeight)
	{
  		var winHandle = window.open(windowURL,windowName,"toolbar=no,resizable=no,scrollbars=" + scrollbarStatus + ",width=" + windowWidth + ",height=" + windowHeight)
  			if(winHandle != null) 
				winHandle.focus() //brings window to top
		 	 	
			return winHandle
		  	}
			
// Gift Cert Form Validation
function valGCInfo() {
	if (document.giftcertificate.ff_BillingPrefix.options[document.giftcertificate.ff_BillingPrefix.selectedIndex].value == "") {
		window.alert("Please select a billing name prefix.");
		return false;
	}	
	
	if (document.giftcertificate.ff_BillingState.options[document.giftcertificate.ff_BillingState.selectedIndex].value == "" && document.giftcertificate.ff_OtherBillingState.value == "") {
		window.alert("Please either select a billing state or enter a billing other state.");
		return false;
	}	
	
	if (document.giftcertificate.ff_BillingCCType.options[document.giftcertificate.ff_BillingCCType.selectedIndex].value == "") {
		window.alert("Please select a credit card type.");
		return false;
	}	
	
	if (document.giftcertificate.ff_BillingCCExpMonth.options[document.giftcertificate.ff_BillingCCExpMonth.selectedIndex].value == "") {
		window.alert("Please select a credit card expiration month.");
		return false;
	}	
	
	if (document.giftcertificate.ff_BillingCCExpYear.options[document.giftcertificate.ff_BillingCCExpYear.selectedIndex].value == "") {
		window.alert("Please select a credit card expiration year.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingPrefix.options[document.giftcertificate.ff_MailingPrefix.selectedIndex].value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please select a mailing name prefix.");
		return false;
	}
	
	if (document.giftcertificate.ff_MailingFirstName.value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please enter a mailing first name.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingLastName.value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please enter a mailing last name.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingAddress.value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please enter a mailing address.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingCity.value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please enter a mailing city.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingState.options[document.giftcertificate.ff_MailingState.selectedIndex].value == ""  && document.giftcertificate.ff_OtherMailingState.value == "" && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please either select a mailing state or enter a mailing other state.");
		return false;
	}	
	
	if (document.giftcertificate.ff_MailingZip.value == ""  && document.giftcertificate.Duplicate_Info.checked == "") {
		window.alert("Please enter a mailing zip code.");
		return false;
	}
	
	myOption = -1;
	for (i=document.giftcertificate.ff_Property.length-1; i > -1; i--) 
		{
		if (document.giftcertificate.ff_Property[i].checked) {
		myOption = i; i = -1;
		}
		}
		if (myOption == -1) 
		{
		alert("Please select a property");
		return false;
		}
return true;
}

function sameMail() 
	{
	if (document.giftcertificate.Duplicate_Info.checked==true)
		{
		document.giftcertificate.ff_MailingPrefix.value = document.giftcertificate.ff_BillingPrefix.value;
		document.giftcertificate.ff_MailingFirstName.value = document.giftcertificate.ff_BillingFirstName.value;
		document.giftcertificate.ff_MailingLastName.value = document.giftcertificate.ff_BillingLastName.value;
		document.giftcertificate.ff_MailingAddress.value = document.giftcertificate.ff_BillingAddress.value;
		document.giftcertificate.ff_MailingCity.value = document.giftcertificate.ff_BillingCity.value;
		document.giftcertificate.ff_MailingState.value = document.giftcertificate.ff_BillingState.value;
		document.giftcertificate.ff_OtherMailingState.value = document.giftcertificate.ff_OtherBillingState.value;
		document.giftcertificate.ff_MailingZip.value = document.giftcertificate.ff_BillingZip.value;
		document.giftcertificate.ff_MailingCountry.value = document.giftcertificate.ff_BillingCountry.value;
		}
		
	else
		{	
		document.giftcertificate.ff_MailingPrefix.value = "";
		document.giftcertificate.ff_MailingFirstName.value = "";
		document.giftcertificate.ff_MailingLastName.value = "";
		document.giftcertificate.ff_MailingAddress.value = "";
		document.giftcertificate.ff_MailingCity.value = "";
		document.giftcertificate.ff_MailingState.value = "";
		document.giftcertificate.ff_OtherMailingState.value = "";
		document.giftcertificate.ff_MailingZip.value = "";
		document.giftcertificate.ff_MailingCountry.value = "";
		}
	}
	
function valJAInfo(jobapp) {
	if (document.jobapp.ff_State.options[document.jobapp.ff_State.selectedIndex].value == "") {
		window.alert("Please select a state.");
		return false;
	}	
	if (document.jobapp.ff_Location.options[document.jobapp.ff_Location.selectedIndex].value == "") {
		window.alert("Please select a job location.");
		return false;
	}
	if (document.jobapp.ff_Age.value == ""  && document.jobapp.ff_Over_21.checked == "") {
		window.alert("Please enter your age.");
		return false;
	}
	if (document.jobapp.ff_Felony_Details.value == ""  && document.jobapp.ff_Felony.checked != "") {
		window.alert("Please enter your felony details.");
		return false;
	}
	return true;
}	
