
function enter(vObj,vMsg)
 	{
		if (event.keyCode==13){	
				Submit(vObj,vMsg);}
	}
			
function Submit(vThis,sMessage)
	{
		vThis.style.visibility='hidden';
		document.getElementById("txtProcessing").style.visibility='visible'
		document.getElementById("lblErrorMessage").style.visibility='hidden';
		document.forms[0].elements["hdnValue"].value = sMessage;
		window.status = "Please wait while your request is processed...."
		document.mainform.submit();	
	}	
		
function SubmitAlone(sMessage)
	{
		document.getElementById("txtProcessing").style.visibility='visible'
		if (document.getElementById("lblErrorMessage"))
		{
			document.getElementById("lblErrorMessage").style.visibility='hidden';
		}
		document.forms[0].elements["hdnValue"].value = sMessage;
		window.status = "Please wait while your request is processed...."
		document.mainform.submit();	
	}	
		
		
function Login(sMessage)
	{
		document.getElementById("PLogin").style.visibility='hidden'
		document.getElementById("txtProcessing").style.visibility='visible'
		document.getElementById("lblErrorMessage").style.visibility='hidden';
		document.forms[0].elements["hdnValue"].value = sMessage;
		window.status = "Please wait while your request is processed...."
		document.mainform.submit();	
	}	
	
function LoginEnter(vMsg)
 	{
		if (event.keyCode==13){	
				Login(vMsg);}
	}
					
function expandContract1(id, img)
{
	var idVariable=document.getElementById(id);
	var ImgName=document.getElementById(img);

	var obj1=document.getElementById('o1');
	var img1=document.getElementById('i1');
	var obj2=document.getElementById('o2');
	var img2=document.getElementById('i2');
	var obj3=document.getElementById('o3');
	var img3=document.getElementById('i3');
	var obj4=document.getElementById('o4');
	var img4=document.getElementById('i4');
	
		if (idVariable.id!='o1' && ImgName.id!='i1')
			{
				obj1.style.display="none" ;
				img1.src = "images/gif/plus.gif" ;
			}
		if (idVariable.id!='o2' && ImgName.id!='i2')
			{
				obj2.style.display="none" ;
				img2.src = "images/gif/plus.gif" ;
			}
		if (idVariable.id!='o3' && ImgName.id!='i3')
			{
				obj3.style.display="none" ;
				img3.src = "images/gif/plus.gif" ;
			}		
	    if (idVariable.id!='o4' && ImgName.id!='i4')
			{
				obj4.style.display="none" ;
				img4.src = "images/gif/plus.gif" ;
			}		
			
		if (idVariable.style.display=="")
			{	
			idVariable.style.display="none" ;
			if (ImgName.src != "") {ImgName.src = "images/gif/plus.gif" ;}
			}
			else
			{
			idVariable.style.display="" ;
			if (ImgName.src != "") {ImgName.src = "images/gif/minus.gif" ;}
     		}
     	
}
		

function expandContract2(id, img){
	var idVariable=document.getElementById(id);
	var ImgName=document.getElementById(img);
		if (idVariable.style.display==""){	
				idVariable.style.display="none" ;
				if (ImgName.src != "") {ImgName.src = "images/gif/plus.gif" ;}
			}
			else{
				idVariable.style.display="" ;
				if (ImgName.src != "") {ImgName.src = "images/gif/minus.gif" ;}
     		}
		}
		
