
//browser fähigkeit
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isIE5 = (document.attachEvent  && document.selection ) ? true : false;
var isIE6 = (window.execScript && document.compatMode ) ? true : false;




function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}

function getSty(id) {
return (isNS4 ? getRef(id) : getRef(id).style);
}



function sendQuery(form){

if(self.document[form].send_name.value !="" ){
			//self.document.contactform.submit();
			var send_name=self.document[form].send_name.value;
			var query=self.document[form].query.value;
			try{
			var send_email=self.document[form].send_email.value;
			}catch(e){}
			try{
			var send_telefon=self.document[form].send_telefon.value;
			var send_firma=self.document[form].send_firma.value;
			var send_termin=self.document[form].send_termin.value;
			}catch(e){}
			var URL = "sendQuery.php?name="+send_name+"&email="+send_email+"&telefon="+send_telefon+"&fima="+send_firma+"&termin="+send_termin+"&query="+query;
	
	
	var Name = "Anfrage senden";
	var Fensteroptionen = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
	var Breite = 145;
	var Hoehe = 110;
	window.open(URL, 'Name', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);
			
			
		}else{
			alert("Bitte füllen sie die mit * gekennzeichneten Felder aus.")
		}

}




	function openShop(){
	var URL = "www.sentgen.de/shop/index.php";
	var Name = "Sentgen_shop";
	var Fensteroptionen = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0";
	var Breite = 810;
	var Hoehe = 700;
	window.open(URL, 'Name', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);
	
	}
	
	
	function changeBG(event){
		var imageArray= new Array("winter","fruehling","sommer","herbst","folgeseite");
		var datum = new Date();
 		var m = datum.getMonth()+1;
  		var d = datum.getDate();
  		/*
		if ((m < 3) || ( (m == 3) && (d < 20) ) ||((m == 12) && ( d > 20))){
    		jz=0;
  		}else{
    		if ((m < 6) || ( (m == 6) && (d < 21))){
      			jz=1;
    		}else{ */
      			if ((m < 9) || ((m == 9) && (d < 23))){
        			jz=2;
      			}else{
        			jz=3;
				}
			/*}
		}	*/
		if(event){
			image_akt=imageArray[event];
			doBoxes();
		}else{
			image_akt=imageArray[jz];
		}
		image_akt="design/"+image_akt;
		document.images['top'].src=image_akt+".jpg";
		document.images['si_l'].src=image_akt+"_l.gif";
		document.images['si_r'].src=image_akt+"_r.gif";
	}

	function doBoxes(){
		document.getElementById("login").style.visibility = "hidden";
	
		document.getElementById("bottom_start").style.visibility = "hidden";
		document.getElementById("bottom_folge").style.visibility = "visible";

		document.getElementById("box_start_s_kontakt").style.visibility = "hidden";
		document.getElementById("si_l").style.visibility = "hidden";
		document.getElementById("si_r").style.visibility = "hidden";

		document.getElementById("box_folge_f_katalog").style.visibility = "visible";
		document.getElementById("box_folge_f_kontakt").style.visibility = "visible";
		document.getElementById("box_folge_f_sortiment").style.visibility = "visible";	
	}

	function changeContent(event){
		if(event!="home")changeBG('4');
		var contentArray =new Array("home","fp","ps","n","u","tt","d","v","f","im","cb");
		var colorArray=new Array("#B92B39","#B92B39","#1474B4","#1FB200","#1C439C","#FFB502","#F05841","#B92B39","#B92B39","#B92B39","#B92B39");
		 
		
		for(i=0;i<contentArray.length;i++){
			document.getElementById(contentArray[i]).style.visibility = "hidden";
			document.getElementById(contentArray[i]).style.scrollbarShadowColor=colorArray[i];
			document.getElementById(contentArray[i]).style.scrollbarHighlightColor=colorArray[i];
			document.getElementById(contentArray[i]).style.scrollbarArrowColor=colorArray[i];
			
			for(j=0;j<20;j++){
			try{
			document.getElementById(i+"t"+j).style.color = colorArray[i];
			}catch(e){}
			}
			
			for(j=0;j<20;j++){
			try{
			
			document.getElementById(i+"b"+j).style.border = 'solid 1px '+colorArray[i];
			}catch(e){}
			}
			
			
			
			
			
			for(j=0;j<20;j++){
			try{
			document.getElementById(i+"lk"+j).style.color = colorArray[i];
			}catch(e){}
			}	
			
		}
		
		document.getElementById(event).style.visibility = "visible";	
	}

	function log(){
		if(self.document.logform.email_address.value !="" && self.document.logform.password.value !=""){
			self.document.logform.submit();
		}else{
			alert("Bitte geben Sie Ihren Benutzernamen und Ihr Passwort ein.")
		}
	}

