<!--
function ShowFile1(fname,fdescript)
{window.open(fname,fdescript,'left=75,top=75,menubar=no,height=414,width=600,scrollbars=yes')}
//-->
function checkForSpecialChar(str, obj) {
     var str1 = str;
     var str2 = obj;
     var i,j;
     var ch;

     for (i=0; i<str2.length; i++) {
        ch = str2.charAt(i);
        for (j=0; j<str1.length; j++)
            if (ch == str1.charAt(j)) break; 
        if (j == str1.length) break;
     }
     if (i != str2.length) {
       return(true);
     }
     else return (false);
}
function trim(s)
{
        s = s.replace( /^\s*/, "" );
        s = s.replace( /\s*$/, "" );
        return s;
}

function isEmail(str)
{
  re = new RegExp("[`~!#$%&*()+=|{}':;,?/><^\"\']");
  r =  str.match(re);
  if (r || str.indexOf("[") >= 0 || str.indexOf("]")>=0 || str.indexOf("\\")>=0 || str.indexOf(" ")>=0)
  {
 	return false;
  }
    var supported = 0;
  if (window.RegExp)
  {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported)
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

function validate()
{
	if(trim(document.form1.memcode.value) == "")
	{
		alert ("Please enter your DMA Code.")
		document.form1.memcode.focus()
		return false;
	}
	
	
	if(trim(document.form1.mempass.value) == "")
	{
		alert ("Please enter your password.")
		document.form1.mempass.focus()
		return false;
	}
	
	document.form1.action="html/logincheck.asp"
	document.form1.submit();

}


function checkenroll()
{
	if(trim(document.form3.dmacode.value) == "")
	{
		alert ("Please enter your DMA Code.")
		document.form3.dmacode.focus()
		return 
	}
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", document.form3.dmacode.value))
   {
       document.form3.dmacode.value="";
	    alert ("Please enter valid DMA code");
       document.form3.dmacode.focus()
       return 
   }
	
	document.form3.action="checkenroll_next.asp"
	document.form3.submit();

}

function checkform()
{

	if(trim(document.form4.cust_fname.value) == "" || (document.form4.cust_fname.value) == "First Name")
	{
		alert ("Please enter your first name.")
		document.form4.cust_fname.focus()
		return 
	}
	
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'", document.form4.cust_fname.value))
   {
	   alert ("Please note that the name cannot contain invalid characters");
       document.form4.cust_fname.focus()
       return 
   }

	if(trim(document.form4.cust_lname.value) == "" || (document.form4.cust_lname.value) == "Last Name")
	{
		alert ("Please enter your last name.")
		document.form4.cust_lname.focus()
		return 
	}
	
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'", document.form4.cust_lname.value))
   {
	   alert ("Please note that the name cannot contain invalid characters");
       document.form4.cust_lname.focus()
       return 
   }

	if(trim(document.form4.cust_dma.value) == "")
   {
	   alert ("Please insert your DMA code");
       document.form4.cust_dma.focus()
       return 
   }


if(trim(document.form4.cust_dma.value).length < "9")
   {
	   alert ("Please note that the DMA code can only be 9 characters long.");
       document.form4.cust_dma.focus()
       return 
   }
   if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", document.form4.cust_lname.value))
   {
	   alert ("Please note that the DMA code cannot contain invalid characters");
       document.form4.cust_lname.focus()
       return 
   }

if(trim(document.form4.address.value) == "")
   {
	   alert ("Please enter your address");
       document.form4.address.focus()
       return 
   }

if(trim(document.form4.city.value) == "")
   {
	   alert ("Please enter your city");
       document.form4.city.focus()
       return 
   }
if(trim(document.form4.pincode.value) == "")
   {
	   alert ("Please enter your pincode");
       document.form4.pincode.focus()
       return 
   }   

if (checkForSpecialChar ("0123456789", document.form4.pincode.value))
   {
	   alert ("Please enter valid pincode");
       document.form4.pincode.focus()
       return 
   }


if(trim(document.form4.std_code.value) == "")
   {
	   alert ("Please enter std code");
       document.form4.std_code.focus()
       return 
   }   


if (checkForSpecialChar ("0123456789", document.form4.std_code.value))
   {
	   alert ("Please enter valid std code");
       document.form4.std_code.focus()
       return 
   } 
   
  

if(trim(document.form4.telephone.value) == "")
   {
	   alert ("Please enter telephone");
       document.form4.telephone.focus()
       return 
   }   

if (checkForSpecialChar ("0123456789", document.form4.telephone.value))
   {
	   alert ("Please enter valid telephone");
       document.form4.telephone.focus()
       return 
   } 


if(trim(document.form4.cust_email.value)== "" || isEmail(document.form4.cust_email.value) != true)
	{
		alert("Plese enter your valid Email ");
		document.form4.cust_email.focus();
		return 
	}


if(trim(document.form4.cust_dd.value) == "")
   {
	   alert ("Please enter date");
       document.form4.cust_dd.focus()
       return 
   } 
   
if (checkForSpecialChar ("0123456789", document.form4.cust_dd.value))
   {
	   alert ("Please enter valid date");
       document.form4.cust_dd.focus()
       return 
   } 

if(trim(document.form4.cust_mm.value) == "")
   {
	   alert ("Please enter month");
       document.form4.cust_mm.focus()
       return 
   } 
   
if (checkForSpecialChar ("0123456789", document.form4.cust_mm.value))
   {
	   alert ("Please enter valid month");
       document.form4.cust_mm.focus()
       return 
   } 
   
if(trim(document.form4.cust_yy.value) == "")
   {
	   alert ("Please enter year");
       document.form4.cust_yy.focus()
       return 
   } 
   
if (checkForSpecialChar ("0123456789", document.form4.cust_yy.value))
   {
	   alert ("Please enter valid year");
       document.form4.cust_yy.focus()
       return 
   } 
		if(document.form4.agree.checked==false)
			{
			alert("Please accept the Terms & Condition");
			document.form4.checkbox.focus();
			return 
			}	
   
	document.form4.action="thankyou.asp"
	document.form4.submit();

}


function qualify()
{

	if(trim(document.form2.dmacode.value) == "")
	{
		alert("Please enter DMA code");
		document.form2.dmacode.focus();
		return false;
	}
	document.form2.action="checkenroll_next.asp"
	document.form2.submit();
}
function passchange()
{
	
	
	if(trim(document.form1.mypass.value) == "")
	{
		alert ("Please enter your old password.")
		document.form1.mypass.focus()
		return 
	}
	
	if(trim(document.form1.mypass.value).length < "8")
	{
		alert ("Please note that the Password can only be 8 characters long.")
		document.form1.mypass.focus()
		return 
	}
	
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", document.form1.mypass.value))
   {
       document.form1.mypass.value="";
	    alert ("Please note that the Password cannot contain invalid characters");
       document.form1.mypass.focus()
       return 
   }
	
	if(trim(document.form1.mynewpass.value) == "")
	{
		alert ("Please enter your new password.")
		document.form1.mynewpass.focus()
		return 
	}
	
	if(trim(document.form1.mynewpass.value).length < "8")
	{
		alert ("Please note that the Password can only be 8 characters long.")
		document.form1.mynewpass.focus()
		return 
	}
	
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", document.form1.mynewpass.value))
   {
       document.form1.mynewpass.value="";
	    alert ("Please note that the Password cannot contain invalid characters");
       document.form1.mynewpass.focus()
       return 
   }
	
	
	if(trim(document.form1.myconfpass.value) == "")
	{
		alert ("Please confirm your password.")
		document.form1.myconfpass.focus()
		return 
	}
	
	if(trim(document.form1.myconfpass.value).length < "8")
	{
		alert ("Please note that the Password can only be 8 characters long.")
		document.form1.myconfpass.focus()
		return 
	}
	
	if (checkForSpecialChar ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", document.form1.myconfpass.value))
   {
       document.form1.myconfpass.value="";
	    alert ("Please note that the Password cannot contain invalid characters");
       document.form1.myconfpass.focus()
       return 
   }
   
	
	
	if(trim(document.form1.mynewpass.value)!= trim(document.form1.myconfpass.value))
	 {
	 alert ("Password mismatch");
       document.form1.myconfpass.focus()
       return 
	 }
	document.form1.action="changepass.asp"
	document.form1.submit();
}

perdet
function perdet()
{

	if(trim(document.perdetform.myquery.value) == "")
	{
		alert("Please enter your query");
		document.perdetform.myquery.focus();
		return ;
	}
	document.perdetform.action="changedetails_request.asp"
	document.perdetform.submit();
}


function docontact()
{

	if(trim(document.contact.dmcode.value) == "")
	{
		alert("Please enter your code");
		document.contact.dmcode.focus();
		return ;
	}

	if(trim(document.contact.custname.value) == "")
	{
		alert("Please enter your name");
		document.contact.custname.focus();
		return ;
	}

if(trim(document.contact.myquery.value) == "")
	{
		alert("Please enter your query");
		document.contact.myquery.focus();
		return ;
	}
	document.contact.action="submitcontact.asp"
	document.contact.submit();
}


function doReset(){
   document.form1.memcode.value = ""
   document.form1.mempass.value = ""   
}
function passReset(){
   document.form1.mypass.value = ""
   document.form1.mynewpass.value = ""
   document.form1.myconfpass.value = ""   
}

function detReset(){
   document.perdetform.myquery.value = ""
}


function memreq()
{

	if(trim(document.checkenroll.myquery.value) == "")
	{
		alert("Please enter your query");
		document.checkenroll.myquery.focus();
		return ;
	}
	document.checkenroll.action="memdetail_request.asp"
	document.checkenroll.submit();
}

function enrollReset(){
   document.checkenroll.myquery.value = ""
}
