// ======================================================================================================
// | File       : eh.js
// | Description: ToolBox JS E.Hoppert
// | History    : 0.9a 24-Nov-2009 hk   Erstfassung
// |              0.9b 28-Feb-2010 hk   Modified Home Pix
// ======================================================================================================
// -------------------------------------------------------------------------------------------- Namespace
var eh = eh || {
	vn: "eva.",
	zn: "hoppert",
	dm1: "chello.",
	dm2: "at"
};

// -------------------------------------------------------------------------------------------- Constants
// ------------------------------------------------------------------------------------- Global variables
var isCSS, isW3C, isIE4, isNN4, isIE6CSS;					// API 
var isIE = true;																	// sicherheitshalber (wir bevorzugen damit den MSIE)
// ===================================================================================== Public Functions
eh.home = function() {
// +-----------------------------------------------------------------------------------------------------
// | home()
// |-----------------------------------------------------------------------------------------------------
// | zeigt eines von wahlweise 3 Starbildern (zufaellige
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
var url;

		eh._browserDetect();
		Math.random( new Date().getSeconds() );
		url = Math.floor( Math.random() * 3 ) + 1;
		url = "./_pix/img0" + url + "_home.png";
		document.getElementById( "homePix" ).src = url;
		window.setTimeout( "eh._homeImgLoaded()", 300 );		
}

eh.init = function() {
// +-----------------------------------------------------------------------------------------------------
// | init()
// |-----------------------------------------------------------------------------------------------------
// | Initialisierung aller Objects (Menu)
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
	eh._browserDetect();
	bMenu.first();
}

eh.initGallery = function() {
// +-----------------------------------------------------------------------------------------------------
// | initGallery()
// |-----------------------------------------------------------------------------------------------------
// | Initialisierung aller Objects (Galerie)
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
	eh._browserDetect();
	bRollbar.first();
	bImage.first();
	bMenu.firstGallery();
}

eh.sendSimple = function() {
// +-----------------------------------------------------------------------------------------------------
// | sendSimple(); 
// |-----------------------------------------------------------------------------------------------------
// | Sendet eine E-Mail
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
var aStr;

	aStr = "m" + "a" + "i" + "l" + "t" + "o" + ":" + eh.vn + eh.zn + "@" + eh.dm1 + eh.dm2;
	aStr += "?subject=Anfrage";
	
	//window.open(aStr,'mailwindow','width=400,height=200');
	document.location.href = aStr;
}

// ==================================================================================== Private Functions
eh._browserDetect = function() {
// +-----------------------------------------------------------------------------------------------------
// | _browserDetect()
// |-----------------------------------------------------------------------------------------------------
// | Initialize upon load to let all browsers establish content objects
// | Stellt globale Variable zur Verfuegung, welche Auskunft darueber geben, in welchem Browser wir uns
// | gerade befinden.
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
  if (document.images) {
    isCSS = (document.body && document.body.style) ? true : false;
    isW3C = (isCSS && document.getElementById) ? true : false;
    isIE4 = (isCSS && document.all) ? true : false;
    isNN4 = (document.layers) ? true : false;
    isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
		isIE = ( navigator.appName == "Microsoft Internet Explorer" );
  }
}

eh._homeImgLoaded = function() {
// +-----------------------------------------------------------------------------------------------------
// | _homeImgLoaded()
// |-----------------------------------------------------------------------------------------------------
// | nimmt das background Imgae weg, wenn das Bild geladen hat
// |-----------------------------------------------------------------------------------------------------
// | Arguments:
// |   <void>
// |-----------------------------------------------------------------------------------------------------
// | Return Value:
// |   <void>
// +-----------------------------------------------------------------------------------------------------
var hI, loaded;

	hI = document.getElementById( "homePix" );
	loaded = false;
	
	if( isIE ) {
		if( hI.readyState == "complete" ) { loaded = true; }
	}
	else if( hI.complete ) { loaded = true; }			

	if( loaded ) {
		hI.style.backgroundImage = "none";
	}
	else {
		window.setTimeout( "eh._homeImgLoaded()", 100 );
	}
}

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