function enAdd(addID)
{
// let's check for browser
if(navigator.appName=="Microsoft Internet Explorer"){
	if(addID==1){	
		document.form1.locData1.disabled = false;		
		document.form1.locData2.disabled = true;
		document.form1.locName.disabled = true;
	}
	if(addID==2){	
		document.form1.locData2.disabled = false;				
		document.form1.locData1.disabled = true;
		document.form1.locName.disabled = true;
	}
	if(addID==3){	
		document.form1.locName.disabled = false;		
		document.form1.locData1.disabled = true;		
		document.form1.locData2.disabled = true;
	}
	} 
}
function checkform() 
{
	if(navigator.appName=="Microsoft Internet Explorer")
	{
	browser="M"
	}
	else
	{
	browser="N"
	}
	if(browser=="M")
	{
	div_fname.innerText="";	
	div_add1.innerText="";
	div_tel.innerText="";
	div_email.innerText="";
	div_userid.innerText="";	
	}
	invalidspace = " ";
 	fname = document.form1.fname.value;
	if (fname == "") 
	{

		document.form1.fname.focus();
		if(browser=="M"){
		div_fname.innerText="Required";
		}else{
		alert ("Please Fill the First Name")
		}
		return false;
	}
	if (fname.substr(0,1).indexOf(invalidspace) > -1) 
	{
		document.form1.fname.focus();
		if(browser=="M"){
		div_fname.innerText="Invalid";
		}else{
		alert ("Please Fill the First Name")
		}
		return false;
	}	
	if (fname.length<4) 
	{
		document.form1.fname.focus();
		if(browser=="M"){
		div_fname.innerText="Invalid";
		}else{
		alert ("Please Fill the First Name")
		}
		return false;
	}
//add1
	add = document.form1.add1.value;
	if (add == "") 
	{
		document.form1.add1.focus();
		if(browser=="M"){
		div_add1.innerText="Required";
		}else{
		alert ("Please Fill the Mailing Address 1")
		}
		return false;
	}
	if (add.substr(0,1).indexOf(invalidspace) > -1) 
	{		
		document.form1.add1.focus();
		if(browser=="M"){
		div_add1.innerText="Invalid";
		}else{
		alert ("Please Fill the Mailing Address 1")
		}
		return false;
	}
	if (add.length<4) 
	{		
		document.form1.add1.focus();
		if(browser=="M"){
		div_add1.innerText="Invalid";
		}else{
		alert ("Please Fill the Mailing Address 1")
		}
		return false;
	}
 //tel
 	tel = document.form1.tel.value;
	if (tel == "") 
	{		
		document.form1.tel.focus();
		if(browser=="M"){
		div_tel.innerText="Required";
		}else{
		alert ("Please Fill the Phone Number")
		}
		return false;
	}
	if (tel.substr(0,1).indexOf(invalidspace) > -1) 
	{		
		document.form1.tel.focus();
		if(browser=="M"){
		div_tel.innerText="Invalid";
		}else{
		alert ("Please Fill the Phone Number")
		}
		return false;
	}
	if (tel.length<4) 
	{		
		document.form1.tel.focus();
		if(browser=="M"){
		div_tel.innerText="Invalid";
		}else{
		alert ("Please Fill the Phone Number")
		}
		return false;
	}
 //email
	if (document.form1.email.value == "") 
	{		
		document.form1.email.focus();
		if(browser=="M"){
		div_email.innerText="Required";
		}else{
		alert ("Please Fill the Email Address")
		}
		return false;
	}
	var testresults	
	var str=document.form1.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
	{
	testresults=true
	}
	else{
		document.form1.email.focus();
		if(browser=="M"){
		div_email.innerText="Invalid";
		}else{
		alert ("Please Fill the Email Address")
		}
		return false;	
	} 
 //USER ID
 	userid = document.form1.userid.value;
	if (userid == "") 
	{
		document.form1.userid.focus();
		if(browser=="M"){
		div_userid.innerText="Required";
		}else{
		alert ("Please Fill the UserID")
		}
		return false;
	}
	if (userid.length < 4) 
	{
		document.form1.userid.focus();
		if(browser=="M"){
		div_userid.innerText="Invalid";
		}else{
		alert ("Please Fill the UserID")
		}
		return false;
	}
	if (userid.indexOf(invalidspace) > -1) 
	{
		document.form1.userid.focus();
		if(browser=="M"){
		div_userid.innerText="Invalid";
		}else{
		alert ("Please Fill the UserID")
		}
		return false;
	}
    //passwd
	passwd = document.form1.passwd.value;
	if (passwd == "") 
	{
		document.form1.passwd.focus();
		if(browser=="M")
		{
		div_passwd.innerText="Required";
		}
		else
		{
		alert ("Please Fill the Password")
		}
		return false;
	}  
	if (passwd.length < 4) 
	{
		document.form1.passwd.focus();
		if(browser=="M")
		{
		div_passwd.innerText="Invalid";
		}
		else
		{
		alert ("Password must be more than 4 charaters")
		}
		return false;
	}   
	if (passwd.indexOf(invalidspace) > -1) 
	{
		document.form1.passwd.focus();
		if(browser=="M")
		{
		div_passwd.innerText="Invalid";
		}
		else
		{
		alert ("Password must be more than 4 charaters")
		}
		return false;
	}
	var must_contain_char = "0,1,2,3,4,5,6,7,8,9,~,!,@,#,$,%,^,&,*,(,)";
	var must_con_char = new Array()
	must_con_char = must_contain_char.split(",");	
	pass=0;		
	for (l=0; l<must_con_char.length; l+=1)
	{
		if(passwd.indexOf(must_con_char[l]) > -1)
		{			
			pass = 1;
		}		
	}
	if(pass!=1)
	{
		document.form1.passwd.focus();
		if(browser=="M")
		{
		div_passwd.innerText="Invalid";
		}
		else
		{
		alert ("Password atleast contain integer or special characters")
		}
		return false;
	}
	
 //Confirm password
	if ((passwd != document.form1.passwd1.value) ||(document.form1.passwd1.value ==""))
	{
		document.form1.passwd1.focus();
		if(browser=="M")
		{
		div_passwd1.innerText="Invalid";
		}
		else
		{
		alert ("Please Fill the Correct Password")
		}
		return false;
	}
	return true;
	document.form1.submit();	
}
function refreshIt()
{
var d1=document.form2;
d1.userid.value="";
d1.passwd.value="";
}
function refreshnow()
{
var d1=document.form1;
d1.fname.value="";
d1.add1.value="";
d1.add2.value="";
d1.state.value="";
d1.zipcode.value="";
d1.tel.value="";
d1.tel2.value="";
d1.fax.value="";
d1.mobile.value="";
d1.email.value="";
d1.email2.value="";
d1.userid.value="";
d1.passwd.value="";
d1.passwd1.value="";
}

function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)
{
for (index = 0; index < strLen; index++)
{
if (index == 0)
{
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))
{
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
}
}
}
}
frmObj.value = tmpStr;
}
//-->
