	function exportToExcel( tableID ){
		if( tableID ){
			wind = window.open( "", "", "width=100,height=100" );
			wind.resizeTo(0, 0);
			wind.moveTo(-100, -100);
			wind.document.write( "<TABLE BORDER='1'>" );
			for( i=1; i<tableID.rows.length; i++ ){
				wind.document.write( tableID.rows[i].outerHTML );
			}
			wind.document.write( "</TABLE>" );
			wind.document.execCommand('SaveAs', true, 'ing_export.xls');
			wind.close();
		}
	}

	// This function is made to check all the checkboxes that are with the same name
	// The argument obj is the checkbox on which the user clicks
	// and the argument chkboxName is the checkboxName of the same named checkboxes.
	function selectAll( obj, chkboxName ){
		for(i=0; i<chkboxName.length; i++){
			obj.form[chkboxName][i].checked = obj.checked;
		}
	}

	// imgCachedSources is an Array that caches images e.g. imgCachedSources[n] = new Image()...
	imgCachedSources = new Array();

	// imgSources is an Array of image sources e.g. ("images/img1.gif", "images/img2.gif")
	function cacheImages(imgSources){
		for(index=0; index<imgSources.length; index++){
			imgCachedSources[index] = new Image();
			imgCachedSources[index].src = imgSources[index];
		}
	}

	imgCachedNavigationSources = new Array();

	// Image name will be like img1.gif and img1over.gif
	function cacheNavigationImages(imgSources){
		indexJ = 0;
		for(index=0; index<imgSources.length; index++){
			imgCachedNavigationSources[indexJ] = new Image();
			imgCachedNavigationSources[indexJ++].src = imgSources[index] +".gif";
			imgCachedNavigationSources[indexJ] = new Image();
			imgCachedNavigationSources[indexJ++].src = imgSources[index] +"over.gif";
		}
	}

	// The following function takes a number of arguments in the following manner:
	// ('Img1', "../images/a1.gif", "Img2", "../images/a2.gif" ....)
	// i.e., a series of imageName and imageSource.
	function changeImages(){
		for(index=0; index<arguments.length; index+=2){
			document.images[arguments[index]].src = arguments[index+1];
		}
	}

// CHANGE HISTORY

// Please left one blank CHANGE HISTORY block for copy paste purpose

//========================================================================
// Description:   Functions to Check Entries
// Author:        Ritesh Mehrotra
// Date:          
//========================================================================

function CheckAlpha(obj)
{
	if ((event.keyCode >= 65 && event.keyCode <= 90) ||
		(event.keyCode >= 97 && event.keyCode <= 122) ||
		(event.keyCode == 32 || event.keyCode == 44))
		event.returnValue = true;
	else
		event.returnValue = false;

}

function CheckPhone(obj)
{	 	
	if ((event.keyCode >= 65 && event.keyCode <= 90) ||
		(event.keyCode >= 97 && event.keyCode <= 122) ||
		(event.keyCode > 45 && event.keyCode < 57) ||
		(event.keyCode == 32 || event.keyCode == 44))
		event.returnValue = true;
	else
		event.returnValue = false;

}

function CheckNumber(obj) //number from 0-9 with decimal '.' and '/'
{
//	var Exp = /[0123456789\.\-]/;
//	var strPass = document.all(obj).value;
//	var strLength = strPass.length;
//	var lchar = document.all(obj).value.charAt((strLength) - 1);
//	if (lchar.search(Exp) == -1) 
//	{
//		var tst = document.all(obj).value.substring(0, (strLength) - 1);
//		document.all(obj).value = tst;
//    }
	
	if (event.keyCode < 45 || event.keyCode > 57) 
		event.returnValue = false;
}

function CheckNum(obj) //number from 0-9 with decimal '.'
{
   //alert(event.keyCode);
	
	if (event.keyCode > 45 && event.keyCode < 58 && event.keyCode!=47) 
		event.returnValue = true;
		else
		event.returnValue = false;
}

//By prajnyan
function isNumberKey(evt)//only number from 0-9
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
} 

