function isEmail(string) {
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}

function isDate(field_name,langf)
{
	var dod = document.getElementById(field_name).value;
	if (dod.length == 0){
		alert("Enter Date");
		document.getElementById(field_name).focus();
		return false;
	}
	var da = dod.split("-");
	if (da.length != 3){
		alert("Date must be in correct Format");
		document.getElementById(field_name).focus();
		return false;
	}
	var dteDate;
	if(langf == "E"){
		da[0] = da[0] -1;
		dteDate=new Date(da[2],da[0],da[1]);
		if (((da[1]==dteDate.getDate()) && (da[0]==dteDate.getMonth()) && (da[2]==dteDate.getFullYear())) == false){
			alert("Date must be in correct Format");
			document.getElementById(field_name).focus();
			return false;
		}
	}
	else{
		da[1] = da[1]-1;
		dteDate=new Date(da[2],da[1],da[0]);
		if (((da[0]==dteDate.getDate()) && (da[1]==dteDate.getMonth()) && (da[2]==dteDate.getFullYear())) == false){
			alert("Date must be in correct Format");
			document.getElementById(field_name).focus();
			return false;
		}
	}
	return true;
}


function validatelength(ta_name,a)
{
	var p;
	p = ta_name.value;

	
	if(window.event.keyCode == 34 || window.event.keyCode == 39 )
	{
		window.event.keyCode=null;
		return;
		//alert("Please Enter Numeric Values Only");
	}
	
	if ((a==1) && (p.length >= 255))
	{
		alert("Max. Charatcters Limit 255 Exceeds");
		window.event.keyCode=null;
	}
	if ((a==2) && (p.length > 255))
	{
		alert("Max. Charatcters Limit 255 Exceeds");
		ta_name.value = p.substring(0,255);
	}
}


function checkFile(fname,extension)
{
		  
	var ext = document.getElementById(fname).value;
	if (ext == "")
	{	
		alert("Select a File in (." + extension + ") Format");
		document.getElementById(fname).focus();
		return false;
	}
	ext = ext.substring(ext.length-3,ext.length);
	ext = ext.toLowerCase();
	
	if (extension.search(ext) == -1)
	{
		alert("You selected a ." + ext + " file; please select a " + extension + " file instead!");
		document.getElementById(fname).focus();
		return false;
	}
	return true;
}

function isLicense(lics)
{
	var licv;
	var lice = lics+3;
	for(i=lics; i<=lice; i++){
		licv = document.getElementById("lic" + i).value;
		switch(i){
			case lics:
				if (licv.length != 3) return false;
				break;
			case (lics+1):
				if (licv.length != 2) return false;
				break;
			case (lics+2):
				if (licv.length != 3) return false;
				break;
			case (lics+3):
				if (licv.length != 1) return false;
				break;
		}
		if (isInteger(licv) == false) return false;
	}
	return true;
}


function checkField(field_name,err_msg)
{
	if (document.getElementById(field_name).value == "")
	{
		alert(err_msg);
		document.getElementById(field_name).focus();
		return false;
	}
	return true;
}

function checkFieldLength(field_name,minLength,err_msg)
{
	if (document.getElementById(field_name).value.length < minLength)
	{
		alert(err_msg);
		document.getElementById(field_name).focus();
		return false;
	}
	return true;
}


var leftPos = 0;
var topPos = 0;


function adjustTopLeft(w,h) {
leftPos = 0
topPos = 0
if (screen) {
leftPos = (screen.width / 2) - w/2;
topPos = (screen.height / 2) - h/2;
}
}



function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}



function refreshSource()
{
	window.opener.location.reload();
	window.close();
}

function check()
{
}