/*
(C)2002-04 schlomania WebDesign / E-Mail: webdesign@schlomania.com
sWD-Utilities-Pack V3.81
REQUIREMENTS: sWD-Utilities-Base V2.5 (file: swdUtilsBase.js)
*/
var ShowDiv="visible", HideDiv="hidden";
if(isLayers) ShowDiv="show",HideDiv="hide";
function chgDiv(divName,divVisi,divX,divY,divIndex) { 
	var divObj;
	if(!divName) return;
	if(divVisi=="0") divVisi=HideDiv; 
	if(divVisi=="1") divVisi=ShowDiv;
	if(dom) divObj=document.getElementById(divName);
	else if(isAll) divObj=document.all[divName];
	else if(isLayers) (!document.layers[divName]) ? divObj=getLayerObj(divName) : divObj=document.layers[divName]; 
	if(typeof divObj=="undefined") return;
    if(isAll||dom) divObj=divObj.style;
	if(divX) { if(!isLayers) divX+="px";
		divObj.left=divX; }
	if(divY) { if(!isLayers) divY+="px";
		divObj.top=divY; }
	if(divIndex) divObj.zIndex=divIndex;
	if(divVisi) divObj.visibility = divVisi;
}
function chgPic(picName,picSrc,picParent) {
    if(document.images) {
		obj=document.images[picName];
		if(typeof picParent=="object") obj=picParent.document.images[picName];
		if(obj) obj.src=picSrc;
	}
}
function chgBg(obj,ColorBg) {
	if(typeof obj!="object") {
		if(dom) obj=document.getElementById(obj);
		else if(isAll) obj=document.all[obj];
		else if(isLayers) (!document.layers[obj]) ? obj=getLayerObj(divName) : obj=document.layers[divName];
	}
    if(isAll||dom) { obj.style.backgroundColor=ColorBg; }
    else if(isLayers) { obj.bgColor=ColorBg; }
}
function chgColor(obj,Color) {
	if(typeof obj!="object") {
		if(dom) obj=document.getElementById(obj);
		else if(isAll) obj=document.all[obj];
		else if(isLayers) (!document.layers[obj]) ? obj=getLayerObj(divName) : obj=document.layers[divName];
	}
    if(isAll||dom) { obj.style.color=Color; }
    else if(isLayers) { obj.color=Color; }
}

function checkDocSize(attr) {
	var ViewWidth,ViewHeight;
    if(window.innerWidth) ViewWidth=window.innerWidth;
    else if(document.body.offsetWidth) ViewWidth=document.body.offsetWidth;
	if(window.innerHeight) ViewHeight=window.innerHeight;
    else if (document.body.offsetHeight) ViewHeight=document.body.offsetHeight;
	if(attr=="width") return ViewWidth;
	else if(attr=="height") return ViewHeight;
	else return true;
}
function getProp(obj,attr) { var Value=null;
	if(typeof obj=="object") obj=obj.id;
	if(dom) obj=document.getElementById(obj);
	else if(isAll) obj=document.all[obj]; 
	else if(isLayers) (!document.layers[obj]) ? obj=getLayerObj(obj) : obj=document.layers[obj]; 
	if(!obj) return false;
	if(attr=="height") (!isLayers) ? Value=obj.offsetHeight : Value=obj.clip.height; 
	else if(attr=="width") (!isLayers) ?  Value=obj.offsetWidth : Value=obj.clip.width;
	else if(attr=="left") (!isLayers) ? Value=obj.offsetLeft : Value=obj.left; 
	else if(attr=="top") (!isLayers) ? Value=obj.offsetTop : Value=obj.top; 
	else Value=obj.attr; 
	return Value;
}
function chgProp(obj,attr,val) { 
	var Value=null;
	if(typeof obj=="object") obj=obj.id;
	if(dom) obj=document.getElementById(obj).style;
	else if(isAll) obj=document.all[obj].style;
	else if(isLayers) (!document.layers[obj]) ? obj=getLayerObj(obj): obj=document.layers[obj];
	if((dom||ie)&&(attr=="width"||attr=="height"||attr=="left"||attr=="top")) val+="px";
	if(attr=="height") { (isLayers) ? obj.clip.height=val : obj.height=val; }
	else if(attr=="width") {  (isLayers) ? obj.clip.width=val : obj.width=val; }
	else obj.attr=val; 
	return true;
}
function getLayerObj(divName, doc) { 
	if(typeof doc == 'undefined') doc = window.document; 
	for(var i=0;i<doc.layers.length;i++) { if(doc.layers[i].id==divName) return doc.layers[i];  }
	for(var i=0;i<doc.layers.length;i++) { return getLayerObj(divName, doc.layers[i].document); }
	return null; 
}
function popUp(Url,X,Y,Opt,Name,W,H) {
	checkDocSize();

	if(W==null||W<0) W=400;
	if(H==null||H<0) H=300;
	if(X==null||X=="") X=parseInt((checkDocSize("width")-W)/2); 
	if(Y==null||Y=="") Y=parseInt((checkDocSize("height")-H)/2);
	if(Opt==null||Opt=="") Opt="dependant=yes,hotkeys=yes,location=no,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=no";
	if(Url=="") Url=window.location.href;
	if(Name=="") Name="PopUp";

	var popUpWindow=window.open(Url,Name,"width="+W+",height="+H+",left="+X+",top="+Y+","+Opt+""); 
}