function CheckDate(obj,MinValue,MaxValue,Format)
{
		
	if(document.all(obj).value != "")
	{
		if (Date.parse(document.all(obj).value) < 0)
		{
			alert("Invalid Date.");
			document.all(obj).focus();
			return false;
		}
		else
		{
			var day;
			var dt = document.all(obj).value;
			var mon = (isNaN(parseInt(dt.substr(0,2),10)) ? -1 : parseInt(dt.substr(0,2),10) - 1) ;
			if(parseInt(mon)>9)
				day = (isNaN(parseInt(dt.substr(3,2),10)) ? -1 : parseInt(dt.substr(3,2),10));
			else
				day = (isNaN(parseInt(dt.substr(2,2),10)) ? -1 : parseInt(dt.substr(2,2),10));
				
			var yr = (isNaN(parseInt(dt.substr(6),10)) ? -1 : parseInt(dt.substr(6),10));
			
			//alert(mon)
			if (day > 31 ||mon > 11 || yr < 0)
			{			
			alert("Invalid Date.");
			document.all(obj).value = "";
			return false;
			}
			var curDate = new Date(yr,mon,day);
			if(!isNaN(curDate))
			{
				var curDate = new Date(yr,mon,day);
				if (MinValue != "" && MaxValue != "")	
				{
					if (Date.parse(document.all(obj).value) >= Date.parse(MinValue) && Date.parse(document.all(obj).value) <= Date.parse(MaxValue))
					{
						return true;
					}
					else
					{
						alert("Date must be in '" + MinValue + "' and '" + MaxValue + "'."); 
						document.all(obj).value = "";
						document.all(obj).focus();
						return false;
					}
				}
				
			}
		}
	}
	else
		return true;

}
//*************By Somya***************************
function CheckDate1(obj,MinValue,MaxValue,Format,test)
{
		
	if(document.all(obj).value != "")
	{
	
		if (Date.parse(document.all(obj).value) < 0)
		{
			alert("Invalid Date.");
			document.all(obj).focus();
			return false;
		}
		else
		{
			var day;
			var dt = document.all(obj).value;
			var mon = (isNaN(parseInt(dt.substr(0,2),10)) ? -1 : parseInt(dt.substr(0,2),10) - 1) ;
			if(parseInt(mon)>9)
				day = (isNaN(parseInt(dt.substr(3,2),10)) ? -1 : parseInt(dt.substr(3,2),10));
			else
				day = (isNaN(parseInt(dt.substr(2,2),10)) ? -1 : parseInt(dt.substr(2,2),10));
				
			var yr = (isNaN(parseInt(dt.substr(6),10)) ? -1 : parseInt(dt.substr(6),10));
			
			//alert(mon)
			if (day > 31 ||mon > 11 || yr < 0)
			{			
			alert("Invalid Date.");
			document.all(obj).value = "";
			return false;
			}
			var curDate = new Date(yr,mon,day);
			if(!isNaN(curDate))
			{
				var curDate = new Date(yr,mon,day);
				if (MinValue != "" && MaxValue != "")	
				{
					if (Date.parse(document.all(obj).value) >= Date.parse(MinValue) && Date.parse(document.all(obj).value) <= Date.parse(MaxValue))
					{
						return true;
					}
					else
					{
						alert("Date must be in '" + MinValue + "' and '" + MaxValue + "'."); 
						document.all(obj).value = "";
						document.all(obj).focus();
						return false;
					}
				}
				
			}
			if(test!="")
			{
			var curDate = new Date(); // Current date
			var myDate = new Date;
			var dt = document.all(obj).value;
			var day;
			var mon = (isNaN(parseInt(dt.substr(0,2),10)) ? -1 : parseInt(dt.substr(0,2),10) - 1) ;
			if(parseInt(mon)>9)
				day = (isNaN(parseInt(dt.substr(3,2),10)) ? -1 : parseInt(dt.substr(3,2),10));
			else
				day = (isNaN(parseInt(dt.substr(2,2),10)) ? -1 : parseInt(dt.substr(2,2),10));
				
			var yr = (isNaN(parseInt(dt.substr(6),10)) ? -1 : parseInt(dt.substr(6),10));
			
			myDate.setDate(day);
			myDate.setMonth(mon); 
			myDate.setFullYear(yr); 
			if(myDate >= curDate)
			{
				alert("Birth Date should be less than current date.");
				document.all(obj).value = "";
				document.all(obj).focus();
				return false;
			}
			}
		}
	}
	else
		return true;

}

function y2k(number) 
{ 
	return (number < 1000) ? number + 1900 : number; 
}

function isDate (day,month,year) {
// checks if date passed is valid
// will accept dates in following format:
// isDate(dd,mm,ccyy), or
// isDate(dd,mm) - which defaults to the current year, or
// isDate(dd) - which defaults to the current month and year.
// Note, if passed the month must be between 1 and 12, and the
// year in ccyy format.

alert(day);

    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) )
        return true;
    else
        return false
}




