var isIE = false;
if (document.all) isIE = true;

var innerWidth;
var innerHeight;

// ******************************************************************
// *********************** TEST FUNCTION ************************
// ******************************************************************

function testOneTwo () {
	alert('habakuk');
}

// ******************************************************************
// *********************** PAUSE FUNCTION ************************
// ******************************************************************

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 

// ******************************************************************
// *************************** ON INIT ****************************
// ******************************************************************

function onInit() {
	if (isIE) {
	    innerWidth = document.body.clientWidth;
	    innerHeight = document.body.clientHeight;
	} else {
        innerWidth = window.innerWidth;
        innerHeight = window.innerHeight;
	}
}

var opContentIE=0;
var opContentNS=0;
var booleanBrowserIE=0;
var booleanBrowserNS=0;

function onInitFrame() {
//	alert('habakuk');
	if (isIE) {
		fadeInContentIE();
	} else {
		fadeInContentNS();
	}
}

function fadeInContentIE() {
	lyrContent=document.getElementById("Layer1");
	lyrContent.style.filter="Alpha(opacity="+opContentIE+")"
	if (opContentIE!=100) {
		setTimeout('opContentIE=opContentIE+4;fadeInContentIE()',50);
    }
	else {
		return true;
	}
}

function fadeInContentNS () {
	lyrContent=document.getElementById("Layer1");
	lyrContent.style.opacity=opContentNS/100;
	if (opContentNS!=100) {
		setTimeout('opContentNS=opContentNS+4;fadeInContentNS()',50);
    }
	else {
		return true;
	}
}

// ******************************************************************
// *********************** FADE IN IMAGE *************************
// ******************************************************************

var opImageNS = 0;

function fadeInImage(idOfObject) {
	if (isIE) {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.filter="Alpha(opacity=0)";
		fadeInImageIE(idOfObject);
	} else {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.opacity=0.00;
		fadeInImageNS(idOfObject);
	}
}

function fadeInImageNS(idOfObject) {
	if (idOfObject=="imagehome") {
		fadeInImgHomeNS();
	}
	if (idOfObject=='imagelinks') {
		fadeInImgLinksNS();
	}	
	else {
		return true;
	}
}

function fadeInImgHomeNS() {
	objectToFade=document.getElementById('imagehome');
	objectToFade.style.opacity=opImageNS/100;
//  lyrNav.style.opacity=0.00;
	if (opImageNS!=100) {
		setTimeout('opImageNS=opImageNS+4;fadeInImgHomeNS()',50);
    }
	else {
		return true;
	}
}

function fadeInImgLinksNS() {
	objectToFade=document.getElementById('imagelinks');
	objectToFade.style.opacity=opImageNS/100;
//  lyrNav.style.opacity=0.00;
	if (opImageNS!=100) {
		setTimeout('opImageNS=opImageNS+4;fadeInImgLinksNS()',50);
    }
	else {
		return true;
	}
}

// ******************************************************************
// ********************** FADE IN WEINGUT ***********************
// ******************************************************************

var opThumbWeingut = 0;

function fadeInWeingut() {
	idWeingarten=document.getElementById('weingarten');
	idKeller=document.getElementById('keller');
	idTradition=document.getElementById('tradition');
	idTermine=document.getElementById('termine');
	if (isIE) {
		idWeingarten.style.filter="Alpha(opacity=0)";
		idKeller.style.filter="Alpha(opacity=0)";
		idTradition.style.filter="Alpha(opacity=0)";
		idTermine.style.filter="Alpha(opacity=0)";
		fadeInWeingutIE();
	} else {
		idWeingarten.style.opacity=0.00;
		idKeller.style.opacity=0.00;
		idTradition.style.opacity=0.00;
		idTermine.style.opacity=0.00;
		fadeInWeingutNS();
	}
}

function fadeInWeingutIE() {
	idWeingarten=document.getElementById('weingarten');
	idKeller=document.getElementById('keller');
	idTradition=document.getElementById('tradition');
	idTermine=document.getElementById('termine');
}

function fadeInWeingutNS() {
	idWeingarten=document.getElementById('weingarten');
	idKeller=document.getElementById('keller');
	idTradition=document.getElementById('tradition');
	idTermine=document.getElementById('termine');
	idWeingarten.style.opacity=opThumbWeingut/100;
	idKeller.style.opacity=opThumbWeingut/100;
	idTradition.style.opacity=opThumbWeingut/100;
	idTermine.style.opacity=opThumbWeingut/100;
	if (opThumbWeingut<=70) {
		setTimeout('opThumbWeingut=opThumbWeingut+4;fadeInWeingutNS()',40);
	}
	else {
		return true;
	}
}


