// 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 TrackOrder(myform){

	if(myform.TrackOrderID.value == ""){
		alert("Please enter 'Order Number'.");
		myform.TrackOrderID.focus();		
		return false;}
	else{
		if(isWhitespace(myform.TrackOrderID.value)){
			alert("'Order Number' cannot contain only spaces.");
			myform.TrackOrderID.focus();
			return false;}
		}	

	if(isNaN(myform.TrackOrderID.value)){
		alert("Please enter numbers only");
		myform.TrackOrderID.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 NewsletterSub(myform){

//	if((myform.MName.value == "") || (myform.MName.value == "Name")){
//		alert("Please enter 'Your Name'.");
//		myform.MName.focus();		
//		return false;}
//	else{
//		if(isWhitespace(myform.MName.value)){
//			alert("'Your Name' cannot contain only spaces.");
//			myform.MName.focus();
//			return false;}
//		}	
		
	var EmailID = myform.NewsletterSub_EmailID.value;
	if ((EmailID=="") || (EmailID== "Email")){
	alert ("Please enter E-mail Address.");
	myform.NewsletterSub_EmailID.focus();
	return false;}
	if (EmailID.length >0) {
	 i=EmailID.indexOf("@")
	 j=EmailID.indexOf(".",i)
	 k=EmailID.indexOf(",")
	 kk=EmailID.indexOf(" ")
	 jj=EmailID.lastIndexOf(".")+1
	 len=EmailID.length
 	if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
 	}
 	else {
 		alert("Please enter an exact email address.\n" +
		EmailID+ " is invalid.");
		return false;
 		}
	 }
		
		return true;
}