//**************************************************************************************
//        Name: formatDate
//              
// Description: Formats a date using a format string. 
//              d or dd represents the day of the month (eg 1 or 01)
//              m or mm represents the month as a number (eg 1 or 01)
//              mmm or mmmm represents the month as a string (eg Jan or January)
//              y or yy represents the year (eg 99 or 1999)
//              w or ww represents the day of the week (eg Mon or Monday)
//              example: formatDate(myDate, "mm/dd/yy") might look like 01/01/2000
//  Parameters: strFullDate - required - the date to display (a date object)
//          strFormatString - required - a format string
//              
//**************************************************************************************
//var myDate = new Date();
//alert(formatDate(myDate, "ww, mmmm, d, yy"));

function formatDate(strFullDate, strFormatString) {

 var strMonths = new Array();
 var strDay = new Array();

 strMonths[0]  = "January";
 strMonths[1]  = "February";
 strMonths[2]  = "March";
 strMonths[3]  = "April";
 strMonths[4]  = "May";
 strMonths[5]  = "June";
 strMonths[6]  = "July";
 strMonths[7]  = "August";
 strMonths[8]  = "September";
 strMonths[9]  = "October";
 strMonths[10] = "November";
 strMonths[11] = "December";

 strDay[0]  = "Sunday";
 strDay[1]  = "Monday";
 strDay[2]  = "Tuesday";
 strDay[3]  = "Wednesday";
 strDay[4]  = "Thursday";
 strDay[5]  = "Friday";
 strDay[6]  = "Saturday";

 var strValue_d    = strFullDate.getDate();
 
 var strValue_dd   = (strValue_d < 10) ? '0' + strValue_d : strValue_d;
 var strValue_m    = strFullDate.getMonth() + 1;
 var strValue_mm   = (strValue_m < 10) ? '0' + strValue_m : strValue_m;
 var strValue_mmmm = strMonths[strFullDate.getMonth()];
 var strValue_mmm  = strValue_mmmm.substr(0,3);
 var strValue_yy   = strFullDate.getYear() + "";
 alert(strFullDate);
 var strValue_y    = strValue_yy.substr(2,2);
 var strValue_ww   = strDay[strFullDate.getDay()];
 var strValue_w    = strValue_ww.substr(0,3);

 if (strFormatString.indexOf("dd") > -1) {
  strFormatString = strFormatString.replace("dd", "strValue_dd");
 }
 else {
  if (strFormatString.indexOf("d") > -1) {
   strFormatString = strFormatString.replace("d", "strValue_d");
  }
 }

 if (strFormatString.indexOf("mmmm") > -1) {
  strFormatString = strFormatString.replace("mmmm", "strValue_mmmm");
 }
 else {
  if (strFormatString.indexOf("mmm") > -1) {
   strFormatString = strFormatString.replace("mmm", "strValue_mmm");
  }
  else {
   if (strFormatString.indexOf("mm") > -1) {
    strFormatString = strFormatString.replace("mm", "strValue_mm");
   }
   else {
    if (strFormatString.indexOf("m") > -1) {
     strFormatString = strFormatString.replace("m", "strValue_m");
    }
   }
  }
 }

 if (strFormatString.indexOf("yy") > -1) {
  strFormatString = strFormatString.replace("yy", "strValue_yy");
 }
 else {
  if (strFormatString.indexOf("y") > -1) {
   strFormatString = strFormatString.replace("y", "strValue_y");
  }
 }

 if (strFormatString.indexOf("ww") > -1) {
  strFormatString = strFormatString.replace("ww", "strValue_ww");
 }
 else {
  if (strFormatString.indexOf("w") > -1) {
   strFormatString = strFormatString.replace("w", "strValue_w");
  }
 }

 strFormatString = strFormatString.replace("strValue_dd", strValue_dd);
 strFormatString = strFormatString.replace("strValue_d", strValue_d);
 strFormatString = strFormatString.replace("strValue_mmmm", strValue_mmmm);
 strFormatString = strFormatString.replace("strValue_mmm", strValue_mmm);
 strFormatString = strFormatString.replace("strValue_mm", strValue_mm);
 strFormatString = strFormatString.replace("strValue_m", strValue_m);
 strFormatString = strFormatString.replace("strValue_yy", strValue_yy);
 strFormatString = strFormatString.replace("strValue_y", strValue_y);
 strFormatString = strFormatString.replace("strValue_ww", strValue_ww);
 strFormatString = strFormatString.replace("strValue_w", strValue_w);

 return strFormatString;
}


function ConfirmDeletion()
		{		
			return confirm('WARNING!! This will delete this record and all related records permanently. Are you sure you want to continue?');
		}
function ConfirmCopy()
		{
			//return confirm('WARNING!! This will delete this record and all related records permanently. Are you sure you want to continue?');
			return confirm('WARNING!! Are you sure you want to create copy of this Class?');
		}
