/************************************************/
/******* generelle JavaScript-Funktionen ********/
/************************************************/

// Browsercheck
function cm_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera 
  	this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera   
  	this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
  	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
 	this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
	this.ie7 = (this.agent.indexOf("msie 7")>-1 && !this.op5 && !this.op6)
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
 	this.ie = (this.ie4 || this.ie5 || this.ie6 || this.ie7)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
  	this.usedom= this.ns6//Use dom creation
  	this.reuse = this.ie||this.usedom //Reuse layers
  	this.px=this.dom&&!this.op5?"px":""
	return this
}

// Browserobjekt wird erzeugt
var bw=new cm_bwcheck();

var nn_mauspos_x=0;
var nn_mauspos_y=0;

function clean_stat() {
	window.status="W+ Werbe- und Internetagentur (c)2005";
	}
function tab_mark() {
	}
function tab_edit() {
	}
	
function menu(rub,typ) {
	if (document.forms.seite.vonlimit){
		document.forms.seite.vonlimit.value="0";
		}
	document.forms.seite.rubrik.value=rub;
	document.forms.seite.seitentyp.value=typ;
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}
	
function galeriebild(rub,typ,bild,vl,al) {
	document.forms.seite.rubrik.value=rub;
	document.forms.seite.vonlimit.value=vl;
	document.forms.seite.anzlimit.value=al;
	document.forms.seite.galeriebild.value=bild;
	document.forms.seite.seitentyp.value=typ;
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}
	
function enter(typ) {
	if (typ=="suche") {
		window.status="w+ selfedit.enterprise#6                 Suche nach '"+document.forms.seite.suchwort.value+"'.";
		document.forms.seite.suchwort.focus();
		document.forms.seite.rubrik.value="suche";
		document.forms.seite.seitentyp.value="spezial";
		}
	if (typ=="sitemap") {
		window.status="Sitemap";
		document.forms.seite.rubrik.value="";
		document.forms.seite.seitentyp.value="sitemap";
		}
	if (typ=="login") {
		window.status="Anmelden ";
		document.forms.seite.rubrik.value="";
		document.forms.seite.seitentyp.value="";
		document.forms.seite.intranet.value="LOGIN";
		}
	if (typ=="seite") {
		window.status="W+ Werbe- und Internetagentur (C)2005";
		document.forms.seite.rubrik.value="";
		document.forms.seite.seitentyp.value="";
		}
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	}
	
function sprachwahl(lang) {
	document.forms.seite.rubrik.value="";
	document.forms.seite.seitentyp.value="";
	document.forms.seite.sprache.value=lang;
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}