for (var i = 0; i < document.links.length; ++i)
  alert(document.links[i]);

// der timeout zum verstecken des menüs
var popTimer = 1;
// Array showing highlighted menu items.
var litNow = new Array();


//beim drüberfahren wird das menü gezeigt
function popOver(menuNum, itemNum) {
//der timer wird auf null gesetzt
clearTimeout(popTimer);
//alle anderen untermenüs werden versteckt
hideAllBut(menuNum);

//
litNow = getTree(menuNum, itemNum);

//ändert die farbe
//changeCol(litNow, true);
targetNum = menu[menuNum][itemNum].target;
if (targetNum > 0) {
//die x-position 
thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
//die y-position
thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);

with (menu[targetNum][0].ref) {
left = parseInt(thisX + menu[targetNum][0].x);
top = parseInt(thisY + menu[targetNum][0].y);
visibility = 'visible';
      }
   }
}

//das dropdown menu wird geschlossen
function popOut(menuNum, itemNum) {
if ((menuNum == 0) && !menu[menuNum][itemNum].target)
hideAllBut(0)
else
popTimer = setTimeout('hideAllBut(0)', 200);
}


function getTree(menuNum, itemNum) {
// Array index is the menu number. The contents are null (if that menu is not a parent)
// or the item number in that menu that is an ancestor (to light it up).
itemArray = new Array(menu.length);
while(1) {
itemArray[menuNum] = itemNum;
// If we've reached the top of the hierarchy, return.
if (menuNum == 0) return itemArray;
itemNum = menu[menuNum][0].parentItem;
menuNum = menu[menuNum][0].parentMenu;
   }
}

// Pass an array and a boolean to specify colour change, true = over colour.
/*
function changeCol(changeArray, isOver) {
for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
if (changeArray[menuCount]) {
newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
// Change the colours of the div/layer background.
with (menu[menuCount][changeArray[menuCount]].ref) {
if (isNS4) bgColor = newCol;
else backgroundColor = newCol;
         }
      }
   }
}
*/
//setzt alle menüs ausser dem aktuellen auf invisible
function hideAllBut(menuNum) {
var keepMenus = getTree(menuNum, 1);
for (count = 0; count < menu.length; count++)
if (!keepMenus[count])
menu[count][0].ref.visibility = 'hidden';
//changeCol(litNow, false);
}


// *** MENU CONSTRUCTION FUNCTIONS ***

function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass) {
// True or false - a vertical menu?
this.isVert = isVert;
// The popout indicator used (if any) for this menu.
this.popInd = popInd;

// Position and size settings.
this.x = x;
this.y = y;
this.width = width;

//vorder und hintergrund farben
this.overCol = overCol;
this.backCol = backCol;

//die stylesheet klassen 
this.borderClass = borderClass;
// Parent menu and item numbers, indexed later.
this.parentMenu = null;
this.parentItem = null;
// Reference to the object's style properties (set later).
this.ref = null;
}


//ist so ähnlich wie menü gilt aber für die einträge
function Item(text, href, frame,title, length, spacing, target, cssClass) {
this.text = text;
this.href = href;
this.frame = frame;
this.length = length;
this.spacing = spacing;
this.target = target;
this.title=title;
this.cssClass = cssClass;
// Reference to the object's style properties (set later).
this.ref = null;
}



//hier werden die menüs geschrieben
function writeMenus() {
if (!isDOM && !isIE4 && !isNS4) return;
for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
// Variable for holding HTML for items and positions of next item.
var str = '', itemX = 0, itemY = 0;
// Remember, items start from 1 in the array (0 is menu object itself, above).
// Also use properties of each item nested in the other with() for construction.
for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
var itemID = 'menu' + currMenu + 'item' + currItem;

// The width and height of the menu item - dependent on orientation!
var w = (isVert ? width : length);
var h = (isVert ? length : width);
if (isDOM || isIE4) {
str += '<div id="' + itemID + '" class="'+cssClass+'" style=" position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
if (backCol){
str += 'background: ' + backCol + '; ';
str +='border-style: solid; border-width: 1px; border-color: #E3D9BE;';
str+='filter: Alpha(Opacity=85);';
}
str += '" ';
}


if (isNS4) {
str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
if (backCol) str += 'bgcolor="' + backCol + '" ';
}
if (borderClass) str += 'class="' + borderClass + '" ';






// beim mouseover wird folgendes aufgerufen
str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';

// Add contents of item (default: table with link inside).
// In IE/NS6+, add padding if there's a border to emulate NS4's layer padding.
// If a target frame is specified, also add that to the <a> tag.

str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '"><tr><td style="text-align:left;vertical-align:top;border:0px;padding-left:2px;" height="' + (h - 7) + '">' + '<a onfocus="blur()" class="' + cssClass + '" style="text-decoration:none;text-align:left;vertical-align:top;" href="' + href + '"'+(title? 'title="'+title+'"':'') + (frame ? ' target="' + frame + '">' : '>') + text + '</a></td>';
if (target > 0) {

// Set target's parents to this menu item.
menu[target][0].parentMenu = currMenu;
menu[target][0].parentItem = currItem;

// Add a popout indicator.
if (popInd) str += '<td class="' + cssClass + '"  >' + popInd + '</td>';
}
str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
if (isVert) itemY += length + spacing;
else itemX += length + spacing;
}
if (isDOM) {
var newDiv = document.createElement('div');
document.getElementsByTagName('body').item(0).appendChild(newDiv);
newDiv.innerHTML = str;
ref = newDiv.style;
ref.position = 'absolute';
ref.visibility = 'hidden';
}