function ConfirmPassword()
		{		
			return confirm('WARNING!! This will regenrate your password. Do you wish to continue?');
		}
function ConfirmCancellation(obj)
		{
			var Amount = document.getElementById(obj).value;
			//alert(Amount);				
			return confirm('WARNING!! This will cancel the registration.Cancellation Charge is ' + Amount + '$. Do you wish to continue?');
		}
function CancelRegistration()
{		
	return confirm('WARNING!! This will cancel the selected registration(s). Do you wish to continue?');
}
		
//****************************************Ritesh Ends*************************************************************

	function getParameter(parameter){
		href = location.href;
		index = href.indexOf("?");
		if(index == -1)
			return "";

		paramValue = href.substring( href.indexOf(parameter, (index+1)) );
		index = paramValue.indexOf(parameter);
		if(index == -1)
			return "";

		paramValue = paramValue.substring( ( index+(parameter.length+1) ) );
		index = paramValue.indexOf("&");
		paramValue = paramValue.substring(0, (index == -1 ? paramValue.length : index) );
		return paramValue;
	}

	function changeImagesFrame(frameObj){
		if( frameObj && arguments.length > 1 ){
			frameObj.document.images[arguments[1]].src = arguments[2];
			for(index=3; index<arguments.length; index+=2){
				document.images[arguments[index]].src = arguments[index+1];
			}
		}
	}

function popUpWindow(url, width, height, x, y){
	var wind;
	if(width=="" || height=="")
	{
	   width =700;
	   height = 400;
	   wind = window.open(url, "_blank", "width=" +width+ ",height=" +height+ ",scrollbars=yes");
	}
	else
	{
		wind = window.open(url, "_blank", "width=" +width+ ",height=" +height+ ",scrollbars=yes");
	}
	if(x != null && y != null){
		//wind.moveTo(x, y);
	}else{
		x = (screen.width/2)  - (width/2);
		y = (screen.height/2) - (height/2);
		//wind.moveTo(x, y);
		//alert( width + ", " +height+ "\n" +screen.width+ "x" +screen.height +"\nx: "+ x +", y: "+ y);
	}
	return false;
}

function generateOptions(selectName, arr){
	document.writeln("<select name=\"" +selectName+ "\"> ");
	for(i=0; i<arr.length; i++){
		document.writeln("<option value=\"" +arr[i]+ "\"> " +arr[i]+ " </option>");
	}
	document.writeln("</select>");
}

function selectOption(selectObject, valueToSelect){
	valueToSelect = valueToSelect.toLowerCase();
	for(i=0; i<selectObject.options.length; i++){
		if(selectObject.options[i].value.toLowerCase() == valueToSelect){
			selectObject.options.selectedIndex = i;
			break;
		}
	}
}

function validateEquality(FirstFieldValue, SecondFieldValue){
	if(FirstFieldValue != SecondFieldValue){
		return false;
	}
	return true;
}

// Function validateRequired() takes variable # of arguments with first argument
// being the form name and rest of the arguments as required fields.
// Note: Original objects have to be passed, not values.
function validateRequired(){
	var formName = "";
	if(arguments.length > 1){
		formName = arguments[0];
		for(i=1; i<arguments.length; i++){
			if(trimSpaces(arguments[i].value).length == 0){
				alert(convertVariable(arguments[i].name) +" is a required field.");
				arguments[i].select();
				return false;
			}
		}
	}
	return true;
}

// Function trimspaces()
function trimSpaces(str){
	var rtn = "";
	var len = str.length;
	var i = 0;
	var startLoc = 0;
	var endLoc = 0;
	var started = false;

	for (i=0; (i < len) && (!started) ; i++){
		if (str.charAt(i) != ' '){
			started = true;
			startLoc = i;
		}
	}

	if (!started) return rtn;

	started = false;
	for (i=len-1; (i > -1) && (!started) ; i--){
		if (str.charAt(i) != ' '){
			started = true;
			endLoc = i + 1;
		}
	}

	for (i=startLoc ; i<endLoc; i++){
		rtn = rtn+str.charAt(i);
	}
	return rtn;
}

// Function convertVariable()
// This function changes the text of a variable name such as "retypePassword" to 
// "Retype Password" So that alert messages come comprehensible.
function convertVariable(varName){
	varNewName = "";
	for(j=0; j<varName.length; j++){
		ch = varName.charAt(j);
		if(ch >= 'A' && ch <= 'Z')
			varNewName += " " +ch;
		else
			varNewName += ch;
	}
	varName = varNewName;
	varNewName = varName.charAt(0).toUpperCase();
	varNewName += varName.substring(1);
	return varNewName;
}

