<!--

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//----------------------------------------------------------------
//  Usernames, Passwords & User Pages - These require configuration.
//----------------------------------------------------------------
var securepath = "https://secure.procyon.lunarpages.com/~njasls2/"; // The path for SSL certificate.
var homepath = "http://www.njasls.org/";  // The home page.
var successpage = securepath+"index_off.htm"; // The page users go to after login, if they have no personal page.
var loginpage = homepath+"index.htm"; //Change this to the page the login panel is on.

var ckTemp = document.cookie;
var ismember= checkforCookie();

//----------------------------------------------------------------
//  Login Functions
//----------------------------------------------------------------

function chk_loggedin(loggedin){
  if(loggedin == 1){
    if (top.location.href != location.href){
      location.href = successpage;           
      top.location.href = successpage;           
    }
    else{
      top.location.href = successpage;  
    }
    setCookie("login",1);
	ismember=true;
  }
  else{
    logonPopup(0);
  }  
}

function logout() {
 deleteCookie("login");
 if (top.location.href != location.href){
  location.href = loginpage;           
 }
 else{
  top.location.href = loginpage;  
 }
}

//----------------------------------------------------------------
// Cookie Handler
//----------------------------------------------------------------

function setCookie(name, value) { 
 if (value != null && value != "")
  document.cookie=name + "=" + escape(value) + ";";
 ckTemp = document.cookie;
}
 
function deleteCookie(name) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function getCookie(name) { 
 var index = ckTemp.indexOf(name + "=");
 if (index == -1) return null;
 index = ckTemp.indexOf("=", index) + 1;
 var endstr = ckTemp.indexOf(";", index);
 if (endstr == -1) endstr = ckTemp.length;
 var retval = ckTemp.substring(index, endstr);
 return unescape(retval);
}
  
function checkCookie() {
 var temp = getCookie("login");
 if(!temp==1) {
  window.alert("You must login as a NJASLS member to access this page.  To join NJASLS please go to the Membership page and submit an application.");
  if(top.location.href != location.href){
   location.href = loginpage;           
  }
  else{
   top.location.href = loginpage;  
  }
 }
}

function checkforCookie() {
 var temp = getCookie("login");
 if(!temp==1) {
  return(false); 
 }
 return(true);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

function logonPopup(newwin)
{
	var url = securepath+"logon.htm";
	var width = 370;
	var height = 420;
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.width - width) / 2;
	var winprops = 'height='+height+',width='+width+',top='+wintop+',left='+winleft+',resizable=yes,scrollbars=yes';
	window.location = url;
}

function chgcolor(str, tocolor) 
{
	if (document.all) str.style.color = tocolor;
}

function logoff()
{
	deleteCookie("login");
	ismember = false;
	window.location = securepath+"cgi-bin/logoff.cgi";
}

function logged_in(url)
{
	var wpath = new String;
	if (ismember==true) {
		window.location = securepath+url+".htm";
		return(true);
	}
	else window.alert("You must login as a NJASLS member to access this page.  To join NJASLS please go to the Membership page and submit an application.");
	return;
}

function logchk(wp, ap)
{
	var wpath = wp;
	var fpath = new String;
	var anchorp = new String;
	fpath = "http://www.njasls.org/";
	if (ap != "") anchorp = ".htm#"+ap;
	else anchorp = ".htm";
	
    if (ismember==false) {
	   if (wpath == "index") {
	         window.location = fpath+"index.htm";
	   }
	   else {
			window.location = fpath+wpath+"_on"+anchorp;
	   }
	}
	else {
	   window.location = securepath+wpath+"_off"+anchorp;
	}
}


//-->

