// JavaScript Document

function showinstructor(a)
{
	win2=open("/about/instructor.asp?instrid="+a, "Instructors", "height=450,width=550,scrollbars=yes");
	win2.focus();
}

function selectcourse(a,b)
{
	window.location="/coursedescription.asp?courseid="+a;
}

function selectcourse2(a,b)
{
	window.opener.location="/coursedescription.asp?courseid="+a;
	window.close()
}

function genealogy(a)
{
	window.opener.location=a;
	window.close()
}

function register(a)
{
 win2=open("/payment/registration.asp?sectionid="+a, "Registration", "height=450,width=715,scrollbars=yes,menubar=yes, top=5,left=20");

}
function waitinglist(a)
{
 win2=open("/payment/waitinglist.asp?sectionid="+a, "waitinglist", "height=450,width=715,scrollbars=yes,menubar=yes, top=5,left=20");

}
function registerspecial(a)
{
		win2=open("/payment/registrationspecial.asp?sectionid="+a, "Registration", "height=450,width=715,scrollbars=yes,menubar=yes, top=5,left=20");
}

function showpage(a,b)
{
	switch (a)
	{
		case 1:
			window.location="/courses.asp?listorder="+b;
			 break;

		case 2:
			window.location="/certificates.asp";
			 break;
			 
		case 3:
			window.location="/customizedcourses.asp";
			 break;	 
		case 4:
			window.location="/courses_webbased.asp";
			 break;
		case 5:
				switch (b)
					{
					case 1:
						window.location="/about/aboutplc.asp";
			 			break;
					case 2:
						window.location="/about/Information.asp";
						 break;
					case 3:
						window.location="/about/plcinstructors.asp";
						 break;	 
					case 4:
						window.location="/about/contactus.asp";
						 break;
					case 5:
						window.location="/about/howtoregister.asp";
						 break;
					case 6:
						window.location="/myplc/myplc.asp";
						//win2=open("/payment/login.asp?pageto=myplc", "login", "height=450,width=715,scrollbars=yes,menubar=yes, top=5,left=20");
						 break;
					case 7:
						window.location="/default.asp";
						 break;
					case 8:
						window.location="/about/news.asp";
						 break;
					case 9:
						window.location="/about/search.asp";
						 break;
					case 10:
						window.location="/about/partners.asp";
						 break;		 
					}
	}
}
/*
function changeclor(a){
a.style.background='#FFCC66';
a.style.color='Black';

}
//-------------------------------
function changeto(a){
a.style.background='#0F97D1';
a.style.color='White';
}*/
function changeclor(a){
a.style.color='Black';
a.style.cursor='hand';
a.style.textDecoration="underline";
}
//-------------------------------
function changeto(a){
a.style.color='#0D67B8';
a.style.textDecoration="none";

}
//--------------------------------
function fontcolorin(a){
a.style.color='#D67432';
//a.style.letterSpacing="1px"
a.style.textDecoration="underline overline"
}
//-------------------------------
function fontcolorout(a){
a.style.color='#0033CC';
//a.style.letterSpacing="0px"
a.style.textDecoration="underline"

}
//--------------------------------
function change11(a){
a.style.color='Black';
a.style.textDecoration="underline";

}
//-------------------------------
function change22(a){
a.style.color='#FFFFFF';
a.style.textDecoration="none";
}


function checkform_login()
{var em = document.l1.email.value;
 var pwd = document.l1.PWD.value;
 var msg = "Please enter your PLC password"
 if (checkmail(em)==0)
  {
  return(0);
  }
  
  if ( checkpwd(pwd,msg)==0)
  {
  return(0);
  }
 document.l1.submit();
 }
/*------------------------------------------*/
function checkmail(em)
{
if (em.length==0)
 	{
	alert("Please enter Email Address")
	return(0);
	}
	if (em.indexOf("@")<1){
	alert("Invalid Email Address")
 	return(0);
	}
 	if (em.indexOf(".")<1)
	{
	alert("Invalid Email Address")
 	return(0);
	}
return(1);
}
/*------------------------------------------*/
function checkpwd(pwd,a)
{
if (pwd.length==0)
 	{
	alert(a)
	return(0);
	}
return(1);
}
/*------------------------------------------*/

function validate2()
{
var em = document.cpwd.email.value;
var pwd = document.cpwd.opwd.value;
var npw1 = document.cpwd.npwd1.value;
var npw2 = document.cpwd.npwd2.value;

 if (checkmail(em)==0)
  {
  return(0);
  }
  var msg = "Please enter your OLD password"
  if ( checkpwd(pwd, msg)==0)
  {
  return(0);
  }
   var msg = "Please enter your NEW password"
  if ( checkpwd(npw1,msg)==0)
  {
  return(0);
  }
  var msg = "Please re-enter your NEW password"
  if ( checkpwd(npw2,msg)==0)
  {
  return(0);
  }
  if ( checkpwd2(npw1,npw2)==0)
  {
  return(0);
  }

  document.cpwd.submit();
}