// ******************************************************************
// ************************ FADE IN WINE *************************
// ******************************************************************

var opThumbWines = 0;

function fadeInWines() {
//	alert('habakuk');
	idWhiteWine=document.getElementById('weissweinimage');
	idRedWine=document.getElementById('rotweinimage');
	idSpezialitaeten=document.getElementById('spezialitaetenimage');
	idAuszeichnungen=document.getElementById('auszeichnungenimage');
	if (isIE) {
		
		idWhiteWine.style.filter="Alpha(opacity=0)";
		idRedWine.style.filter="Alpha(opacity=0)";
		idSpezialitaeten.style.filter="Alpha(opacity=0)";
		idAuszeichnungen.style.filter="Alpha(opacity=0)";
		fadeInWinesIE();
	} else {
		idWhiteWine.style.opacity=0.00;
		idRedWine.style.opacity=0.00;
		idSpezialitaeten.style.opacity=0.00;
		idAuszeichnungen.style.opacity=0.00;
		fadeInWinesNS();
	}
}

function fadeInWinesIE() {
//	alert('habakuk');
	idWhiteWine=document.getElementById('weissweinimage');
	idRedWine=document.getElementById('rotweinimage');
	idSpezialitaeten=document.getElementById('spezialitaetenimage');
	
}

function fadeInWinesNS() {
//	alert('habakuk');
	idWhiteWine=document.getElementById('weissweinimage');
	idRedWine=document.getElementById('rotweinimage');
	idSpezialitaeten=document.getElementById('spezialitaetenimage');
	idAuszeichnungen=document.getElementById('auszeichnungenimage');
	idWhiteWine.style.opacity=opThumbWines/100;
	idRedWine.style.opacity=opThumbWines/100;
	idSpezialitaeten.style.opacity=opThumbWines/100;
	idAuszeichnungen.style.opacity=opThumbWines/100;
	if (opThumbWines<=70) {
		setTimeout('opThumbWines=opThumbWines+4;fadeInWinesNS()',40);
	}
	else {
		return true;
	}
}



// ******************************************************************
// ********************** FADE IN GALLERY ************************
// ******************************************************************

function fadeInGalerie () {
	idThumb1=document.getElementById('galeriebetrieb');
	idThumb2=document.getElementById('galerieregion');
	idThumb3=document.getElementById('galerieveranstaltungen');
	idTopic1=document.getElementById('spanbetrieb');
	idTopic2=document.getElementById('spanregion');
	idTopic3=document.getElementById('spanveranstaltungen');
	idSymbol1=document.getElementById('symbolcamera1');
	idSymbol2=document.getElementById('symbolcamera2');
	idSymbol3=document.getElementById('symbolcamera3');
	
	if (document.all) {
	alert('ie');
	idThumb1.style.filter="Alpha(opacity=0)";
	idThumb2.style.filter="Alpha(opacity=0)";
	idThumb3.style.filter="Alpha(opacity=0)";
	idTopic1.style.filter="Alpha(opacity=0)";
	idTopic2.style.filter="Alpha(opacity=0)";
	idTopic3.style.filter="Alpha(opacity=0)";
	idSymbol1.style.filter="Alpha(opacity=0)";
	idSymbol2.style.filter="Alpha(opacity=0)";
	idSymbol3.style.filter="Alpha(opacity=0)";
	fadeInGalerieIE ();
	}
	else {
//	alert('ns');
	idThumb1.style.opacity=0.00;
	idThumb2.style.opacity=0.00;
	idThumb3.style.opacity=0.00;
	idTopic1.style.opacity=0.00;
	idTopic2.style.opacity=0.00;
	idTopic3.style.opacity=0.00;
	idSymbol1.style.opacity=0.00;
	idSymbol2.style.opacity=0.00;
	idSymbol3.style.opacity=0.00;	
	fadeInGalerieNS ();
	}
}

function fadeInGalerieIE () {
	alert('ie');
	return true;
}


var opGalerieThumb1 = 0;
var opGalerieThumb2 = 0;
var opGalerieThumb3 = 0;

