<!--
var objPrevRow;
var strClassName;

function CallExcelExport() 
{
	var myForm = document.forms[0];
	myForm.oldTarget = myForm.target;
	myForm.target = '_blank';
	setTimeout(ResetTarget, 1000);
}


function ChangeTarget()
{
	var myForm = document.forms[0];
	myForm.oldTarget = myForm.target;
	myForm.target = '_blank';
	setTimeout(ResetTarget, 1000);
}


function ResetTarget() 
{
	var myForm = document.forms[0];
	myForm.target = myForm.oldTarget;
}
			
			

function SelectedRow(objTR)
{
	try
	{
		objPrevRow.className=strClassName;
	}
	catch(e)
	{}
	
	try
	{
		strClassName=objTR.className;
		objTR.className="RowSelected";
		objPrevRow=objTR;
	}
	catch(e)
	{
		objPrevRow=null;
		strClassName=""
	}
	
}

function DisplayRow()
{
	try
	{
		objPrevRow.click();
	}
	catch(e)
	{}
}
function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var w_CrLf = String.fromCharCode(13);
	var w_Lf = String.fromCharCode(10);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{}
		else if(VALUE.charAt(iTemp) == w_CrLf || VALUE.charAt(iTemp) == w_Lf)
		{}
		else
		{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var w_CrLf = String.fromCharCode(13);
	var w_Lf = String.fromCharCode(10);
	if(v_length < 1)
	{
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{}
		else if(VALUE.charAt(iTemp) == w_CrLf || VALUE.charAt(iTemp) == w_Lf)
		{}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function

function isDigit (c)
{  
 return ((c >= "0") && (c <= "9"))
}

function isaNumber(s, StrFld)
{
				
	//Check whether 's' is numeric..
	var m,j,trigger,j,a,x;
	trigger=1;
	m=s.value;
	a=m.length;
	var z;
	for(j=0; j<a; j++)
	{
		var x;
		x=m.charAt(j);
		if(isDigit(x))
			;
		else
		{
			alert( StrFld + "has to be numeric");
			trigger=0;
			break;
		}
		
	}
	if(trigger==0)
		return false;
	else
		return true; 
				
}

// Check whether string s is empty.
function isEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespaces (s)

{   var i;
	var whitespace = " \t\n\r";
    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function isEmail(s)
{   
	//Check whether the email is in valid format..
	
	if (isEmpty(s)) return false;
       
   
    // is s whitespace?
    if (isWhitespaces(s)) return false;
    //Added by Asha on 20 Feb 2007
    //if special characters are present other than '@', '.'and '''in the email id then return false..  'sumit allowing special char '''
     var iChars = "!#$%^&;*()+=[]\\\;,/{}|\":<>?";
     for(i=0;i<s.length;i++)
		{
  			if (iChars.indexOf(s.charAt(i)) != -1) 
  			{
  				return false;
  			}
		}
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var ctr1 = 0;
    var ctr2 = 0;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    
    //Check for multiple '@' and '.'
    for (i=0 ;i<sLength;i++)
				 {
				   if( s.charAt(i) == "@")
				     ctr1 ++;
				   /*if( s.charAt(i) == ".")
				     ctr2 ++;*/ //Commented By Asha
				 }
				 if (ctr1>1) return false;
				 
    else return true;
}

function isValidMultipleEmail(obj) 
{					
	
	var email= obj.value.split(',');
	for (var i = 0; i < email.length; i++) {
		if (!isEmail(email[i],false)) 	
		{
			alert("Please Enter Valid e-mail's seperated by commas")
			obj.focus()
			return false
		}
	}
	return true;
} 

function isDate(dateStr) //Added On 26 Apr 2007..
{

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?

	if (matchArray == null) {
		alert("Please enter date as mm/dd/yyyy format.");
		return false;
	}

	month = matchArray[1]; // parse date into variables
	day = matchArray[3];
	year = matchArray[5];

	if (month < 1 || month > 12) { // check month range
		alert("Month must be between 1 and 12.");
		return false;
	}

	if (day < 1 || day > 31) {
		alert("Day must be between 1 and 31.");
		return false;
	}

	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Month "+month+" doesn't have 31 days!")
		return false;
	}

	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
			alert("February " + year + " doesn't have " + day + " days!");
			return false;
		}
	}
	return true; // date is valid
}

function isCurrency(str){
numdecs = 0; 
for (i = 0; i < str.length; i++) 
{mychar = str.charAt(i); 
if ((mychar >= "0" && mychar <= "9") || mychar == "." ){ 
if (mychar == ".") 
numdecs++; 
} 
else return false; 
} 
if (numdecs > 1){return false;} 
return true; 
}// end isNumber function 

//-->