<!--

function checkData (){
  var expdate = new Date();
  expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 180));
 document.Form1.FirstName.value = strTrim(document.Form1.FirstName.value);
 if (document.Form1.FirstName.value.length ==0){
  alert("Please enter your first name.")
  return false}
 if (document.Form1.LastName.value.length ==0){
  alert("Please enter your last name.")
  return false}
  
 selPos = document.Form1.Country.selectedIndex;
 selValue = document.Form1.Country.options[selPos].value;
 if ( selValue == "" || selValue == 0){
   alert("Please select a country.")
   return false
 }
 
 
  document.Form1.Email.value = strTrim(document.Form1.Email.value);
 if (document.Form1.Email.value.length >0){
   i=document.Form1.Email.value.indexOf("@")
   j=document.Form1.Email.value.indexOf(".",i)
   k=document.Form1.Email.value.indexOf(",")
   kk=document.Form1.Email.value.indexOf(" ")
   jj=document.Form1.Email.value.lastIndexOf(".")+1
   len=document.Form1.Email.value.length
   
   if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
     if (document.Form1.Email.value==ul_email)
        SetCookie("ulcst_first","no", null, "/", null, false); 
     else 
        SetCookie("ulcst_first","yes", null, "/", null, false);    
     SetCookie("ulcst_fname",document.Form1.FirstName.value, expdate, "/", null, false);
     SetCookie("ulcst_lname",document.Form1.LastName.value, expdate, "/", null, false);     	        
     SetCookie("ulcst_email",document.Form1.Email.value, expdate, "/", null, false); 
     SetCookie("ulcst_country",selValue, expdate, "/", null, false);
   } else {
     alert("Please enter your email address.\n" +
     document.Form1.Email.value + " is incorrect format.")
     return false}
   }
 else {
     alert("Please enter your email address.")
     return false}
 
  selPos = document.Form1.ProductNo.selectedIndex;
  selValue = document.Form1.ProductNo.options[selPos].value;
  if ( selValue == "" || selValue == 0){
   alert("Please select a Product Version.")
   return false
 }    
}

function setdata()
{
ul_fname=GetCookie("ulcst_fname");
ul_lname=GetCookie("ulcst_lname");
ul_email=GetCookie("ulcst_email");
ul_country=GetCookie("ulcst_country");

 if (ul_fname != null)
    document.Form1.FirstName.value=ul_fname;
 if (ul_lname != null)
    document.Form1.LastName.value=ul_lname;
 if (ul_email != null)
    document.Form1.Email.value=ul_email;
 if (ul_country != null) {
    selList = document.Form1.Country
    for ( i = 0; i <  document.Form1.Country.length; i++) {
      if (selList.options[i].value == ul_country ) {
         selList.options[i].selected = true;
         break;
      }   
    }
 }
}

function checkLoginData (){
 document.Form0.login_name.value = strTrim(document.Form0.login_name.value);
 if (document.Form0.login_name.value.length ==0){
  alert("Please enter your login name.")
  return false}
 if (document.Form0.password.value.length ==0){
  alert("Please enter your password.")
  return false}
  
}

function setLoginData()
{
ulcst_uid=GetCookie("ulcst_uid");
ulcst_pwd=GetCookie("ulcst_pwd");

 if (ulcst_uid != null)
    document.Form0.login_name.value=ulcst_uid;
 if (ulcst_pwd != null)
    document.Form0.password.value=ulcst_pwd;

}

function strTrim(InString) {

   strLen = InString.length;
   if(strLen==0) 
        OutString = InString;
   else {
       i=0;
       while ( InString.charAt(i) == " ") {
          i++;
       }
       j=strLen-1;
       while ( InString.charAt(j) == " ") {
          j--;
       }
       if(strLen==i)
        OutString = "";
       else
        OutString = InString.substring(i,j+1);
   }
   return OutString;
}

function getCookieVal (offset)
{
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name)
{
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen)
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0)
         break;
      }
   return null;
}

function SetCookie (name, value)
{
   var argv = SetCookie.arguments;
   var argc = SetCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) +
     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
}
setdata()
//-->
