
var browser = {
	dom:(document.getElementById != null),
	ie:(document.all && parseInt(navigator.appVersion) >= 4),
	ns:(document.layers && parseInt(navigator.appVersion) >= 4)
}

function getLayer(name) {
	if (browser.dom) return document.getElementById(name);
	else if (browser.ie) return document.all[name];
	else if (browser.ns) return document.layers[name];
}

function change_picture(where, what){
	
	if (document.images){
		document.images[where].src = eval("loadImages." + what + ".src");
	}
						
}

function openW(urlW, width_w, height_w, scroll_bar){
	center_x = Math.round((window.screen.availWidth - width_w) / 2);
	center_y = Math.round((window.screen.availHeight - height_w) / 2);
	
	window.open(urlW,'_blank','top=' + center_y + ',left=' + center_x + ',width=' + width_w + ',height=' + height_w + ',status=no,titlebar=no,toolbar=no,menubar=no,location=no,resizable=no,directories=no,scrollbars=' + scroll_bar);
}

function submitSend() {
	document.sendfrm.submit();
}

function submitCancel() {
	document.sendfrm.Action.value = "Cancel";
	document.sendfrm.submit();
}

function submitSearch() {
	document.searchfrm.submit();
}

function popupWindow(name, url, imgWidth, imgHeight, options) {
	var winWidth 		= 100;
	var winHeight 		= 100;
	var screenHeight 	= screen.availHeight;
	var screenWidth		= screen.availWidth;

	if (imgWidth>screenWidth)		winWidth = screenWidth; else winWidth = imgWidth;
	if (imgHeight>screenHeight)		winHeight = screenHeight; else winHeight = imgHeight;

	var params = "width=" + winWidth + ", height=" + winHeight;
	params += options ? ", " + options.join(",") : "";
	var popup = window.open(url, name, params);
	return popup;
}
function documentWindow(name, content, width, height, scroll) {
	var options = [];
	options.push("scrollbars=" + (scroll ? "yes" : "no"));
	var popup = popupWindow(name, "", width, height, options);
	popup.document.open();
	popup.document.write(content);
	popup.document.close();
	popup.focus();
}
function imageWindow(title, src, width, height, alt)
{
	width = width;
	height = height;
	var name = 'img';
	var html = "<html>";
	html += "<head><title>" + title + "</title></head><body style=\"margin:0px\">";
	html += "<a href=\"javascript:close()\"/><img src=\"" + src + "\" border=\"0\" alt=\"" + (alt != undefined ? alt : '') + "\" /></a>";
	html += "</body></html>";
	documentWindow(name, html, width, height, false);
}


