window.onload = function() {
	if (document.getElementById) {
		testBrowser();
		checkHeight()
		createDummyNav();
		sendNewsletter();
		tipAFriend();
		opacSearch();
	}
}
function Is() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.mac = (agent.indexOf("mac")!=-1);
	this.macie5 = (this.mac && (agent.indexOf("msie 5.0")!=-1));
}
function testBrowser() {
	var is = new Is();
	if (is.macie5) {
		window.open("/old_popup.html", "oldpopup", "width=320, height=320");
	}
}

function checkHeight() {
	if(document.getElementById("campaignDiv")) {
		if (document.getElementById("contentDiv").clientHeight < document.getElementById("campaignDiv").clientHeight) {
			document.getElementById("contentDiv").style.height = document.getElementById("campaignDiv").clientHeight + "px";
		}
	}
}
function createDummyNav() {
	if(document.createElement) {
		for(i=1;i<=40;i++) {
			dummyRow = document.createElement("div");
			document.getElementById("navDiv").appendChild(dummyRow);
			dummyRow.className = "navDummy"
		}
	}
}
function sendNewsletter() {
	if(document.forms["NewsletterSubscribe"]) {
		document.forms["NewsletterSubscribe"].onsubmit = function() {
			var mailadr = document.forms["NewsletterSubscribe"]["Email"].value;
			var FormOpener = document.forms["NewsletterSubscribe"]["FormOpener"].value;
			listpopupStr = '/newsletter/index.xml?Email=' + mailadr + "&FormOpener=" + FormOpener + "&isJavaScriptEnabled=true";
			var popupWindow = window.open(listpopupStr,"listpopupWin","width=320, height=320");
			popupWindow.focus();
			return false;
		} 
	}
}
function tipAFriend() {

	if(document.getElementById("tipafriend")) {
		document.getElementById("tipafriend").onclick = function() {
			var strLink = document.forms["sendtofriendForm"]["Link"].value;
			var strName = document.forms["sendtofriendForm"]["Name"].value;
			var strFormOpener = document.forms["sendtofriendForm"]["FormOpener"].value;
			var listpopupStr = "/sendtofriend/index.xml?Link=" + strLink + "&Name=" + strName + "&FormOpener=" + "&isJavaScriptEnabled=true";
			var tipPopup = window.open(listpopupStr,"tippopupWindow","width=320, height=520, scrollbars");
			tipPopup.focus();
			return false;
		} 
	}
}

function opacSearch() {
	if(document.forms["OPACForm"]) {
		document.forms["OPACForm"].onsubmit = function() {
			var strOpacServer = document.forms["OPACForm"]["OpacServer"].value;
			var strOpacQuery = document.forms["OPACForm"]["OpacQuery"].value;
			opacPopupStr = strOpacServer + strOpacQuery;
			var popupWindow = window.open(opacPopupStr,"OpacPopupWin");
			popupWindow.focus();
			return false;
		} 
	}
}



