function movewin(win, width, height) {
		var fullWidth = screen.availWidth;
		var fullHeight = screen.availHeight;
		var x = (fullWidth/2)-(width/2);
		var y = (fullHeight/2)-(height/2);
		win.moveTo(x,y); 
	}
			
function viewWin(filenames,width,Height)
{

	filenames=filenames;
		
	var newwin = window.open(filenames, 'Image', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,maximize=0,width='+width+',height='+Height);
	
	movewin(newwin, width, Height);
	    if (navigator.appName=="Netscape") 
	        newwin.location=url;
		
		newwin.opener=window;
		newwin.focus();
		return false;
}






function validate()
{
	if(frmshow.first_name.value=="")
	{
		alert("Please Enter First Name!");
		frmshow.first_name.focus();
		return false;
	}
	
	if(frmshow.last_name.value=="")
	{
		alert("Please Enter Last Name!");
		frmshow.last_name.focus();
		return false;
	}
	
	if(frmshow.phone_number.value=="")
	{
		alert("Please Enter Phone Number!");
		frmshow.phone_number.focus();
		return false;
	}
	
	if(frmshow.fax_number.value=="")
	{
		alert("Please Enter Fax Number!");
		frmshow.fax_number.focus();
		return false;
	}
	
	if(!validateEmail(frmshow.email.value))
	{
		alert("Please Enter Correct Email!");
		frmshow.email.focus();
		return false;
	}
	
	
}

function validateEmail(email){
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	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 validatelogin()
{
	if(frmshow.username.value=="")
	{
		alert("Username cannot be blank!");
		frmshow.username.focus();
		return false;
	}
	
	if(frmshow.password.value=="")
	{
		alert("Password cannot be blank!");
		frmshow.password.focus();
		return false;
	}
}
