/*
	Javascript Included Files
*/

	
	if (document.images) {
		home = new Image();
		home.src = "/images/home.gif";
		home_on = new Image();
		home_on.src = "/images/home_on.gif";
		
		about = new Image();
		about.src = "/images/about.gif";
		about_on = new Image();
		about_on.src = "/images/about_on.gif";
		
		services = new Image();
		services.src = "/images/services.gif";
		services_on = new Image();
		services_on.src = "/images/services_on.gif";
		
		portfolio = new Image();
		portfolio.src = "/images/portfolio.gif";
		portfolio_on = new Image();
		portfolio_on.src = "/images/portfolio_on.gif";
		
		testimonials = new Image();
		testimonials.src = "/images/testimonials.gif";
		testimonials_on = new Image();
		testimonials_on.src = "/images/testimonials_on.gif";
		
		contact = new Image();
		contact.src = "/images/contact.gif";
		contact_on = new Image();
		contact_on.src = "/images/contact_on.gif";
		
		faqs = new Image();
		faqs.src = "/images/faqs.gif";
		faqs_on = new Image();
		faqs_on.src = "/images/faqs_on.gif";
		
		
	}//if images
	
	function imgOn(imgName) {
		if (document.images) {
			document[imgName].src = eval (imgName + "_on.src");
		}
	}//imgOn()
	
	function imgOff(imgName) {
		if (document.images) {
			document[imgName].src = eval (imgName + ".src");
		}
	}//imgOff()



	function rowBGColor(row, color) {
		if (document.getElementById) {
			row.style.backgroundColor = color;
		}
	}
	
	
	
	function objClass(obj, className) {
		if (obj) {
			obj.className = className;
		}
	}
	
	
	
	
	
	function btnOn(btn) {
		if (document.getElementById) {
			btn.className = 'submt_on';
		}
	}
	
	function btnOff(btn) {
		if (document.getElementById) {
			btn.className = 'submt';
		}
	}
	
	
	
	function hideShow(objID) {
	
		if (document.getElementById) {
			var curObj = document.getElementById(objID);
			var curStatus = curObj.style.display;
			
			if (curStatus == 'block') curObj.style.display = 'none';
			else curObj.style.display = 'block';
		}
	}



	function strpad (str, length2be, paddding, direction) {
		/*
			str - the string to be 
				if str is not set, the original string is returned

			length2be - the length of the resultant (padded) string
				if length2be is not set, the original string is returned
			
			padding - what to pad the string with
				defaults to underscore if not set
			
			direction - which side of the string to place the padding
				defaults to left if not set
		*/
		
	
	
		if (!str || str == '' || !length2be || length2be == '') return str;
		if (!paddding || paddding == '') paddding = '_';
		if (!direction || direction == '') direction = 'l';
	
		while(str.length < length2be)
			if (direction == 'l') str = paddding + str;
			else str = str + paddding;
			
		return str;
	}



	function validateMailingListEntry(fld) {
		if (!validEmail(fld.value)) {
			alert('Enter a valid email address.');
			fld.focus();
			fld.select();
			return false;
		}
		else return true;
	}
	
	




function portfolioPopper(info, thumbnail) {
	var w = screen.width - 200;
	var h = screen.height - 150;
	var t = 10;
	var l = 10;
	
	if (thumbnail == undefined) thumbnail='';

	
	var params = "scrollbars=1,resizable=1,status=0,location=0,width="+ w +",height="+ h;

	if (document.all) {
		//var top = (screen.height - h)/2;
		var top = 10;
		
		var left = (screen.width- w)/2;
		params += ",left="+ left +",top="+ top ;
	}


	thisWindow = window.open(
		'/popups/portfolio.php?info='+info+'&thumbnail='+thumbnail,
		"portfolio",
		params
	);

	thisWindow.focus();
}






	
	
	
	

//=========== FORM VALIDATION FUNCTIONS



function stripSpaces(str) {
	//wrapper for a legacy function
	return trim(str);
}//stripSpaces


function trim(str) {
return str.replace(/^\s*|\s*$/g,"");
}

function validEmail(str) {
	emailEXP = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2}[mtgvu]?$/;


	if (!emailEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}

function validZipCode(str) {
	numEXP = /^\d{5}(-\d{4})?$/;

	if (!numEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}

function validPhoneNumber(str) {
	phoneEXP = /^(\d{3}\-\d{3}\-\d{4}$|\d{3}\.\d{3}\.\d{4}$|\d{3}\ \d{3}\ \d{4}$|\d{10}$)/

	if (!phoneEXP.test(str)) {
		return false;
	} else {
		return true;
	}
}