function printWindow(lang) {
	if((op&&opV<6)||(ie&&ieV<6&&(os=="mac"||os=="macx"))) return;
	else if(ie&&ieV<5) {
		var text=new Array;
		text["de"]="Seite mit Standard-Drucker ausdrucken?";
		text["en"]="Print page with default printer?";
		if(!lang||(lang!="de"&&lang!="en")) lang="en";
		var check=window.confirm(text[lang]);
		if(check==true) {
			self.focus();
			var OLECMDID_PRINT = 6;
			var OLECMDEXECOPT_DONTPROMPTUSER = 2;
			var OLECMDEXECOPT_PROMPTUSER = 1;
			var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
			document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
			WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
			WebBrowser1.outerHTML = '';
		}
	}
	else { window.print(); }
    
}
var mouseX=0, mouseY=0; 
function mouseMove(e) {
	if(isLayers) var y=e.pageY, x=e.pageX;
	if(isAll) var y=event.y, x=event.x;
	else if(dom) var y=e.clientY, x=e.clientX;
	mouseX=x; mouseY=y;
}
document.onmousemove=mouseMove;
if ((isLayers && !ns4) || (ns4 && nsV>=4.5)) document.captureEvents(Event.MOUSEMOVE);
else if (!isAll && dom) { 
	if (!op && !icab) { window.document.addEventListener("mousemove",mouseMove,true); }
}




/* charset-encoding="UTF-8" */

// Bibliothek zur einheitlichen Definition von Popup-Fenstern in iPersis
// [24.05.2007] lo: Seiten werden jetzt immer im "zurueck.frame" geÃ¶ffnet. BenÃ¶tigt dann auch "string.js" und "coding.js".
// [17.03.2008] wb: popupWindow: QVGA und VGA eingefÃ¼gt
// [25.03.2009] kw: Parameter allowExternal hinzugefÃ¼gt. Verhashter Parameter, der beim Aufruf von domainfremden Seiten 1 enthalten muss 
//                  damit im zurueck.frame keine CrossSite PrÃ¼fung passiert (die den Aufruf verhindern wÃ¼rde).

/**
 * Ã–ffnet ein Popup-Fenster gemÃ¤ÃŸ fest definierten Persis-Stilen
 */
