﻿function DoSearch(itemid) {
	location.href = "/?path="+itemid+"&search="+document.getElementById("searchfield").value + "&searchprodonly="+ document.getElementById("searchprodonly").checked + "&searchfiles=false";
}

function PostSearch(buttonid) {    
	if (window.event.keyCode == 13) {
		window.event.returnValue = false;
		var button = document.getElementById(buttonid);
		if (button != null) {
			button.click(); 
		}
	}
}

function DoAdvancedSearch(itemid) {
	var loc = "/?path="+itemid;
	loc += "&search="+document.getElementById("searchfield2").value;
	loc += "&searchprodonly="+document.getElementById("searchprodonly2").checked;
	loc += "&searchfiles="+document.getElementById("searchfiles2").checked;
	location.href = loc;
}

function TableHover(obj, col, id, color2) {
	if (obj) {
		var div = document.getElementById("listdiv"+id);
		div.style.borderRight = "1px solid " + col;
		obj.style.color = col;
		obj.style.borderTop = "1px solid " + (color2 ? color2 : col);
		obj.style.borderBottom = "1px solid " + (color2 ? color2 : col);
		for(var e = new Enumerator(obj.all); !e.atEnd(); e.moveNext()) {
			e.item().style.color = col;
		}
	}
}

function LinkHover(obj, on, color, id) {
	var a = obj.childNodes[0];
	var b = obj.childNodes[1];
	if ((!a || !b) && id) {
		a = document.getElementById(id);
		if (a) {
			b = a.nextSibling;
		}
	}
	if (a && b) {
		if (on) {
			a.style.display = "none";
			b.style.display = "";
		} else {
			a.style.display = "";
			b.style.display = "none";
		}
	}
	if (color) obj.style.color = color;
}

function DoPrint() {
	var loc = location.href;
	var pri = "?print=1";
	if (loc.indexOf("?")>0) {
		pri = "&print=1";
	}
	if (loc.indexOf("#")>0) {
		loc = loc.substring(0, loc.indexOf("#"));
	}
	window.open(loc+pri, "", "toolbar=1,location=0,directories=0,status=0,menubar=yes,scrollbars=yes,resizable=yes,width=769,height=400");
}