// 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 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 ValidationSearch(myform){
	
	if(myform.SearchForText.value == ""){
		alert("Please enter text to search.");
		myform.SearchForText.focus();		
		return false;}
	else{
		if(isWhitespace(myform.SearchForText.value)){
			alert("'Search Text' cannot contain only spaces.");
			myform.SearchForText.focus();
			return false;}
		}	
	
	
	if (myform.SearchIn.value=="Products") {
		myform.action="SearchProducts.asp";
	}
	else{		
		myform.action="searchpro/index.asp?q="+myform.SearchForText.value+"&g=0&Submit=Search";
	}
	
	myform.submit();
	return true;
}
//-----------------------------------------------------------------------------------------------
function ForgotPassword(){
	window.open('ForgotPassword.asp','ForgotPassword','width=550,height=325,top=20px,left=20px');
}
//-----------------------------------------------------------------------------------------------
function ActiveDeactive(ID){	
	
	var PresentShownID = document.ProdNavi.PresentShownID.value;
	if (PresentShownID !=""){
		document.getElementById(PresentShownID).style.display='none'; 
	}
	if (ID==PresentShownID){
		document.getElementById(ID).style.display='none';
		document.ProdNavi.PresentShownID.value="";
	}
	else
	{
		if (document.getElementById && document.createTextNode)
		{
			 var tr=document.getElementById(ID);
			   if(tr.style.display=='' || tr.style.display=='none')
				{
					tr.style.display = "inline";
					tr.className = "LI_Initial ProductsNaviDiv_Show";
					document.ProdNavi.PresentShownID.value=ID;
				}else {
					tr.style.display = "none";
					tr.className = "LI_Initial ProductsNaviDiv_Hide";
				}       
		}
	}
}
//-----------------------------------------------------------------------------------------------
function ActiveDeactive_Racing(ID){
	
	var PresentShownID = document.Racing.PresentShownID.value;
	if (PresentShownID !=""){
		document.getElementById(PresentShownID).style.display='none'; 
	}
	if (ID==PresentShownID){
		document.getElementById(ID).style.display='none';
		document.Racing.PresentShownID.value="";
	}
	else
	{		
		if (document.getElementById && document.createTextNode)
		{
			 var tr=document.getElementById(ID);
			   if(tr.style.display=='' || tr.style.display=='none')
				{
					tr.style.display = "inline";
					tr.className = "ProductsNaviDiv_Show";
					document.Racing.PresentShownID.value=ID;
				}else {
					tr.style.display = "none";
					tr.className = "ProductsNaviDiv_Hide";
				}       
		}
	}
}
//--------------------------------------------------------------------------------------------------
function ViewEnlarge(ImageID){
	window.open('Merchandise_Popup.asp?ImageID='+ImageID+'','','scrollbars=yes,width=800,height=600,left=0px,top=0px');
}
//--------------------------------------------------------------------------------------------------
function NewsDetails(NewsID) { //v2.0
  window.open('News-Events-Popup.asp?NewsID='+NewsID+'','','scrollbars=yes,width=800,height=600,top=0,left=0');
}