/*------------------------------------------*/
function checkpwd2(pw1,pw2)
{
if (pw1!=pw2)
 	{
	alert("You re-typed your new password incorrectly. Try again")
	return(0);
	}
return(1);
}
/*------------------------------------------*/

function validate1()
{
var em = document.f2.email.value;
 if (checkmail(em)==0)
  {
  return(0);
  }
  document.f2.submit();
}
/*------------------------------------------*/
function shownewpage1(a)
{
if (a.length!=0)
{
window.location=a
}
}
/*------------------------------------------*/
function checkpwd(pwd,a)
{
if (pwd.length==0)
 	{
	alert(a)
	return(0);
	}
return(1);
}
//------------------------------------------
function validateNewRegistration()
{	
	msg= "First Name field cannot be empty.";
  	if (checkOther(document.newR.fname.value, msg)==0)
  		{  return(0); }
 	 msg= "Last Name field cannot be empty.";
 	if (checkOther(document.newR.lname.value, msg)==0)
  		{  return(0);  }
	msg= "Street Address field cannot be empty."
	if (checkOther(document.newR.addr1.value, msg)==0)
  		{  return(0);  }
 	msg= "City field cannot be empty."
   	if (checkOther(document.newR.city.value, msg)==0)
  		{  return(0);  }
   
   	if (checkmail(document.newR.email.value)==0)
  		{  return(0);  }
   	msg= "Password field cannot be empty."
   	if (checkpwd(document.newR.npwd1.value,msg)==0)
  		{  return(0);  }
    msg= "Please confirm password."
   	if (checkpwd(document.newR.npwd2.value, msg)==0)
  		{  return(0);  }
   	if (checkpwd2(document.newR.npwd1.value, document.newR.npwd2.value)==0)
  		{
		  return(0);
	    }

document.newR.goahead.value="Yes";		
document.newR.submit();
}
/*------------------------------------------*/
function checkOther(a,b)
{
if (a.length==0)
 	{
	alert(b);
	return(0);
	}
return(1);
}
//------------------------------------------------------
function myplclogin()
{
win2=open("/payment/login.asp?pageto=myplc", "login", "height=300,width=715,scrollbars=yes,menubar=yes, top=5,left=20");
}				
//-------------------------------------
function myplcf1(a)
{
window.location="/myplc/myplc.asp?myrequest="+a;
}

function updatepinfo()
{
	msg= "First Name field cannot be empty.";
  	if (checkOther(document.updatef1.fname.value, msg)==0)
  		{  return(0); }
 	 msg= "Last Name field cannot be empty.";
 	if (checkOther(document.updatef1.lname.value, msg)==0)
  		{  return(0);  }
	if (checkmail(document.updatef1.Email.value)==0)
  		{  return(0);  }
		
 	if (confirm("Please press 'OK' to confirm update"))
		{
		document.updatef1.pinfo.value="yes";
		document.updatef1.submit();
	}
}
function gotoshopingcart()
{
win2=open('/payment/plccart.asp', 'Shopcart', 'height=450,width=715,scrollbars=yes,menubar=yes, top=5,left=20');
}
function deleterec(a,b)
{
	if (confirm("Are you sure you want to DELETE this record?"))
		{
		window.location=b+"?deleteid="+a
		}
}
//-----------------------------------------------------------
function showpoppage(a,b,c)
{
win2=open(a, 'poppage', 'height='+b+',width='+c+',scrollbars=yes,resizeble=yes, top=5,left=20');
}
//-----------------------------------------------------------
function showpoppage2(a,b,c)
{
win2=open(a, 'poppage', 'height='+b+',width='+c+',scrollbars=yes,resizeble=yes, top=5,left=20,menubar=yes');
}
function showpoppage3(a,b,c)
{
win6=open(a, 'calender', 'height='+b+',width='+c+',scrollbars=yes,resizeble=yes, top=5,left=20');
}
function checkform(a,b,c)
{
var d=0;
var aa=new Array();
var bb=new Array();
aa[0]=a;
aa[1]=b;
aa[2]=c;
bb[0]="Please enter your First Name.";
bb[1]="Please enter your Last Name.";
bb[2]="Invalid Email Address. Please try again";
for (i=0; i<aa.length; i++)
	{
	if (checkform2(aa[i], bb[i], i)==0)
	{
		d=1;
		break;
	}
	
	}	
if (d==0)
	{
		document.f1.submit();
	}
}

function checkform2(x,y,z)
{
	if (z!=2)
	{
		if (x.length==0)
		{
			alert(y);
			return (0);
		}
		else
		{
			return(1);
		}
	}
	else
	{
	return(checkmail(x))
	}
}

function addeditlocation($id)
{
if ($id==1)
	{
	 $id=document.form1.LocationID.value
	}
 win22=open("addeditlocation.asp?LocationID="+$id, "addeditlocation", "height=550,width=750,scrollbars=yes,menubar=yes, top=5,left=20");
 win22.focus();
}
