// JavaScript Document

// - - - - -  some instructions for dentaConcept.de - - - - - - - -

var g_braus = new BrowserCheck()  			//	var g_braus = "ix";

var g_lmenu_noshowflag = 0;					// solange das gilt, wird kein Left-Menu geöffnet
var g_lmenu_hidewait;
var g_lmenu_show = 0;
var g_lmenu_hide = 0;
var g_lmenu_next = 0;

var g_diff = 0;
var g_id = 0;

var late = false;

var index = 1;

var g_xMenu = 0;

/*	if ( g_braus.ie )
	{
		window.setTimeout(setLady, 1000);
	}
	else
	{
		window.addEventListener("load", function() { window.setTimeout(setLady, 100) }, false);
	}   */

window.onresize = setLady;


function BrowserCheck() 
{
	var b = navigator.appName;

	if 	   ( b == "Netscape") { this.b = "ns"; }
	else if (b == "Microsoft Internet Explorer") { this.b = "ie"; }
	else if (b == "Opera") { this.b = "op"; }
	else this.b = b;

	this.v = parseInt(navigator.appVersion);

	this.ns  = ( this.b=="ns" && this.v>=4 );
	this.ns4 = ( this.b=="ns" && this.v==4 );
	this.ns5 = ( this.b=="ns" && this.v==5 );
	this.ie  = ( this.b=="ie" && this.v>=4 );
	
//	alert (navigator.userAgent);

	this.ie4 = ( navigator.userAgent.indexOf('MSIE 4')>0 );
	this.ie5 = ( navigator.userAgent.indexOf('MSIE 5')>0 );
	this.ie6 = ( navigator.userAgent.indexOf('MSIE 6')>0 );
	this.ie7 = ( navigator.userAgent.indexOf('MSIE 7')>0 );
	this.ie8 = ( navigator.userAgent.indexOf('MSIE 8')>0 );
	this.ie9 = ( navigator.userAgent.indexOf('MSIE 9')>0 );
	
	this.fx  = ( navigator.userAgent.indexOf('Firefox')>0 );
	this.op  = ( navigator.userAgent.indexOf('Opera')>=0 );
	this.sf  = ( navigator.userAgent.indexOf('Safari')>=0 );

	if (this.ie5) { this.v = 5; }
	this.min = (this.ns||this.ie);
}

//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//	wird nur zur aufklärung benutzt ....
/*
function shoNavi() 
{
	var n = navigator.appName;
	var v = navigator.appVersion;
	var u = navigator.userAgent;
	
	alert ("Name = "+n+"\nVers = "+v+"\nAgnt = "+u);
}
*/
//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
function centerPage()
{
	var w = 700;						// default-wert wird Ÿberschrieben
	var wa, left, obj;

	if (window.innerWidth)			{ wa = window.innerWidth; }
	if (document.body.clientWidth)	{ wa = document.body.clientWidth; }
	if (document.getElementById)	{ obj = document.getElementById("object").style; }
	
	w = Number( obj.width.substr( 0,obj.width.length-2 ) );

	wa -= 50;
	left = Math.floor( ( wa - w ) / 2 );
	if ( left < 0 ) { left = 0; }
	
//	alert ("wa ist "+wa+", left ist "+left);

	obj.margin = "10px auto 0px "+left+"px";
	obj.visibility = "visible"; 
}
*/
//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function betpass()
{
	var db1=document.betaform;
	
	db1.action = "../Support/Support-Beta1.htm"; 				// dummy action

	if ( (db1.betapass.value == "alleswirdgut") || (db1.betapass.value == "Alleswirdgut") || (db1.betapass.value == "Alles wird gut") || (db1.betapass.value == "alles wird gut") )
	{
		db1.action = "../Support/Support-Beta2.htm";
		db1.submit();
	}
	else
	{
		alert ("Der Freigabe-Code war nicht richtig. \nAls Teilnehmer des Beta-Tests \nhaben Sie den Code erhalten.");
	}
}