function parseDT(dateString){ // Date should be in MM/DD/YYYY format
	dt1 = new Date( dateString );
	arr_Month = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	return arr_Month[dt1.getDay()];
}

// Function validateDouble(value, dataType)
// e.g. validateDouble(25.99, "dec");
// e.g. validateDouble(25,    "int");
// e.g. validateDouble(-57,   "int");
function validateDouble(value, dataType){
	dataType = dataType.toLowerCase();

	for(i=0; i<value.length; i++){
		val = value.charAt(i);
		if(!(val >= 0 && val <= 9)){ // If not in between 0-9
			if(dataType == "dec" && val != "."){
				if(i == 0 && val == '-')
					continue;
					
				return false;
			}

			if(dataType == "int"){
				if(i == 0 && val == '-')
					continue;
					
				return false;
			}
		}
	}
	return true;
}

// Function validateEmail( "emailId@email.com" ) for email validation
function validateEmail(email){
	invalidChars = " /:,;"
	if(email == ""){                 //email cannot be empty
		return false;
	}

	for(i=0; i<invalidChars.length; i++){ //check for invalid characters
		badChar = invalidChars.charAt(i);
		if(email.indexOf(badChar,0) != -1){
			return false;
		}
	}

	atPos = email.indexOf("@",1);         //there must be one "@" symbol
	if(atPos == -1){
		return false;
	}
	if(email.indexOf("@",atPos+1) != -1){ //check to make sure only one "@" symbol
		return false;
	}

	periodPos = email.indexOf(".",atPos);
	if (periodPos == -1){ // make sure there is one "." after the "@"
		return false;
	}

	if(periodPos+3 > email.length){ // must be at least 2 chars after the "."
		return false;
	}
	return true;
}


// Function validateSelect()
// Forces selection of options other than first one in a select control.
function validateSelect(selectObject){
	val = selectObject[selectObject.selectedIndex].value;
	if( val == 0 || val == "" ){
		alert("Please choose another option from '" +convertVariable(selectObject.name)+ "'" );
		selectObject.focus();
		return false;
	}else{
		return true;
	}
}

//add by jagdish
function delRec()
{
	confirm("Are you sure you want to delete this record? ")
}

function tblHide(obj)
{
	document.all(obj).style.display = "";		
}

function hide(obj,val)
{
	document.all(obj).style.display = "none";
	document.all(val).style.display = "none";
}

function delRow(obj)
{
	document.all(obj).style.display = "none";
}

function openWindow(url)
{
	//alert("Jag");
	var myWind = window.open(url,"EmpWin","scrollbars=yes,status=yes,width=800,height=600");
	//var myWind = window.open(url,"EmpWin","scrollbars=yes,menubar=yes,toolbar=yes,status=yes,width=800,height=600");
	myWind.moveTo(10,10)
				
}

function openTime(controlObjStr){
	wind = window.open('timeEditable.html?' +controlObjStr, '', 'resizable');
	wind.resizeTo(210, 10);
}

function popUpWindowName(url, name, width, height, x, y,z)
{
	//IsPopupBlocker();
	var wind;
	if(width=="" || height=="")
	{
	   width =700;
	   height = 400;
		wind = window.open(url, name," width=" +width+ ",height=" +height+ ",scrollbars=yes,resizable=yes");
	}
	else
	{
		wind = window.open(url, name, " width=" +width+ ",height=" +height+ ",scrollbars=yes,resizable=yes");
	}
	
	wind.focus();
	if(x != null && y != null){
		wind.moveTo(x, y);
	}else{
		x = (screen.width/2)  - (width/2);
		y = (screen.height/2) - (height/2);
		wind.moveTo(x, y);
		//alert( width + ", " +height+ "\n" +screen.width+ "x" +screen.height +"\nx: "+ x +", y: "+ y);
	}
	
}

// function to detect popupblocker
function IsPopupBlocker()
 {
        var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
        alert(typeof(oWin));
        //if (oWin ==null || oWin.closed==true)
         if (oWin==null || typeof(oWin)=="undefined")
         {              
              alert("You HAVE A POPUP BLOCKER");
                        
        }
        else 
        {
			 alert("You HAVENT A POPUP BLOCKER");
			// oWin.close();
               
        }
}

///Function to trim the Value
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 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
				{
					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);
			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
				{
					strTemp = VALUE.substring(iTemp,v_length);
					break;
				}
				iTemp = iTemp + 1;
			} //End While
			return strTemp;
		} //End Function
