<!--
//blah dee blah

var errfound = false;
function ValidLength(item, len) {
   return (item.length >= len);
}
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   if (item.indexOf ('.', 0) == -1) return false;
   return true;
}
function error(elem, text, tflag) {
   if (errfound) return;
   window.alert(text);
   if (tflag == 1) {
		elem.select();
   		elem.focus();
   }
   errfound = true;
}
function CheckMemberForm() {
   errfound = false;
   PassFirst = document.RegisterForm.PassWord.value;
   PassSecond = document.RegisterForm.PassWordCheck.value;

   if (!ValidLength(document.RegisterForm.MemberName.value,3))
      error(document.RegisterForm.MemberName,"Your Real Name appears to be invalid!",1);
   if (!ValidEmail(document.RegisterForm.EmailAddy.value))
      error(document.RegisterForm.EmailAddy,"Please enter a valid email address!",1);
   if (document.RegisterForm.EmailAddy.value != document.RegisterForm.EmailAddyCheck.value)
      error(document.RegisterForm.EmailAddyCheck,"Your email address and repeat email address do not match!",1);
   if (!ValidLength(document.RegisterForm.ReqUserName.value,5))
      error(document.RegisterForm.ReqUserName,"Your required User Name appears to be too short or invalid!",1);
   if (!ValidLength(document.RegisterForm.PassWord.value,5))
      error(document.RegisterForm.PassWord,"Your Password appears to be too short or invalid!",1);
   if (PassFirst != PassSecond)
      error(document.RegisterForm.PassWordCheck,"Your Password and Repeat Password do not match!",1);
   if (document.RegisterForm[11].checked) { return !errfound; } 
   else { error(document.RegisterForm.AcceptTerms,"You must accept the terms of membership before you can continue!",0); }

   return !errfound;
}

function CheckContactForm() {
   errfound = false;
   if (!ValidLength(document.EnquireForm.FirstName.value,2))
      error(document.EnquireForm.FirstName,"Your First Name appears to be invalid!",1);
   if (!ValidEmail(document.EnquireForm.MailAddy.value))
      error(document.EnquireForm.MailAddy,"Please enter a valid email address!",1);
   if (!ValidLength(document.EnquireForm.Comments.value,2))
      error(document.EnquireForm.Comments,"Please enter your query in the Comments box!",1);

   return !errfound;
}

function CheckEmailAddy() {
   errfound = false;
   if (!ValidEmail(document.ProfileForm.EmailAddy.value))
      error(document.ProfileForm.EmailAddy,"Please enter a valid email address!",1);
   return !errfound;
}
function CheckSubmit() {
   errfound = false;
  if (!ValidLength(document.program_data.RootCat.value,2))
    error(document.program_data.RootCat,"Please select a valid Category!",0);
  if (!ValidLength(document.program_data.ProgTitle.value,2))
    error(document.program_data.ProgTitle,"Please enter a valid value for Program Title!",1);
  if (!ValidLength(document.program_data.Description.value,2))
	error(document.program_data.Description,"Please enter a Description!",1);
  if (!ValidLength(document.program_data.LinkURL.value,2))
    error(document.program_data.LinkURL,"Please enter a valid value for Website URL!",1);
  if (!ValidLength(document.program_data.StartCapMin.value,2))
    error(document.program_data.StartCapMin,"Please enter a valid value for Starting Capital!",1);
  if (!ValidLength(document.program_data.EarnPotMin.value,2))
    error(document.program_data.EarnPotMin,"Please enter a valid value for Earning Potential!",1);
  if (!ValidLength(document.program_data.InputReqd.value,2))
    error(document.program_data.InputReqd,"Please select a valid value for Effort Required!",0);

  var ResourceClicked = 0;
  Resources=document.forms[0].Resources;
  for (i=0;i<Resources.length;++ i) {
	if (Resources[i].checked) { ResourceClicked = 1; }
  }
  if (ResourceClicked == 0)
	error(document.program_data.Description,"Please select Required Resources from the list!",0);

  if (!ValidLength(document.program_data.ProgramSuits.value,2))
    error(document.program_data.ProgramSuits,"Please select a valid value for Suitable For...!",0);
  if (document.getElementById("NoBanner").checked) { IgnoreNext = 1; }
  else {
  if ((!ValidLength(document.program_data.BannerCode.value,10)) && (!ValidLength(document.program_data.BannerImage.value,10)))
    error(document.program_data.BannerCode,"Please enter a valid value for Banner Code, Banner Image URL or select \"I Don\'t have a Banner\"!",1);
  }
  if (!ValidLength(document.program_data.Keywords.value,2))
    error(document.program_data.Keywords,"Please enter your search KeyWords!",1);
  if (!ValidLength(document.program_data.FirstName.value,2))
    error(document.program_data.FirstName,"Please enter a valid value for Full Name!",1);
  if (!ValidEmail(document.program_data.EmailAddress.value))
    error(document.program_data.EmailAddress,"Please enter a valid value for Email Address!",1);
  if (!ValidLength(document.program_data.Company.value,2))
    error(document.program_data.Company,"Please enter a valid value for Company Name!",1);
  if (!ValidLength(document.program_data.PositionTitle.value,2))
    error(document.program_data.PositionTitle,"Please enter a valid value for Position/Title!",1);
  if (!ValidLength(document.program_data.Location.value,2))
    error(document.program_data.Location,"Please select a valid Country/Location!",0);

  if (document.getElementById("AcceptTerms").checked) { return !errfound; }
  else { error(document.program_data.terms,"You must acknowledge acceptance of the terms and conditions!",1); }
	return !errfound;
}