function fadeInGalerieNS () {
	setTimeout('fadeInGalerieThumb1();',10);
	setTimeout('fadeInGalerieThumb2();',600);
	setTimeout('fadeInGalerieThumb3();',1200);
}

function fadeInGalerieThumb1() {
	idThumb1=document.getElementById('galeriebetrieb');
	idTopic1=document.getElementById('spanbetrieb');
	idSymbol1=document.getElementById('symbolcamera1');
	idThumb1.style.opacity=opGalerieThumb1/100;
	idTopic1.style.opacity=opGalerieThumb1/100;
	idSymbol1.style.opacity=opGalerieThumb1/100;
	if (opGalerieThumb1<=70) {
		setTimeout('opGalerieThumb1=opGalerieThumb1+4;fadeInGalerieThumb1()',40);
	}
	else {
		return true;
	}
}

function fadeInGalerieThumb2() {
	idThumb2=document.getElementById('galerieregion');
	idTopic2=document.getElementById('spanregion');
	idSymbol2=document.getElementById('symbolcamera2');
	idThumb2.style.opacity=opGalerieThumb2/100;
	idTopic2.style.opacity=opGalerieThumb2/100;
	idSymbol2.style.opacity=opGalerieThumb2/100;
	if (opGalerieThumb2<=70) {
		setTimeout('opGalerieThumb2=opGalerieThumb2+4;fadeInGalerieThumb2()',40);
	}
	else {
		return true;
	}
}

function fadeInGalerieThumb3() {
	idThumb3=document.getElementById('galerieveranstaltungen');
	idTopic3=document.getElementById('spanveranstaltungen');
	idSymbol3=document.getElementById('symbolcamera3');
	idThumb3.style.opacity=opGalerieThumb3/100;
	idTopic3.style.opacity=opGalerieThumb3/100;
	idSymbol3.style.opacity=opGalerieThumb3/100;
	if (opGalerieThumb3<=70) {
		setTimeout('opGalerieThumb3=opGalerieThumb3+4;fadeInGalerieThumb3()',40);
	}
	else {
		return true;
	}
}

/*
var Eingabe = "";
var Zaehler = 1;
while (Eingabe != "how to make love" && Zaehler <= 3) {
  Eingabe = window.prompt(Zaehler + ". Versuch: Was bedeutet 'HTML'?", "");
  Zaehler++;
}

if (Eingabe != "how to make love") {
  document.write("<big>Lernen Sie erst mal HTML! ...<\/big>");
} else {
  document.write("<big>Fein, Sie haben verstanden worum es geht! ...<\/big>");
}
*/




// ******************************************************************
// *********************** FADE IN OBJECT ************************
// ******************************************************************

function fadeInObject (idOfObject) {
	if (document.all) {
	alert('ie');
	lyrContentInitial=document.getElementById(idOfObject);
	lyrContentInitial.style.filter="Alpha(opacity=0)";
	fadeInObjectIE (idOfObject);
	}
	else {
//	alert('ns');
	lyrContentInitial=document.getElementById(idOfObject);
	lyrContentInitial.style.opacity=0.00;
	fadeInObjectNS (idOfObject);
	}
}

function fadeInObjectIE (idOfObject) {
	lyrContent=document.getElementById("Layer1");
	lyrContent.style.filter="Alpha(opacity="+opContentIE+")";
	if (opContentIE!=100) {
		setTimeout('opContentIE=opContentIE+4;fadeInContentIE()',40);
	}
	else {
		return true;
	}
}

function fadeInObjectNS (idOfObject) {
//	alert('check 1.0');
	if (idOfObject == 'galeriebetrieb') { 
		fadeInObjectNSGalBet ();
	}
	else {
		return true;
	}
}	


var opacityOfObject = 0;

function fadeInObjectNSGalBet () {
	objectToFade=document.getElementById('galeriebetrieb');
	objectToFade.style.opacity=opacityOfObject/100;
	if (opacityOfObject<=70) {
		setTimeout('opacityOfObject=opacityOfObject+4;fadeInObjectNSGalBet()',40);
    }
	else {
		return true;
	}
}

function fullOpacity(idOfObject) {
	alert('check 1.0');
	if (isIE) {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.opacity=1.00;
	} else {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.filter="Alpha(opacity=100)";
	}
}

function halfOpacity(idOfObject) {
	alert('check 2.0');
	if (isIE) {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.opacity=0.70;
	} else {
		objectToFade=document.getElementById(idOfObject);
		objectToFade.style.filter="Alpha(opacity=70)";
	}
}

