
	if(navigator.appName != "Microsoft Internet Explorer")
	{
		document.write('<link rel="stylesheet" href="ns_site.css">');
	} 
	else
	{
		document.write('<link rel="stylesheet" href="site.css">');
	}

    userAgent = navigator.userAgent.toLowerCase();
	n4 = document.layers;
	ie = (document.all && userAgent.indexOf("mac")<0);
	w3c = document.documentElement;
	dhtml = ((n4 || ie || w3c) &&  userAgent.indexOf("aol")<0);					
    function popupseiteempfehlen(url)
	{
		myCMSFenster = window.open(url,'Empfehlung','width=347,height=550,status=no,resizable=no,menubar=no,toolbar=no,locationbar=no,scrollbars=no,dependent=no' );
	}
	function popupempfehlung(url)
	{
		myCMSFenster = window.open(url,'Empfehlungsnotiz','top=0,left=0,width=347,height=400,status=no,resizable=no,menubar=no,toolbar=no,locationbar=no,scrollbars=no,dependent=no' );
	}
	function scrollit(xoffset,yoffset)
	{
		scrollTo(xoffset,yoffset);
	}
	function markArea(left,top,width,height,xoffset,yoffset,win_width,win_height)
	{
			if(xoffset || yoffset || win_width || win_height)
			{
			alert('scrollBy:'+xoffset+'x'+yoffset);
			window.moveTo(0,0);
			window.resizeTo(win_width,win_height);
			scrollit(0,0);
			}
						
			if(n4)
			{
				document.layers['highlight'].left = left;
				document.layers['highlight'].top = top;
				document.layers['highlight'].width = width;
				document.layers['highlight'].height = height;
				document.layers['highlight'].visibility = 'show';
			} else if (ie) 
			{
				document.all['highlight'].style.left = left;
				document.all['highlight'].style.top = top;
				document.all['highlight'].style.width = width;
				document.all['highlight'].style.height = height;
				document.all['highlight'].style.visibility = 'visible';
			} else if(w3c)
			{
				document.getElementById('highlight').style.left = left;
				document.getElementById('highlight').style.top = top;
				document.getElementById('highlight').style.width = width;
				document.getElementById('highlight').style.height = height;
				document.getElementById('highlight').style.visibility = 'visible';
			}
	}
	function showselect()
	{
		userAgent = navigator.userAgent.toLowerCase();
		n4 = document.layers;
		ie = (document.all && userAgent.indexOf("mac")<0);
		w3c = document.documentElement;
		dhtml = ((n4 || ie || w3c) &&  userAgent.indexOf("aol")<0);
		//alert('ie:'+ie+' n4:'+n4+' w3c: '+w3c);
	    if(ie) 
		{
	    	op_width=document.body.clientWidth;
			op_height=document.body.clientHeight;
		    op_yoffset=document.body.scrollTop;
			op_xoffset=document.body.scrollLeft;
		} else if(n4) 
		{
			op_width=window.innerWidth;
		    op_height=window.innerHeight;
		    op_yoffset=window.pageYOffset;
			op_xoffset=window.pageXOffset;
		}
								
		if (document.selection.type!="None")
		{
			var sel = document.selection;
			var rng = sel.createRange();
			var itm = rng.htmlText;
			//alert((op_width)+"--"+(rng.boundingLeft-4)+","+(rng.boundingTop-4)+","+(rng.boundingWidth+7)+","+(rng.boundingHeight+7));
			markArea(rng.boundingLeft-4,rng.boundingTop-4,rng.boundingWidth+7,rng.boundingHeight+7);
			//rng.pasteHTML("<font color=\"#ff0000\"><b>"+itm+"</b></font>");
		}
	}
		
	function popup(url, width, height, name, addon)
	{
		if(addon != false)
		   	myCMSFenster = window.open(url,name,'width=' + width + ',height=' + height + ',' + addon + "'");
		else
		   	myCMSFenster = window.open(url,name,'width=' + width + ',height=' + height + ',status=yes,resizable=yes,menubar=no,locationbar=no,scrollbars=yes,dependent=yes' );

	}
 	function popupmenu(url, width, height, name)
	{
	   	myCMSFenster = window.open(url,name,'width=' + width + ',height=' + height + ',status=yes,resizable=yes,menubar=yes,toolbar=yes,locationbar=no,scrollbars=yes,dependent=yes' );
	}
	
	if(top.frames.length > 0)
   	top.location.href=self.location;
	
	function conf()
	{ 
		check = confirm("Wollen Sie das wirklich?");
		return check; 
	}
	
	function conf_exp2nor()
	{ 
		check = confirm("Beim Wechsel des Modus gehen Änderungen verloren!");
		return check; 
	}
	
	function shopuser_toggle_delivery_info()
	{
		if(document.USERINFO.delivery_address.checked == true)
		{
			document.USERINFO.d_company.disabled = false;
			document.USERINFO.d_department.disabled = false;
			document.USERINFO.d_partner.disabled = false;
			document.USERINFO.d_street.disabled = false;
			document.USERINFO.d_zip.disabled = false;
			document.USERINFO.d_city.disabled = false;
			document.USERINFO.d_tel.disabled = false;
			document.USERINFO.d_telsms.disabled = false;
			document.USERINFO.d_fax.disabled = false;
			document.USERINFO.d_email.disabled = false;
			document.USERINFO.d_www.disabled = false;		
		}
		else
		{
			document.USERINFO.d_company.disabled = true;
			document.USERINFO.d_department.disabled = true;
			document.USERINFO.d_partner.disabled = true;
			document.USERINFO.d_street.disabled = true;
			document.USERINFO.d_zip.disabled = true;
			document.USERINFO.d_city.disabled = true;
			document.USERINFO.d_tel.disabled = true;
			document.USERINFO.d_telsms.disabled = true;
			document.USERINFO.d_fax.disabled = true;
			document.USERINFO.d_email.disabled = true;
			document.USERINFO.d_www.disabled = true;
		}
		return 0;
	}	
