function email(username, domain, subject, body) {
	var params = new Array();
	subject = ( subject == null || subject == "" ? "" : params.push("subject=" + escape(subject)));
	body = ( body == null || body == "" ? "" : params.push("body=" + escape(body)));
	window.location.href='mailto:' + username + "@" + domain + (params.length > 0 ? "?" + params.join("&") : "");
}

/*Konstante Variablen:*/
var KONTAKT_LINK = "kontakt.html?OpenForm&key=SBUO-5NPR55";
var DIREKT_SERVICE_LINK = "ML16.htm?ReadForm&bereich=Strom&key=TBAL-6BWGXL"


/*String*/
function strltrim() { return this.replace(/^\s+/,''); }
function strrtrim() { return this.replace(/\s+$/,''); }
function strtrim() { return this.replace(/^\s+/,'').replace(/\s+$/,''); }

function strRight () {
 if ( this.indexOf( this.strRight.arguments[0] ) < 0 ) return "";
 else return this.substring( this.indexOf( this.strRight.arguments[0] ) + this.strRight.arguments[0].length, this.length );
}
function strRightBack () {
 if ( this.lastIndexOf( this.strRightBack.arguments[0] ) < 0 ) return "";
 else return this.substring( this.lastIndexOf( this.strRightBack.arguments[0] ) + this.strRightBack.arguments[0].length, this.length );
}
function strLeft () {
 if ( this.indexOf( this.strLeft.arguments[0] ) < 0 ) return "";
 else return this.substring( 0, this.indexOf( this.strLeft.arguments[0] ));
}
function strLeftBack () {
 if ( this.lastIndexOf( this.strLeftBack.arguments[0] ) < 0 ) return "";
 else return this.substring( 0, this.lastIndexOf( this.strLeftBack.arguments[0] ));
}
function contains() { if ( this.indexOf(this.contains.arguments[0]) > -1 ) return true; return false; }

function beginsWith() { return (this.indexOf(this.beginsWith.arguments[0]) == 0) }

