// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0

	// create first array to hold values of 'features' array
	var temp = new Array(); 
	
	// split 'features' array at the ',' comma to reveal name value pairs (name = value)
	temp = features.split(','); 
	
	// create second array to hold name/value pairs
	var multi = new Array(); 

		// Loop through first array and split the name value pairs at the '=' sign
		for (i=0;i<temp.length;i++) {				
			multi[i] = temp[i].split('=');
			
				// if name = width, assign value to width variable
				if (multi[i][0] == "width") {
					var width = multi[i][1];
				}
					// if name = height, assign value to height variable
					if (multi[i][0] == "height") {
						var height = multi[i][1];
					}

		}
		
	// create left position and top position variables, append to 'features' argument
	// and return new window now positioned in middle of screen
	leftpos = (screen.width - width) / 2;
	toppos = (screen.height - height) / 2;
	newfeatures = features + ",left="+leftpos+",top="+toppos+"";
	
	NewWindow = window.open(theURL,winName,newfeatures);
	NewWindow.focus();
}

function deletewin(id,type) 
    {	
		var truthBeTold = window.confirm("Are you sure you want to delete this entry ?")
		if(truthBeTold)
		{	
			window.location = "user_display.asp?descid="+id+"&action="+type;
		} 
		return false;
	}
function updatewin(id)
	{
	    //mindhive
		MM_openBrWindow("userdescadd.asp?action=update&id="+id,"Vendor_window","resizable=no,scrollbars=no,status=yes,width=500,height=390,menubar=0,toolbar=0, left = 0 , top = 0");
		return false;
	}
	
	
	
function newuserwin()
	{
		MM_openBrWindow("useradd.asp?action=New","Admin_window","resizable=no,scrollbars=no,status=yes,width=490,height=450,menubar=0,toolbar=0");
		return false;
	}
function newlistingwin()
	{
		MM_openBrWindow("userdescadd.asp?Action=New","Admin_window","resizable=no,scrollbars=no,status=yes,width=500,height=390,menubar=0,toolbar=0");
		return false;
	}

function forpasswin()
	{
		var val 
		val = document.frmUserLogin.txtUserName.value;
		if (val) {
		MM_openBrWindow("forpass.asp?uid="+val,"Admin_window","resizable=no,scrollbars=no,status=yes,width=375,height=230,menubar=0,toolbar=0");
		
		}
		else alert('Please first enter your email address in the Members Login area, then click the Forgot Password link');
	}
function changepasswin()
	{
		
		MM_openBrWindow("changepass.asp","Admin_window","resizable=no,scrollbars=no,status=yes,width=390,height=175,menubar=0,toolbar=0");
		return false;
	}
function gowin()
	{
		window.location = "user_display.asp";
		return false;
	
	}
	
function submit_onclick()
	{
		if(frmUserLogin.txtUserName.value == "")
		{
			alert("Enter the EMail Address !");
			frmUserLogin.txtUserName.focus();
			return (false);
		} 
		if (frmUserLogin.txtUserName.value.length < 7 || frmUserLogin.txtUserName.value.indexOf("@")==-1 || frmUserLogin.txtUserName.value.indexOf(".")==-1 || frmUserLogin.txtUserName.value.indexOf("!")!=-1)
		{
			frmUserLogin.txtUserName.value="";
			frmUserLogin.txtUserName.focus();
			alert("You did not provide a valid Email address.");
			return false;
	   	}
		if(frmUserLogin.txtPassword.value == "")
		{
			alert("Enter the Password  !");
			frmUserLogin.txtPassword.focus();
			return (false);
		} 	
		return true;
	}
	