// Insert a div tag to the end of the BODY with menu HTML in place for IE4.
if (isIE4) {
document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
ref = getSty('menu' + currMenu + 'div');
}

// In NS4, create a reference to a new layer and write the items to it.
if (isNS4) {
ref = new Layer(0);
ref.document.write(str);
ref.document.close();
}

for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
itemName = 'menu' + currMenu + 'item' + currItem;
if (isDOM || isIE4) menu[currMenu][currItem].ref = getSty(itemName);
if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
   }
}
with(menu[0][0]) {
ref.left = x;
ref.top = y;
ref.visibility = 'visible';
   }
}

var menu = new Array();



//die defaultwerte für die breite und höhe eines menüpunktes
var defLength = 100;
var defHeight = 15;


menu[0] = new Array();
top_menupos = 203;
left_menupos = 5;
if (isIE6 || isIE5 >> isIE4) menupos = 204;

//die hintergrundfarbe muss durch ein hintergrundbild ersetzt werden

// vertical, popup-zeichen, left, top, width/height, 'over color', 'backgr image', 'border style', 'text style'
menu[0][0] = new Menu(false, '', left_menupos, top_menupos, 17, '', '', '');
						// Text,				Link,					Target,titel,breit,Abstand,Verweis-auf-Submenue,css-klasse
menu[0][1] = new Item('Firmenportrait', 'javascript:changeContent(\'fp\');', '','Firmenportrait', 95, 0, 1,'fp');
menu[0][2] = new Item('Produkt-Sortiment', 'javascript:changeContent(\'ps\')', '','Produkt-Sortiment', 118, 0, 0,'ps');
//menu[0][3] = new Item('Online-Shop', 'javascript:openShop(\'\')', '','', 90, 0, 0,'os');
menu[0][3] = new Item('Online-Shop', 'http://www.sentgen.de/shop/index.php?language=de', '_blank','Online-Shop', 80, 0, 0,'os');
menu[0][4] = new Item('Neuheiten', 'javascript:changeContent(\'n\')', '','Neuheiten', 68, 0, 0,'n');
menu[0][5] = new Item('Umwelt', 'javascript:changeContent(\'u\')', '','Umwelt', 54, 0, 0,'u');
menu[0][6] = new Item('Tipps & Trends', 'javascript:changeContent(\'tt\')', '','Tipps & Trends', 95, 0, 0,'tt');
menu[0][7] = new Item('Dialog', 'javascript:changeContent(\'d\')', '','Dialog', 60, 0, 0,'d');

// Submenue 1 - firmenprotrait
menu[1] = new Array();										//border-klasse //text-klasse
menu[1][0] = new Menu(true, '', 0, -40, 120, '', '#ffffff', '', '');
menu[1][1] = new Item('Vielfalt', 'javascript:changeContent(\'v\')', '','', 15, 1, 0,'fp');
menu[1][2] = new Item('Fairness & N&auml;he', 'javascript:changeContent(\'f\')', '','', 15, 1, 0,'fp');

// *** OPTIONAL CODE FROM HERE DOWN ***

// These two lines handle the window resize bug in NS4. See <body onResize="...">.                    // I recommend you leave this here as otherwise when you resize NS4's width menus are hidden.

var popOldWidth = window.innerWidth;
nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');


// This is a quick snippet that captures all clicks on the document and hides the menus
// every time you click. Use if you want.

if (isNS4) document.captureEvents(Event.CLICK);
document.onclick = clickHandle;

function clickHandle(evt)
{
 if (isNS4) document.routeEvent(evt);
 hideAllBut(0);
}


// This is just the moving command for the example.

function moveRoot()
{
 with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
}