function checkreturn(evt)
{
	if (window.event)
	{
		if (window.event.keyCode == 13)
			return false;
	}
	else
	{
		if (evt.which == 13)
			return false;
	}
	
	return true;
}

function NewWindow(windowname)
{
    if (windowname == 'help')
	    window.open ('../Public/pgHelp.aspx', 'helpwindow', config='height=600, width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')

    if (windowname == 'aboutfara')
        window.open ('http://www.curefa.org/about.html', 'aboutfarawindow')

}

function PrintPage()
{
	window.open ('../Grant/pgPrintGrant.aspx', 'PrintGrant')
}

function ChangeStyle()
{
    if (this.className == this.getAttribute("classOut"))
        this.className = this.getAttribute("classOver");
    else
        this.className = this.getAttribute("classOut");
}

function ChangeMenuItem(oMenu)
{
    if (oMenu.className == oMenu.getAttribute("classOut"))
        oMenu.className = oMenu.getAttribute("classOver");
    else
        oMenu.className = oMenu.getAttribute("classOut");
}

function PhoneNumber(sender, args)
{
    var bOk = true;
    var objRegExp = /^(\d{3}-\d{3}-\d{4}( x\d+)*)$/;  /*us phone*/ 
    var sCountry = document.forms[0].txtCountry.value.toLowerCase();
    
    sCountry = sCountry.replace(/\./g,'');
   
    switch (true)
    {
        case (sCountry == 'us' && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
        case (sCountry == 'usa' && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
        case (sCountry.indexOf('united states') > -1 && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
    }
    
    args.IsValid = bOk;
}

function ZipCode(sender, args)
{
    var bOk = true;
    var objRegExp = /^((\d{5}-\d{4})|(\d{5}))$/; /*us zip*/
    var sCountry = document.forms[0].txtCountry.value.toLowerCase();
    
    sCountry = sCountry.replace(/\./g,'');
    
    switch (true)
    {
        case (sCountry == 'us' && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
        case (sCountry == 'usa' && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
        case (sCountry.indexOf('united states') > -1 && !(objRegExp.test(args.Value))):
			bOk = false;
            break;
    }
    
    args.IsValid = bOk;
}

function Country()
{
    var sCountry = document.forms[0].txtCountry.value.toLowerCase();
    
    sCountry = sCountry.replace(/\./g,'');
    
    switch (true)
    {
        case (sCountry == 'us' || sCountry == 'usa' || sCountry.indexOf('united states') > -1):
			document.getElementById('lblPhoneFormat').innerHTML  = "(###-###-#### x##.. [ext. optional])";
			document.getElementById('lblZipFormat').innerHTML  = "(#####-#### [zip +4 optional])";
            break;
        default:
			document.getElementById('lblPhoneFormat').innerHTML  = "";
			document.getElementById('lblZipFormat').innerHTML  = "";
            break;
    }
}