/* TO CHECK THE USERS EMAIL, ALPHABETS, NAME, PASSWORD, REMOVE SPACES FORM THE NAME THROUGH TRIM() ETC..*/
function trim (strVar) {
	if(strVar.length >0)
	{
		while(strVar.charAt(0)==" ")						//REMOVE LEFT SPACES
			strVar=strVar.substring(1,strVar.length);
		while(strVar.charAt(strVar.length-1)==" ")			//REMOVE RIGHT SPACES
			strVar=strVar.substring(0,strVar.length-1);
	}
	return strVar;
}


var pop='';
function openwin(nm,width,height) {
	var name = nm;
	if (pop && !pop.closed) {
		pop.close();
	}

	pop = eval("window.open('"+name+"','NewWIN','chrome[4],toolbar=no,left=5,top=5,width="+width+",height="+height+",directories=no,menubar=no,SCROLLBARS=yes,left=2,right=2')");
	if (!pop.opener) popUpWin.opener = self;
}

function closewin()
{
	window.close();
}
/*FUNCTION FOR ERROR REPORTING*/
function checkRptForm(theForm)
{
	var issue = trim(theForm.issue.value);
	var name = trim(theForm.name.value);
	var email = trim(theForm.email.value);
	var detail = trim(theForm.detail.value);
	var req_imageCode = trim(theForm.req_imageCode.value);

	if(issue.length==0)
	{
		alert("Please select issue!");
		theForm.issue.focus();
		return false;
	}
	if(name.length==0)
	{
		alert("Please enter name!");
		theForm.name.focus();
		return false;
	}
	if(email.length==0)
	{
		alert("Please enter email!");
		theForm.email.focus();
		return false;
	}
	if(checkEmail(email) == false)
	{
		alert("Invalid e-mail address! Please re-enter.");
		theForm.email.select();
		return false;		  
	}
	if(detail.length==0)
	{
		alert("Please enter detail!");
		theForm.detail.focus();
		return false;
	}
	if(req_imageCode.length==0)
	{
		alert("Please enter image code!");
		theForm.req_imageCode.focus();
		return false;
	}
	return true;
}


function checkEmail(email) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{
		return (true);
	}
	return false;
}