function detail_tabelle(ref_id,titel,kdir) {
	breite=screen.width;
	hoehe=screen.availHeight;
	breite=810;
	hoehe=410;
	links=10;
	oben=10;
	eval("fenster=window.open('../../system/admin/tab_template.php?id="+ref_id+"&titel="+titel+"&verzeichnis="+kdir+"','fenster','width="+breite+",height="+hoehe+",left=="+links+",top=="+oben+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes')");
	fenster.resizeTo(breite,hoehe);
	fenster.focus();
	}

function tab_edit(ref_id,idee) {
	document.forms.seite.action="tab_editor.php";
	document.forms.seite.job.value=ref_id;
	document.forms.seite.editid.value=idee;
	document.forms.seite.submit();
	}

function voten() {
	if (document.forms.seite.auswahl.value!="") {
		document.forms.seite.action="seite.php";
		document.forms.seite.target="_self";
		document.forms.seite.submit();
		}
	}
	
function kontStandard() {
		document.forms.seite.action="../user/kontStandard.php";
		document.forms.seite.method="get";
		document.forms.seite.target="_self";
		document.forms.seite.submit();
	}
	
function kontTerminwunsch() {
		document.forms.seite.action="../user/kontTermin.php";
		document.forms.seite.method="get";
		document.forms.seite.target="_self";
		document.forms.seite.submit();
	}
	
function login() {
	//document.forms.seite.action="http://selfedit.w-plus.de/version_2/indexp.php";
	document.forms.seite.action="statistik_login.php";
	document.forms.seite.target="_blank";
	document.forms.seite.submit();
	}	
function sitelogin(rub,typ,baum) {
	if (typ!="sitemap" && typ!="spezial") {
		document.forms.seite.rubrik.value=rub;
		document.forms.seite.seitentyp.value=typ;
		}
	document.forms.seite.sprache.value=baum;
	document.forms.seite.intranet.value="LOGIN";
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}	
function sitelogout(rub,typ,baum) {
	if (typ!="sitemap" && typ!="spezial") {
		document.forms.seite.rubrik.value="";
		document.forms.seite.seitentyp.value="";
		}
	document.forms.seite.sprache.value=baum;
	document.forms.seite.intranet.value="";
	document.forms.seite.anmeldung_war_ok.value="nein";
	document.forms.seite.sitegruppe.value="";
	document.forms.seite.action="seite.php";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}	

/* Glossar-Infolayer */
function glossar_in(nr,hoehe) {
	doclayer=(bw.ie4?"all.glossarleger"+nr+".style":(bw.ns4?"layers.glossarleger"+nr:"getElementById('glossarleger"+nr+"').style"));
	eval("var schonda=(document."+doclayer+".visibility=='visible'?'ja':'nein')");
	if (schonda=="nein") {
		eval("document."+doclayer+".visibility='visible'");
		topwert=bw.ns4?nn_mauspos_y-hoehe-15:window.event.clientY-hoehe-15+document.body.scrollTop;
		window.status=topwert+"/"+hoehe;
		if (topwert<210) {
			topwert=(bw.ns4?nn_mauspos_y:window.event.clientY)-hoehe/2+(bw.ns4?0:document.body.scrollTop);
			topwert=(topwert<210?210:topwert);
			}
		leftwert=bw.ns4?nn_mauspos_x+40:window.event.clientX+40;
		if (bw.ns4) {
			//topwert+=topwert+window.pageYOffset;
			}
		eval("document."+doclayer+".top="+topwert);
		eval("document."+doclayer+".left="+leftwert);
		}
	}
function glossar_out(nr) {
	doclayer=(bw.ie4?"all.glossarleger"+nr+".style":(bw.ns4?"layers.glossarleger"+nr:"getElementById('glossarleger"+nr+"').style"));
 	eval("document."+doclayer+".visibility='hidden'");
	}

/* Mausposition für NN für Glossar-Infolayer */
if (bw.ns4) {
	window.captureEvents(Event.MOUSEMOVE);
	window.onMouseMove = setpos;
	}
function setpos(ev){
	if (bw.ns4) {
		nn_mauspos_x=ev.pageX;
		nn_mauspos_y=ev.pageY;
		}
	}
function drucken1(was) {
	eval ("window.open('../user/artikel_"+was+".html','drucken','width=460,height=600,location=no,toolbar=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes')");
	}
function drucken(was,wer,wo,styp,spra,bezei) {
	//alert(bezei);
	eval ("window.open('drucken.php?rubrik="+was+"&kundenname="+wer+"&bezei="+bezei+"&url="+wo+"&sprache="+spra+"&seitentyp="+styp+"','drucken','width=600,height=600,location=no,toolbar=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes')");
	//eval ("window.open('drucken.php?rubrik="+was+"&bezei="+bezei+"&url="+wo+"&kundenname="+wer+"','drucken')");
	}
function verschicken(was,wer,wo,styp,spra,bezei) {
	if (spra!="") {
		if (spra=="deutsch") {
			eval ("window.open('versenden.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
			}
		if (spra=="english") {
			eval ("window.open('versenden_gb.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
			}
		if (spra=="france") {
			eval ("window.open('versenden_f.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
			}
		if (spra=="espanola") {
			eval ("window.open('versenden_e.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
			}
		if (spra=="nederland") {
			eval ("window.open('versenden_nl.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
			}
		}
	else {
		eval ("window.open('versenden.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&sprache="+spra+"&seitentyp="+styp+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
		}
	}
function verschicken1(was,wer,wo,styp,spra,bezei) {
	eval ("window.open('versenden.php?rubrik="+was+"&url="+wo+"&bezei="+bezei+"&kundenname="+wer+"&spra="+spra+"','versenden','width=600,height=600,location=no,toolbar=no,scrollbars=yes,directories=no')");
	}
function ansehen(bildnr,breite,hoehe) {
	var fenster;
	breite=(parseInt(breite)+40)>600?(parseInt(breite)+40):600;
	hoehe=(parseInt(hoehe)+80)>350?(parseInt(hoehe)+80):350;
	eval("fenster=window.open('../start/ecard_prototyp?pid="+bildnr+"&breite="+breite+"&hoehe="+hoehe+"','fenster','width="+breite+",height="+hoehe+",left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes')");
	fenster.resizeTo(breite,hoehe);
	fenster.focus();
	}	
function machnix() {
	;
	}
function fenster(seite,breite,hoehe) {
	eval("fenster=window.open('"+seite+"','fenster','width="+breite+",height="+hoehe+",left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes')");
	document.forms.seite.submit();
	}
function formular(rubrik) {
	for(w=0; w<document.forms.seite.length; w++)
	{	
	if(document.forms.seite.elements[w].pflicht == "ja")
		{
		if(document.forms.seite.elements[w].value == "")
			{
			if(textsprache!="") {
				if(textsprache=="deutsch") {alert("Bitte das Pflichtfeld "+document.forms.seite.elements[w].name+" ausfüllen.");}
				if(textsprache=="english") {alert("Please fill out the duty field "+document.forms.seite.elements[w].name+".");}
				if(textsprache=="france") {alert("Remplir le champ de devoir "+document.forms.seite.elements[w].name+" s'il vous plaît.");}
				if(textsprache=="nederland") {alert("Een of meerdere van de velden die moeten worden ingevuld lijken leeg te zijn.");}
				if(textsprache=="espanola") {alert("Por favor llene el "+document.forms.seite.elements[w].name+" de campo de obligación.");}
				}
			else { 	
				alert("Bitte das Pflichtfeld "+document.forms.seite.elements[w].name+" ausfüllen."); 
				}
				document.forms.seite.elements[w].focus();
				return;
			}
		}
	}	
	document.forms.seite.action="seite.php";
	document.forms.seite.seitentyp.value="absenden";
	document.forms.seite.rubrik.value=rubrik;
	document.forms.seite.method="get";
	document.forms.seite.target="_self";
	document.forms.seite.submit();
	}