function doDelete(del_name,tbl,script_name,del_id) {
	check=confirm("\""+del_name+"\" wirklich löschen?");
	if (check) {
		self.location.href=script_name+"&tbl="+tbl+"&del=1&del_id="+del_id;
	}
}
 function relocate(url) {
 	self.location.href=url;
 }
 function changePerson(id,saison,flag,person,position,funktion) {
	self.location.href="mannschaft_edit.php?id="+id+"&saison="+saison+"&flag="+flag+"&changePerson_id="+person+"&funktion="+funktion+"&position="+position;
 }
function spielstart(liga_id,saison,spielsystem,spielplan) {
	self.location.href="liga_edit.php?id="+liga_id+"&saison="+saison+"&spielsystem_id="+spielsystem+"&spielplan_id="+spielplan+"&flag=start";
}
function insertErgebnis(saison,spielsystem_mannschaft_id,spielsystem_id,mannschaft_a,mannschaft_b,begegnung,liga,spieltag,liga_id) {
	url="ergebnis_new.php?saison="+saison;
	url+="&spielsytem_mannschaft_id="+spielsystem_mannschaft_id;
	url+="&spielsystem_id="+spielsystem_id;
	url+="&mannschaft_a="+mannschaft_a;
	url+="&mannschaft_b="+mannschaft_b;
	url+="&begegnung_id="+begegnung;
	url+="&liga="+liga;
	url+="&liga_id="+liga_id;
	url+="&spieltag="+spieltag;
	window.open(url,"ergebniss","width=500,height=500,scrollbars=no");
}

function showBegegDet(spieltag,liga,spielsystem) {
	window.open("ergebnis_det.php?spieltag="+spieltag+"&liga_id="+liga+"&spielsystem_id="+spielsystem,"details","width=500,height=300,scrollbars=yes");
}

/*function showMannschaftDet(mannschaft_id) {
	self.location.href="liga/detail_mannschaft.php?mannschaft_id="+mannschaft_id;
}*/


function showSpielerDet(spieler_id) {
	window.open("detail_spieler.php?spieler_id="+spieler_id,"details_spieler","width=500,height=500,scrollbars=no");
}


function setErgebnis(satz,spieler,spiel_nr) {
	
	/*var ergebnis_a=document.forms[spiel_nr].elements["satz"+satz+"_a["+spiel_nr+"]"].value;
	var ergebnis_b=document.forms[spiel_nr].elements["satz"+satz+"_b["+spiel_nr+"]"].value;
	
	if ((ergebnis_a!="" && ergebnis_b>=15) || (ergebnis_b!="" && ergebnis_a>=15)) {
		if (ergebnis_a>ergebnis_b) {
			var ergebniszahla=Number(document.forms[spiel_nr].elements["ergebnis_a["+spiel_nr+"]"].value);
			var ergebniszahlb=Number(document.forms[spiel_nr].elements["ergebnis_b["+spiel_nr+"]"].value);
			document.forms[spiel_nr].elements["ergebnis_a["+spiel_nr+"]"].value=ergebniszahla+1;
			if (ergebniszahlb>0) {
				document.forms[spiel_nr].elements["ergebnis_b["+spiel_nr+"]"].value=ergebniszahlb-1;
			}
		} else if (ergebnis_b>ergebnis_a) {
			var ergebniszahla=Number(document.forms[spiel_nr].elements["ergebnis_a["+spiel_nr+"]"].value);
			var ergebniszahlb=Number(document.forms[spiel_nr].elements["ergebnis_b["+spiel_nr+"]"].value);
			document.forms[spiel_nr].elements["ergebnis_b["+spiel_nr+"]"].value=ergebniszahlb+1;
			if (ergebniszahla>0) {
				document.forms[spiel_nr].elements["ergebnis_a["+spiel_nr+"]"].value=ergebniszahla-1;
			}
		}
	}*/
}

