var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function create_link(pathval,proid) {
       var i,clink;
	    var rg;
		var val;
		clink = "";
		 val = "_" + proid; 
		 for (i=0; i<document.dispro.elements.length; i++) {
		    if(document.dispro.elements[i].name.indexOf(val)!=-1) {
			   clink=clink + "&pfields[]=" + document.dispro.elements[i].name + "~" + document.dispro.elements[i].value;
			}
			
		 }
		 //alert(pathval + clink); 
	   window.location = pathval + clink;
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popup(popupfile,winheight,winwidth)
{
newwin = window.open(popupfile,"newWindow","resizable=no,top=10,left=100,height=" + winheight + ",width=" + winwidth + ",scrollbars=yes");
newwin.focus();
}
function popup1(popupfile,winheight,winwidth)
{ var tp,bt;
	tp = screen.height/2 - winheight/2;
	bt = screen.width/2 - winwidth/2;
newwin = window.open(popupfile,"newWindow","resizable=no,top=" + tp + ",left=" + bt + ",height=" + winheight + ",width=" + winwidth + ",scrollbars=yes");
newwin.focus();
}

function show_login_form_errors() {
	var ErrorStr;
	trimForm();
	ErrorStr="";
	if (document.LoginFrm.LoginId.value=="") {
		 ErrorStr +="&nbsp;&nbsp;Error : Please Enter Login Id<br>";
		  
		}
	if (document.LoginFrm.Pwd.value=="") {
		 ErrorStr +="&nbsp;&nbsp;Error : Please Enter Password<br>";
		  
		}	
		
		if (ErrorStr!="") {
		ErrorStr += "<br>";	
		document.getElementById("ErrorLable").innerHTML= ErrorStr;
		return false;
		} else return true;
}

function show_finish_reg_errors() {
	var ErrorStr;
	trimForm();
	ErrorStr="";
	if (document.FForm.LoginName.value=="") {
		 ErrorStr ="&nbsp; &nbsp;Login Name could not be empty<br><br>";
		  document.getElementById("ErrorLable").innerHTML= ErrorStr;
		} else {
	if (!isValidEmail_user_id(document.FForm.LoginName.value)) {
				ErrorStr ="&nbsp; &nbsp;Login Name is not Valid, Don't use Special Characters & Spaces<br><br>";
				 document.getElementById("ErrorLable").innerHTML= ErrorStr;
				} else {
					 document.FForm.submit();
					}
		}
}
function update_shipping (){
	if (document.RegForm.ShipCheck.checked) {
	  document.RegForm.ShipStAddress.value = document.RegForm.BillStAddress.value
	  document.RegForm.ShipCity.value = document.RegForm.BillCity.value
	  document.RegForm.ShipState.value = document.RegForm.BillState.value
	  document.RegForm.ShipZip.value = document.RegForm.BillZip.value
	  document.RegForm.ShipCountry.selectedIndex = document.RegForm.BillCountry.selectedIndex;
	} else {
	   document.RegForm.ShipStAddress.value = "";
	   document.RegForm.ShipCity.value = "";
	   document.RegForm.ShipState.value = "";
	   document.RegForm.ShipZip.value = "";
	   document.RegForm.ShipCountry.selectedIndex = 0;
	}
	} 
function show_reg_errors() {
      var ErrorString,PwdError,EmailError,LoginError;
	  trimForm();
      ErrorString = "";
	  PwdError = "";
	  EmailError = "";
	  LoginError = "";
	  document.getElementById("LoginNameId").style.color = "";
	  document.getElementById("PasswordId").style.color = "";
	  document.getElementById("RePasswordId").style.color = "";
	  document.getElementById("FirstNameId").style.color = "";
	  //document.getElementById("LastNameId").style.color = "";
	  document.getElementById("EmailAddressId").style.color = "";
	  document.getElementById("PhoneId").style.color = "";
	  document.getElementById("streetAddressId").style.color = "";
	  document.getElementById("CityId").style.color = "";
	  document.getElementById("ZPCId").style.color = "";
	  document.getElementById("CNameId").style.color = "";
	  
      if (document.RegForm.LoginName.value=="") {
		 ErrorString+="&nbsp;Error : Please Enter Login Name <br>";
		 document.getElementById("LoginNameId").style.color = "#C10000";
		 LoginError = 1;
      }
      if (document.RegForm.Password.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Password <br>";
		 document.getElementById("PasswordId").style.color = "#C10000";
		 PwdError=1;
		 
      }
	  if (document.RegForm.RePassword.value=="") {
         ErrorString+="&nbsp;Error : Please Re-Enter Password <br>";
		 document.getElementById("RePasswordId").style.color = "#C10000";
		 
		 PwdError=1;
      }
	  if (document.RegForm.FirstName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Full Name <br>";
		 document.getElementById("FirstNameId").style.color = "#C10000";
	  
      }
      /*if (document.RegForm.LastName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Last Name <br>";
		 document.getElementById("LastNameId").style.color = "#C10000";
      }*/
	  if (document.RegForm.streetAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Street Address <br>";
		 document.getElementById("streetAddressId").style.color = "#C10000";
      }
	  if (document.RegForm.City.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("CityId").style.color = "#C10000";
      }
	  if (document.RegForm.ZPcode.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip/Postal Code <br>";
		 document.getElementById("ZPCId").style.color = "#C10000";
      }
	  if (document.RegForm.CName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Company Name <br>";
		 document.getElementById("CNameId").style.color = "#C10000";
      }
	  if (document.RegForm.EmailAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Email Address <br>";
		 document.getElementById("EmailAddressId").style.color = "#C10000";
	  
		 EmailError = 1; 
      }
	  if (document.RegForm.Phone.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Phone # <br>";
		 document.getElementById("PhoneId").style.color = "#C10000";
      }
      if (LoginError!=1) {
		   //if (!validate_user_id(document.RegForm.LoginName)) {  // by asif
		   if (!isValidEmail_user_id(document.RegForm.LoginName.value)) {
			   ErrorString+="&nbsp;Error : Invalid Login Name, Please Enter Your Email ID<br>";
			   document.getElementById("LoginNameId").style.color = "#C10000";
			   }
		  }
	  if (PwdError!=1) {
		  
		  if (document.RegForm.Password.value!=document.RegForm.RePassword.value) {
			    ErrorString+="&nbsp;Error : Passwords Missmatch <br>";
				document.getElementById("PasswordId").style.color = "#C10000";
				document.getElementById("RePasswordId").style.color = "#C10000";
			  }
	  }
	  if (EmailError!=1) {
		    if (!isValidEmail(document.RegForm.EmailAddress.value)) {
				ErrorString+="&nbsp;Error : Invalid Email Address <br>";
				document.getElementById("EmailAddressId").style.color = "#C10000";
				}
		  }
	  if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {   
	        document.RegForm.submit();
			/*document.getElementById("TrStep2").style.display = "block"; // by asif
			document.getElementById("TrStep1").style.display = "none";  by asif*/
		  }   
  }
  function show_reg_errors_billing() {
      var ErrorString,StateError,ZipError;
	  trimForm();
      ErrorString = "";
	  document.getElementById("BillStAddressId").style.color = "";
	  document.getElementById("BillCityId").style.color = "";
	  document.getElementById("BillStateId").style.color = "";
	  document.getElementById("BillZipId").style.color = "";
	  document.getElementById("BillCountryId").style.color = "";
	
	if (document.RegForm.BillStAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Street Address <br>";
		 document.getElementById("BillStAddressId").style.color = "#C10000";
      }
      if (document.RegForm.BillCity.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("BillCityId").style.color = "#C10000";
		 
      }
	  if (document.RegForm.BillState.value=="") {
         ErrorString+="&nbsp;Error : Please Enter State <br>";
		 document.getElementById("BillStateId").style.color = "#C10000";
		 StateError=1;
      }
	  if (document.RegForm.BillZip.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip Code <br>";
		 document.getElementById("BillZipId").style.color = "#C10000";
		 ZipError=1;
      }
	  if (document.RegForm.BillCountry.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Country <br>";
		 document.getElementById("BillCountryId").style.color = "#C10000";
      }
	  
    if (ErrorString!="") {
		ErrorString= ErrorString+"<br>";
	document.getElementById("ErrorLableBilling").innerHTML= ErrorString;
	} else {
		    if (document.RegForm.ShipCheck.checked) {
				
	  document.RegForm.ShipStAddress.value = document.RegForm.BillStAddress.value
	  document.RegForm.ShipCity.value = document.RegForm.BillCity.value
	  document.RegForm.ShipState.value = document.RegForm.BillState.value
	  document.RegForm.ShipZip.value = document.RegForm.BillZip.value
	  document.RegForm.ShipCountry.selectedIndex = document.RegForm.BillCountry.selectedIndex;
	}
			document.getElementById("TrStep2").style.display = "none";
			document.getElementById("TrStep3").style.display = "block";
			
		  }
  }
  
  
  function show_reg_errors_shipping() {
      var ErrorString;
	  trimForm();
      ErrorString = "";
	  document.getElementById("ShipStAddressId").style.color = "";
	  document.getElementById("ShipCityId").style.color = "";
	  document.getElementById("ShipStateId").style.color = "";
	  document.getElementById("ShipZipId").style.color = "";
	  document.getElementById("ShipCountryId").style.color = "";
	  if (document.RegForm.ShipStAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Street Address <br>";
		 document.getElementById("ShipStAddressId").style.color = "#C10000";
	  
      }
      if (document.RegForm.ShipCity.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("ShipCityId").style.color = "#C10000";
	  
      }
	  if (document.RegForm.ShipState.value=="") {
         ErrorString+="&nbsp;Error : Please Enter State <br>";
		 document.getElementById("ShipStateId").style.color = "#C10000";
	  
      }
	  if (document.RegForm.ShipZip.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip Code <br>";
		 document.getElementById("ShipZipId").style.color = "#C10000";
	  
      }
	  if (document.RegForm.ShipCountry.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Country <br>";
		 document.getElementById("ShipCountryId").style.color = "#C10000";
      }
	  
    if (ErrorString!="") {
		ErrorString= ErrorString+"<br>";
	document.getElementById("ErrorLableShipping").innerHTML= ErrorString;
	} else {
		    //RegForm.submit(); // by asif
		  }
  }
  function validate_user_id(field) {
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	var ok = true;
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = false;
	}
return(ok);
}