function explode(str, delim, bWithEmpty){
	if (str.indexOf(delim) < 0 || str.length == 0) return str;
	delim = (delim ? delim : " ");
	bWithEmpty = ( bWithEmpty ? true : false);
	var retVal = new Array();
	var strTemp = str;
	var pos = strTemp.indexOf(delim);
	do {
		if ( strTemp.substring(0, pos).length > 0 || bWithEmpty)
			retVal[retVal.length] = strTemp.substring(0, pos);
		strTemp = strTemp.substring(pos+1, strTemp.length);
		pos = strTemp.indexOf(delim);
	}
	while (pos > -1);
	if (strTemp.length > 0 || bWithEmpty) retVal[retVal.length] = strTemp;
	return retVal;
}
function implode(a, delim) {
	if (!a) return "";
	delim = (delim ? delim : " ");
	var strRet = "";
	if (a.length) {	for( i = 0; i < a.length; i++ ) strRet += (i==0 ? "" : delim) + a[i]; }
	else { for(e in a) strRet += (strRet.length==0 ? "" : delim) + a[e]; }
	return strRet;
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;
String.prototype.strRight = strRight;
String.prototype.strRightBack = strRightBack;
String.prototype.strLeft = strLeft;
String.prototype.strLeftBack = strLeftBack;
String.prototype.contains = contains;
String.prototype.beginsWith = beginsWith;
String.prototype.explode = explode;
String.prototype.implode = implode;
/*String*/

var winPopup = null;
objInput = document.getElementsByName("query")[0];
if (objInput) {
	
}

function onFocusHandler() {
	if (!winPopup) return;
	if (!winPopup.closed) winPopup.close();
	winPopup = null;
}


function doGlobalOpen(url,name, width, height, typ, bscroll){
	bscroll = (bscroll ? bscroll : "yes");
	width = (width ? width : 520);
	height = (height ? height : (screen.height < 700 ? 540 : 600 ));
	if ( url.indexOf("http://") == 0 || url.indexOf("https://") == 0 ) url = url;
	else if ( url.toLowerCase().indexOf("readform") > -1 || url.toLowerCase().indexOf("openform") > -1 || url.toLowerCase().indexOf("openview")  > -1) url = window.base + url;
//	else url = window.base + url +".html";
	else url = window.base + url;
	
	if ( url.toLowerCase().indexOf("vido") > -1 && url.toLowerCase().indexOf(".htm") == -1){
	url += ".html"	;
	}
	
	var t ="Privatkunden";
	if(window.typ=="VNM") t="Marktpartner";
	if(window.typ=="VNG") t="Geschaeftskunden";
	url=url.replace("<!Type>",t);
	url=url.replace("VID/","VIDO/");
	winPopup = window.open(url,name,"width=" + width + ",height=" + height + ",screenX=0,screenY=0,left=100,top=50,dependent=yes,status=no,copyhistory=no,scrollbars="+bscroll+",toolbar=no,location=no");
	if (typ==false) {
		var winPopupLoc=winPopup;
		winPopupLoc.focus();
		winPopup=null;
	}else {
		winPopup.focus();
	}
	return false;
}

function doGlobalOpenDS(url,name, width, height, typ, bscroll){
	bscroll = (bscroll ? bscroll : "yes");
	width = (width ? width : 520);
	height = (height ? height : (screen.height < 700 ? 540 : 600 ));
	if ( url.indexOf("http://") == 0 || url.indexOf("https://") == 0 ) url = url;
	else if ( url.toLowerCase().indexOf("readform") > -1 || url.toLowerCase().indexOf("openform") > -1 || url.toLowerCase().indexOf("openview")  > -1) url = window.base + url;
//	else url = window.base + url +".html";
	else url = window.base + url;
	
	if ( url.toLowerCase().indexOf("vido") > -1 && url.toLowerCase().indexOf(".htm") == -1){
	url += ".html"	;
	}
	
	var t ="Privatkunden";
	if(window.typ=="VNM") t="Marktpartner";
	if(window.typ=="VNG") t="Geschaeftskunden";
	url=url.replace("<!Type>",t);
	url=url.replace("VID/","VIDO/");
	winPopup = window.open(url,name,"width=" + width + ",height=" + height + ",screenX=0,screenY=0,left=100,top=50,dependent=yes,status=yes,copyhistory=no,scrollbars="+bscroll+",toolbar=no,location=no,resizable=yes");
	if (typ==false) {
		var winPopupLoc=winPopup;
		winPopupLoc.focus();
		winPopup=null;
	}else {
		winPopup.focus();
	}
	return false;
}

function doGlobalOpenWYSIWYG(url,name, params){

	if ( url.indexOf("http://") == 0 || url.indexOf("https://") == 0 ) url = url;
	else if ( url.toLowerCase().indexOf("readform") > -1 || url.toLowerCase().indexOf("openform") > -1 || url.toLowerCase().indexOf("openview")  > -1) url = window.base + url;
//	else url = window.base + url +".html";
	else url = window.base + url;
	
	if ( url.toLowerCase().indexOf("vido") > -1 && url.toLowerCase().indexOf(".htm") == -1){
	url += ".html"	;
	}
	
	var t ="Privatkunden";
	if(window.typ=="VNM") t="Marktpartner";
	if(window.typ=="VNG") t="Geschaeftskunden";
	url=url.replace("<!Type>",t);
	url=url.replace("VID/","VIDO/");
	winPopup = window.open(url,name, params);
	if (typ==false) {
		var winPopupLoc=winPopup;
		winPopupLoc.focus();
		winPopup=null;
	}else {
		winPopup.focus();
	}
	return false;
}

function getIDReihenfolge( objID ){
	try{
		var ids = "";
		childs = $( objID ).childElements(); 
		for (i = 0; i < childs.length; i++ ){
			ids += childs[i].firstChild.id + (( i + 1 < childs.length) ? (";") : "");
		}
		return  ids ;
		// AJAX-Request, Neue Reihenfolge anns Dokument senden...
	}
	catch(e){ alert(e.description); }
}

function sendContent( ids, unid , fieldID){
    doGlobalOpen("WQSTinyMCE?Open&tmp_tEditableDivID="+fieldID+"&tmp_tEditableDocID=" + unid + "&tmp_tEditableHTML=" + ids + "","",50,50);
}


function doQuickFinder(f) {
	if(f.value!="#")
		window.location.href=window.base+f.value;
}

function doSearch() {
	if (window.query==null) return;
	var querys=window.query.value;
	querys=doUnicodeURL(querys);
	if(querys!=""){
		var url="search.html?ReadForm&query="+querys;
		doGlobalOpen(url,"Suchergebnis",false,false, false);
	}
}

//unicode Url, benutzt f\u00FCr Suche
function doUnicodeURL(s){
     if(s==null) {
     	s="";
     	return s
     }else if (s=="") return s;
     /*while(s.indexOf(" ")!=-1) s=s.replace(" ","+");
     while(s.indexOf(String.fromCharCode(228))!=-1) s=s.replace(String.fromCharCode(228),"%E4");//ae
     while(s.indexOf(String.fromCharCode(246))!=-1) s=s.replace(String.fromCharCode(246),"%F6");//oe
     while(s.indexOf(String.fromCharCode(252))!=-1) s=s.replace(String.fromCharCode(252),"%FC");//ue
     while(s.indexOf(String.fromCharCode(196))!=-1) s=s.replace(String.fromCharCode(196),"%C4");//Ae
     while(s.indexOf(String.fromCharCode(214))!=-1) s=s.replace(String.fromCharCode(214),"%D6");//Oe
     while(s.indexOf(String.fromCharCode(220))!=-1) s=s.replace(String.fromCharCode(220),"%DC");//Ue
     while(s.indexOf(String.fromCharCode(223))!=-1) s=s.replace(String.fromCharCode(223),"%DF");//ss
     while(s.indexOf(".")!=-1) s=s.replace(".","%26");
     while(s.indexOf("?")!=-1) s=s.replace("?","%2E");*/
     return escape(s);
}

var query=null;



function doKeyUp( eventObj ) {
	if ( ! getSrcElement(eventObj) ) return;
	if ( eventObj.keyCode != 13 ) return true;
	doSearch(); return false;
}
/* Auswertung von Events */
function getSrcElement(eventObj) {
		 if ( eventObj.srcElement ) return eventObj.srcElement; // Microsoft
		 else if ( eventObj.target ) return eventObj.target; // Mozilla, Netscape
		 return false;
}


function setQuery(f){
	window.query=f;
}

function check_suchvalue (akt_value,default_value) {
			if (akt_value == '') akt_value=default_value;
		return akt_value;
}

function doGlobalOpenUmfrage(url,name, width, height, typ, bscroll){
	bscroll = (bscroll ? bscroll : "yes");
	width = (width ? width : 480);
	height = (height ? height : (screen.height < 700 ? 540 : 600 ));
	if ( url.indexOf("http://") == 0 || url.indexOf("https://") == 0 ) url = url;
	else if ( url.toLowerCase().indexOf("readform") > -1 || url.toLowerCase().indexOf("openform") > -1 || url.toLowerCase().indexOf("openview")  > -1) url = window.base + url;
	else url = window.base + url +".html";
	var t ="Privatkunden";
	if(window.typ=="VNM") t="Marktpartner";
	if(window.typ=="VNG") t="Geschaeftskunden";
	url=url.replace("<!Type>",t);
	url=url.replace("VID/","VIDO/");
	window.open(url,name,"width=" + width + ",height=" + height + ",screenX=0,screenY=0,left=100,top=50,dependent=yes,status=no,copyhistory=no,scrollbars="+bscroll+",toolbar=no,location=no");
	return false;
}

function changePlusMinusIcon( objID ){
try{
	if ( $( objID ).src.indexOf("plus") > 0 ) {
		$( objID ).src = $( objID ).src.replace(/plus/, "minus" )
	}
	else {
		$( objID ).src = $( objID ).src.replace(/minus/, "plus" )
	}
}//try
catch(e){}
}

/* Event Handler f\u00FCr Aktionen zum Thema Quickinfo f\u00FCr Links */
var Quickinfo = {
	mouseOverHandler : function(e) {
		var obj = Event.element(e);
		if ( $("quickinfo_" + obj.id ) == null ) return;
		$("quickinfo_" + obj.id).setStyle({top: Event.pointerY(e) +20, left: Event.pointerX(e) - ( $("quickinfo_" + obj.id).getHeight() / 2)});
		Effect.Appear($("quickinfo_" + obj.id), {duration: 0.2});
	},

	mouseOutHandler : function(e) {
		var obj = Event.element(e);
		if ( $("quickinfo_" + obj.id ) == null ) return;
		Effect.Fade($("quickinfo_" + obj.id), {duration: 0.2});
	},

	mouseMoveHandler : function(e) {
		var obj = Event.element(e);
		if ( $("quickinfo_" + obj.id ) == null ) return;
		$("quickinfo_" + obj.id).setStyle({left: Event.pointerX(e) + 20 , top: Event.pointerY(e) - ( $("quickinfo_" + obj.id).getHeight() / 2)});
	}
};


function sindAlleLinksGleichUndHabenKeinOnClick( Linkliste ){
	var gleich = false;
	
	for ( i = 0; i < Linkliste.length; i++ ){
		if ( i == 0 ){
			var vergleichslink = Linkliste[ i ].href;
			gleich = true;
		}//if
		else{
			if( vergleichslink != Linkliste[ i ].href  | (Linkliste.length > 1 & Linkliste[ i ].href.indexOf("#") != -1)){
				return false;
			}//if
		}//else
	}//for
	return gleich;
}

function getLinkHrefOderOnClick( linkObj ){
	var tlink = "";
	tlink = linkObj.onclick ? linkObj.onclick() : ( linkObj.target == "" ? document.location = linkObj.href :  window.open(linkObj.href, linkObj.target) ) ;
	//alert(tlink);
	return tlink;
}


function keypressHandler (event){

 var key = event.which || event.keyCode;

 switch (key) {
   case Event.KEY_RETURN:
	 document.location = window.base + "search.html?ReadForm&query=" + $('query').value ;
	 return false;
     break;
 }
}
/* Event Handler f\u00FCr Click auf Element "a.linkpopup" */
var PopupOpener = {
	clickHandler : function(e) {
		var obj = Event.element(e);
		doGlobalOpen(obj.toString());
		return false;
	}
}

var default_verhalten= {
	'#btn_top' :	function(elem){
				elem.onclick = function(){
					new Effect.ScrollTo('page_wrapper', {duration:0.6}); return false;
				}
		},
	'#warenkorb_top_wrapper' :	function(elem){
				elem.onclick = function(){
					document.location = window.base + "warenkorb.html?ReadForm";
				}
		},
	'#query' :	function(elem){
				Event.observe(elem, 'keypress', keypressHandler);
		},	
	'#plz_ort_suche' :	function(elem){
				elem.onfocus = function(){ if (this.value == this.defaultValue) this.value='';},
				elem.onblur = function() { if (this.value == '') this.value=this.defaultValue;}
		},
	'#ansplz' :	function(elem){
				elem.onfocus = function(){ if (this.value == this.defaultValue) this.value='';},
				elem.onblur = function() { if (this.value == '') this.value=this.defaultValue;}
		},
	'#plz_ort_suche_btn' : function(elem){
				elem.onclick = function(){ 
				var radioList = document.getElementsByName("abnahmestelle");
				var rad_val = "";
				for (var i=0; i < radioList.length; i++) {
					if (radioList[i].checked){
				      rad_val = radioList[i].value;
					}//if
				}//for
				if(rad_val==""){
					rad_val = radioList[0].value;
				}//if
				var radioObj = $('abnahmestelle') || document.getElementsByName("abnahmestelle")[0];
				var suchObj = $('plz_ort_suche') || document.getElementsByName("plz_ort_suche")[0];
				document.location = window.base + ( rad_val  + '&plz=' + encodeURIComponent(suchObj.value)); 
				}
		},
	'#google-toplink' :	function(elem){
				elem.onclick = function(){
					new Effect.ScrollTo('page_wrapper', {duration:0.6}); return false;
				}		
			},
	'.prod_bestellen' :	function(elem){
				elem.onclick = function(){
					doGlobalOpen( getSelectedRadioObj( this.name ).value ,'Direktservice',800,600,false,'yes');
					return false;
				}		
			}		
}
Behaviour.register( default_verhalten);

	function loadeffizienz() {
try {
Start1();	
} catch(err) {}	
}
function loadeffizienz2() {
try {
Start2();		
} catch(err) {}	
}
/* "OnLoad"-Funktion */
	function readhidden() {

if($('copytobranch')==null && $('ansplz')==null) {
} else {
sendAnssuche();
branchenliste();
}

		Behaviour.apply( default_verhalten);

		/* Links im Inhaltsbereich mit  Quickinfos */
		
		var base = Element.getElementsBySelector(document, "base[href=]")[0].href;
		
		
		if ( $("page_wrapper") != null && $("page_wrapper").hasClassName("contentpage") && $("content") != null ) {
			$("content").getElementsBySelector( "div.webware_mceEditableElement a").each(
				function(n) {
					if ( n.hasClassName("disable_quickinfo") ) return;

					if (n.id == "") n.id = "a_" + parseInt(new Date().getTime().toString() * (Math.random()*99 + 1)); 
					iHtml = (n.title == "" ? n.innerHTML : n.title);
					iHtml += (n.target == "_blank" ? "<br>&Ouml;ffnet im neuen Fenster" : "");
					html = "<div class=\"layer_box_wrapper\" id=\"quickinfo_" + n.id + "\"><div class=\"layer_box\"><div class=\"layer_box_c\">" + iHtml + "</div></div></div></div>";
					n.title = "";
					new Insertion.Bottom($("content"), html);
					$("quickinfo_" + n.id).setStyle({display: "none"});
					$(n.id).observe("mouseover", Quickinfo.mouseOverHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mousemove", Quickinfo.mouseMoveHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mouseout", Quickinfo.mouseOutHandler.bindAsEventListener(Quickinfo));
				}
			);
			$("content").getElementsBySelector( "a.produktinfo img").each(
				function(n) {
				try{
					$("quickinfo_" + n.id).setStyle({display: "none"});
					$(n.id).observe("mouseover", Quickinfo.mouseOverHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mousemove", Quickinfo.mouseMoveHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mouseout", Quickinfo.mouseOutHandler.bindAsEventListener(Quickinfo));
					}catch(e){}

				}
			);

			$("content").getElementsBySelector( "area.muster").each(
				function(n) {	
				try{
					$("quickinfo_" + n.id).setStyle({display: "none"});
					$(n.id).observe("mouseover", Quickinfo.mouseOverHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mousemove", Quickinfo.mouseMoveHandler.bindAsEventListener(Quickinfo));
					$(n.id).observe("mouseout", Quickinfo.mouseOutHandler.bindAsEventListener(Quickinfo));
					}catch(e){}

				}
			);
		}
		if ( $("page_wrapper") != null ) {
			$("page_wrapper").getElementsBySelector( "a.linkpopup").each(
				function(n) {
					Element.observe(n, "click", PopupOpener.clickHandler.bindAsEventListener(PopupOpener));
				});
		};
		if ( $("page_wrapper") != null ) {
			$("page_wrapper").getElementsBySelector( "div.dyn_direktservice").each(
				function(n) {
					n.addClassName('pointer');
					Element.observe(n, "click", function() { document.location=window.base + DIREKT_SERVICE_LINK;});
				});
			$("page_wrapper").getElementsBySelector( "div.dyn_direktservice_hp").each(
				function(n) {
if(!n.hasClassName("noclick") ){
					n.addClassName('pointer');
					Element.observe(n, "click", function() { document.location=window.base + DIREKT_SERVICE_LINK;});
				}});
		};
		
		if ( $("page_wrapper") != null ) {
			$("page_wrapper").getElementsBySelector( "div.dyn_box_wrapper").each(
				function(n) {
					var tlinks = n.getElementsBySelector( "a" );
					if( tlinks.length > 0 & sindAlleLinksGleichUndHabenKeinOnClick( tlinks ) & !n.hasClassName("noclick") ){
						
						n.addClassName('pointer');
						Element.observe(n, "click", function() { getLinkHrefOderOnClick( tlinks[0] ) ; return false });
					}//if
				});
			$("page_wrapper").getElementsBySelector( "div.call").each(
				function(n) {
					if ( ! n.hasClassName('noclick') ) {
						n.addClassName('pointer');
						n.title = "Kontakt";
						Element.observe(n, "click", function() { document.location=window.base + KONTAKT_LINK;});					
}
				});
			
		};
		
		
	}


/* Tracking f\u00FCr Sysinfo */
function f(){var k=screen,m=window,g=document,j=navigator,w="",i=new Image();w+=d();var o=c();if(o)w+=("&flash="+o);try{var r=new ActiveXObject("Shell.UIHelper");w+="&activex";}catch(e){}w+=(j.javaEnabled()?"&java":"");w+=(j.cookieEnabled?"&cookie":"");return w;};function c(){var o="",j=navigator,m=window;var n=j.plugins["Shockwave Flash"];if(n&&n.description){o=n.description.split(" ")[2];}else if(m.ActiveXObject){for(var i=25;i>1&& !n;i--){try{n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);o=i+".0"}catch(e){};}}return o;};function d(){var k=screen,m=window,l=top,t="";t+="&resolution="+k.width+"x"+k.height;t+="&resavail="+k.availWidth+"x"+k.availHeight;if(l.frames.length&&l.innerWidth&&l.innerHeight){t+="&innersize="+l.innerWidth+"x"+l.innerHeight;}else if(m.innerWidth&&m.innerHeight){t+="&innersize="+m.innerWidth+"x"+m.innerHeight;}else if(l.frames.length&&l.document.documentElement){t+="&innersize="+l.document.documentElement.offsetWidth+"x"+l.document.documentElement.offsetHeight;}else if(document.documentElement){t+="&innersize="+document.documentElement.offsetWidth+"x"+document.documentElement.offsetHeight;}t+="&colors="+screen.colorDepth;return t;};var v=f();if(v){var img=new Image();img.src="sysinfo.txt?Open"+v;} 

// LAYER ERLEBNISPFAD
var pfade = new Array( "Tharandt", "Klingenberg", "Malter", "Seifersdorf", "Rabenau", "abschnitt1", "abs1_mark2", "abschnitt2", "abs2_mark1", "abschnitt3", "abs3_mark1", "abs3_mark2", "abs3_mark3", "abschnitt4" );
var mouseX = 0;
var mouseY = 0;

function handleMouseMove(evnt) {
	if ( window.event ) {
		mouseX = event.x;
		mouseY = event.y;
	}
	else if (evnt) { 
		mouseX = evnt.layerX; 
		mouseY = evnt.layerY; 
	}
	else 
		return true;
	obj = document.getElementById("hilfe");
	if (obj && obj.style.display == "inline") { 
		obj.style.top = ( mouseY + 20); 
		obj.style.left = ( mouseX - 25); 
	}
	return true;
}
window.document.onmousemove = handleMouseMove;

function showHelp(dir) {
	obj = document.getElementById("hilfe");
	if (obj) {
		obj.style.display = ( dir ? "inline" : "none" );
		obj.style.top = ( mouseY + 20); 
		obj.style.left = ( mouseX - 25);
	}
}

function closeAll() {
	for ( i = 0; i < pfade.length; i++ ) {
		obj = document.getElementById(pfade[i]);
		if (obj) obj.style.visibility = "hidden";
	}	
}

function showPfad( id ) {
	closeAll();
	obj = document.getElementById(id);
	if (obj) obj.style.visibility = "visible";
}

// LAYER MUSTERRECHNUNG
var actualPage = 1;
var targetGroup = ""; // muss dann in der wirklichen Datei gesetzt werden
var imgRessource = ""; // Name der NotesRessourcen, muss dann in der wirklichen Datei gesetzt werden

function ms_show(divnr) {
	var obj = document.getElementById("p" + actualPage + "m" + divnr); 
	if ( obj ) obj.style.visibility = "visible";
}
function ms_hide(divnr) {
	var obj = document.getElementById("p" + actualPage + "m" + divnr); 
	if ( obj ) obj.style.visibility = "hidden";
}
function page( nr ) {
	if ( nr == actualPage ) return;
	var obj = document.getElementById("page" + actualPage);
	if ( obj ) obj.style.display = "none";
	obj = document.getElementById("page" + nr);
	if ( obj ) obj.style.display = "inline";
	var oldPage = actualPage;
	actualPage = nr;
	swap(oldPage, 0);
}
function swap( nr, dir) {
	if (nr==actualPage) return;
	var obj = document.getElementById("thumb"+nr);
	if (obj) {
		if ( window.location.href.indexOf(".nsf/") > -1 ) 
			obj.src = imgRessource + "" + targetGroup + "_s" + nr + "_" + (dir==1?"a":"n") + ".gif";
		else
			obj.src = "images/" + targetGroup + "_s" + nr + "_" + (dir==1?"a":"n") + ".gif";
	}
}

function getSelectedRadioObj( radionames ){
						var radioList = document.getElementsByName( radionames );
						var rad_val = "";
						for (var i=0; i < radioList.length; i++) {
							if (radioList[i].checked){
								 return radioList[i];
							}//if
						}//for
					}//function



var mo_verhalten= {
	'div.mo' :	function(elem){
				elem.onmouseover= function(){
					$(this).addClassName("mohover");
				}
				elem.onmouseout= function(){
					$(this).removeClassName("mohover");
				}
		}}


Behaviour.register( mo_verhalten);

function changeZahlertyp( typ ){
    if (typ == "2"){
	$("nachttarif").show();
	$('label_tmp_tKWH_HT').innerHTML = "Tag";
	$('infoJahresverbrauch').id = "infoHT";


    }//if 
    else{
	$("nachttarif").hide();
	$('label_tmp_tKWH_HT').innerHTML = "Jahresverbrauch";
	$('infoHT').id = "infoJahresverbrauch";

}}

function changeZahlertyp2( typ, artikelid ){
    if (typ == "2"){
	$(artikelid+'_nachttarif').show();
	$(artikelid+'_tagtarif').innerHTML = "kWh/Tag";
	$(artikelid+'_infoJahresverbrauch').id = artikelid+'_infoHT';
	$(artikelid+'_jahr_berechnen').hide()

    }//if 
    else{
	$(artikelid+'_nachttarif').hide();
	$(artikelid+'_tagtarif').innerHTML = "kWh/Jahr";
	$(artikelid+'_infoHT').id = artikelid+'_infoJahresverbrauch';
	$(artikelid+'_jahr_berechnen').show()
}}

function sendProduktanfrage(){

    var taction = $(vergleich).action;
    taction += "&plz=" + $("plz").value;
    taction += "&kwhht=" + $("tmp_tKWH_HT").value;
    if ( produkttyp == "strom") { 
      if( $("tmp_tZaehler").options[$("tmp_tZaehler").selectedIndex].value == "2"){
        taction += "&kwhnt=" + $("tmp_tKWH_NT").value;
      }//if
      taction += "&zaehlertyp=" + $("tmp_tZaehler").options[$("tmp_tZaehler").selectedIndex].value;
    }//if
    else{
    taction += "&nennleistung=" + $("nennleistung").value;
    }//else
    document.location = taction;
}


function sendProduktanfrageStrom(){

    var taction = $(vergleich).action;
    taction += "&plz=" + $("plz").value;
    taction += "&kwhht=" + $("tmp_tKWH_HT").value;
   
      if( $("tmp_tZaehler").options[$("tmp_tZaehler").selectedIndex].value == "2"){
        taction += "&kwhnt=" + $("tmp_tKWH_NT").value;
      }//if
      taction += "&zaehlertyp=" + $("tmp_tZaehler").options[$("tmp_tZaehler").selectedIndex].value;

       document.location = base + "/" + taction;
}

function sendProduktanfrageErdgas(){

    var taction = $(vergleich).action;
    taction += "&plz=" + $("plz").value;
    taction += "&kwhht=" + $("tmp_tKWH_HT").value;
   

    taction += "&nennleistung=" + $("nennleistung").value;

    document.location = base + "/" + taction;
}

function sendProduktanfrageAngebot(){

    var taction = $(vergleich).action;
    taction += "&plz=" + $("angebotdirekt_tmp_tPLZ").value;
    taction += "&kwhht=" + $("angebotdirekt_tmp_tKWH_HT").value;
   
      if( $("angebotdirekt_tmp_tZaehler").options[$("angebotdirekt_tmp_tZaehler").selectedIndex].value == "2"){
        taction += "&kwhnt=" + $("angebotdirekt_tmp_tKWH_NT").value;
      }//if
      taction += "&zaehlertyp=" + $("angebotdirekt_tmp_tZaehler").options[$("angebotdirekt_tmp_tZaehler").selectedIndex].value;

    document.location = taction;
}

function sendAnssuche() {
try{
if($('ansplz')!=null){
key=$('ansplz').value
}else {
s=$('ansbranchen')
key = "Branche_"+s.options[s.selectedIndex].text;
}
var url = 'ansprechpartner.html?ReadForm&ansplz='+key; 
	//var pars = Form.serialize('frm');
new Ajax.Request(url, {
  method: 'post',
  //parameters:  pars,
  onSuccess: function(originalRequest) {
   	var newData = originalRequest.responseText;
	$('copytoans').innerHTML = newData;
	//html = $('copytoans').innerHTML;
	//new Insertion.Bottom($('ansbranchen'),  newData);
if($('ansplz')!=null){
 $('plzsuche').setStyle({display: 'block'});
}else { $('branchsuche').setStyle({display: 'block'}); }
},
onFailure: function(request) {
}
});
}catch(err){}
}

function branchenliste() {
try{
html = $('copybranchlist').innerHTML;
$('copytobranch').innerHTML = html;
//new Insertion.After($('copytobranch'), html);
}catch(err){}
}

 function evaluateSubmit(e) {  
     var key = null;  
     if (window.event) {          
          key = window.event.keyCode; //IE
     } else {  
          key = e.which; //firefox
     }  
       
     if (key == 13) { //ENTER  
         return true; //Submit
     } else {  
         return true;  
     }  
}  


// Funktion zur Darstellung eines DIVs an der Mauszeigerposition 
function showInfo(imglink)
{
  document.getElementById('hover_logo').innerHTML = "<div><img src=\"" + imglink + "\"></div>";
  document.getElementById('hover_logo').style.visibility = "visible";
  document.body.onmousemove=mouseposition;
}

function mouseposition(e)
{
  var x = e? e.pageX : event.clientX + document.body.scrollLeft;
  var y = e? e.pageY : event.clientY + document.body.scrollTop;

  document.getElementById('hover_logo').style.top = y - 50 + "px";
  document.getElementById('hover_logo').style.left = x + 50 + "px";
}

function clearInfo()
{
  //document.body.onmousemove=null;
  document.getElementById('hover_logo').style.visibility = "hidden";
}



var g_id = null;

// Mouseover f\u00FCr ECheck
function showECheckDiv(id){
	g_id = id;
	document.getElementById(id).style.visibility = "visible";
	document.body.onmousemove=emouseposition;
}

function emouseposition(e)
{
  var x = e? e.pageX : event.clientX + document.body.scrollLeft;
  var y = e? e.pageY : event.clientY + document.body.scrollTop;

  document.getElementById(g_id).style.top = y - 100 + "px";
  document.getElementById(g_id).style.left = x + 20 + "px";
}

function clearECheckInfo(id)
{
  //document.body.onmousemove=null;
  document.getElementById(id).style.visibility = "hidden";
}


