/***********************************************************************************************************

	w h y d a t a   I T   S e r v i c e s
	
	www.whydata.de

***********************************************************************************************************/

var sServer="http://www.whydata.de/";
//---------------------------------------------------------------------------------------
//---- browser-check --------------------------------------------------------------------
var ua	= navigator.userAgent;
var opera	= /opera [56789]|opera\/[56789]/i.test(ua);
var ie	= !opera && /msie [56789]/i.test(ua);		// preventing opera to be identified as ie
var moz	= !opera && /mozilla\/[56789]/i.test(ua);		// preventing opera to be identified as mz
//---------------------------------------------------------------------------------------
// ----- aktuelles Datum ----------------------------------------------------------------
var sH = new Date();
var sT = sH.getDate();
var sM = sH.getMonth()+1;
var sJ = sH.getYear();
if (!ie) sJ += 1900;
//---------------------------------------------------------------------------------------
// ----- ändert die BG-Farbe von best. aktiven FormFeldern ------------------------------
var Faktiv='#d1d1d1';
//---------------------------------------------------------------------------------------
//Fenster der Suchmaske leeren ----------------------------------------------------------
function fktLeer(){document.getElementById("ysuchen").value="";}
//---------------------------------------------------------------------------------------
//ändert die BG-Farbe von best. aktiven FormFeldern -------------------------------------
//var Faktiv='#d1d1d1';
var ns6=document.getElementById&&!document.all;var previous='';var eventobj;
//welche FormFelder
var intended=/INPUT|TEXTAREA|SELECT|OPTION/;
//wurde ein FormFeld angeklickt
function fktCheckEl(which){if (which.style&&intended.test(which.tagName)){if (ns6&&eventobj.nodeType==3)eventobj=eventobj.parentNode.parentNode;return true;}else return false;}
//Farbe ändern
function fktFarbe(e){eventobj=ns6? e.target : event.srcElement;if (previous!=''){if (fktCheckEl(previous))previous.style.backgroundColor='';previous=eventobj;if (fktCheckEl(eventobj))eventobj.style.backgroundColor=Faktiv;}else{if (fktCheckEl(eventobj))eventobj.style.backgroundColor=Faktiv;previous=eventobj;}}
//---------------------------------------------------------------------------------------
function fkteM(ix) {
	switch(ix)
	{
		case 3:
			eM="mail";
			break;
		case 5:
			eM="paproth";
			break;
	}
	document.write("<a href='mailto:"+eM+"@whyd"+"ata.de"+"'>"+eM+"@whyd"+"ata.de"+"</a>");
}
//---------------------------------------------------------------------------------------
function fktBMark(){
	var url = sServer + XXFile;
	var url_txt = 'whydata-' + XXNameMP;
	if (navigator.appName=='Microsoft Internet Explorer'){window.external.AddFavorite(url, url_txt)}
	else if (navigator.appName=='Netscape'){alert('Bitte Strg+D klicken')}
}
// ----- Suchergebnisse öffnen/focus setzen -wird aufgerufen von y_nav -------------------
function fktSuauf(){
ySuche = window.open(sServer+'ySuchen.html','ySuche','width=225,height=700,Left=780,Top=15,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no');
}
//---------------------------------------------------------------------------------------
//für die Anrede auf den Browser-Fehler-Formularen --------------------------------------
function fktAnrede(){
out = "%20";
add = " ";
var temp = "" + location.search;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
}
out = "?";
add = "";
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
}
document.write(temp);
}
//---------------------------------------------------------------------------------------
// ----- Anzahl an Zeichen in Feldern Begrenzungsszeile ---------------------------------
function fktMax(sID,max){
max=max-1;
var obj=document.getElementById(sID);
if(obj.value.length>max)
{
obj.value=obj.value.substring(0,max);
alert("Dieses Feld fasst max. "+(max+1)+" Zeichen.");
}
}
//---------------------------------------------------------------------------------------
function fktZeigePI(sID){
	var oDiv;
	var i=0;
	for(i=0;i<12;i++)
	{
	if(document.getElementById("PI"+i))
	{
		if(sID==i)
		{
			//das gewünschte DIV zeigen bzw. verbergen
			oDiv = document.getElementById("PI"+i);
			if(oDiv.style.display=='block')
			{
				oDiv.style.display='none';
			}else{
				oDiv.style.display='block';
			}
		}else{
			oDiv = document.getElementById("PI"+i);
			oDiv.style.display='none';
		}
	}
	}
	fktStart();
}
//---------------------------------------------------------------------------------------
// ---- Fenster- und Pagehöhe und -breite bestimmen -------------------------------------
//
// Copy von http://www.huddletogether.com/projects/lightbox/
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
// var arrayPageSize = getPageSize();
//	arrayPageSize[0];	//page width
//	arrayPageSize[1];	//page height
//	arrayPageSize[2];	//window width
//	arrayPageSize[3];	//window height
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
//---------------------------------------------------------------------------------------
// ---- DIV-Höhe bestimmen --------------------------------------------------------------
//
function fktHoehe(elem){
var elm = document.getElementById(elem);
if (document.layers)
{
if (!elm.height)
elm.height = elm.clip.height;
return elm.height;
}
else if (typeof(elm.style && elm.style.height) == 'number')
{
return elm.style.height;
}
else if (typeof(elm.style && elm.style.height) == 'string' && !isNaN(parseInt(elm.style.height)))
{
return parseInt(elm.style.height);
}
else if (elm.offsetHeight)
{
return elm.offsetHeight;
}
else if (typeof(elm.style && elm.style.pixelHeight) == 'number')
{
return elm.style.pixelHeight;
}
else if (elm.clientHeight)
{
return elm.clientHeight;
}
}

