
function isNumeric(checkVal)
{
	var checkValLen = checkVal.length;	
	if(checkValLen == 0)
	{
		return true;
	}
	
	var isNumber = true;
	
	for(var i = 0 ; i <	checkValLen ; i++)
	{
		if(checkVal.charAt(i)<'0' || checkVal.charAt(i)>'9')
		{
			isNumber = false;
		}	
	}
	
	return isNumber;
}
/*
function setCookie(name, value, expires, path, domain, secure) {
 var curCookie = name + "=" + escape(value) +
     ((expires) ? "; expires=" + expires.toGMTString() : "") +
     ((path) ? "; path=" + path : "") +
     ((domain) ? "; domain=" + domain : "") +
     ((secure) ? "; secure" : "");
 document.cookie = curCookie;
}
*/
function SetCookie (name, value) { 
alert(name) 
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function popLoading()
{
//var exp = new Date(); 
//exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
//SetCookie("LOADING", "load");
var attributes;	
	{
		var popup_width=280;
		var popup_height=150;
		var screen_width=window.screen.width;
		var screen_height=window.screen.height;
		var popup_left=Math.round((screen_width-popup_width)/2);
		var popup_top=Math.round((screen_height-popup_height)/2);    
		attributes = "scrollbars=0,resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,height=" + popup_height + ",width=" + popup_width + ",top="+popup_top+",left=" + popup_left; 
	}	
//setCookie("LOADING", "load", now);
LoadWin = window.open('includeGen/loading.asp','LoadingWin',attributes);
}
function popLoadingClose()
{
window.open('','LoadingWin').close();
}
function openWindow(pageUrl,pageName,attributes)
{
//popLoading();	
//	var popup_win = window.open(pageUrl,pageName,attributes);
//	popup_win.focus();
document.goon.action=pageUrl; document.goon.submit();
//window.location.href = pageUrl;	 
}

function sortProductsBy(resort,currentQstring)
{

	var tmpSearch;
	if(resort != '')
	{	
		
		if(currentQstring == '' || currentQstring == 'undefined')
		{
			tmpSearch = 'productSortBy=' + resort;
		}
		
		else
		{	
			tmpSearch = 'productSortBy=' + resort + currentQstring;
		}
		
		window.location.search = tmpSearch;

	}
}

function ShowCat(categoryID,windID)
{
	//if (document.images["b"+i].src == url0+"button/but_x.jpg") 
	if(categoryID.style.display=='none')
	{
		categoryID.style.display='';
		//ChangeWind(windID);
	}
	else
	{
		categoryID.style.display='none';
		//ChangeWind(windID);
	}	
}

function ChangeWind(windID)
{
	if(windID.className == "wind1")
		windID.className = "wind"
	else
		windID.className = "wind1"
}


function dologin(inForm,FailReturnTo,SuccessReturnTo)
{
	if(inForm.username.value=='') 
	{
		//alert("בצוע לוגין : שם משתמש חובה");
		alert("Please enter user name");
		inForm.username.focus();
	}
	else if(inForm.password.value=='') 
	{
		//alert("בצוע לוגין : סיסמא חובה");
		alert("Please enter password");
		inForm.password.focus();
	}
	
	else
	{
	//	popLoading();
		inForm.FailReturnTo.value = FailReturnTo;
		inForm.SuccessReturnTo.value = SuccessReturnTo;
		inForm.submit();
	}	
}


function dologout(inForm)
{
	inForm.FailReturnTo.value = window.location;
	inForm.SuccessReturnTo.value = window.location;
	inForm.submit();
}

 
function openHelp(url, name,reqWidth) 
{
var winPar = 'scrollbars=1,left=10,top=20 resizable=1,height=400,width='+parseInt(reqWidth)  
	popupWin = window.open(url, name,winPar )
	popupWin.focus(); 
} 

function validEmail(email)
{
	var i = 0;
	var mark1 = 0;
	var mark2 = 0;

	for(i = 0; i <  email.length ;i++)
	{
		if(email.charAt(i) == '@')
			{
			mark1++;
			}
		if(email.charAt(i) == '.')
			mark2++;
	
	}
	
	if(mark1 != 1)
	{
		return false; 
	}
	
	else if(mark2 == 0)
	{
		return false; 
	}
	
	else if(email.length < 4)
	{
		return false; 
	}
	
	return true;
}

function addMailngList(inForm)
{
	var valEmail = validEmail(inForm.email.value);

	if(valEmail == false)
	{
		//alert('כתובת אימייל לא חוקית');
		alert("Invalid email");
		inForm.email.focus();
	}
		
	else
	{
		var popup_width=350;
		var popup_height=100;
		var screen_width=window.screen.width;
		var screen_height=window.screen.height;
		var popup_left=Math.round((screen_width-popup_width)/2);
		var popup_top=Math.round((screen_height-popup_height)/2)-100;  
		
		attr = "scrollbars=0,resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,height=" 
		+ popup_height + ",width=" + popup_width + ",top=" + popup_top + ",left=" + popup_left; 
		window.open('', 'mailingList', attr);
		inForm.location1.value = window.location;
		inForm.submit();
	}
}
var buttonFocusColor;
var buttonFocusFontColor;
function buttonFocus(obj,bcolor,fcolor)
{
obj.style.cursor='hand';
buttonFocusColor=obj.style.backgroundColor
buttonFocusFontColor=obj.style.color
obj.style.backgroundColor=bcolor
obj.style.color = fcolor
//style.textDecoration
document.buttonsound.play();
}
function buttonOut(obj)
{
obj.style.cursor='auto';
obj.style.backgroundColor = buttonFocusColor
obj.style.color = buttonFocusFontColor;
}
function rightProtect(e) {
//var msg = "Sorry, you don't have permission to right-click.";
var msg = "Sorry ...";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}
