//copyright   : (c) macrocom gmbh
           
function openscrollxy(WinWidth,WinHeight,Link,WindowName){
   var xpos=200;
   var ypos=50;
   new_Window = window.open(Link,WindowName,'toolbar=0,width='+WinWidth+',height='+WinHeight+',location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,left='+xpos+',top='+ypos);
   new_Window.focus();
}

function openpopxy(divid,httpurl){
	
	if (jQuery("#facebox")) {
		if (jQuery("#facebox").css('display').match(/block/i)) {
			// facebox already open - so just update
			// clear content, show loading icon, remove loading icon on complete and display html data
			$('#facebox .content').empty();
			$('#facebox .body').children().end().
		       append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>');

			jQuery.get(httpurl, function(data) {
				$('#facebox .loading').remove();
				jQuery("#facebox .content").append(data);
			});
		}
		else {
			// facebox not open - load content and insert into facebox
			jQuery.get(httpurl, function(data){
				jQuery.facebox(data);
			});
		}
	}
	
	return;
	jQuery.get(httpurl, function(data) {
		jQuery.facebox(data);
	});
	return;
		var popdiv=document.getElementById(divid);
		var connection=GetXmlHttp();
		var responseCallback = function(response) {
			if (response.readyState != 4) {
				return;
			}
			popdiv.innerHTML=response.responseText;
			//CSBfleXcroll('popcontent');
			resize('schwarz');
		}
		SendHttpGet(connection,httpurl, responseCallback);
		document.getElementById('schwarz').style.display='block';
		popdiv.style.display='block';
		popdiv.style.visibility='hidden';
		window.setTimeout('showZoom(\'popup\')',2000);
		
}

function resize(divid){
	var resdiv=document.getElementById(divid);
	var unten=document.getElementById('unten');
	var unten1=document.getElementById('unten1');
	unten.style.display='block';
	Height=getTop(unten);
	Height1=getTop(unten1);
	resdiv.style.width='100%';
	max=(Height>Height1)?Height:Height1;
	resdiv.style.height=(max*1+40)+'px';

}
function showZoom(divid){
	var popdiv=document.getElementById(divid);
	var zoom=document.getElementById('zoom');
	zoom.style.height=(document.getElementById('offsettop').offsetTop*1.05)+'px';
	zoom.style.width=(document.getElementById('offsetrechts').offsetLeft*1)+'px';
	popdiv.style.visibility='visible';
	resize('schwarz');        
}
function closepop(divid){
	jQuery(document).trigger('close.facebox');
	return;
	document.getElementById(divid).style.display='none';
	document.getElementById('schwarz').style.display='none';
	document.getElementById('unten').style.display='none';
}

function openfix(WinWidth,WinHeight,Link,WindowName){
	new_Window = window.open(Link,WindowName,'toolbar=0,width='+WinWidth+',height='+WinHeight+',location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,copyhistory=0,left=0,top=0');
	new_Window.focus();
}
function getLeft(l){
	return;
	if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
	else return (l.offsetLeft);
}
function getTop(l){
	return;
	if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));
	else return (l.offsetTop);
}
function decode_utf8(utftext) {
    var plaintext = ""; var i=0; var c=c1=c2=0;
    // while-Schleife, weil einige Zeichen uebersprungen werden
    while(i<utftext.length)
        {
        c = utftext.charCodeAt(i);
        if (c<128) {
            plaintext += String.fromCharCode(c);
            i++;}
        else if((c>191) && (c<224)) {
            c2 = utftext.charCodeAt(i+1);
            plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
            i+=2;}
        else {
            c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
            plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
            i+=3;}
        }
    return plaintext;
}
function encode_utf8(rohtext) {                                         
    // dient der Normalisierung des Zeilenumbruchs          
    rohtext = rohtext.replace(/\r\n/g,"\n");                
    var utftext = "";                                       
    for(var n=0; n<rohtext.length; n++)                     
        {                                                   
        // ermitteln des Unicodes des  aktuellen Zeichens   
        var c=rohtext.charCodeAt(n);                        
        // alle Zeichen von 0-127 => 1byte                  
        if (c<128)                                          
            utftext += String.fromCharCode(c);              
        // alle Zeichen von 127 bis 2047 => 2byte           
        else if((c>127) && (c<2048)) {                      
            utftext += String.fromCharCode((c>>6)|192);     
            utftext += String.fromCharCode((c&63)|128);}    
        // alle Zeichen von 2048 bis 66536 => 3byte         
        else {                                              
            utftext += String.fromCharCode((c>>12)|224);    
            utftext += String.fromCharCode(((c>>6)&63)|128);
            utftext += String.fromCharCode((c&63)|128);}    
        }                                                   
    return utftext;                                         
}                                                           