

// JavaScript Document
if (top.location != location) top.location.href = document.location.href ;
  			
function doresize(s){		
	document.getElementById("main").height = s + 10;			
	document.getElementById("area").height = s;		
}
	
function removeLoginPanel(){	
	document.getElementById("login").style.display = "none"; 	
	document.getElementById("logout").style.display = "block"; 	
}

function showLoginPanel(){
	document.getElementById("login").style.display = "block"; 
	document.getElementById("logout").style.display = "none";	
}
	
function checkLoginPanel(){	
	var s = document.getElementById("area").src;	   		
	if ( s.substring(0, 37) == "http://code-logic.com/pages/login.php"   ) 	{			
		document.getElementById("login").style.display = "none"; 
		document.getElementById("logout").style.display = "block";				
	}else{
		document.getElementById("login").style.display = "block"; 
		document.getElementById("logout").style.display = "none";				
	}	
}
		
function login(a, u, p){	
		
			
			//document.write(a.loginForm.value);
			
	doMem(a);	
	if (u.value == "") {
		alert("Please enter your user name.");
		return false;
	}      
	if (p.value == "") {
		alert("Please enter your password.");
		return false;
	}
	
	document.submitForm.username.value = u.value;
	document.submitForm.password.value = p.value;
	document.submitForm.submit();	
	
	
	/*doMem(a);	
	if (frm.username.value == "") {
		alert("Please enter your user name.");
		return false;
	}      
	if (frm.password.value == "") {
		alert("Please enter your password.");
		return false;
	}
	
	frm2.username.value = frm.username.value;
	frm2.password.value = frm.password.value;
	frm2.submit();	*/
	
}




function alternateCheck(chkbox){
	chkbox.checked = !chkbox.checked;		
}
	

function doMem(a){	
	if (document.getElementById("checkbox").checked) {
		toMem(a);			
	}else{
		delMem(a);
	}		
	
}
	
	// JavaScript Document

function newCookie(username,value,days) {
 var days = 10;   // the number at the left reflects the number of days for the cookie to last
                 // modify it according to your needs
 if (days) {
   var date = new Date();
   date.setTime(date.getTime()+(days*24*60*60*1000));
   var expires = "; expires="+date.toGMTString(); }
   else var expires = "";
   document.cookie = username+"="+value+expires+"; path=/"; 
   
   }

function readCookie(username) {
   var usernameSG = username + "=";
   var nuller = "";
  if (document.cookie.indexOf(usernameSG) == -1)
    return nuller;

   var ca = document.cookie.split(";");
  for(var i=0; i<ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==" ") c = c.substring(1,c.length);
  if (c.indexOf(usernameSG) == 0) return c.substring(usernameSG.length,c.length); }
    return null; }

function eraseCookie(username) {
  newCookie(username,"",1);
  }

function toMem(a) {
    newCookie("theusername", document.loginForm.username.value);     // add a new cookie as shown at left for every
    newCookie("thepassword", document.loginForm.password.value);   // field you wish to have the script remember
}

function delMem(a) {
  eraseCookie("theusername");   // make sure to add the eraseCookie function for every field
  eraseCookie("thepassword");
}