function popupWindow(url, title, size, type, print, tool_url, allowExternal)
{   
	// Parameter tool_url wird fÃ¼r Vorschau benÃ¶tigt

    // Defaults
    var width = 700;
    var height = 500;
    var left = 0;
    var top = 0;
    var wndprops = "status=yes,menubar=no,resizable=yes,scrollbars=no,toolbar=no";
    
    // -------------- Window-GrÃ¶ÃŸen --------------
    /*
        Einige FenstergrÃ¶ÃŸen in iPersis:
          w x h
        300 x 200
        300 x 500
        600 x 400        
        700 x 500
        720 x 600
        800 x 480 
    */    
    if (size.toUpperCase() == 'S')
    {
       width = 300;
       height = 500; 
    }
	else if(size.toUpperCase() == 'QVGA')
    {
       width = 320;
       height = 240; 
    }
	else if(size.toUpperCase() == 'SS')
    {
       width = 300;
       height = 100; 
    }
    else if(size.toUpperCase() == 'VGA')
    {
       width = 640;
       height = 480; 
    }
    else if(size.toUpperCase() == 'M')
    {
       width = 700;
       height = 500; 
    }
    else if(size.toUpperCase() == 'L')
    {
       width = 800;
       height = 600;         
    }  
    else if(size.toUpperCase() == 'WL')
    {
       width = 800;
       height = 500;         
    }  
    else if(size.toUpperCase() == 'XL')
    {
       width = 1024;
       height = 768;         
    }
    else if(size.toUpperCase() == 'WXL')
    {
       width = 1024;
       height = 640;
    }
    else if(size.toUpperCase() == 'XXL')
    {
        width = screen.availWidth - 40;
        height = screen.availHeight - 80;
    }
	else if(size.toUpperCase() == 'DYN')
    {
        width = screen.availWidth * 0.85;
        height = screen.availHeight * 0.85;
    }
    left = (screen.availWidth/2) - (width/2);
  	top = (screen.availHeight/2) - (height/2);
    //alert(size);

    // -------------- Window-Typen --------------
    if (type.toUpperCase() == 'DEFAULT')
    {    
        wndprops = 'status=yes,menubar=no,resizable=yes,scrollbars=yes,toolbar=no';  
    }
    else if (type.toUpperCase() == 'TOOLBAR')
    {
        wndprops = 'status=yes,menubar=no,resizable=yes,scrollbars=yes,toolbar=yes';  
    }
    else if (type.toUpperCase() == 'MENUBAR')
    {
        wndprops = 'status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=no';  
    }
    else if (type.toUpperCase() == 'FULL')
    {
        wndprops = 'status=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=no';  
    }   

    // -------------- Window anzeigen --------------   
    // Einstellungen zusammenbauen
    var wnddef = wndprops + ',width=' + width + ',height=' + height + ',top=' + top + ',left=' + left;       
    //alert(wnddef);
    
	if(typeof print == 'undefined') {
        print = '1';
    }
	
	if(typeof allowExternal == 'undefined') {
        allowExternal = '';
    }
	
	// Variablen fÃ¼r Vorschau
	if(typeof tool_url == 'undefined') 
	{	tool_url = '';
		var tool_pos = '';
    }
	else
	{	var tool_pos = 'top';	}
	
	 // Fenster anzeigen
    var frame_url;
    // Der zurueck.frame wird nur dann automatisch verwendet, wenn die baseEncode- und die strReplaceAll-Funktion deklariert sind.

    if(url.indexOf("zurueck.frame") < 0 && typeof(baseEncode) == "function" && typeof(strReplaceAll) == "function")
    	frame_url = "?fn=zurueck.frame&close=1&back=0&print=" + print + "&url=" + baseEncode(url) + "&tool_pos=" + tool_pos + "&tool_url=" + tool_url + "&allowExternal=" + allowExternal;
    else
    	frame_url = url;
		
    var neww = window.open(frame_url, title, wnddef);
    if (neww == null)
    {
        alert(/* persis-id="26219" */  "Es kann kein Popup-Fenster geÃ¶ffnet werden, da Ihr Browser dies blockiert. Bitte Ã¤ndern Sie Ihre Sicherheitseinstellungen fÃ¼r diese Website!");  
        return null;
    }

    neww.focus();    
    // Fenster nicht zurÃ¼ckgeben, Mitarbeiterstammblatt hat dann leere Seite ?!
    //return neww;    
}


// -------------------- Hilfsfunktionen ----------------------

function popupsAllowed()
{
    var neww = window.open("", "f", "width=1,height=1");
    if (neww.closed != true)
    {
        neww.close();
        return true;
    }
    else
    {
        neww.close();
        return false;
    }     
}
