/**
*
*   MeteoCheck Project
*
*   Version 1.0
*
*   (c) by Linard Moll
*       MIT Innovation AG, 2010
*
**/

function load(){

	var ribbon =  $('vote_meteo_ribbon_0');
	var gui =  $('vote_meteo_gui_layer_0');
	var elem0 =  $('vote_meteo_element_0');	
	var elem1 =  $('vote_meteo_element_1');
	var elem2 =  $('vote_meteo_element_2');	
	var elem3 =  $('vote_meteo_element_3');	
	
	if (voting){
		ribbon.observe('mouseover',showGui);
		ribbon.observe('click',showGui2);
		gui.observe('click',fadeGui);
		elem1.observe('click',fadeGui);
		elem0.observe('click',fadeGui);
		setupVoting();
	}
	
	setupZoom();
	
	/* In-Place-Selector loader */
	new Ajax.InPlaceSelect('sliceTranslation', '', slicesTranslated, slicesTranslated, { 
		callback: function(value, text) { location.href="?p="+p+"&j="+j+"&s=" + text; }
	} );
	
}

/** Loginbox loader: **/
function loginHintBoxInitNG(){
	_h = getDocHeight();
	_wholeSite = $('pageBody');
	
	if (typeof showLoginHintBox == 'undefined')
		return;
	
	if (showLoginHintBox){
		a = document.createElement("div");
		a.setAttribute("id", "login-hint-box-cover");
		a.setAttribute("style", "height: '+h+'px;");
		_wholeSite.insertBefore(a, null);
		$('infobox2').setStyle({'display': 'block'});
		$('login-hint-box-cover').update( $('infobox2') );
		Event.observe( $('login-hint-box-cover'), 'click', close_infobox, false);
	}
	else {
		if ( $('infobox2') != null )	
		  $('infobox2').remove();
	}
}

Event.observe(window, 'load', loginHintBoxInitNG, false);
/** /Loginbox loader **/

/** Archivebox loader: **/
function archiveHintBoxInitNG(){
	_h = getDocHeight();
	_wholeSite = $('pageBody');
	
	if (typeof showArchiveBox == 'undefined')
		return;
	
	if (showArchiveBox){
		a = document.createElement("div");
		a.setAttribute("id", "login-hint-box-cover");
		a.setAttribute("style", "height: '+h+'px;");
		_wholeSite.insertBefore(a, null);
		boxCode = $('infobox3').cloneNode(true);
		boxCode.setStyle({'display': 'block'});
		$('login-hint-box-cover').update( boxCode );
		//Event.observe( $('login-hint-box-cover'), 'click', close_infobox, false);
	}
	else {
		if ( $('infobox3') != null )	
		  $('infobox3').remove();
	}
}
/** /Archivebox loader **/


/** Lightbox Functions **/
function close_infobox() {
	if ( $('login-hint-box-cover') != null )
		$('login-hint-box-cover').remove();
}

function getDocHeight() {
    D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
/** /Lightbox Functions **/