function MyTrim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function trimForm()
{
	for(field in document.getElementsByTagName("input"))
	{
		try{
		document.getElementById(field).value=MyTrim(document.getElementById(field).value);
		}catch(e)
		{}
	}
	for(field in document.getElementsByTagName("textarea"))
	{
		try{
		document.getElementById(field).value=MyTrim(document.getElementById(field).value);
		}catch(e)
		{}
	}
}


function back_billing () {
	document.getElementById("TrStep2").style.display = "none";
	document.getElementById("TrStep1").style.display = "block";
  }
 function back_shipping () {
	  document.getElementById("TrStep3").style.display = "none";
	  document.getElementById("TrStep2").style.display = "block";
	  } 
 function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
function isValidEmail_user_id(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
function show_feed_errors() {
      var NameString,EmailError,SubError,CommentsError,LoginError, ErrorString;
	  trimForm();
      ErrorString ="";
	  NameString = "";
	  SubError = "";
	  EmailError = "";
	  CommentsError = "";
	  document.getElementById("fNameId").style.color = "";
	  document.getElementById("femailId").style.color = "";
	  document.getElementById("fsubjectId").style.color = "";
	  document.getElementById("fcommentsId").style.color = "";
	  	  
     if (document.feedform.fName.value== "") {
         
		 ErrorString+="&nbsp;Error : Please Enter Your Name <br>";
		 document.getElementById("fNameId").style.color = "#C10000";
		 
      }
	  
      if (document.feedform.femail.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Email <br>";
		 document.getElementById("femailId").style.color = "#C10000";
		EmailError =1;
		 
      }
	  if (document.feedform.fsubject.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Subject <br>";
		 document.getElementById("fsubjectId").style.color = "#C10000";
		}
	  if (document.feedform.fcomments.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Comments<br>";
		 document.getElementById("fcommentsId").style.color = "#C10000";
	  
      }
       
	  
	  if (EmailError!=1) {
		    if (!isValidEmail(document.feedform.femail.value)) {
				ErrorString+="&nbsp;Error : Invalid Email Address <br>";
				document.getElementById("femailId").style.color = "#C10000";
				}
		  }
	  if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {
		    document.getElementById("TrStep2").style.display = "block";
			document.getElementById("TrStep1").style.display = "none";
		  }
  }

function show_regedit_errors() {
      var ErrorString,PwdError,EmailError,LoginError;
	  trimForm();
      ErrorString = "";
	  PwdError = "";
	  EmailError = "";
	  LoginError = "";
	  document.getElementById("FirstNameId").style.color = "";
	  //document.getElementById("LastNameId").style.color = "";
	  document.getElementById("EmailAddressId").style.color = "";
	  document.getElementById("PhoneId").style.color = "";
	  /*document.getElementById("ShipStAddressId").style.color = "";
	  //document.getElementById("ShipCityId").style.color = "";
	  //document.getElementById("ShipStateId").style.color = "";
	  //document.getElementById("ShipZipId").style.color = "";
	  //document.getElementById("ShipCountryId").style.color = "";
	  //document.getElementById("BillStAddressId").style.color = "";
	  //document.getElementById("BillCityId").style.color = "";
	  //document.getElementById("BillStateId").style.color = "";
	  //document.getElementById("BillZipId").style.color = "";
	  //document.getElementById("BillCountryId").style.color = ""; by asif*/
	  document.getElementById("streetAddressId").style.color = "";
	  document.getElementById("CityId").style.color = "";
	  document.getElementById("ZPCId").style.color = "";
	  document.getElementById("CNameId").style.color = "";
      document.getElementById("SpId").style.color = "";
	
      if (document.RegEditForm.FirstName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter First Name <br>";
		 document.getElementById("FirstNameId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.CName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Company Name <br>";
		 document.getElementById("CNameId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.streetAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Street Address <br>";
		 document.getElementById("streetAddressId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.City.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("CityId").style.color = "#C10000";
	  
      }
	   if (document.RegEditForm.select.value=="") {
         ErrorString+="&nbsp;Error : Please Enter State/Province <br>";
		 document.getElementById("SpId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.ZPcode.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip/Postal Code <br>";
		 document.getElementById("ZPCId").style.color = "#C10000";
	  
      }
      /*if (document.RegEditForm.LastName.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Last Name <br>";
		 document.getElementById("LastNameId").style.color = "#C10000";
	  
      } */
	  if (document.RegEditForm.EmailAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Email Address <br>";
		 document.getElementById("EmailAddressId").style.color = "#C10000";
	  
		 EmailError = 1; 
      }
	  if (document.RegEditForm.Phone.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Phone # <br>";
		 document.getElementById("PhoneId").style.color = "#C10000";
      }
	  if (EmailError!=1) {
		    if (!isValidEmail(document.RegEditForm.EmailAddress.value)) {
				ErrorString+="&nbsp;Error : Invalid Email Address <br>";
				document.getElementById("EmailAddressId").style.color = "#C10000";
				}
		  }
	/*if (document.RegEditForm.BillStAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Street Address <br>";
		 document.getElementById("BillStAddressId").style.color = "#C10000";
      }
      if (document.RegEditForm.BillCity.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("BillCityId").style.color = "#C10000";
		 
      }
	  if (document.RegEditForm.BillState.value=="") {
         ErrorString+="&nbsp;Error : Please Enter State <br>";
		 document.getElementById("BillStateId").style.color = "#C10000";
		 StateError=1;
      }
	  if (document.RegEditForm.BillZip.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip Code <br>";
		 document.getElementById("BillZipId").style.color = "#C10000";
		 ZipError=1;
      }
	  if (document.RegEditForm.BillCountry.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Country <br>";
		 document.getElementById("BillCountryId").style.color = "#C10000";
      }
	  
     if (document.RegEditForm.ShipStAddress.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Street Address <br>";
		 document.getElementById("ShipStAddressId").style.color = "#C10000";
	  
      }
      if (document.RegEditForm.ShipCity.value=="") {
         ErrorString+="&nbsp;Error : Please Enter City <br>";
		 document.getElementById("ShipCityId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.ShipState.value=="") {
         ErrorString+="&nbsp;Error : Please Enter State <br>";
		 document.getElementById("ShipStateId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.ShipZip.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Zip Code <br>";
		 document.getElementById("ShipZipId").style.color = "#C10000";
	  
      }
	  if (document.RegEditForm.ShipCountry.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Your Country <br>";
		 document.getElementById("ShipCountryId").style.color = "#C10000";
      } by asif*/
	  
    if (ErrorString!="") {
		ErrorString= ErrorString+"<br>";
	document.getElementById("ErrorLable").innerHTML= ErrorString;
	} else {
		    document.RegEditForm.submit();
		  }
		  
  }
function show_feed_errors() {
      var NameString,EmailError,SubError,CommentsError,LoginError, ErrorString;
	  trimForm();
      ErrorString ="";
	  NameString = "";
	  SubError = "";
	  EmailError = "";
	  CommentsError = "";
	  document.getElementById("fNameId").style.color = "";
	  document.getElementById("femailId").style.color = "";
	  document.getElementById("fsubjectId").style.color = "";
	  document.getElementById("fcommentsId").style.color = "";
	  	  
     if (document.feedform.fName.value== "") {
         
		 ErrorString+="&nbsp;Error : Please Enter Your Name <br>";
		 document.getElementById("fNameId").style.color = "#C10000";
		 
      }
	  
	  if (document.feedform.fsubject.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Subject <br>";
		 document.getElementById("fsubjectId").style.color = "#C10000";
		}
	  if (document.feedform.femail.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Email <br>";
		 document.getElementById("femailId").style.color = "#C10000";
		EmailError =1;
		 
      }
	  if (document.feedform.fcomments.value=="") {
         ErrorString+="&nbsp;Error : Please Enter Comments<br>";
		 document.getElementById("fcommentsId").style.color = "#C10000";
	  
      }
       
	  
	  if (EmailError!=1) {
		    if (!isValidEmail(document.feedform.femail.value)) {
				ErrorString+="&nbsp;Error : Invalid Email Address <br>";
				document.getElementById("femailId").style.color = "#C10000";
				}
		  }
	  if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {
			feedform.submit()
		  }
  }
function show_pass_errors() {
      var OldString,NewError,ReError,ErrorString;
	  trimForm();
      ErrorString ="";
	  OldString = "";
	  NewError = "";
	  ReError = "";
	  document.getElementById("oldpId").style.color = "";
	  document.getElementById("newpId").style.color = "";
	  document.getElementById("repId").style.color = "";
	  	  
     if (document.RegPassForm.oldp.value== "") {
         
		 ErrorString+="&nbsp;Error : Please Enter Old Password <br>";
		 document.getElementById("oldpId").style.color = "#C10000";
		 
      }
	  
	  if (document.RegPassForm.newp.value=="") {
         ErrorString+="&nbsp;Error : Please Enter New Password <br>";
		 document.getElementById("newpId").style.color = "#C10000";
		}
	  if (document.RegPassForm.rep.value=="") {
         ErrorString+="&nbsp;Error : Please Re-enter New Password<br>";
		 document.getElementById("repId").style.color = "#C10000";
		 ReError =1;
	    }
		
	 if (ReError!=1) {
		  
		  if (document.RegPassForm.newp.value!=document.RegPassForm.rep.value) {
			    ErrorString+="&nbsp;Error : Passwords Missmatch <br>";
				document.getElementById("newpId").style.color = "#C10000";
				document.getElementById("repId").style.color = "#C10000";
			  }
	  }
	  
	  if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {
			document.RegPassForm.submit()
		  }
  }
function show_pwd_errors() {
      var LoginError, ErrorString;
	  trimForm();
      ErrorString ="";
	  LoginError = "";
	  
	  document.getElementById("pwdloginId").style.color = "";
	  
	  	  
     if (document.forPassForm.login.value== "") {
         
		 ErrorString+="&nbsp;Error : Please Enter Your Login Name <br>";
		 document.getElementById("pwdloginId").style.color = "#C10000";
		 
      }
	  
	  if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {
			forPassForm.submit()
		  }
  }
  
function ValidateForm(){
	var dt=document.frmSample.txtDate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }

function getCheckedValue(radioObj) {
	var radioLength = radioObj.length;
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function show_orderhistory_errors() {
      var ErrorString;
	  trimForm();
      ErrorString ="";
	  
	  if (getCheckedValue(document.OptFrm.OptRadio)=="date_range") {
     if (document.OptFrm.FromDate.value== "" ) {
		 ErrorString+="&nbsp;&nbsp;&nbsp;Error : Please Enter From Date Value <br>";
      }
	 if (document.OptFrm.ToDate.value== "") {
		 ErrorString+="&nbsp;&nbsp;&nbsp;Error : Please Enter To Date Value <br>";
      }
	   if (ErrorString=="") {
		  
	       if (!isDate(document.OptFrm.FromDate.value))
		   ErrorString+="&nbsp;&nbsp;&nbsp;Error : Invalid From Date <br>";
		   if (!isDate(document.OptFrm.ToDate.value))
		   ErrorString+="&nbsp;&nbsp;&nbsp;Error : Invalid To Date <br>";
		   if (ErrorString=="") {
			    if (document.OptFrm.FromDate.value >= document.OptFrm.ToDate.value)
				 ErrorString+="&nbsp;&nbsp;&nbsp;Error : To Date Should be greater then From Date <br>";
			   }
		}
	  }
	  if (getCheckedValue(document.OptFrm.OptRadio)=="tracking_number") {
	  if (document.OptFrm.TrackingNumber.value== "") {
		 ErrorString+="&nbsp;&nbsp;&nbsp;Error : Please Enter Tracking Number <br>";
      }
	  }
     if (ErrorString!="") {
	  ErrorString+="<br>"; 	  
	  document.getElementById("ErrorLable").innerHTML= ErrorString;
	  } else {
		     document.OptFrm.submit();
		  } 
  }
