/*  Project Name		: ourgreatlife.com
   	Program name		: member.js
 	Program function	: javascript validation
	Author				: George Joseph.
	Developed by	   	: Colbridge Web Logics - www.colbridge.com 
 	Created Date  		:  !5,July, 05 
	
	Update History
    -------------------------------------------------------------------
     Date       	By 				  		short desc. of what updated 	
	-------------------------------------------------------------------*/

function locateCursorprimary(theform, txtName){
	switch(txtName){
			case 'SSNRE1':
			if(eval("theform.frm_prim_ph1.value.length==4"))
				eval("theform.frm_prim_ph2.focus()");
			break;
		case 'SSNRE2':
			if(eval("theform.frm_prim_ph2.value.length==4"))
				eval("theform.frm_prim_ph3.focus()");
			break;	
	}
}
function locateCursorsecondary(theform, txtName){
	switch(txtName){
			case 'SSNRE1':
			if(eval("theform.frm_sec_ph1.value.length==4"))
				eval("theform.frm_sec_ph2.focus()");
			break;
		case 'SSNRE2':
			if(eval("theform.frm_sec_ph2.value.length==4"))
				eval("theform.frm_sec_ph3.focus()");
			break;	
	}
}
function selectactive(check){//alert("hii");
	cnt = document.frm.count.value;// no. of check boxes
	//alert(document.frm.count.value);
	for( var i = 1, j; j = document.getElementById('active_'+i),i <= cnt; i++ ) {
		if(j){
			if(check.checked == true)	
				j.checked = true;
			else
				j.checked = false;
		}
	}
}
function select_all_active(check){
	cnt = document.frm.count.value;// no. of check boxes
	var atvcnt = 0;	
	for( var i = 1, j; j = document.getElementById('active_'+i),i <= cnt; i++ ){
		if(j){
			if(j.checked == true)
				atvcnt++;		
		}
	}
	 if(atvcnt == cnt )
		document.frm.activeall.checked = true;
		
}
//function to select/deselect all check boxes
function selectDelete(check){
	cnt = document.frm.count.value;// no. of check boxes
	for( var i = 1, j; j = document.getElementById('delete_'+i),i <= cnt; i++ ) {
		if(j){
			if(check.checked == true)	
				j.checked = true;
			else
				j.checked = false;
		}
	}
}

//confirm delete
function Check(theform){
	var cnt = theform.count.value;// no. of check boxes
	
	var dltcnt = 0;	
	for( var i = 1, j; j = document.getElementById('delete_'+i),i <= cnt; i++ ) {
		if(j){
			if(j.checked == true)
				dltcnt++;		
		}
	}
	if(dltcnt > 0){
		if (!confirm("Do you want to delete these items? "))
			return false;
		else
			return true;
	}
	return true;
}
//if all the check boxes are checked then set the select all check box

function select_all_del(check){
	cnt = document.frm.count.value;//no. of records in the page
	sltcnt = document.frm.count.value - document.frm.delete_inuse.value;//no. of check boxes
	var dltcnt = 0;	
	for( var i = 1, j; j = document.getElementById('delete_'+i),i <= cnt; i++ ){
		if(j){
			if(j.checked == true)
				dltcnt++;		
		}
	}
	 if(dltcnt == sltcnt )
		document.frm.deleteall.checked = true;
}	


function showCal(dob, dte){
		showCalendar(dob, dte);
}	