


function validEmail(email) 
{ 
    if (email == ""){return false;} 
    badStuff = ";:/,' \"\\"; 
     
    for (i=0; i<badStuff.length; i++) 
    { 
        badCheck = badStuff.charAt(i) 
        if (email.indexOf(badCheck,0) != -1){return false;} 
    } 

    posOfAtSign = email.indexOf("@",1) 
     
    if (posOfAtSign == -1){return false;} 

    if (email.indexOf("@",posOfAtSign+1) != -1){return false;} 
    posOfPeriod = email.indexOf(".", posOfAtSign) 
     
    if (posOfPeriod == -1){return false;} 
    if (posOfPeriod+2 > email.length){return false;} 
     
return true; 
} 




function left_chk()
{

		var errorstr = '';
		var msgstr = "There is a slight problem with your form submission.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		
		with(document.formleft)
		{ 	
			if(username.value=='') { errorstr += "- Please enter username.\n"; }
			if (password.value=='') { errorstr += "- Please enter password.\n";}
		}	
		
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
			
} 



function IsEmpty(objWord)
{
	var blnIsEmpty = true;	
	var blnObjectPrm=false;
	var i=0;	
	var strWord='';
	var objThis;
	strWord = objWord;
	while(i<strWord.length && blnIsEmpty) {
		if (strWord.charAt(i)!=' ')
			blnIsEmpty=false;
		i++;
  	}
	if (blnIsEmpty)
	{
		return true;
	}
	else
	{
		return false;
	}
	
}




function textCounter(field, countfield, maxlimit)
{
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	}
	else
	{
       countfield.value = maxlimit - field.value.length;
    }
}




var ajax = null; 

// Create AJAX Object
function createObject()
{
	var ajaxObj;
	if (window.XMLHttpRequest)
	{
		ajaxObj = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		ajaxObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return ajaxObj;	
}


// Pass the url and function name here
function makeRequest(url,functionName)
{
	
	
	
	ajax = createObject();
	ajax.onreadystatechange = eval(functionName);		
	ajax.open("GET", url, true);
	ajax.send(null);	
}



// Specific Functions
function check_email_availability()
{
		
	if (ajax.readyState==4 && ajax.status==200)
	{
		xmlData = ajax.responseText;
		document.getElementById("opt1").innerHTML = xmlData;
		
	}
	else
	{
		
		document.getElementById("opt1").innerHTML = "Processing...";
	}
}


