//get the input 
function i(str)
{
var input;
input=document.getElementById(str).value;
return input;
}

//focus
function foc(str,color)
{
document.getElementById(str).innerHTML="";
document.getElementById(str).style.color="#"+color;
}

function ninput(v)
{
var field,field1,field2;
field=document.getElementById(v).value;
field1="d"+v;
field2="n"+v;

	if (document.getElementById(field1) && document.getElementById(field2) ){

		if ( field == "" )
		{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>UNVERIFIED ENTRY!</b>";
	 	var strs="0"
	 	}
	 	else 
		{
	    	document.getElementById(field1).style.backgroundColor="#ABCDEC";
	 	document.getElementById(field2).innerHTML="";
	 	var strs="1" 		
		}
	return strs;
	
	}
}

function nemail(str)
{
var email,field1,field2;
field1="d"+str;
field2="n"+str;
email=document.getElementById(str).value;
	if ( !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) )
      {
	  document.getElementById(field1).style.backgroundColor="#FF4200";
	  document.getElementById(field2).innerHTML="<b>UNVERIFIED EMAIL!</b>";
	  var strs="0"
	  }
	else 
     {
	 document.getElementById(field1).style.backgroundColor="#ABCDEC";
	 document.getElementById(field2).innerHTML="";
	 var strs="1" 			
	 }
return strs;
}

function npass()
{
var fields1,fields2,password0,password1;
field1="dpassword";
field2="npassword";
password0=document.getElementById("password1").value;
password1=document.getElementById("password2").value;

		if ( password0 == "" )
		{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>ENTER YOUR PASSWORD!</b>";
	 	var strs="0"
	 	}
		
		else if ( password0 != "" && password1 == "" )
		{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>RE-ENTER YOUR PASSWORD!</b>";
	 	var strs="0"
	 	}
		
		else if ( password0 != "" && password1 != "" && password0 != password1  )
		{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>PASSWORD CONFIRMATION DOESN'T MATCH!</b>";
	 	var strs="0"
	 	}
		
	 	else 
		{
	        document.getElementById(field1).style.backgroundColor="#ABCDEC";
	 	document.getElementById(field2).innerHTML="";
	 	var strs="1" 			
		}
	
		
}


function nphonella(v)
{
var field,field1,field2;
field=document.getElementById(v).value;
field1="d"+v;
field2="n"+v;
	if ( !/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]+$/.test(field) )
	{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>UNVERIFIED NUMBER!</b>";
	 	var strs="0"
	}
	 else
	 {
	    document.getElementById(field1).style.backgroundColor="#ABCDEC";
	 	document.getElementById(field2).innerHTML="";
	 	var strs="1" 			
	}
return strs;
}

function ninputd(v,v1)
{
var field,field1,field2;
field=document.getElementById(v).value;
field1="d"+v1;
field2="n"+v1;
		if ( field == "" )
		{
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	 	document.getElementById(field2).innerHTML="<b>UNVERIFIED ENTRY!</b>";
	 	var strs="0"
	 	}
	 	else 
		{
	    document.getElementById(field1).style.backgroundColor="#ABCDEC";
	 	document.getElementById(field2).innerHTML="";
	 	var strs="1" 			
		}
return strs;
}


function checkSelectedRadio(radioName){
        theRadio = document.getElementsByName(radioName);
        for (i=0;i<theRadio.length; i++){
                if (theRadio[i].checked) return theRadio[i].value;
        }
        return null;
}


function nchecks(str)
{
var strs,field1,field2;
field1="d"+str;
field2="n"+str;
	if ( checkSelectedRadio(str) == null ){
		document.getElementById(field1).style.backgroundColor="#ABCDEC";
		document.getElementById(field2).innerHTML="";
		var strs="1" 
     }
	else {
	  	document.getElementById(field1).style.backgroundColor="#FF4200";
	  	document.getElementById(field2).innerHTML="<b>UNVERIFIED EMAIL!</b>";
	  	var strs="0"			
     }
return strs;
}