// JavaScript Document
browtype=document.all ? true:false;
var ie=document.all?true:false;
 if (navigator.appName == 'Netscape') 
 {
	   window.captureEvents(Event.KEYPRESS);
       window.onKeyPress = checkkey;
 }
// index.jsp
function indexpageload()
{	
	if( (screen.width <= 800) && (screen.height <=600))
	{
		alert("Please Change the Screen Size to 1024 * 768 pixels");
	}
	document.frmdetails.supplierid.focus();
}

function indexvalidate()
{
	var supplierid = document.frmdetails.supplierid.value;
	var usercode = document.frmdetails.personid.value;
	var password = document.frmdetails.password.value;
	var illegalChars = /\W/;

        if(supplierid=="")
	{
		alert("You didn't enter a supplier code");
		document.frmdetails.supplierid.focus();
		return false;
	}
	if (illegalChars.test(supplierid)) 
	{ 
		alert("The supplier code contains illegal characters");
		document.frmdetails.supplierid.select();
		return false;
	}

        if(usercode=="")
	{
		alert("You didn't enter a person code");
		document.frmdetails.personid.focus();
		return false;
	}
	if (illegalChars.test(usercode)) 
	{ 
                alert("The person code contains illegal characters");
                document.frmdetails.personid.select();
                return false;
	}

        if(password=="")
	{
		alert("You didn't enter a password");
		document.frmdetails.password.focus();
		return false;
	}
	/*if (illegalChars.test(password)) 
	{
                alert("The Password contains illegal characters");
                document.frmdetails.password.select();
                return false;
	}*/
}


// SelectSupplier.jsp
function enablesuppcd()
{
    document.frmDetails.suppcd.disabled=false;
    document.frmDetails.suppcd.focus();
}
function clearsuppcd()
{
    document.frmDetails.suppcd.value="";
    document.frmDetails.suppcd.disabled=true;
}

function Validate()
{
    if (document.frmDetails.selectoption[0].checked == true)
    {
            if(document.frmDetails.suppcd.value=="")
            {
                    alert("Enter a supplier code");
                    return false;
            }
            else
            {
                    document.frmDetails.action="SelectSupplierDetails.jsp";
                    document.frmDetails.submit();
                    return true;
            }
    }
    else if (document.frmDetails.selectoption[1].checked == true)
    {
                    document.frmDetails.suppcd.value="";
                    document.frmDetails.action="MessageToSuppliers.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[2].checked == true)
    {
                    document.frmDetails.suppcd.value="";
                    document.frmDetails.action="VendorFeedBacks.jsp?flag=0";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[3].checked == true)
    {
                    document.frmDetails.suppcd.value="";
                    document.frmDetails.action="ALContactDetails.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[4].checked == true)
    {
                    document.frmDetails.suppcd.value="";
                    document.frmDetails.action="GetPassword.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[5].checked == true)
    {
                    document.frmDetails.suppcd.value="";
                    document.frmDetails.action="NewSupplier.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[6].checked == true)
    {
                    document.frmDetails.action="Supplier.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[7].checked == true)
    {
                    document.frmDetails.action="Employee.jsp";
                    document.frmDetails.submit();
                    return true;
    }
    else if (document.frmDetails.selectoption[8].checked == true)
    {
                    document.frmDetails.action="TableDetails.jsp";
                    document.frmDetails.submit();
                    return true;
    }
}

