/*
Copyright 2003 Active Media Architects, Inc. - www.activema.com
Usage of these scripts is limited to their original intent as developed and deployed for serviceseekers.com by Active Media Architects, Inc. Copying, selling or distributing of these scripts, in whole or in part, is strictly prohibited.
*/



	///////////////////////////////////////
	// Frame Buster
	///////////////////////////////////////

if (window != window.top)
  top.location.href = location.href;


	///////////////////////////////////////
	// Current Date/Time
	///////////////////////////////////////

var showDateShort = 1;
var showDate= 2;
var showDateTime= 3;
var showTime= 4;

function ShowDateTime(dateStyle)
{
	var today = new Date();
	var dStr = "";

	switch (dateStyle)
	{
		case showDateShort:
			dStr = today.toDateString();
			break;
		case showDateTime:
			dStr = today.toLocaleString();
			break;
		case showTime:
			dStr = today.toLocaleTimeString();
			break;
		case showDate:
		default:
			dStr = today.toLocaleDateString();
			break;
	}
	document.write(dStr);
}



	///////////////////////////////////////
	// Row-Over Effect
	///////////////////////////////////////

	function mouseOverWhite(i) {
		i.style.backgroundColor='#F2F2F2';
	}
	function mouseOutWhite(i) {
		i.style.backgroundColor='#FFFFFF';
	}

	function mouseOverGray(i) {
		i.style.backgroundColor='#F2F2F2';
	}
	function mouseOutGray(i) {
		i.style.backgroundColor='#F2F2F2';
	}



	///////////////////////////////////////
	// Category Rolls
	///////////////////////////////////////

	function imgovernews(imgname){

	if(imgovernews.arguments.length == 2)
	{
		imgovernews.arguments[0].src = imgover.arguments[1];
	}
	else
	{
		imgovernews.arguments[0].src = "/images/ArrowRed.gif";
	}
	}
	function imgoutnews(imgname){
	imgname.src="/images/ArrowBlue.gif" }



	///////////////////////////////////////
	// On-Click-Pop-Center
	///////////////////////////////////////
	// Requires "onClick="NewWindow(this.href,'title','400','300','no');return false;"" in the A HREF tag
	// Example: <a href="doc.html" onClick="NewWindow(this.href,'title','400','300','no');return false;">LINK</a>

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no,toolbar=no,menubar=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}




	///////////////////////////////////////
	// Auto-Select Field
	///////////////////////////////////////
	// Requires "onLoad=ready()" in the BODY tag
	// Example: <body onLoad=ready()>
	// Requires form name to match where it reads "form" in script
	// Example: <form name="form">
	// Requires form field name to match where it reads "field" in script
	// Example: <input name="field">

function ready(){document.form.field.focus();}



	///////////////////////////////////////
	// Form Validation
	///////////////////////////////////////


function validateSearch(form) {
	return (
				 checkZIPCode(form.elements["zip"],false));
}

function validateEmailme(form) {
	return (
				 checkSelect(form.elements["recipient"],"V","","Please enter the Recipient's Name.",false) &&
				 checkSelect(form.elements["to"],"V","","Please enter the Recipient's E-mail.",false) &&
				 checkEmail(form.elements["to"],false) &&
				 checkSelect(form.elements["to"],"V","joe@example.com","Please supply valid E-mail Address.",false) &&
				 checkSelect(form.elements["comments"],"V","","Please enter the Message to Recipient.",false) &&
				 checkSelect(form.elements["sender"],"V","","Please enter Your Name.",false) &&
				 checkSelect(form.elements["from"],"V","","Please enter Your E-mail.",false) &&
				 checkEmail(form.elements["from"],false) &&
				 checkSelect(form.elements["from"],"V","joe@example.com","Please supply valid E-mail Address.",false));
}

function validateNewPass(form) {
	return (
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false));
}


function validateTell(form) {
	return (
				 checkSelect(form.elements["to_email"],"V","","Please enter your Friend's E-mail Address.",false) &&
				 checkEmail(form.elements["to_email"],false) &&
				 checkSelect(form.elements["to_email"],"V","joe@example.com","Please supply valid E-mail Address.",false) &&
				 checkSelect(form.elements["from_email"],"V","","Please enter Your E-mail Address.",false) &&
				 checkEmail(form.elements["from_email"],false) &&
				 checkSelect(form.elements["from_email"],"V","joe@example.com","Please supply valid E-mail Address.",false) &&
				 checkSelect(form.elements["from_name"],"V","","Please enter Your Name.",false));
}

function validateContact(form) {
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkUSPhone(form.elements["phone"],false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["response"],"V","","Please tell us your Preferred Response method by selecting it from the drop-down.",false) &&
				 checkSelect(form.elements["comments"],"V","","Please provide us with your Questions or Comments.",false));
}

function validateEmailSignup(form) {
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["firstname"],"V","First Name","Please enter your real First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","First Name","Please enter your real Last Name.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false));
}

