function newImage(arg){
	if (document.images){
		rslt = new Image();rslt.src = arg;return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)){
		for (var i=0; i<changeImages.arguments.length; i+=2){
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}

var preloadFlag = false;
if (document.images){preloadFlag = true;}

function popup(url, width, height) {
	mapwin = window.open(url,"","width="+(width+20)+",height="+(height+28));
	mapwin.focus();
}


function popup_img(img_id, width, height){
	width += 70
	height += 120
	
	if (width > 800) width = 800
	if (height > 600) height = 600
//	if (width < 320) width = 300
//	if (height < 200) height = 200

	popup_win = window.open("_popup_img.php?img_id=" + img_id, "img_" + img_id, "resizable=1,scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,width="+width+",height="+height)
	popup_win.focus()
}

function popup_imgurl(imgurl, width, height) {
	p_width = width + 40
	p_height = height + 70
	
	popup_win = window.open("_popup_imgurl.php?imgurl=" + imgurl + "&width=" + width + "&height=" + height, "",
		"resizable=1,scrollbars=1,toolbar=0,location=0,directories=0,status=1,menubar=0,width="+p_width+",height="+p_height);
	popup_win.focus();
}

function popup_bo(bo_href) {
	popup_win = window.open("backoffice/" + bo_href);
	popup_win.focus();
}
function popup_bomh(bo_href) {
	popup_win = window.open("backoffice/manheim/" + bo_href);
	popup_win.focus();
}

function print_area_on() {
	var div = document.getElementById("content");
	div.style.border = "1px dashed #575757";
	div.style.margin = "0px";
}

function print_area_off() {
	var div = document.getElementById("content")
	div.style.border = "0px solid #575757";
	div.style.margin = "1px";
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function layer_isopened(nr) {
	ret = 0
	layer_nr = MM_findObj("layer_" + nr)
//	alert ("layer_open(" + nr + "): " + layer_nr)
	if (layer_nr != null) {
		if (layer_nr.style.display == 'block') ret = 1
	}
	return ret
}

function layer_open(nr) {
	layer_nr = MM_findObj("layer_" + nr)
//	alert ("layer_open(" + nr + "): " + layer_nr)
	if (layer_nr != null) layer_nr.style.display = 'block'

	layer_opened_nr = MM_findObj("layer_opened_nr")
	if (layer_opened_nr != null) layer_opened_nr.value = nr
//	alert ("layer_open(" + nr + "): layer_opened_nr=" + layer_opened_nr.value)
}

function layer_close(nr) {
	layer_nr = MM_findObj("layer_" + nr)
//	alert ("layer_close(" + nr + "): " + layer_nr)
	if (layer_nr != null) layer_nr.style.display = 'none'

	layer_opened_nr = MM_findObj("layer_opened_nr")
	if (layer_opened_nr != null) layer_opened_nr.value = 0
//	alert ("layer_close(" + nr + "): layer_opened_nr=" + layer_opened_nr.value)
}

function layer_switch(nr) {
	for (i = 1; i <= layers_total; i++) {
	    if (i != nr) layer_close(i)
	}

	if (layer_isopened(nr)) layer_close(nr)
	else layer_open(nr)
}

function layer_switch_forceopened(nr) {
	for (i = 1; i <= layers_total; i++) {
	    if (i == nr) layer_open(i)
	    else layer_close(i)
	}
}

function ShowHelp(div, title, desc)
{
	div = document.getElementById(div);
	div.style.display = 'inline';
	div.style.position = 'absolute';
	div.style.width = '300';
	div.style.backgroundColor = 'lightyellow';
	div.style.border = 'dashed 1px black';
	div.style.padding = '10px';
	div.innerHTML = '<b>' + title + '</b><br><div style="padding-left:10; padding-right:5">' + desc + '</div>';
}

function HideHelp(div)
{
	div = document.getElementById(div);
	div.style.display = 'none';
}