//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function chkpass()
{
	var db1=document.sympform;
	
	db1.action = "../Support/Support-Symp1.htm"; 				// dummy action

	if ( (db1.sympass.value == "Diagnostik-Kaskade") || (db1.sympass.value == "diagnostik-kaskade") || (db1.sympass.value == "Diagnostikkaskade") || (db1.sympass.value == "diagnostikkaskade") )
	{
		db1.action = "../Support/Support-Symp2.htm";
		db1.submit();
	}
	else
	{
		alert ("Das Passwort war nicht richtig. \nAls Teilnehmer des Symposiums \nhaben Sie das Passwort erhalten.");
	}
}

//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function popitup(link,titel,w,h,s,t) 
{ 
	var winx = 100;
	var winy = 100;
	pitup=window.open(link,titel,"toolbar="+t+",location=no,directories=no,status=no,menubar=no,scrollbars="+s+",resizable=no,copyhistory=no,width="+w+",height="+h+",left="+winx+",top="+winy); 
	pitup.focus();
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
// 		Funktionen fŸr das MenŸ links
// 		die kommen spŠter noch mit Nummern...
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function lmenu_all()
{
	var i;
	var l = lxMenus.length - 1;

	if (l > 0 && late == true )
	{
		for ( i = 0; i < l; i++ ) 
		{
		//	alert( "l ist " + l + ", i ist " + i + " bei menu" + lxMenus[i] );
			lmenu_apush(lxMenus[i]);
		}
	}
}

function lmenu_none()
{
	var i;
	var l = lxMenus.length - 1;

	if (l > 0 && late == true )
	{
		for ( i = 0; i < l; i++ ) { lmenu_aflush(lxMenus[i]); }
	}
	
	if ( g_xMenu != 0 ) { lmenu_apush(g_xMenu); }
}


function lmenu_push(id)
{
	g_xMenu = id;
	lmenu_apush(id);
}

function lmenu_apush(id)
{
	var menu = "menu"+id;
	var obj;
	
	if ( document.getElementById)
	{
		obj = document.getElementById(menu).style;
		
		obj.visibility = "visible";
		obj.display = "block";
	//	obj.position = "relative";
	}
}

function lmenu_aflush(id)
{
	var menu = "menu"+id;
	var obj;
	
	if ( document.getElementById)
	{
		obj = document.getElementById(menu).style;
		
		obj.visibility = "hidden";
		obj.display = "none";
	//	obj.position = "absoute";
	}
}

function lmenu_blush(id)
{
	var menu = "trigger"+id;
	var obj;
	
	if ( document.getElementById)
	{
		obj = document.getElementById(menu).style;
		
		obj.color = "#c91400";
	}

}

function lmenu_show(id)
{
	id = 0;
}

function lmenu_hide(id)
{
	id = 0;
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function setad(id)
{
	getLaid(); 

	var aref = "t"+id;
	var lili = "tab"+id;

	var rpic = 'url(../aBilder/top_active_right.png)';
	var lpic = 'url(../aBilder/top_active_left.png)';

	var obj, tobj, arefs;
	
//	Anpassung an IE 7 und IE 8, die topmenu zu tief setzen

	if ( ( g_braus.ie7 || g_braus.ie8 ) && document.getElementById ) 
	{
		obj = document.getElementById("topmenu").style;
		obj.top = "1.5em";
		obj.left = "100px";

		for ( i=1; i<6; i++)
		{
			arefs = "t"+i;
			tobj = document.getElementById(arefs).style;
			tobj.padding = "0.2em 12px 0.2em 2px";
		}
		obj.visibility = "visible";
	}


/*	Anpassung an die drei Seiten, die außerhalb der Ordner liegen */
	if ( window.location.href.indexOf("Produkte0.shtml") > 0 || window.location.href.indexOf("Produkte.shtml") > 0 || window.location.href.indexOf("index.shtml") > 0 || window.location.href.indexOf("Patienteninfos.shtml") > 0 )
	{
		rpic = 'url(aBilder/top_active_right.png)';
		lpic = 'url(aBilder/top_active_left.png)';
	//	alert ("Helau!");
	}

	if ( id > 0 )
	{

		if (document.getElementById)
		{
			obj = document.getElementById(lili).style;		
			obj.backgroundImage = lpic;
		}

		if (document.getElementById)
		{
			obj = document.getElementById(aref).style;		
			obj.color = "#ffffff";
			obj.backgroundImage = rpic;
		}

	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function getLaid()
{
	setLady();
}

function getLady()
{
//	setLady();
	window.setTimeout(setLady, 1000);  
}


function setLady()
{
	late = true;

	repos();

	var ha, obj, bod, tab, map, mleftbody, contheit;
	ha = 0;
	var loc = window.location;
	var lady = "../aBilder/0Left-Lady6.png";
	var imp = "../aBilder/1Left-Lady6sml.png";
		
	var ref = window.location.href;
	ref = ref.substr( ref.lastIndexOf("/") +1 );
	
	/*	Anpassung an die Seiten, die außerhalb der Ordner liegen (incl. Aufruf als Ordner ohne Seite) */
	if ( ref == "Produkte0.shtml" || ref == "Produkte.shtml" || ref == "index.shtml" || ref == "" || ref == "Patienteninfos.shtml" )
	{
		lady = "aBilder/0Left-Lady6.png";
		imp = "aBilder/1Left-Lady6sml.png";
	}
			
	if ( late == true)
	{		
		if ( g_braus.b == "ie" )
		{
			if ( g_braus.ie6 )
			{
				if (document.body.clientHeight)		{ ha = document.body.clientHeight; }	
			}
			else
			{
				if (document.documentElement.clientHeight)		{ ha = document.documentElement.clientHeight; }	
			}
		}
		else 
		{ 
			ha = window.innerHeight; 
		}

		obj = document.getElementById('mylady').style;
		mleftbody = lxMenus[lxMenus.length-1];
		if ( mleftbody == 0 ) { mleftbody = 580; }
		else { mleftbody += 260; }
		
	//	alert ( "hoehe ist " + mleftbody );

		if ( ha > mleftbody )			// variabel Pixel fŸr alle MenŸs offen !!! // 560 fŸr alle MenŸs geschlossen
		{
			obj.backgroundImage = "url(" + lady + ")";
			obj.top = (ha-320) + "px";
			if ( g_braus.ie6 ) { obj.top = (ha-280) + "px"; }
		}
		else
		{
			obj.backgroundImage = "url(" + imp + ")";
			obj.top = (ha-140) + "px";

		//	map = document.getElementById('imppic').style;
		//	map.top = 300  + "px";
		}

		if ( ha > 2820 )			// 820 Pixel für alle Menüs offen !!! // 560 für alle Menüs geschlossen
		{
			lmenu_all();
		}
		else
		{
			lmenu_none();
		}

		obj = document.getElementById('leftbody').style;
		
	/* 	Da wollte ich den linken Streifen bei kleinen Seiten auf dieselbe Höhe bringen */
	//	contheit = document.getElementById('rite').style.height;
	//	contheit = Math.floor( contheit.substr( 0, 3 ) );
	//	obj.height = ( contheit + 5 ) + "px";
	/*	Wir bleiben aber mal beim automatischen Nachführen in Fensterhöhe */
		obj.height = ( ha - 114 ) + "px";

	}
//	repovis()
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function repos()
{
	var w = 994;						// breite der seite (fest vorgegeben)
	var wa = 994;
	var mtop, mtopmenu, mleft, mleftbody, mfixmenu, mcont, diff, lefty;
	var mtop0 = 0, mleft0 = 1, mfixmenu0 = 186, mcont0 = 0;	// Defaults der Left-Koordinaten
	var tmp, srch, slash;
	
//	window.clearTimeout(reps);
	
//	if (window.innerWidth)				{ wa = window.innerWidth; }
	
	wa = window.innerWidth;
	if (document.body.clientWidth)		{ wa = document.body.clientWidth; }
	diff = Math.floor( ( wa - w ) / 2 );
	
	if ( diff < 0 ) { diff = 0; }
	
	if (document.getElementById)
	{
		mcont = document.getElementById("cont").style;
		mfixmenu = document.getElementById("fixmenu").style;
		mleft = document.getElementById("left").style;
	//	mleftbody = document.getElementById('leftbody').style;
		mtop = document.getElementById("top").style;
		mtopmenu = document.getElementById("topmenu").style;
	}

//	alert ("wa ist "+wa+", diff ist "+diff);

	mtop.left = (mtop0 + diff) + "px";
	mleft.left = (mleft0 + diff) + "px";
	mcont.left = (mcont0 + diff) + "px";
	mfixmenu.left = (mfixmenu0 + diff) + "px";

	srch = String(window.location);
	slsh = srch.lastIndexOf("index");
	srch = srch.substr( slsh );

/*	if ( g_braus.ie6 || g_braus.ie7  )
	{
		if ( srch == "index.shtml" )
		{
			obj = document.getElementById("topbody").style;
			obj.left = diff + "px";
		}

		if ( srch == "index.shtml" )
		{
			diff += 192;
		}
		else
		{
			diff += 192;
		}

		obj = document.getElementById("topmenu").style;
		obj.left = diff + "px";
		obj.top = "1.7em";

		if ( srch == "index.shtml" )
		{
			diff += 138;
			obj = document.getElementById("topdc").style;
			obj.left = diff + "px";
		}
	}
*/
	if (  g_braus.ie7 || g_braus.ie8 || g_braus.ie9 )
	{
		if ( g_braus.ie7 ) { diff = 0; }
		if ( g_braus.ie8 ) { diff = 52; }
		if ( g_braus.ie9 ) { diff = 40; }
		
		obj = document.getElementById("topmenu").style;
		obj.marginTop = "3px";
		obj.marginLeft = diff + "px";

		if (  g_braus.ie8 || g_braus.ie9 )
		{
			obj.clip = "auto";	
		}
		
		obj.visibility = "visible";
	}

	mtop.visibility = "visible";
	mtopmenu.visibility = "visible";
	mcont.visibility = "visible";
	mfixmenu.visibility = "visible";
	mleft.visibility = "visible";
//	mleftbody.visibility = "visible";

}
	
function repovis()
{
	var mtop, mleft, mleftbody, mfixmenu, mcont, diff, lefty;
	
	if (document.getElementById)
	{
		mcont = document.getElementById("cont").style;
		mfixmenu = document.getElementById("fixmenu").style;
		mleft = document.getElementById("left").style;
	//	mleftbody = document.getElementById("leftbody").style;
		mtop = document.getElementById("top").style;
	}

	mtop.visibility = "visible";
	mcont.visibility = "visible";
	mfixmenu.visibility = "visible";
	mleft.visibility = "visible";
//	mleftbody.visibility = "visible";
}

function earlcont()
{
	var w = 994;						// breite der seite (fest vorgegeben)
	var wa = 994;
	var mcont, diff;

	wa = window.innerWidth;
	if (document.body.clientWidth)		{ wa = document.body.clientWidth; }
	diff = Math.floor( ( wa - w ) / 2 );
	diff -= 7;
	if ( diff < 0 ) { diff = 0; }
	
	document.write('<div id="cont" style="left:' + diff + 'px; visibility:visible;">');
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


function shopred(obj)
{
	obj.src = "../aBilder/shoppingacartred.png";
}

function shopblk(obj)
{
	obj.src = "../aBilder/shoppingacart.png";
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//	Dialoge checken für den Diagnose-Pilot-Korrektur Online
//  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

function chkDiag()
{
	var db1=document.dpilot;
	var bonny = 1;
	var dummy;
	
	if ( db1.name.value == "") 
	{
		bonny = 0;
		alert ("Bitte tragen Sie Ihren Namen ein.");
		db1.name.focus();
		return false;
	}

	if ( db1.teln.value == "" &&  db1.mail.value == "") 
	{
		bonny = 0;
		alert ("Bitte tragen Sie mindestens \neine Telefonnummer oder \neine Emailadresse ein.");
		db1.teln.focus();
		return false;
	}
	
	if ( db1.mail.value != ""  )
	{
		dummy = db1.mail.value; 

		var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
		if ( !filter.test(dummy) )
		{
			bonny = 0;
			alert ("Das Format der Email-Adresse ist nicht korrekt.");
			db1.mail.focus();
			return false;
		}
	}

	if ( bonny == 1 ) { return true; } else { return false; }
}

function chkDelDiag()
{
	var db1=document.dpilot;
	
	if  ( confirm ("Datensatz wirklich löschen?") == true )
	{
		return true;
	}
	else
	{
		return false;
	}
}

//	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

