String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }
function __fncChangeTopMenuButtonStatus(id,customerId){
	for(var i=1;i<=9;i++){
		if(i==8){
			if(customerId>0){
				document.getElementById('top_img_'+i).src	=	'images/top_menu/top_menu_img_off_'+i+'a.jpg';
			}
		} else {
			document.getElementById('top_img_'+i).src	=	'images/top_menu/top_menu_img_off_'+i+'.jpg';
		}
	}
	if(id==8){
		if(customerId>0){
			document.getElementById('top_img_'+id).src	=	'images/top_menu/top_menu_img_on_'+id+'a.jpg';
		} else {
			document.getElementById('top_img_'+id).src	=	'images/top_menu/top_menu_img_on_'+id+'.jpg';	
		}
	} else {
		if(document.getElementById('top_img_'+id)) document.getElementById('top_img_'+id).src	=	'images/top_menu/top_menu_img_on_'+id+'.jpg';
	}
}
function __fncCheckQty(qty_row){
	var theForm	=	document.multiple_products_cart_quantity;
	if((1*document.getElementById("quantity_row"+qty_row).value)<=0){
		alert("Please enter a quantity");
		document.getElementById("quantity_row"+qty_row).focus();
		return false;
	} else {
		theForm.submit();	
	}
}
function __fncCheckEmail(emailField){
	var theForm	=	document.advanced_search;
	if(theForm.email.value){
		valid_email	=	__fncValidateEmail(theForm.email.value);
	} else {
		valid_email	=	false;
	}
	if(valid_email){
		theForm.submit();
	} else {
		alert("Please enter a valid email");
		theForm.email.focus();
		return false;
	}
}

function __fncValidateEmail(emailStr){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!filter.test(emailStr)){
		return false;
	} else {
		return true;
	}
}
