var newhttp

function getXmlHttpRequestObject() {
        if (window.XMLHttpRequest) {
                return new XMLHttpRequest();
        } else if (window.ActiveXObject) {
                return new ActiveXObject("Microsoft.XMLHTTP");
        } else {
        }
}

function InfoWindow (url, name, height, width) {
	window.open(url, name, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,height="+height+",width="+width);
	return false;
}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function'){
        window.onload = func;
    } else {
        window.onload = function(){
        oldonload();
        func();
        }
    }

}

function showDiv (showDiv, hideDiv) {
	document.getElementById(showDiv).style.display = 'block';
	document.getElementById(hideDiv).style.display = 'none';
}

var currentSearch = 'search';

function searchTab () {

	if (currentSearch == 'search') {
			document.getElementById('advancedsearch').style.display = 'block';
			document.getElementById('normalsearch').style.display = 'none';
			document.getElementById('search_tab').src = '/_images/buttons/nav_search.png';
			currentSearch = 'advancedsearch';

	} else {
			document.getElementById('normalsearch').style.display = 'block';
			document.getElementById('advancedsearch').style.display = 'none';
			document.getElementById('search_tab').src = '/_images/buttons/advancedsearch.png';
			currentSearch = 'search';
	}

}

function divvisible(div) {
	document.getElementById(div).style.visibility="visible";
}
function divinvisible(div) {
	document.getElementById(div).style.visibility="hidden";
}

function countrychange(country) {
	var id = country + "img";
	if(country=="none"){document.getElementById("Germanyimg").src = "/_images/header/Germany.png";
	document.getElementById("Irelandimg").src = "/_images/header/Ireland.png";
	document.getElementById("Greeceimg").src = "/_images/header/Greece.png";
	document.getElementById("Ukimg").src = "/_images/header/Uk.png";}else{
	document.getElementById(id).src = "/_images/header/" + country + "_titled.png";
	if(country!="Germany"){document.getElementById("Germanyimg").src = "/_images/header/Germany_white.png";}
	if(country!="Ireland"){document.getElementById("Irelandimg").src = "/_images/header/Ireland_white.png";}
	if(country!="Greece"){document.getElementById("Greeceimg").src = "/_images/header/Greece_white.png";}
	if(country!="Uk"){document.getElementById("Ukimg").src = "/_images/header/Uk_white.png";}
	}
}
function change_img(name,alt,address,holder) {
	var id = 'LF_' + holder + '_img';
	var img = document.getElementById(id);
	img.src = "_images/homepage_0809/LF_" + holder + "_" + name + ".png";
	img.alt = alt;
	var hrefid = id + "_link";
	var hreflink = document.getElementById(hrefid);
	hreflink.href = address;
}
function contact_change_img(name,alt,holder) {
	var id = holder;
	var img = document.getElementById(id);
	img.src = "_images/contact/" + name;
	img.alt = alt;
}