function checksearch(form)
{
	if (form.SearchFor.value == "") {
		alert("You must enter a search term");
		return false;
	} 
	return true ;
}

function checkform (form)
{    
	if (form.attribute_id.value == "") {
		alert("Please Make a Selection for this product.");
		return false;
	}
	return true ;
}


function checkEmail(email) 
{
	// the regular expression to check the email
	var pattern  = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})+$/;
	return(pattern.test(email)); 
}

function toggle(id){
	ulElement = document.getElementById(id);
	if(ulElement){
		if(ulElement.className == 'closed'){
			ulElement.className = "open";
		}else{
			ulElement.className = "closed";
		}
	}
}


function showDiv(id) {
	if(document.getElementById(id)) {
		document.getElementById(id).className = "active";
	}
}


function hideDiv(id) {
	if(document.getElementById(id)) {
		document.getElementById(id).className = "inactive";
	}
}


function validateCCDate(month, year) {
	var now = new Date();
	// create an expired on date object with valid thru expiration date
	var expiresIn = new Date(year,month,0,0,0);	
	// adjust the month, to first day, hour, minute & second of expired month
	expiresIn.setMonth(expiresIn.getMonth());
	if(now.getTime() > expiresIn.getTime()) {
		return false;
	}
	return true;
}


function validateCreditCard(s) {
	var v = "0123456789";
	var w = "";
	for (var i = 0; i < s.length; i++) {
		x = s.charAt(i);
		if (v.indexOf(x,0) != -1) w += x;
	}
	var j = w.length / 2;
	if (j < 6.5 || j > 8 || j == 7) return false;
	var k = Math.floor(j);
	var m = Math.ceil(j) - k;
	var c = 0;
	for (var i = 0; i < k; i++) {
		a = w.charAt(i*2+m) * 2;
		c += a > 9 ? Math.floor(a/10 + a%10) : a;
	}
	for (var i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
	return (c%10 == 0);
}


/*
http://simon.incutio.com/archive/2004/05/26/addLoadEvent
addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
  // more code to run on page load 
});
*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


if(top.frames.length!=0) top.location=self.document.location;


function stopError() {
	return true;
}
window.onerror = stopError;