function SetFormFocus(FieldName) {
	elem.select(FieldName);
  elem.focus(FieldName);
}

function textCounter(field, countfield, maxlimit) {
   if(field.value.length > maxlimit){
      field.value = field.value.substring(0, maxlimit);
   }
   else{
      countfield.value = maxlimit - field.value.length;
   }
}


var highlightbehavior="TD"
var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor) {
	source=ie? event.srcElement : e.target
	if (source.tagName=="TABLE")
	return
	while(source.tagName!=highlightbehavior && source.tagName!="HTML")
	source=ns6? source.parentNode : source.parentElement
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
	source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { 
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}

function ViewUserProfile(UserId,LgType,SessId) {
	OpenURL = "../cgi-bin/index.pl?f=mem&s=pfview&x=" + UserId + "&l=" + LgType + "&u=" + SessId;
	thewindow = window.open(OpenURL, 'UserProfileWindow', config='height=400,width=500,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
}




var dom = (document.getElementById && !document.all)? 1: 0;
function show_hide(the_id,Hide_1,Hide_2)
{
 var obj_1 = (dom)? document.getElementById(Hide_1): document.all[Hide_1];
 var obj_2 = (dom)? document.getElementById(Hide_2): document.all[Hide_2];
  obj_1.style.visibility = "hidden";
  obj_1.style.display = "none";
  obj_2.style.visibility = "hidden";
  obj_2.style.display = "none";

 var obj = (dom)? document.getElementById(the_id): document.all[the_id];
 if(obj.style.visibility == "hidden"){ // show
   obj.style.visibility = "visible";
   obj.style.display = "block"; 
 }
 else { // hide
    obj.style.visibility = "hidden";
    obj.style.display = "none";
  }
}

function show_source(the_id)
{
 var obj = (dom)? document.getElementById(the_id): document.all[the_id];
 if(obj.style.visibility == "hidden"){ // show
   obj.style.visibility = "visible";
   obj.style.display = "block"; 
 }
 else { // hide
    obj.style.visibility = "hidden";
    obj.style.display = "none";
  }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore(ImageName) { //v3.0
//  document.AutoSurf.ImageName.value = ImageName;
  var PauseFlag = document.AutoSurf.PauseState.value;
  if ((ImageName == "PauseButton") && (PauseFlag == 1)) { return; }
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//var PauseFlag = document.AutoSurf.PauseState.value;
var CountDown=10
var t
function timedCount()
{
var GetURL = document.AutoSurf.GetNextURL.value;
if (document.AutoSurf.PauseState.value == 1) { return; }
else {
	document.getElementById('SurfCounter').value=CountDown
	CountDown=CountDown-1
	if (CountDown == -1) { location.href = GetURL; }
	else { t=setTimeout("timedCount()",1000) }
}
}
function SetPause() {
	var PauseFlag = document.AutoSurf.PauseState.value;
	if (PauseFlag == 0) { 
		document.AutoSurf.PauseState.value = 1;
		MM_swapImage('PauseButton','','../images/pause_on.gif',1);
	}
	else { 
		document.AutoSurf.PauseState.value = 0;
		t=setTimeout("timedCount()",1000);
		MM_swapImgRestore('PauseButton');
	}
}
function ForcePause () { 
	document.AutoSurf.PauseState.value = 1;
	MM_swapImage('PauseButton','','../images/pause_on.gif',1);
}

function SubmitSearch() {
	var SearchKey = document.SearchAll.SearchKey.value;
	if ((SearchKey.indexOf ('Keyword', 0) > -1) || (!ValidLength(SearchKey,3))) { return false; }
	else { document.SearchAll.submit(); }
}

//-->
