﻿// Bild-Funktionen
function ti_size_widthfix(picture,mwidth) {
	if(picture.width>mwidth) {
		picture.height=((picture.height*mwidth)/picture.width);
		picture.width=mwidth;
	}
}

function ti_size_heightfix(picture,mheight) {
	if(picture.height>mheight) {
		picture.width=((picture.width*mheight)/picture.height);
		picture.height=mheight;
	}
}

//function navi_openlink
function navi_openlink(linkurl,linktarget) {
	var win=window.open(linkurl,linktarget,"");
}


function init() {
	panel_wait = new YAHOO.widget.Panel("wait", 
		{
		width:"400px",
		close:false,  
	    visible:false,
   		draggable:true,
		fixedcenter:true,
		modal:true,
	    constraintoviewport:true
	 	} 
	);

	panel_wait.render();
	panel_wait.hide();

	panel_sitemap = new YAHOO.widget.Panel("sitemap", 
		{
		width:"400px",
		close:true,  
	    visible:false,
   		draggable:true,
		fixedcenter:true,
		modal:true,
	    constraintoviewport:true
	 	} 
	);
	panel_sitemap.render();
	panel_sitemap.hide();


	panel_detail = new YAHOO.widget.Panel("div_paneldetail", 
		{
		width:"800px",
		height:"700px",
		close:true,  
	    visible:false,
   		draggable:true,
		fixedcenter:true,
		modal:true,
	    constraintoviewport:true
	 	} 
	);
	
	panel_detail.show = function() {
		try { document.getElementById("div_paneldetail").style.display="block"; } catch(e) {};  
		this.cfg.setProperty("visible", true);
	}
	
	
	panel_detail.hide = function() {
		try { document.getElementById("div_paneldetail").style.display="none"; }  catch(e) {};  
		this.cfg.setProperty("visible", false);
	}
	

	panel_detail.render();
	panel_detail.hide();

}


function yahooConnect(sUrl,AusgabeElementId,frmName,initSchalt) {
	var callback = {   
		success: function(o) {
			var re = /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig;
			// assumes HTML well formed.
			var match;
			while (match = re.exec(o.responseText))	{
				var s0 = document.createElement("script");
				if (match[1])
					s0.src = match[1];
				else if (match[2])
					s0.text = match[2];
				else
				continue;
				document.getElementsByTagName("head")[0].appendChild(s0);
			}
			document.getElementById(AusgabeElementId).innerHTML=o.responseText;
			try { panel_wait.hide(); } catch(e) {};  
		},   
		failure: function(o) {
			alert('Bei der Aktion trat ein Problem auf!\n'+o.status+'\n'+o.statusText);
			try { panel_wait.hide(); } catch(e) {};  
		}   
	};
	
	//YAHOO.util.Connect.setDefaultPostHeader(false);
	//YAHOO.util.Connect.initHeader('content-type','ISO-8859-1');
	//YAHOO.util.Connect.initHeader('Content-Transfer-Encoding','8bit');
	
	if (initSchalt != 'init') {
		var formObject = document.getElementById(frmName);   
		YAHOO.util.Connect.setForm(formObject);   
	}
	// Show the Panel
	try { panel_wait.show(); } catch(e) {};   
	var transaction = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback);
}

YAHOO.util.Event.addListener(window, "load", init);
