var lastClick = false;

function directSearch(form) {
	var action = form.action;
	
	if (form.q[0].checked) {
		action="index.php";
	}
	
	form.action=action;

}

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}
function getHTMLSize () {
	var x,y;
	var test0 = (document.documentElement)?document.documentElement.scrollHeight:0
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	
	
	if (test0 > test1) // all but Explorer Mac
	{
		x = document.documentElement.scrollWidth;
		y = document.documentElement.scrollHeight;
	}
	else if (test1 > test2) // all but Explorer Mac
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else // Explorer Mac;
	     //would also work in Explorer 6 Strict, Mozilla and Safari
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}

	var data = new  Object()
	data.x = x
	data.y= y

	return(data);
}

function isIE () {
	return((navigator.appName=="Microsoft Internet Explorer")? true: false);
}

function get100percentHeight() {
	var data = getHTMLSize()
	
	return ((data.y) +"px");
	

}

function make100percentHeight (div) {

	//if (isIE())  {
	div.style.height = get100percentHeight();
	//}

}


function showInteraction(id) {

	parent.showInteraction(id);
}

function closePopUp() {
	if (document.getElementById("summaryContent")) 
		document.getElementById("summaryContent").style.visibility ="hidden";
		
	if (document.getElementById("summaryOverlay")) 
		document.getElementById("summaryOverlay").style.visibility ="hidden";
		
}

function showPopUp() {
	
	if ( lastClick && document.getElementById("summaryContent")) {

		document.getElementById("summaryOverlay").style.visibility ="visible";
		make100percentHeight(document.getElementById("summaryOverlay"));
		document.getElementById("summaryContent").style.visibility ="visible";
		document.getElementById("summaryContent").style.left =lastClick.x +"px"
		document.getElementById("summaryContent").style.top =lastClick.y +"px";
		
		}
}

function showSearchSummary(id, e) {
	e = e || window.event;
	
	var page = "pageContent.php?pageid=" + id;
	
	lastClick = getPosition(e);
	
	closePopUp();
	//document.getElementById("contentIFrame").src=page;
	frames['contentIFrame'].location =page;
	
	
	return(false);

}

function contentNotifyUpdate() {
	parent.document.getElementById("summaryContent").innerHTML =document.getElementById("pageSummary").innerHTML;
	parent.showPopUp();
	//alert("here");
}


function viewEvent(url)
{	 
  window.open(url, "event", "width=540,height=320,scrollbars=yes");
  return false;
}

