//**** login box function ****
function lgn(type){
	window.onerror=lgn2;
	set_jump();
	if(type != "" && type != null){
		newlogin=window.open("/cgi-bin/login_frames.cgi?t="+type,'newlogin','width=600,height=300,toolbar=no,location=no,directories=no,status=no,menubar=noscrollbars=no,resizable=yes,left=100,top=100,screenX=100,screenY=100');
	}else{
		newlogin=window.open("/cgi-bin/login_frames.cgi",'newlogin','width=600,height=300,toolbar=no,location=no,directories=no,status=no,menubar=noscrollbars=no,resizable=yes,left=100,top=100,screenX=100,screenY=100');
	}
	newlogin.opener=parent.main;
	window.onerror=MyJSError;
	//	newlogin.sidebar=self;
}
// USed for error jump when detecting url in main frame
function lgn2(type){
	window.onerror=MyJSError;
	if(type != "" && type != null){
		newlogin=window.open("/cgi-bin/login_frames.cgi?t="+type,'newlogin','width=600,height=300,toolbar=no,location=no,directories=no,status=no,menubar=noscrollbars=no,resizable=no,left=100,top=100,screenX=100,screenY=100');
	}else{
		newlogin=window.open("/cgi-bin/login_frames.cgi",'newlogin','width=600,height=300,toolbar=no,location=no,directories=no,status=no,menubar=noscrollbars=no,resizable=no,left=100,top=100,screenX=100,screenY=100');
	}
	newlogin.opener=parent.main;
}


//Retrieve URL data from main frame and set cookie for jump after login
//example url processing: http://10.10.10.2/html/products/brady/somefile.html?abc=1
function set_jump(){
	temp_array1 = new Array();
	temp_array2 = new Array();
	temp_array3 = new Array();
	fullurl=new String(top.main.location);
	//alert(fullurl);
	temp_array1=fullurl.split("//");
	// array contains [0] http:  [1] 10.10.10.2/html/products/brady/somefile.html?abc=1
	// assign [1] for processing
	temp1=new String(temp_array1[1]);
	temp_array2=temp1.split("?");
	// array contains [0] 10.10.10.2/html/products/brady/somefile.html [1] abc=1
	// assign [0] for processing
	temp2=new String(temp_array2[0]);
	temp_array3=temp2.split("/");
	// array contains [0] 10.10.10.2  [1] html  [2] products  [3] brady  [4] somefile.html
	// assign [4] to filename var using length of array to assign
	domain= new String(temp_array3[0]);
	filename=new String(temp_array3[temp_array3.length-1]);
	// assign main directory
	directory=new String(temp_array3[1]);
	//reassemble array skipping ip/domain
	jumpurl = new String();
	for(i=1;i<temp_array3.length;i++){
		jumpurl = jumpurl+"/"+String(temp_array3[i]);
	}
	// Set jump url to new url if the jumpurl is not the homepage	
	if(directory != "cgi-bin"){
		//alert(jumpurl);
		clear_jump();
		path= new String("/cgi-bin/");
		var expdate = new Date ();
		expdate.setTime (expdate.getTime() + (30 * 60 * 1000)); // 30 Minutes From Now
		SetCookie ("jump", jumpurl, expdate, path, domain);
	}else{
		oldjump = GetCookie("jump");
	}
}
//clear any existing jump cookies
function clear_jump(){
   var thePath='/';
	 var Then  = new Date();        
   var Now   = new Date();
	 SiteAccess= new String(Math.round(Now.getTime()/1000));
	 ExpireNow = new String(Now.toGMTString());
	 Then.setTime(Then.getTime() + 480 * 60 * 1000);
	 ExpireLater = new String(Then.toGMTString());
	 document.cookie = "jump=;path="+thePath+";expire="+ExpireLater+";";
}
