// JavaScript Document
//Chk the White space in the Text Fields.
function isWhitespace(s)
{
   var i;
   for (i = 0; i < s.length; i++)
   {
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if(c!=" ")
		return false;
   }
   // All characters are whitespace.
   return true;
}
//-----------------------------------------------------------------------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,''+features+',left=0px,top=0px');
}
//-----------------------------------------------------------------------------------------------
function LoginValidation(myform){

	if((myform.LoginID.value == "") || (myform.LoginID.value == "Login ID")){
		alert("Please enter 'Login ID'.");
		myform.LoginID.focus();		
		return false;}
	else{
		if(isWhitespace(myform.LoginID.value)){
			alert("'Login ID' cannot contain only spaces.");
			myform.LoginID.focus();
			return false;}
		}	

	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	for (var i = 0; i < myform.LoginID.value.length; i++) {
  		if (iChars.indexOf(myform.LoginID.value.charAt(i)) != -1) {
  		alert ("'Login ID' has special characters. \nThese are not allowed.\n Please remove them and try again.");
		myform.LoginID.focus();
  		return false;
  		}
 	 } 
	
	if((myform.Pass.value == "") || (myform.Pass.value == "Password") ){
		alert("Please enter 'Password'.");
		myform.Pass.focus();		
		return false;}
	else{
		if(isWhitespace(myform.Pass.value)){
			alert("'Password' cannot contain only spaces.");
			myform.Pass.focus();
			return false;}
		}	
	
	
	return true;
}
//-----------------------------------------------------------------------------------------------
function ForgotPassword(){
	window.open('ForgotPassword.asp','ForgotPassword','width=550,height=325,top=20px,left=20px');
}
//-----------------------------------------------------------------------------------------------
function LoginAlert(){
		alert("Please login first to add this product into your wish list.");
}
//-------------------------------------------------------------------------------------------
function BlankTextFieldFun(TextField,DefaultValue){
	if (TextField.value == DefaultValue){
		TextField.value ="";		
	}
}
//-------------------------------------------------------------------------------------------
function SearchValidation(myform){

	if(((myform.SearchProductTxt.value=="")||(myform.SearchProductTxt.value=="Search Product")) && (myform.Search_Price.value=="") ){
		alert("Please enter 'Search Product' OR select 'Price Range'.");
		myform.SearchProductTxt.focus();
		return false;
	}
	
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	if (myform.SearchProductTxt.value != ""){
		for (var i = 0; i < myform.SearchProductTxt.value.length; i++) {
			if (iChars.indexOf(myform.SearchProductTxt.value.charAt(i)) != -1) {
			alert ("'Search Product' has special characters. \nThese are not allowed.\n Please remove them and try again.");
			myform.SearchProductTxt.focus();
			return false;
			}
		 } 
	}

	return true;
}