function PrintPage(vThis)
	{
		vThis.style.visibility='hidden';
		document.getElementById("txtProcessing").style.visibility='visible'
		var x
		x = window.showModalDialog("print.aspx", "", "dialogHeight: 500px; dialogWidth: 700px; dialogTop: 50px; dialogLeft: 50px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
		if (x ==0)
			{
			alert('It is necessary to retain a hard copy of certification for submission to the department!')
			}
				document.getElementById("btnPrint").style.visibility='visible'
				document.getElementById("btnRosterOKay").style.visibility='visible'
				document.getElementById("txtProcessing").style.visibility='hidden'
			}


	
function HideProcessing()
	{
		document.getElementById("txtProcessing").style.visibility='hidden';
		
	}
function imgborderize_on(e)
		{
		if (!e)
			var e=window.event;
			var S=e.srcElement;
			
			while (S.tagName!="IMG")
				{S=S.parentElement;}
				S.className="AbN";
		}
			
function imgborderize_off(e)
	{
		if (!e)
			var e=window.event;
			var S=e.srcElement;
		while (S.tagName!="IMG")
			{S=S.parentElement;}
			S.className="N";
	}	
	
function borderize(what,Color){
	
	what.style.backgroundColor=Color
	}

function borderize_on(e,colo){
	var col2 
	col2 = colo;
	if (document.all)
	source3=event.srcElement
	else if (document.getElementById)
	source3=e.target
	if ((source3.className=="menulines") || (source3.className=="side"))
	{
	borderize(source3,col2)
	}
	else
	{
	while(source3.tagName!="TABLE"){
	source3=document.getElementById? source3.parentNode : source3.parentElement
	if ((source3.className=="menulines") || (source3.className=="side"))
	borderize(source3,col2)
	}
	}
	}
	
function borderize_off(e,colo){
	var col 
	col = colo;
	if (document.all)
	source4=event.srcElement
	else if (document.getElementById)
	source4=e.target
	if ((source4.className=="menulines")||(source4.className=="side"))
	borderize(source4,"white")
	else{
	while(source4.tagName!="TABLE"){
	source4=document.getElementById? source4.parentNode : source4.parentElement
	if ((source4.className=="menulines") ||(source4.className=="side"))
	borderize(source4,"white")
	}
	}
	}
	
function tdborderize_on(e)
		{
		if (!e)
			var e=window.event;
			var S=e.srcElement;
			
			while (S.tagName!="TD")
				{S=S.parentElement;}
				S.className="AbNormal";
		}
			
function tdborderize_off(e)
	{
		if (!e)
			var e=window.event;
			var S=e.srcElement;
		while (S.tagName!="TD")
			{S=S.parentElement;}
			S.className="Normal";
	}	

	
function SSNValidation(vObj,vMsg) 
	{
	
		var ssn = document.getElementById("txtSSn").value;
		var ssnLen = ssn.length;
		var err;				
		
		if (ssnLen > 0) 
		{ 
		for (var j = 0; j < ssnLen; j++) 
		{
			var ch2 = ssn.substring(j, j + 1);
			if ((ch2 < "0") ||  (ch2 > "9"))
				{
				err=1;
				}
		}
		if (err==1) {
			alert("Please input a valid Social Security!");
			document.mainform.txtSSN.value = "";
			document.mainform.txtSSN.focus();
			return false;
		}
		
		if (ssnLen < 9) {
			alert('Invalid Social Security. Must be 9 digits');
			document.mainform.txtSSN.focus();
			return false;
		}

		else {
				//vObj.style.visibility='hidden';
				//document.getElementById("txtProcessing").style.visibility='visible';
				//document.getElementById("txtProcessing").value ="< Processing Please wait...! >";
				//document.forms[0].elements["hdnValue"].value = "LookupOn";
				//document.mainform.submit();	
		}
		}
	}
		
		
function OpenNewWindow(vURL,vWidth,vHeight) 
 	{
  	myWin= open(vURL, "displayWindow","width=" + vWidth + ",height=" + vHeight + ",status=no,toolbar=no,menubar=no,scrollbars=yes,left=200,top=200,location=no,directories=no,copyhistory=no");
 	}	
 

function Options(vURL)
		{
			//myWin= open(vURL, "displayWindow","width=590,height=450,status=no,toolbar=no,menubar=no,scrollbars=yes,left=200,top=200,location=no,directories=no,copyhistory=no");
			var sFeatures="dialogHeight: 450px; dialogWidth: 590px; status: no; help: no;";
			var sResult = window.showModalDialog(vURL, "", sFeatures);
	    }

function moneyFormat(txt){             
  var amount = txt.value;
  var len = amount.length;
  var pos0 = amount.indexOf(",");
  if(pos0 != -1){
    while(pos0 != -1){
      var partOne = amount.substring(0, pos0);
      var partTwo = amount.substring(pos0+1, len);
      amount = partOne + partTwo;
      pos0 = amount.indexOf(",");
    }
  }
  var len = amount.length;
  var pos1 = amount.indexOf("/");
  if((amount=='')||(amount==' ')||(amount==' ')) txt.value = '';
  else if(amount.length>=20) alert("Please Do Not Enter More Than 20 Characters");
  else if(pos1!=-1){
    var amt = amount.substring(0, pos1);
    var cur = amount.substring(pos1+1, len);
    var moneyPart = fixAmount(amt);
    if(moneyPart!='noGood') var currencyPart = fixCurrency(cur);
    if((moneyPart!='noGood')&&(currencyPart!='noGood'))
       txt.value = moneyPart //+ '/' + currencyPart;
    else{
      txt.focus();
      txt.value='';
    }
  } 
  else if((!isNaN(amount))||(amount=='.')){ 
    var moneyPart = fixAmount(amount);
    if(moneyPart!='noGood') txt.value = moneyPart.toString()// + '/USD';
    else{
      txt.focus();
      txt.value='';
      //txt.select();
    }
  }
  else{
    var checkPoint = amount.substring(len-3, len-2);
    if((!isNaN(checkPoint))||(checkPoint=='.'))
       checkPoint = amount.substring(len-2, len-1); 
    if((!isNaN(checkPoint))||(checkPoint=='.'))
       checkPoint = amount.substring(len-1, len);
    var pos2 = amount.indexOf(checkPoint);
    var amt = amount.substring(0, pos2);
    var cur = amount.substring(pos2, len);
    var moneyPart = fixAmount(amt);
    if(moneyPart!='noGood') var currencyPart = fixCurrency(cur);
    if((moneyPart!='noGood')&&(currencyPart!='noGood'))
       txt.value = moneyPart + '/' + currencyPart;
    else{
      txt.focus();
      txt.value='';
      //txt.select();
    }
  }
}

function fixCurrency(str){
  var currencyIs = str;
  currencyIs = currencyIs.toUpperCase();
  if((currencyIs == '')||(currencyIs == 'U')||(currencyIs == 'US')){
    currencyIs = 'USD';
    return currencyIs;
  }
  else if(currencyIs != 'USD'){
    alert('Invalid Money Format. Please Enter as 999.99');
    return 'noGood';
  }
  else return currencyIs; 
}

function fixAmount(num){ 
  var amountNum = num;
  if(amountNum==0) amountNum = '0';
  var pos = amountNum.indexOf(".");
  if(pos==-1){ 
    if(!isNaN(amountNum)){ 
      amountNum = amountNum.toString() + '.00';
      return amountNum; 
    }
    else{
      alert('Invalid Money Format. Please Enter as 999.99');
      return 'noGood';
    }
  }
  else{
    var amtLen = amountNum.length;
    var dollars = amountNum.substring(0, pos);
    var cents = amountNum.substring(pos+1, amtLen);
    var centLen = cents.length;
    if((dollars=='')||(dollars==' ')||(dollars==' ')) dollars=0;
    if((cents=='')||(cents==' ')||(cents==' ')) cents='00';
    if((isNaN(dollars))||(isNaN(cents))||(centLen>2)){
      alert('Invalid Money Format. Please Enter as 999.99');
      return 'noGood';
    } 
    else{
      cents = cents.toString();
      var centLen = cents.length;
      if ((centLen==1)||(cents==0)) cents = cents*1 + '0';
      amountNum = dollars + '.' + cents;
      return amountNum;
    }
  }
}

				
function numberOnly(txt){    
  var isNumber = txt.value; 
  isNumber = trim(isNumber);  
  if(isNaN(isNumber)){
    alert('Please Enter a Numeric Value');    
    txt.focus();
    txt.select();
  }
}

function trim(txt){
  var str = txt;
  var len = str.length;
  var isSpace = str.indexOf(' ');
  var partOne, partTwo;
  while (isSpace != -1){
    partOne = str.substring(0, isSpace);
    partTwo = str.substring(isSpace+1, len);
    str = partOne + partTwo;
    var len = str.length;
    isSpace = str.indexOf(' ');
  } 
  return str;
}
function calendarPicker(strField,T,L)
			{
				window.open('DatePicker.aspx?field=' + strField,'calendarPopup','width=250,height=190,resizable=yes,top='+ T + ',left=' + L );
			}
			
function CheckEmail(obj) {

			
				var sLogin=obj.value;
				if ((sLogin.indexOf('@') == -1) && (sLogin != ""))
				{
					//obj.value = obj.value + "@nycboe.net";
				}
			


				var input_str=obj.value;
				var input_len1=input_str.length;
				var iserror=0;
 
					input_len1=input_str.length;
				     
				if (input_len1==0) {
						//alert("You must enter a Valid Email Address!\n");
						iserror=0;
						return true;
					}

					var lastdot=-1;
					var lastat=-1;
					var numberat=0
					for (var j = 0; j < input_len1; j++) {
						var ch2 = input_str.substring(j, j + 1);
						if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
							alert("Please input a valid email address!\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
							iserror=1;
						}
						if (ch2==".") {
							if ( j == lastdot + 1) {
								alert("Please input a valid email address!\nYou can't have two dots next to\neach other'..'.");
								iserror=1;
							}
							lastdot=j;
						}
						if (ch2=="@") {
							lastat=j;
							numberat=numberat+1
						}
						if (ch2==" ") {
							alert("Please input a valid email address!\nYou can't have any spaces in the address.");
							iserror=1;
						}
					}
					if (lastat == -1) {
						alert("Please input a valid email address!\nYou don't have an '@'.");
						iserror=1;
					}
					if (lastat == 0) {
						alert("Please input a valid email address!\nYou don't have a name before the '@'.");
						iserror=1;
					}
					if (numberat > 1) {
						alert("Please input a valid email address!\nYou may have only one '@'.");
						iserror=1;
					}
					if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
						alert("Please input a valid email address!\nYou don't have a proper domain name!\nUse .com, .org, .net, .cc, etc");
						iserror=1;
					}
					if (lastdot == lastat + 1) {
						alert("Please input a valid email address!\nYou don't have a proper organization name!");
						iserror=1;
					}
					if (iserror==1) {
						obj.focus();
						obj.select();
						return false;
					}
			}
			