/*
var Eingabe = "";
var Zaehler = 1;
while (Eingabe != "how to make love" && Zaehler <= 3) {
  Eingabe = window.prompt(Zaehler + ". Versuch: Was bedeutet 'HTML'?", "");
  Zaehler++;
}

if (Eingabe != "how to make love") {
  document.write("<big>Lernen Sie erst mal HTML! ...<\/big>");
} else {
  document.write("<big>Fein, Sie haben verstanden worum es geht! ...<\/big>");
}
*/


// ******************************************************************
// ************************* TESTING 1 - 2  *************************
// ******************************************************************




// ******************************************************************
// ************************* MOVE OBJECT *************************
// ******************************************************************

function move(f) {
  window.setTimeout("move1('" + f[0] + "','" + f[1] + "')", 10);
}

function move1(f0, f1) {
  frames['frame_left'].location.href = f0;
  frames['frame_main'].location.href = f1;
}

// *************************

function onInitDoc() {
	if (document.all) {
//	alert('IE');
	fadeInIE();
	fadeInContentIE();
	}
	else {
//	alert('NS');
	fadeInNS();
	fadeInContentNS();
	}
}

function getWidth() {
	if (document.all) {
//	alert('IE');
	varWidth = document.body.clientWidth;
	alert('Width is '+varWidth+ 'pixel..');
		if (varWidth> 1024) {
			document.href="index2.html";
			return true;
		}
		else {
			document.href="index.html";
			return true;
		}
	}
	else {
//	alert('NS');
	varWidth = window.innerWidth;
	//alert('Width is '+varWidth+ 'pixel.. ');
		if (varWidth> 1024) {
			//alert('Height: '+window.innerHeight+" pixel..");
			varNewHeight = window.innerHeight - 20;
			//alert('New height: '+varNewHeight+" pixel..");
			//alert('Height: '+document.getElementById("layer1").style.height+" pixel..");
			document.getElementById("layer1").style.height = varNewHeight +"px";
			// document.getElementById("layer1").height = window.innerHeight;
		}
		else {
			//alert('Height: '+window.innerHeight+" pixel..");
			varNewHeight = window.innerHeight - 20;
			//alert('New height: '+varNewHeight+" pixel..");
			//alert('Height: '+document.getElementById("layer1").style.height+" pixel..");
			document.getElementById("layer1").style.height = varNewHeight +"px";
			// document.getElementById("layer1").height = window.innerHeight;
		}
	}
}

// *****************************

function initDocSize() {
	if (isIE) {
		setHeightIE();
	} else {
		setHeightNS();
	}
}

function setHeightIE() {
	varAvailHeight = window.screen.availHeight;
	varNewHeight = document.body.clientHeight;
	document.all("tableindex").style.height = varAvailHeight - 110 + 'px';
	document.all("layerbody").style.height = varAvailHeight + 'px';
}

function setHeightNS() {
	varNewHeight = window.innerHeight;
	document.getElementById("tableindex").style.height = varNewHeight - 20 + 'px';
	document.getElementById("layerbody").style.height = varNewHeight + 'px';
}

function initDocSizeHome() {
	if (isIE) {
		setSizeHomeIE();
	} else {
		setSizeHomeNS();
	}
}

function setHeightHomeIE() {
	varAvailHeight = window.screen.availHeight;
	varNewHeight = document.body.clientHeight;
	document.all("tableindex").style.height = varAvailHeight - 110 + 'px';
	document.all("layerbody").style.height = varAvailHeight + 'px';
}

function setHeightHomeNS() {
	varNewHeight = window.innerHeight;
	document.getElementById("tableindex").style.height = varNewHeight - 20 + 'px';
	document.getElementById("layerbody").style.height = varNewHeight + 'px';
}

// *****************************

