// JavaScript for www.pro-karli.de

// link automatically
function goToURL(url) { 
  location.href = url;
}

// open popup window
function openWindow(path,name,breite,hoehe) { //v3.0
  	var newF = "./empty.php";
	var popup = window.open (newF, name, 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbar=0, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	with (popup.document) {
		open();
		write('<html>\n<head>\n<title>Pro Karli - Galerie</title></head>\n<body leftmargin="0" topmargin="0" bgcolor="#FFFFFF">\n<a href="javascript:self.close()"><img src="'+path+'" alt="Fenster Schliessen" border="0"></a>\n</body>\n</html>\n');
		close();
	}
	popup.focus();
}

// open images for gallery etc.
function openImage(file,breite,hoehe,path,name){
		/*if (hoehe>=601){
			breite = breite/hoehe*600;
			hoehe = 600;
		}*/		
		var preview = window.open (path, 'name', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=auto, fullscreen=0, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
		with (preview.document) {
			open();
			write('<html>\n<head>\n<title>Pro Karli - Galerie</title>\n');
			write('<link href="sty/styles.css" rel="stylesheet" type="text/css"></head>\n');
			write('<body style="margin-left:0px; margin-top:0px; margin-right:0px; margin-bottom:0px">\n');
			write('<table width="100%" height="100%" align="center" cellspacing="0" cellpadding="0" border="0"><tr class="txtbody">\n');
			write('<td colspan="2" align="center" valign="middle" width="100%">');
			write('<a href="javascript:self.close()"><img src="'+file+'" border="0" alt="Schliessen"></a></td></tr><tr class="txtbody">\n');
			write('<td width="50%"  height="50" align="left" valign="top"><a href="javascript:self.print()">&nbsp;&nbsp;Drucken</a></td>\n');
			write('<td align="right" valign="top"><a href="javascript:self.close()">Schliessen&nbsp;&nbsp;</a></td>\n');
			write('</tr></table></body>\n</html>\n');
			close();
		}
		preview.focus();
}
// setGET
// onChange=\"setGET(this,self,'nex')
// 3rd argument is for unset specific elements parted by # or 0 for nothing
function setGET(ename,site,unset){
	var nGn = ename.name;
	var nGv = ename.value;
	var url = site.location;
	var adr = url.href.split("?");
	var get = "";
	if(adr.length>1){
		if(adr[1].search(eval("/"+nGn+"=(.*?)(&|$)/"))!=-1){
			get = adr[1].replace(eval("/"+nGn+"=(.*?)(&|$)/"),nGn+'='+nGv+'&');
		}else{
			if(adr[1].substr(adr[1].length-1,adr[1].length)=='&'){
				get = adr[1]+nGn+'='+nGv;
			}else{
				get = adr[1]+'&'+nGn+'='+nGv;
			}
		}
		if(unset.length!=1){
			unsetA = unset.split("#");
			for(i=0;i<unsetA.length;i++){
				get = get.replace(eval("/"+unsetA[i]+"=(.*?)(&|$)/"),'');
			}
		}
	}else{
		get = nGn+'='+nGv;
	}
	location.href = adr[0]+"?"+get;
}
//
function reloadBericht(){
	var day = document.formDay.selectDay.value;
	var season = document.formDay.selectSeason.value;
	var liga = document.formDay.selectLiga.value;
	location.href = "berichte.php?season="+season+"&day="+day;
}