function HJProg()
		{
			document.getElementById("PUpload").style.visibility='hidden';
			document.getElementById("lblErrorMessage").style.visibility='hidden';
			document.getElementById("PBar").style.visibility='visible';
		}
			
var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;
var bars=new Array();

function PleaseWait(w,h,bgc,brdW,brdC,blkC,speed,blocks,msg)
		{
			if(ie||w3c){
			var t='<div style="position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid;"><center><font size=1 face=verdana color=#33cc33><b>'+ msg;

			t+='<span id="blocks'+(++N)+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
			
			for(i=0;i<blocks;i++)
			{
				t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
				t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);		
				t+='"></span>';
			}

			t+='</span></font></div>';
			document.write(t);
			
			var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
			bA.blocks=blocks;
			bA.w=w;
			bA.h=h;	
			bars[bars.length]=bA;
			setInterval('startBar('+N+')',speed);
			}
		}

function startBar(bn)
		{
			var t=bars[bn];
			t.style.left=((parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w)? -(t.h*2+1) : parseInt(t.style.left)+t.h+1)+'px';
		}	
			
			
		var iTimeout = 0;
		var iServerTimeout = 0;
		var iMsgTimeout = 30;
		var sLogoff = "";
		var timeId = null;
		var timeServerId = null;
		
		function SetClientTimeout(Timeout, MsgTimeout, Logoff)
		{	
			sLogoff = Logoff;
			if (Timeout < 5)  Timeout = 5;	// min
			if (Timeout > 15) Timeout = 15;	
			iServerTimeout = Timeout*2 + 2;
			if (iServerTimeout > 18) iServerTimeout = 18;	// leave at least 2 min to submit page
			iTimeout = Timeout*60*1000;
			iServerTimeout *= 60000;
						
			if (MsgTimeout < 30) MsgTimeout  = 30;	// sec
			if (MsgTimeout > 120) MsgTimeout = 120;	
			iMsgTimeout = MsgTimeout*1000;
									
			document.body.onclick = f_TimeoutReset; 
			document.body.onkeydown = f_TimeoutReset;

			timeId = window.setTimeout("f_Timeout1()", iTimeout);
			timeServerId = window.setTimeout("f_Timeout2()", iServerTimeout);
		}
		
		function f_Timeout1()
		{	
			var sFeatures="dialogHeight: 130px; dialogWidth: 620px; status: no; help: no;";
			var sResult = window.showModalDialog("Timeout.aspx?type=1", iMsgTimeout, sFeatures);
			if (sResult == "Keep Alive") f_TimeoutReset();			
			else 
			{
				var frame = window.parent;
				if (frame != null) frame.location = sLogoff;
				else window.location = sLogoff;			
			}
		}
		
		function f_Timeout2()
		{	
			var sFeatures="dialogHeight: 200px; dialogWidth: 800px; status: no; help: no;";
			var sResult = window.showModalDialog("Timeout.aspx?type=2", iMsgTimeout, sFeatures);
			if (sResult == "Keep Alive") f_TimeoutReset();			
			else 
			{
				var frame = window.parent;
				if (frame != null) frame.location = sLogoff;
				else window.location = sLogoff;			
			}
		}
		
		function f_TimeoutReset()
		{		
			if (timeServerId != null) window.clearTimeout(timeServerId);
			window.clearTimeout(timeId);
			timeId = window.setTimeout("f_Timeout1()", iTimeout);
		}
		
		
				
