// Need4U Main Library with functions
// Author : Ronald Need
// (C) 2004-2005
// http://www.need4u.nl/
		
//--Global variables------------------------------------------

var authUser = false;
var loginAttempts = 0;
var custID = "";
var custUser = "";
var custPass = "";
var newEntry = true;
var tickerOn = false;
var newsPage = "Index2.html";
var newsItem = 0;

//--Browser Detection---------------------------------------

var ns4= (navigator.appName=='Netscape' && parseInt(navigator.appVersion)==4);
var ns6= (document.getElementById)? true:false;
var ie4plus = (document.all)? true:false;
var ver4 = (ns4 || ie4plus || ns6) ? true : false;

// script to escape from other frames and to set 
// window size to a maximum size of 1024 x 768 pixels or to
// the maximum available size if less than 1024 x 768 pixels

if (top.frames.length != 0) {
	top.location = self.document.location;
}

if (screen.width > 1024 && screen.height > 768) {
	var windowW = 1024;
	var windowH = 768;
	var windowX = (screen.availWidth/2)-(windowW/2);
	var windowY = (screen.availHeight/2)-(windowH/2);
}
else {
	var windowW = screen.availWidth;
	var windowH = screen.availHeight;
	var windowX = 0;
	var windowY = 0;
}

//Auto Maximize Window Script

top.window.moveTo(windowX,windowY);
if (document.all) {
	top.window.resizeTo(windowW,windowH);
}
else if (document.layers||document.getElementById) {
	if (top.window.outerHeight < windowH||top.window.outerWidth < windowW){
	top.window.outerHeight = windowH;
	top.window.outerWidth = windowW;
	}
}


//--scripts to display and clear messages in the Status Bar--

	function clearStatus() {
		
		window.status= '';
	  	return true
	}
	
	function setStatus(msg) {
		
		window.status= msg;
	  	return true
	}

//--End of status messages scripts---------------------------

// Script to another page in history -----------------------------

function previousPage(step) {
	history.go(step);
}

//--End of script -----------------------------------------------

//--Script to display popup images----------------------------

var popimg = null;

function closePopUpImg(){

	if(popimg != null) if(!popimg.closed) popimg.close();

}

function openPopUpImg( title, pic , windowW , windowH , pos ){

	var windowX = (screen.availWidth/2)-(windowW/2);
	var windowY = (screen.availHeight/2)-(windowH/2);

	if (pos == 0) {
		windowX = 10;
		windowY = 10;
	}

	setStatus('Retrieving Image....');
	closePopUpImg();
	popimg = window.open("","title","height="+windowH+",width="+windowW+",left="+windowX+",top="+windowY+",resizable=no,status=no,toolbar=no,scrollbars=no,location=no,menubar=no,directories=no");     
	popimg.document.open();
	popimg.document.write('<HTML><HEAD><TITLE>'+title+'</TITLE></HEAD><BODY onBlur="self.close()" onClick="self.close()" BGCOLOR="#FFFFFF" BACKGROUND="'+pic+'"></BODY></HTML>');
	popimg.document.close();
	popimg.focus();
	clearStatus();
}


//--Script to open a PDF document in a new window----------

function openPdfDoc(url) {

	var windowH = 0.8 * screen.availHeight;
	var windowW = 0.8 * screen.availWidth;
	
	var pdfdoc = window.open(url,"pdfdoc","height="+windowH+",width="+windowW+",left=0,top=0,resizable=yes,status=yes,toolbar=no,scrollbars=no,location=no,menubar=no,directories=no");
	pdfdoc.focus();

}

//----end of Library with main functions ------------------------------------------
