//show layer on load

function init() {
	for(i=0;i<draggable.length;i++) {
		obj = findObj(draggable[i]);
		obj.style.visibility = "visible";
	}
}

function findObj(n, d) {
	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(!isIEMAC && !(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=findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}

// Function Big Image ein- und ausblenden

function showBigSizeImage(imageurl){
	parent.document.getElementById("bigSizeImage").src = "inhalt/arbeiten/big/"+imageurl;
	parent.document.getElementById("bigSizeImageDiv").style.display = "block";
}
function hideBigSizeImage(){
	document.getElementById("bigSizeImage").src = "img/spacer.gif";
	document.getElementById("bigSizeImageDiv").style.display = "none";
}


//popups
function popUpStart() {
	window.open('fs.php','ruflanz','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1018,height=721,left=0,top=0');
}
function popUpOld() {
	window.open('gratisbrowser.php','ruflanz','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1018,height=721,left=0,top=0');
}

function downloadZip() {
	top.sound.location.href= "/downloads/ruflanz_booklet.pdf.zip";
}

function downloadMap() {
	window.open('/downloads/karte.pdf','plan','toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=700,left=0,top=0');
}


function popUpPress(URL) { //href="javascript:popUpPress('test.php')"
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=700,left=" + ((screen.availWidth - 450) / 2) + ",top=" + ((screen.availHeight - 700) / 2) + "');");
}

//zoom window
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;

function zoomMe() {
	if (isMac && screen.height <= 769 && navigator.appVersion.charAt(0) >=4) {
		self.moveTo(0,0);
		resizeTo(1018,721);

	}
}


//center window
function centerMe() {
	if (screen.height <= 769 && navigator.appVersion.charAt(0) >=4){
	} 
	else {
		top.window.moveTo((screen.availWidth - 1020) / 2,(screen.availHeight - 721) / 2);
	}
}


//read window size
/*
error by patman
var winW = 1020;
var winH = 721;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
} 
*/

//check window size and resize if wrong
function checkSize() {
	if ( winH <= 720) {
		self.moveTo(0,0);
		resizeTo(1020,721);
	}
}



// layer show/hide
var _target_frame = "";

function hA(args) {
	for(i=0;i<(args.length);i++) {
		obj=findObj(args[i]);
		if (obj) {
			if (obj.style) { obj.style.visibility='hidden'; 
			}
			else if(obj.visibility) { obj.visibility='hidden'; 
			}
			else { alert(obj);
			}
    	}
	}
}

function findObj(n, d) {
	var p,i,x;
		if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		sub=n.substring(p+1);
		d=top.frames[sub].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=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
		return x;
}

function shL() {
	var i,p,v,obj,args=shL.arguments;
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=findObj(args[i]))!=null) {
			v=args[i+2];
		if (obj.style) { 
		obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;
		}
		obj.visibility=v;
		}
}