var iTimeout = 0;
var iServerTimeout = 0;
var iMsgTimeout = 30;
var sLogoff = "";
var timeId = null;
var timeServerId = null;

function SetClientTimeout(Timeout, MsgTimeout, Logoff)
		{		
			sLogoff = Logoff;
			if (Timeout < 5)  Timeout = 5;	// min			
			if (Timeout > 15) Timeout = 15;	
			iServerTimeout = Timeout*2 + 2;
			if (iServerTimeout > 18) iServerTimeout = 18;	// leave at least 2 min to submit page
			iTimeout = Timeout*60*1000;
			iServerTimeout *= 60000;
						
			if (MsgTimeout < 30) MsgTimeout  = 30;	// sec
			if (MsgTimeout > 120) MsgTimeout = 120;	
			iMsgTimeout = MsgTimeout*1000;
									
			document.body.onclick = f_TimeoutReset; 
			document.body.onkeydown = f_TimeoutReset;

			timeId = window.setTimeout("f_Timeout1()", iTimeout);
			timeServerId = window.setTimeout("f_Timeout2()", iServerTimeout);
		}
		
		function f_Timeout1()
		{	
						var sFeatures="dialogHeight: 200px; dialogWidth: 800px; status: no; help: no;";

			//var sFeatures="dialogHeight: 130px; dialogWidth: 620px; status: no; help: no;";
			var sResult = window.showModalDialog("Timeout.aspx?type=1", iMsgTimeout, sFeatures);
			if (sResult == "Keep Alive") f_TimeoutReset();			
			else 
			{
				var frame = window.parent;
				if (frame != null) frame.location = sLogoff;
				else window.location = sLogoff;			
			}
		}
		
		function f_Timeout2()
		{	
						var sFeatures="dialogHeight: 200px; dialogWidth: 800px; status: no; help: no;";

			//var sFeatures="dialogHeight: 130px; dialogWidth: 620px; status: no; help: no;";
			var sResult = window.showModalDialog("Timeout.aspx?type=2", iMsgTimeout, sFeatures);
			if (sResult == "Keep Alive") f_TimeoutReset();			
			else 
			{
				var frame = window.parent;
				if (frame != null) frame.location = sLogoff;
				else window.location = sLogoff;			
			}
		}
		
		function f_TimeoutReset()
		{		
			if (timeServerId != null) window.clearTimeout(timeServerId);
			window.clearTimeout(timeId);
			timeId = window.setTimeout("f_Timeout1()", iTimeout);
		}
		



/*
******************************************************************
Designed By: Hanly Joseph
	   Date: 11/08/04	
			 New York City Board Of Eduction
******************************************************************	
*/
