function fun_confirmapin() {

var v_pin;

v_pin = window.prompt("To protect your Information please confirm your in number.","");

if (v_pin == "<%=szPIN%>")
  {	document.frm_contact.submit(); }
else
	{ v_pin = window.prompt("Your entered an invalid pin, Please try again.","");
	if (v_pin == "<%=szPIN%>") 
  		{	document.frm_contact.submit(); }
		else
		{ v_pin = window.prompt("Your entered an invalid pin, You will be logged out if you miss it this time.","");
			if (v_pin == "<%=szPIN%>") 
  				{	document.frm_contact.submit(); }
			else
				{	document.location="../es/clear.asp"; }
		}
    }
}



function LoadconfirmpinWindow(){
	var v_choose;
    	v_choose = document.frm_contact.h_update.value; 
	switch (v_choose) {
case '1':
	var objWindow=window.open('confirmpin.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm_contact.submit();
	break;
default:
	break;
}
}


function LoadconfirmpinWindow_profile(){
	var v_choose;
        v_choose = document.myform.h_update.value; 
switch (v_choose) {
case '1':
	var objWindow=window.open('mp/confirmpin_profile.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="es/clear.asp";
	break;
case '3':
	document.myform.submit();
	break;
default:
	break;
}
}



function LoadconfirmpinWindow_makpay(){
	var v_choose;
    	v_choose = document.semester.h_update_makpay.value; 
	switch (v_choose) {
case '1':
	var objWindow=window.open('../payment/confirmpin_makpay.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.location = "../payment/paydtl.asp";
	break;
default:
	break;
}
}

function checkmyprocess_semestre(){
    var v_choose;
    var v_choose2;

    v_choose = document.semester.h_update.value; 
    v_choose2 = document.semester.h_update_makpay.value;

if (v_choose !== "1" ) 

   { 
	checkmyprocess_sem();
   }


if (v_choose2 !== "1" ) 
   { 
	checkmyprocess_makpay();
   }

}


function DoPayment(vh_id)
{	
document.frm.h_id.value=vh_id;
document.frm.action = "collect.asp";
document.frm.method = "POST";
document.frm.submit();	
}

function DoViewPayment(vh_termcode)
{	
	document.frm.h_termcode.value=vh_termcode;
	document.frm.action = "../es/data_request.asp"
	document.frm.method ="POST";
	document.frm.submit();

}


function LoadconfirmpinWindow_viewdet(vh_termcode){
	document.frm.h_termcode.value=vh_termcode;
	var objWindow=window.open('../payment/confirmpin_viewdet.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
}



function checkmyprocess_viewdet(){

	document.frm.action = "../es/semester.asp"
	document.frm.method ="POST";
	document.frm.submit();


}


function LoadconfirmpinWindow_sempay(vh_id){
	document.frm.h_id.value=vh_id;
	var v_choose;
        v_choose = document.frm.h_update_pay.value; 
switch (v_choose) {
case '1':
	var objWindow=window.open('../payment/confirmpin_sempay.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');	
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.action = "collect.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}
}



function LoadconfirmpinWindow_collect(){
	var objWindow=window.open('../payment/confirmpin_collect.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
}

function checkmyprocess_collect(){
	var v_choose;
        v_choose = document.frm.h_update.value; 
switch (v_choose) {
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.submit();
	break;
default:
	break;
}

}
function LoadWindow_viewinsdetails(){
	var objWindow=window.open('installmentdetails.asp', 'w_installmentdetails','width=530,height=400,top=50,left=100,resizable=1');
}

function LoadWindow_installement(){
	var objWindow=window.open('installment.html', 'w_installmentdetails','width=530,height=400,top=50,left=100,resizable=1');
}

function LoadconfirmpinWindow_detalles(vh_termcode){
	var objWindow=window.open('confirmpin_viewdet.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
}


function myopen(filename,windowname,properties) {
       mywindow = window.open(filename,windowname,properties);
 }

function check_agreement()
{
  var rb_checked;
  rb_checked = document.frm.rb_Iagree.checked;
  if (rb_checked != 1)
   { alert("You must click in the radio button to confirm \n your agreement to the terms and conditions \n in order to continue.");
   }
  else {
	LoadconfirmpinWindow_agree()
	}
}


function GoCancel()
{

document.location="../eservices.asp";
}


function DoProccesAccpetfullpay() 
{ 
	document.frm.action = "processpayfull.asp";
	document.frm.target = "_self";
	document.frm.method = "POST";
	document.frm.submit();	
}

function DoProccesAccpetinstpay() 
{
	document.frm.action = "agreement.asp";
	document.frm.target = "_self";
	document.frm.method = "POST";
	document.frm.submit();	
}	

function DoViewInstallmentDet() 
{ 
	document.frm.action = "installmentdetails.asp";
	document.frm.target = "installment";
	document.frm.method = "POST";
	document.frm.submit();	
}

function checkmyprocess_viewdetinst()
{
	opener.document.frm.action = "../es/semester.asp"
	opener.document.frm.method ="POST";
	opener.document.frm.submit();
	window.close();

}



function LoadWindow_confirmpayinst(){
	var v_choose;
        v_choose = document.frm.h_update.value; 
switch (v_choose) {
case '1':
	var objWindow=window.open('confirmpin_payinst.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.action = "checkout.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}
}




function LoadconfirmpinWindow_agree(){
	var v_choose;
        v_choose = document.frm.h_update.value; 
switch (v_choose) {

case '1':
	var objWindow=window.open('confirmpin_agree.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	opener.location="../es/clear.asp";
	break;
case '3':
	document.frm.action = "processpayins.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}
}

function checkType(){
cType = document.frm.elements[14].value; //card Type
cNum = document.frm.elements[15].value; //card Number

	switch(cNum.charAt(0))
	{ 
	case "6": //Discover
		if (cType != "0")
		noMatch();
		break 
	case "5": //Mastercard
		if (cType != "1")
		noMatch();
		break 
	case "4": //Visa
		if (cType != "2")
		noMatch();
		break 
	default:
		alert("We\'re sorry.\nWe only accept\nDiscover,\nMastercard, or\nVisa.\n\nPlease check your\nCard Number and Card Type\nand try again.")
    	document.frm.elements[14].focus();
	}
}
function noMatch(){
	alert("Your Card Number and Card Type do not match.\n\nPlease make corrections and try again.");
	document.frm.elements[14].focus();
	}




function Load_callconfirm(){
	var v_choose;
        v_choose = document.frm.h_update.value; 

switch (v_choose) {
case '1':
	var objWindow=window.open('confirmpin_callconfirm.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.b_email.value="Processing..."
	document.frm.action = "resultscall.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}

	
}


function Load_Regconfirm(){
	var v_choose;
        v_choose = document.frm.h_update.value; 
switch (v_choose) {
case '1':
	var objWindow=window.open('confirmpin_Regconfirm.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.action = "regconfirm.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}
}



function Load_RegWconfirm(){
	var v_choose;
        v_choose = document.frm.h_update.value; 
switch (v_choose) {
case '1':
	var objWindow=window.open('confirmpin_WRegconfirm.asp', 'w_confirmpin','width=300,height=150,top=250,left=350,resizable=1');
	break;
case '2':
	document.location="../es/clear.asp";
	break;
case '3':
	document.frm.action = "regwithdrawlconfirm.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	break;
default:
	break;
}
}




function ShowDet() {
var detWin = window.open ("about:blank","detailsWindow","width=300,height=150,top=250,left=350,resizable=1");
detWin.document.open();
detWin.document.writeln("<HTML><TITLE>Your Installment Details</TITLE><HEAD>");
detWin.document.writeln("<STYLE><!-- --></STYLE>");
detWin.document.writeln("<link rel='stylesheet' href='/css/uhdglobal.css'></link></HEAD><BODY BGCOLOR='#FFFFFF'>");
detWin.document.writeln("<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0>");
detWin.document.writeln("<TR><TD COLSPAN=3><SPAN class=MainHeader>Installment Plan Details.<BR></SPAN></TD></TR>");
detWin.document.writeln("</TABLE>");
// Start Writing the Hidden Fields
	detWin.document.writeln("1st Installment: "+document.frm.h_firstinst.value+"</B><BR>");
detWin.document.writeln("<FORM name='nada'><INPUT TYPE='button' Value='Close This Window' OnClick='self.close()'></FORM></BODY></HTML>");
detWin.document.close();
}


function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function search_directory()
{
	
document.frm.lst_department_desc.value= document.frm.lst_department.options[document.frm.lst_department.selectedIndex].text;
document.frm.lst_college_desc.value= document.frm.lst_college.options[document.frm.lst_college.selectedIndex].text;	

}
function clear_search()
{
	document.frm.txt_firstname.value = '';
	document.frm.txt_lastname.value = '';
	document.frm.txt_title.value = '';
	document.frm.lst_type.options[0].selected = true ;
	document.frm.submit();

}

function go_employee_add()
{
		document.location="/directory/admin/employee_add.asp";

	}
	
function go_employee_edit()
{
    var isOK = false;
    for (i=0;i<document.frm.elements.length;i++) {
	currElem = document.frm.elements[i]
        if (currElem.type == "radio" && currElem.checked) {
            isOK=true;
	    break;
        }
    }
    if (!isOK) 
	{alert("You need to click in a radio button!");
	}
	else
	{
	document.frm.action = "/directory/admin/employee_edit.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	}
}

function get_confirm_employee_save() {
	
if (document.frm.txt_firstname.value=='')
{
	alert('Please enter the Firstname');
	//document.frm.lst_title.focus();//
	return;
}

if (document.frm.txt_lastname.value=='')
{
	alert('Please enter the Lastname');
	//document.frm.lst_title.focus();//
	return;
}

if (document.frm.lst_title.options[0].selected == true)
{
	alert('Please select a Title');
	//document.frm.lst_title.focus();//
	return;
}

if (document.frm.lst_department.options[0].selected == true)
{
	alert('Please select a Department');
	//document.frm.lst_title.focus();//
	return;
}

if (document.frm.lst_college.options[0].selected == true)
{
	alert('Please select a College');
	//document.frm.lst_title.focus();//
	return;
}



	
doyou = confirm("Are you sure you want to save? (OK = Yes   Cancel = No)"); //Your question.
if (doyou == true)
{
document.frm.action='/directory/admin/employee_save.asp';
document.frm.submit();
}
}


function inactive_emp()
{
	document.frm.method='post';
	document.frm.action='/directory/admin/search_employee_inactive.asp';
	document.frm.submit();

	}
	
	function active_emp()
{
	document.frm.method='post';
	document.frm.action='/directory/admin/search_employee.asp';
	document.frm.submit();
	}
	
function search_emp()
{
	document.frm.method='post';
	document.frm.action="/directory/admin/search_employee.asp"
	document.frm.submit();
	}
	
	function search_inactive_emp()
{
	document.frm.method='post';
	document.frm.action="/directory/admin/search_employee_inactive.asp"
	document.frm.submit();
	}
	
	
function go_employee_delete()
{
    var isOK = false;
    for (i=0;i<document.frm.elements.length;i++) {
	currElem = document.frm.elements[i]
        if (currElem.type == "radio" && currElem.checked) {
            isOK=true;
	    break;
        }
    }
    if (!isOK) 
	{alert("You need to click in a radio button!");
	}
	else
	{
	document.frm.action = "/directory/admin/employee_display_delete.asp";
	document.frm.method = "POST";
	document.frm.submit();	
	}
}

function get_confirm_employee_delete() {
doyou = confirm("Are you sure you want to delete this record? (OK = Yes   Cancel = No)"); //Your question.
if (doyou == true)
{
document.frm.action='/directory/admin/employee_confirm_delete.asp';
document.frm.submit();
}
}

function get_cancel_employee_delete() {
document.frm.action='/directory/admin/search_employee.asp';
document.frm.submit();
}
