var aObjects = new Array(); 
function t4e_ScreenShot_Init(name) { aObjects [aObjects.length] = name.replace ("source", "sheet"); var item = new T4e_getObj (name); if (item == null) return false; item.obj.onmouseup = t4e_ScreenShot_register; if (item.obj.captureEvents) item.obj.captureEvents(Event.MOUSEUP) }
var TopPosition = 0; 
function t4e_ScreenShot_register(e) { if (!e) e = window.event; if (e.pageY) { TopPosition = document.body.scrollTop;} else if (e.clientY) { TopPosition = document.body.scrollTop;} }
function T4e_getObj(name) { if (document.getElementById) { this.obj = document.getElementById(name); if ( this.obj == null) return null; this.style = document.getElementById(name).style;} else if (document.all) { this.obj = document.all[name]; if (this.obj == null) return null; this.style = document.all[name].style;} else if (document.layers) { this.obj = document.layers[name]; this.style = document.layers[name];} } 
function T4e_GetNewStyle ($item) { if ($item == null) return ""; if ($item.style.visibility == "hidden") { return "visible";} else { return "hidden";} } 
function T4e_HideObject (name) { var x = new T4e_getObj (name); if (x.style == null) return false; x.style.visibility = 'hidden';} 
function T4e_ShowFancyScreenPopup (item) { if (item == null) return; var style = T4e_GetNewStyle (item); for (i=0; i < aObjects.length; i++) { T4e_HideObject (aObjects [i]);} item.style.visibility = style; item.style.top = 50 + TopPosition;}

function ShowScreenPopup ($url)
{
	//scrollbars=yes,
	w = window.open ($url, "t4eshowscreen", "resizable=yes,titlebar=yes,scrollbars=1");
}

function startSearch() {
	location.href = "/xsearch?q=" + encodeURIComponent(document.getElementById("searchQuery").value) + "&submit=search";
}

var contactForm = new function() {
	this.pos = 0;
	this.out = false;
	this.defCfLink = false;
	
	this.show = function() {
		if (this.out) {
			document.getElementById('cf_link').firstChild.nodeValue = this.defCfLink;
			document.getElementById('contact_form_form').style.display = 'none';
		}
		this.iterate();
	}
	
	this.iterate = function() {
		this.pos = Math.round(Math.max(0, Math.min(600, this.pos + (this.out ? -1 : 1) * Math.max(1, 75 - this.pos / 9))));
		document.getElementById('contact_form').style.width = this.pos + 'px';
		if (this.pos == 0) {
			this.out = false;
		}
		else if (this.pos == 600) {
			this.out = true;
			document.getElementById('contact_form_form').style.display = 'block';
			if (!this.defCfLink) this.defCfLink = document.getElementById('cf_link').firstChild.nodeValue;
			document.getElementById('cf_link').firstChild.nodeValue = 'Close window';
		}
		else {
			setTimeout("contactForm.iterate()", 30);
		}
	}
}

function setHomeBlocks() {
	var handle, i, height;
	if (handle = document.getElementById('content_fp')) {
		if (height = handle.offsetHeight) {
			for (i = 0; i < handle.childNodes.length; i++) {
				if (handle.childNodes[i].className == 'fp_block') {
					handle.childNodes[i].style.height = (height - 12) + 'px';
				}
			}
		}
	}
}

window.onload = function() {
	setHomeBlocks();
}
