function Jump2Window()
{
	alert("Here");
	location.href = "./default.asp";
}

function ClearFilter()
{
	var argv = ClearFilter.arguments;
	var argc = argv.length;
	
	if ( argc > 0 )
		var URL =  argv[0] + "?Filter=NO" ;
	else
		var URL = "./search.asp?Filter=NO";
		
	location.href = URL;
}


function CheckAmount(ctl1,msg,formsubmit)
{

	
		if ( isNaN( parseFloat( ctl1.value ) ) ) {
		alert(msg);
		return 1;
		}
		else{
		
			ctl1.value = parseFloat( ctl1.value);
			if ( formsubmit == 1)
			document.all.form1.submit();
			
			return 0;
			}

}


function LTrim(str)
        /***
                PURPOSE: Remove leading blanks from our string.
                IN: str - the string we want to LTrim

                RETVAL: An LTrimmed string!
        ***/
        {
                var whitespace = new String(" \t\n\r");

                var s = new String(str);

                if (whitespace.indexOf(s.charAt(0)) != -1) {
                    // We have a string with leading blank(s)...

                    var j=0, i = s.length;

                    // Iterate from the far left of string until we
                    // don't have any more whitespace...
                    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                        j++;


                    // Get the substring from the first non-whitespace
                    // character to the end of the string...
                    s = s.substring(j, i);
                }

                return s;
        }


function RTrim(str)
        /***
                PURPOSE: Remove trailing blanks from our string.
                IN: str - the string we want to RTrim

                RETVAL: An RTrimmed string!
        ***/
        {
                // We don't want to trip JUST spaces, but also tabs,
                // line feeds, etc.  Add anything else you want to
                // "trim" here in Whitespace
                var whitespace = new String(" \t\n\r");

                var s = new String(str);

                if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
                    // We have a string with trailing blank(s)...

                    var i = s.length - 1;       // Get length of string

                    // Iterate from the far right of string until we
                    // don't have any more whitespace...
                    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                        i--;


                    // Get the substring from the front of the string to
                    // where the last non-whitespace character is...
                    s = s.substring(0, i+1);
                }

                return s;
        }



function Trim(str)

        {
                return RTrim(LTrim(str));
        }


function loadDetail(URL)
{

document.form1.action = URL  +  "&Change=Source";
document.form1.submit();

}

function validateUser(blnval)
{
if  ( Trim(document.form1.fname.value) == "" )
	{

		alert("First Name cannot be blank");
		return;

	}
if ( Trim(document.form1.lname.value) == ""  )
{

		alert("Last Name cannot be blank");
		return;

	}
if ( !blnval ) {
	if ( Trim(document.form1.UserName.value) == "" ) {
	alert("User Name cannot be blank");
	return;
	}
}
else {

	if ( document.form1.AccessM.checked ) {
		if ( Trim(document.form1.UserName.value) == "" ) {
			alert("User Name cannot be blank");
			return;
		}
	}

}
document.form1.submit();

}

function validateGroup()
{

if ( Trim(document.form1.CatName.value) == "" )
	{
		alert( "Name cannot be blank");
		return;
	}

document.form1.submit();	
}

function validateOther(val)
{

if ( val == "Status" ) 
	{
		if ( Trim(document.form1.Status.value) == "" )
			{
				alert("Please enter a valid status text");
				return;
			}
	}


if ( val == "Market")
	{
	if ( Trim(document.form1.CName.value) == "" )
			{
				alert("Please enter a valid campaign name");
				return;
			}
	
	
	}
	
if ( val == "Priority")
	{
	if ( Trim(document.form1.Priority.value) == "" )
			{
				alert("Please enter a valid Priority text");
				return;
			}
	
	
	}
	
document.form1.submit();	
}


function validateSD()
{

if ( Trim(document.form1.Source.value) == "" )
	{
		alert("Please enter a valid Source text");
		return;
	}
	
if ( Trim(document.form1.Detail.value) == "" )
	{
		alert("Please enter a valid Detail text");
		return;
	}

document.form1.submit();

}



function validateProgram()
{

if ( Trim(document.form1.market_program.value) == "" )
{
	alert( "Please enter a valid program text");
	return;

}

if ( Trim(document.form1.from_name.value) == "" ) 
{
	alert("Please enter a valid from name");
	return;
}

document.form1.submit();


}


function validateProject()
{


if ( Trim(document.form1.project_name.value) == "" )
	{
		alert("Enter a valid project name");
		return;
	}
	

if (isNaN(document.form1.revenue.value) )
{
		alert( "Enter a number for revenue");
		return;
}
else {
	if ( parseInt(document.form1.revenue.value,10) < 0 ) {
			alert("Enter a positive revenue number");
			return;
	}

}

document.form1.submit();
}