//-------------------------------------------------------------------------------------------------
function fktStart(){
// Höhe von Fenster und Page
	var arrayPageSize = getPageSize();

// Abstand des Hauptcontainers vom oberen Fensterrand setzen
	var o_ContGlobal = document.getElementById("ContGlobal");
	var Abst1 = arrayPageSize[3]/20 + "px";	//window height
	o_ContGlobal.style.marginTop = Abst1;

// falls der HEAD zu dicht am linken Rand liegt
	if (arrayPageSize[2] < 900) document.getElementById("ContHaupt").style.left = Abst1;

// divFoot platzieren - Margins von ca. 40px berücksichtigen
	var o_ContFoot = document.getElementById("ContFoot");
	o_ContFoot.style.top = parseInt(Abst1) + parseInt(fktHoehe("ContHEAD")) + parseInt(fktHoehe("ContArtikel")) + 20 + 'px';
}

//-------------------------------------------------------------------------------------------------
//Transparenz von divArtikel einleiten
	var oc=100;

function fktOC(){

	var o_divArtikel = document.getElementById("divArtikel");
	o_divArtikel.style.opacity=oc/100;
	o_divArtikel.style['-moz-opacity']=oc/100;
	o_divArtikel.style.filter="alpha(opacity="+oc+")";

	var o_divArtikel2 = document.getElementById("divArtikel2");
	o_divArtikel2.style.opacity=oc/100;
	o_divArtikel2.style['-moz-opacity']=oc/100;
	o_divArtikel2.style.filter="alpha(opacity="+oc+")";

	//cp-Bild nicht transparent
/*
	var o_img = document.getElementById("cpXX");
	o_img.style.opacity=1;
	o_img.style['-moz-opacity']=1;
	o_img.style.filter="alpha(opacity=100)";
*/
	oc=oc-1;
	if(oc>60)
	{
		setTimeout('fktOC()',100);
	}else{
		if(document.getElementById("cpYY"))
		{
			var o_img1 = document.getElementById("cpYY");
			o_img1.style.top="114px";
			o_img1.style.left="442px";
			o_img1.style.display="block";
			var o_img = document.getElementById("cpXX").innerHTML="";
		}
	}
}

