//Function to change page from option list
function linkURL(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//PenguinO
function loadHTML(url,elename)
{
//theRequester = 'xmlhttp' + elename;

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  window["theRequester_xmlhttp_" + elename] =new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  window["theRequester_xmlhttp_" + elename]=new ActiveXObject("Microsoft.XMLHTTP");
  }

window["theRequester_xmlhttp_" + elename].onreadystatechange=function(){
	if (window["theRequester_xmlhttp_" + elename].readyState==4 && window["theRequester_xmlhttp_" + elename].status == 200)
		{
		document.getElementById(elename).innerHTML=window["theRequester_xmlhttp_" + elename].responseText;
		}
	else
		{
		document.getElementById(elename).innerHTML="Loading...";
	}
};  
window["theRequester_xmlhttp_" + elename].open("GET",url,true);
window["theRequester_xmlhttp_" + elename].send(null);
//if(window["theRequester_xmlhttp_" + elename].status == 200) document.getElementById(elename).innerHTML=window["theRequester_xmlhttp_" + elename].responseText;
}

function W3C_table(prefix){
	document.write(prefix + document.getElementById('W3C_menu').innerHTML);
}

function showDiv(objectID) {
	var theElementStyle = document.getElementById(objectID);

	if(theElementStyle.style.display == "none")	{
		theElementStyle.style.display = "block";
	}
	else {
	theElementStyle.style.display = "none";
	}
}

function hide1way(objectID) {
	var theElementStyle = document.getElementById(objectID);

	theElementStyle.style.display = "none";
}

//PenguinO

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}
// UserMenu functions
// Mod by Venky, http://venki.seccomnetworks.net, hrvojevencl@gmail.com
// Thanx to this site: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
var intUserID=0;
var strUserName='';
function ShowUserMenu(UserID, UserName){
	intUserID = UserID;
	strUserName = UserName;
	var intUserLeft = 0, intUserTop = 0, intWindowWidth = 0,  intWindowHeight = 0;
	//scroll
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		intUserTop = window.pageYOffset;
		intUserLeft = window.pageXOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		intUseCrTop = document.body.scrollTop;
		intUserLeft = document.body.scrollLeft;
	}
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		intUserTop = document.documentElement.scrollTop;
		intUserLeft = document.documentElement.scrollLeft;
	}
	//window size
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		intWindowWidth = window.innerWidth;
		intWindowHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		intWindowWidth = document.documentElement.clientWidth;
		intWindowHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		intWindowWidth = document.body.clientWidth;
		intWindowHeight = document.body.clientHeight;
	}

	//Menu
	if((intWindowWidth - 200)>(event.clientX + intUserLeft)){
		document.all.UserMenu.style.pixelLeft = event.clientX + intUserLeft;
	}
	else{
		document.all.UserMenu.style.pixelLeft = event.clientX + intUserLeft - 200;
	}
	document.all.UserMenu.style.pixelTop = event.clientY + intUserTop; 
	document.all.UserMenu.style.visibility="visible";
	return false;
}
function HideUserMenu(){
	UserMenu.style.visibility="hidden";
}
function SMO(elem){
	elem.style.backgroundColor = '#CCEEFF'; elem.style.cursor = 'hand'
}
function SMU(elem){
	elem.style.backgroundColor = '#FFFFFF';
}
function SMLIDN(path){
	window.open(path + intUserID);
}
function SMLIDL(path){
	location.href = path + intUserID;
}
function SMLUN(path){
	location.href = path + strUserName;
}
// UserMenu functions
// Mod by Venky, http://venki.seccomnetworks.net, hrvojevencl@gmail.com
function ResizeImages(){
	if(document.images.length > 0){
		var intImgHeight = 0, intImgWidth = 0, intForCounter = 0;
		for(intForCounter; intForCounter < document.images.length; intForCounter++){
			intImgWidth = document.images[intForCounter].width;
			if(intImgWidth > 700){
				intImgHeight = document.images[intForCounter].height;
				document.images[intForCounter].style.width = "700px";
				document.images[intForCounter].style.height = (intImgHeight / (intImgWidth / 700)) + "px";
			}
		}
	}
}

function FitImages(){
	if(document.images.length > 0){
		var intImgHeight = 0, intImgWidth = 0, intForCounter = 0;
		for(intForCounter; intForCounter < document.images.length; intForCounter++){
			intImgWidth = document.images[intForCounter].width;
			if(intImgWidth > 700){
				//intImgHeight = document.images[intForCounter].height;
				document.images[intForCounter].style.width = "100%";
				document.images[intForCounter].style.height = "100%";
			}
		}
	}
}