function handleNav (varNavLoc) {

	if (varNavLoc=="aktuelles") {
		//alert('habakuk1');
		varFrmAktuelles = parent.document.getElementById('framecontent');
		varFrmAktuelles.src = "frm_aktuelles_ger.html"; 
		window.location.href = "frm_menu_0.html";
	}
	if (varNavLoc=="weingut") {
		//alert('habakuk2');
		varFrmWeingut = parent.document.getElementById('framecontent');
		varFrmWeingut.src = "frm_weingut_ger.html"; 
		window.location.href = "frm_menu_1.html";
	}
	if (varNavLoc=="weingarten") {
		//alert('habakuk2');
		varFrmWeingut = parent.document.getElementById('framecontent');
		varFrmWeingut.src = "frm_weingarten_ger.html"; 
		window.location.href = "frm_menu_1.html";
//		idDownImage = document.getElementById('weingarten');
//		idDownImage.src="img/nav_bar_ger/weingarten_2.gif";
	}
	if (varNavLoc=="keller") {
		//alert('habakuk2');
		varFrmWeingut = parent.document.getElementById('framecontent');
		varFrmWeingut.src = "frm_keller_ger.html"; 
		window.location.href = "frm_menu_1.html";
	}
	if (varNavLoc=="tradition") {
		//alert('habakuk2');
		varFrmWeingut = parent.document.getElementById('framecontent');
		varFrmWeingut.src = "frm_tradition_ger.html"; 
		window.location.href = "frm_menu_1.html";
	}
	if (varNavLoc=="termine") {
		//alert('habakuk2');
		varFrmWeingut = parent.document.getElementById('framecontent');
		varFrmWeingut.src = "frm_termine_ger.html"; 
		window.location.href = "frm_menu_1.html";
	}
	if (varNavLoc=="weine") {
		//alert('habakuk3');
		varFrmWeine = parent.document.getElementById('framecontent');
		varFrmWeine.src = "frm_weine_ger.html"; 
		window.location.href = "frm_menu_2.html";
	}
	if (varNavLoc=="weissweine") {
		//alert('habakuk3');
		varFrmWeine = parent.document.getElementById('framecontent');
		varFrmWeine.src = "frm_weinliste_ww_ger.html"; 
		window.location.href = "frm_menu_2.html";
	}
	if (varNavLoc=="rotweine") {
		//alert('habakuk3');
		varFrmWeine = parent.document.getElementById('framecontent');
		varFrmWeine.src = "frm_weinliste_rw_ger.html"; 
		window.location.href = "frm_menu_2.html";
	}
	if (varNavLoc=="spezialitaeten") {
		//alert('habakuk3');
		varFrmWeine = parent.document.getElementById('framecontent');
		varFrmWeine.src = "frm_weinliste_sw_ger.html"; 
		window.location.href = "frm_menu_2.html";
	}
	if (varNavLoc=="auszeichnungen") {
		//alert('habakuk3');
		varFrmWeine = parent.document.getElementById('framecontent');
		varFrmWeine.src = "frm_auszeichnungen_ger.html"; 
		window.location.href = "frm_menu_2.html";
	}
	
	if (varNavLoc=="galerie") {
		//alert('habakuk4');
		varFrmGalerie = parent.document.getElementById('framecontent');
		varFrmGalerie.src = "frm_galerie_ger.html"; 
		window.location.href = "frm_menu_3.html";
	}
	if (varNavLoc=="betrieb") {
		//alert('habakuk4');
		varFrmGalerie = parent.document.getElementById('framecontent');
		varFrmGalerie.src = "frm_galerie_betrieb_ger.html"; 
		window.location.href = "frm_menu_3.html";
	}
	if (varNavLoc=="region") {
		//alert('habakuk4');
		varFrmGalerie = parent.document.getElementById('framecontent');
		varFrmGalerie.src = "frm_galerie_region_ger.html"; 
		window.location.href = "frm_menu_3.html";
	}
	if (varNavLoc=="veranstaltungen") {
		//alert('habakuk4');
		varFrmGalerie = parent.document.getElementById('framecontent');
		varFrmGalerie.src = "frm_galerie_veranstaltungen_ger.html"; 
		window.location.href = "frm_menu_3.html";
	}
	if (varNavLoc=="anreise") {
		//alert('habakuk5');
		varFrmAnreise = parent.document.getElementById('framecontent');
		varFrmAnreise.src = "frm_anreise_ger.html"; 
		window.location.href = "frm_menu_4.html";
	}
	if (varNavLoc=="links") {
		//alert('habakuk6');
		varFrmLinks = parent.document.getElementById('framecontent');
		varFrmLinks.src = "frm_links_ger.html"; 
		window.location.href = "frm_menu_5.html";
	}
	if (varNavLoc=="kontakt") {
		//alert('habakuk7');
		varFrmKontakt = parent.document.getElementById('framecontent');
		varFrmKontakt.src = "frm_kontakt_ger.html"; 
		window.location.href = "frm_menu_6.html"; 
	}
}