function validateShortHomeownerSignup(form) {
	return (
				 checkSelect(form.elements["customer_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["customer_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["customer_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["customer_email"],false) &&
				 checkSelect(form.elements["customer_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password1"],"V","","Please enter your Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please enter your password again for confirmation.",false));
}

function validateLongHomeownerSignup(form) {
	return (
				 checkUSPhone(form.elements["customer_phone"],false) &&
				 checkSelect(form.elements["fields[customer_address]"],"V","","Please enter your street address.",false) &&
				 checkSelect(form.elements["fields[customer_city]"],"V","","Please enter your city.",false) &&
				 checkSelect(form.elements["fields[customer_state]"],"V","","Please select your state.",false) &&
				 checkZIPCode(form.elements["customer_zip"],false) &&
				 checkSelect(form.elements["fields[customer_county]"],"V","","Please enter your county.",false)
	);
}

function validateShortContractorSignup(form) {
	return (
				 checkSelect(form.elements["contractor_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["contractor_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["contractor_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["contractor_email"],false) &&
				 checkSelect(form.elements["contractor_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password1"],"V","","Please enter your Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please enter your password again for confirmation.",false));
}

function validateShortAffiliateSignup(form) {
	return (
				 checkSelect(form.elements["affiliate_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["affiliate_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["affiliate_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["affiliate_email"],false) &&
				 checkSelect(form.elements["affiliate_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password1"],"V","","Please enter your Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please enter your password again for confirmation.",false));
}

function validateContractorLeadsSignup(form) {
	return (
				 checkSelect(form.elements["contractor_company"],"V","","Please enter your company name.",false) &&
				 checkSelect(form.elements["contractor_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["contractor_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["contractor_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["contractor_email"],false) &&
				 checkSelect(form.elements["contractor_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["phone1"],"V","","Please supply a Phone Number.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter your Zip Code.",false)
	);
}


function validateLongContractorSignup(form) {
	return (
				 checkUSPhone(form.elements["contractor_phone"],false) &&
				 checkSelect(form.elements["contractor_address"],"V","","Please enter your correct address.",false) &&
				 checkSelect(form.elements["contractor_city"],"V","","Please enter your city.",false) &&
				 checkSelect(form.elements["contractor_state"],"V","","Please select your state.",false) &&
				 checkZIPCode(form.elements["contractor_zip"],false) &&
				 checkSelect(form.elements["contractor_county"],"V","","Please enter your county.",false) &&
				 checkSelect(form.elements["contractor_operating_years"],"V","","Please enter your company's age.",false) &&
				 checkSelect(form.elements["contractor_has_liability_insurance"],"V","","Please enter your insurance information.",false) &&
				 checkSelect(form.elements["contractor_bad_legal"],"V","","Please enter your legal information.",false) &&
				 checkSelect(form.elements["contractor_bankruptcy"],"V","","Please enter your bankruptcy information.",false)
	       );
}

function validateLongAffiliateSignup(form) {
	return (
				 checkUSPhone(form.elements["affiliate_phone"],false) &&
				 checkSelect(form.elements["affiliate_address"],"V","","Please enter your correct address.",false) &&
				 checkSelect(form.elements["affiliate_city"],"V","","Please enter your city.",false) &&
				 checkSelect(form.elements["affiliate_state"],"V","","Please select your state.",false) &&
				 checkZIPCode(form.elements["affiliate_zip"],false) &&
				 checkSelect(form.elements["affiliate_county"],"V","","Please enter your county.",false)
		  );
}

function validateServiceRequest(form) {
	return (

				 checkSelect(form.elements["field[request_contact_time]"],"V","","Please indicate the best time to contact you.",false) &&
				 checkSelect(form.elements["field[request_completion_month]"],"V","","Please select the month for the project completion date.",false) &&
				 checkSelect(form.elements["field[request_completion_day]"],"V","","Please select the day for the project completion date.",false) &&
				 checkSelect(form.elements["field[request_completion_year]"],"V","","Please select the year for the project completion date.",false) &&
				 checkSelect(form.elements["field[request_recurring]"],"V","","Please tell us if this is a recurring job or not.",false) &&
				 checkSelect(form.elements["field[request_insurance]"],"V","","Please tell us if this is an insurance job.",false) &&
				 checkSelect(form.elements["field[request_materials]"],"V","","Please tell us who will be supplying the materials for this work.",false) &&
				 checkSelect(form.elements["field[request_title]"],"V","","Please provide a descriptive title for this service request.",false) &&
				 checkSelect(form.elements["field[request_description]"],"V","","Please provide as many details about your service request as possible.",false) &&
				 checkSelect(form.elements["field[request_firstname]"],"V","","Please enter your first name.",false) &&
				 checkSelect(form.elements["field[request_lastname]"],"V","","Please enter your last name.",false) &&
				 checkSelect(form.elements["request_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["request_email"],false) &&
				 checkSelect(form.elements["request_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &
				 checkUSPhone(form.elements["request_phone"],false) &&
				 checkSelect(form.elements["field[request_address]"],"V","","Please enter the address for this service request.",false) &&
				 checkSelect(form.elements["field[request_city]"],"V","","Please enter the city for this service request.",false) &&
				 checkSelect(form.elements["field[request_state]"],"V","","Please enter the state for this service request.",false) &&
				 checkZIPCode(form.elements["request_zip"],false) &&
				 checkSelect(form.elements["field[request_county]"],"V","","Please enter the county for this service request.",false));
}

function validateUnsub(form) {
	return (
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false));
}

function validateLogin(form) {
	return (
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password"],"V","","Please enter your Password.",false));
}

function validateNewLogin(form) {
	return (
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["firstname"],"V","First Name","Please enter your real First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","First Name","Please enter your real Last Name.",false) &&
				 checkSelect(form.elements["password1"],"V","","Please create a Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please confirm your Password.",false));
}

function validatePay(form)
{

		return (
				 checkSelect(form.elements["cc_firstname"],"V","","Please enter the first name on the card.",false) &&
				 checkSelect(form.elements["cc_lastname"],"V","","Please enter the last name on the card.",false) &&
				 checkSelect(form.elements["cc_address"],"V","","Please enter the address the card is registered to.",false) &&
				 checkSelect(form.elements["cc_city"],"V","","Please enter the city the card is registered to.",false) &&
				 checkStateCode(form.elements["cc_state"],false) &&
				 checkZIPCode(form.elements["cc_zip"],false) &&
				 checkSelect(form.elements["cc_num"],"V","","You have chosen to pay by Credit Card. Please enter your Credit Card Number before continuing.",false) &&
				 checkSelect(form.elements["cc_expires_month"],"V","00","Please select the Month this credit card expires.",false) &&
				 checkSelect(form.elements["cc_expires_year"],"V","00","Please select the Year this credit card expires.",false) &&
				 checkSelect(form.elements["cc_id"],"V","","Please enter your credit card's 3-digit Identification Number.",false));
}

////////////////////////////////////////////////
// disabling and enabling shipping info fields
////////////////////////////////////////////////

function toggleFields(form) {
	var toggle = form.elements['same_as_billing'];

	var ship_firstname = form.elements['ship_firstname'];
	var ship_lastname = form.elements['ship_lastname'];
	var ship_phone = form.elements['ship_phone'];
	var ship_company = form.elements['ship_company'];
	var ship_address = form.elements['ship_address'];
	var ship_city = form.elements['ship_city'];
	var ship_state = form.elements['ship_state'];
	var ship_zip = form.elements['ship_zip'];
	var ship_country = form.elements['ship_country'];

	if (toggle.checked == true) {
		ship_firstname.disabled = true;
		ship_lastname.disabled = true;
		ship_phone.disabled = true;
		ship_company.disabled = true;
		ship_address.disabled = true;
		ship_city.disabled = true;
		ship_state.disabled = true;
		ship_zip.disabled = true;
		ship_country.disabled = true;
	}
	else {
		ship_firstname.disabled = false;
		ship_lastname.disabled = false;
		ship_phone.disabled = false;
		ship_company.disabled = false;
		ship_address.disabled = false;
		ship_city.disabled = false;
		ship_state.disabled = false;
		ship_zip.disabled = false;
		ship_country.disabled = false;
	}
}

function enableFields(form) {
	var ship_firstname = form.elements['ship_firstname'];
	var ship_lastname = form.elements['ship_lastname'];
	var ship_phone = form.elements['ship_phone'];
	var ship_company = form.elements['ship_company'];
	var ship_address = form.elements['ship_address'];
	var ship_city = form.elements['ship_city'];
	var ship_state = form.elements['ship_state'];
	var ship_zip = form.elements['ship_zip'];
	var ship_country = form.elements['ship_country'];

	ship_firstname.disabled = true;
	ship_lastname.disabled = true;
	ship_phone.disabled = true;
	ship_company.disabled = true;
	ship_address.disabled = true;
	ship_city.disabled = true;
	ship_state.disabled = true;
	ship_zip.disabled = true;
	ship_country.disabled = true;
}

function disableFields(form) {
	var ship_firstname = form.elements['ship_firstname'];
	var ship_lastname = form.elements['ship_lastname'];
	var ship_phone = form.elements['ship_phone'];
	var ship_company = form.elements['ship_company'];
	var ship_address = form.elements['ship_address'];
	var ship_city = form.elements['ship_city'];
	var ship_state = form.elements['ship_state'];
	var ship_zip = form.elements['ship_zip'];
	var ship_country = form.elements['ship_country'];

	ship_firstname.disabled = false;
	ship_lastname.disabled = false;
	ship_phone.disabled = false;
	ship_company.disabled = false;
	ship_address.disabled = false;
	ship_city.disabled = false;
	ship_state.disabled = false;
	ship_zip.disabled = false;
	ship_country.disabled = false;
}