// JavaScript Document: Login scripts

<!--

if (top.frames.length != 0) {
   top.location = self.document.location;
}

var bPCookieOff = false;
var bSCookieOff = false;

document.cookie = "testsession=on"; 
if (document.cookie.indexOf("testsession=on") == -1){
   bSCookieOff = true;
}
var exp = new Date();
var oneYearFromNow = exp.getTime() + (365*24*60*60*1000);
exp.setTime(oneYearFromNow);
document.cookie= "testpermenent=on; expires=" + exp.toGMTString();

if (document.cookie.indexOf("testpermenent=on") == -1 ){
   bPCookieOff = true;
}

if ( bSCookieOff && bPCookieOff ) {
   location = '/help/us/nocookies.asp';
}

function open_agreement()
{
   remote = window.open("/cougar/member/terms.html", "_remote_control", "toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=450,width=530,copyhistory=no");
   if ( remote != null ) {
       if ( remote.opener == null ) {
           remote.opener = self;
       }
   }
}

function open_remote01(url) {
  remote = window.open(url, "_remote_control",
    "toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=380,width=675,copyhistory=no");
}

function ValidateForm(form)
{
   if ( bPCookieOff && form.in_persistent.checked ) {
       alert("We cannot remember your login name and password because your web browser settings do not allow cookies that are stored on your computer. If you would like Intranets.com to remember your login name and password, please change your browser settings. Otherwise, please de-select the \"Remember\" option." );
       return false;
   }

   if ( bSCookieOff && !form.in_persistent.checked ) {
       alert("Your web browser settings do not currently allow per-session cookies. To log in, you need to either change your browser settings to allow per-session cookies or select the \"Remember my login name and password\" option." );
       return false;
   }
   form.jstest.value = "javascript on"; 
   if ( form.in_agree != null ) {
       if (!(form.in_agree.checked)){
           alert("You must agree to the Intranets.com Terms of Service before you can activate this Site.");
           return false;
       }
   }
   return true;
}

function ValidateGuestUserLogin(form)
{
   if ( bSCookieOff ) {
       alert("Your web browser settings do not currently allow per-session cookies. To enter this site as a guest, you need to either change your browser settings to allow per-session cookies." );
       return false;
   }
   form.jstest.value = "javascript on"; 
   form.guest.value = "on"; 
   return true;
}

function EnterAsGuest()
{
   var form;
   if (document.layers)
   {
       form = top.document.layers['site-page-contents'].document.forms[0];
   }
   else
   {
       form = document.forms[0];
   }

   if ( ValidateGuestUserLogin(form) ) {
       form.submit();
   }
}

//-->
