var ns4up = (document.layers) ? 1 : 0;  // Browseridentifizierung
var ns6up = (document.getElementById && !document.all && !window.opera) ? 1 : 0;
var ie4up = (document.all && !window.opera) ? 1 : 0;
var op5up = (document.getElementById && window.opera) ? 1 : 0;



function ImageLoader(id,url){
    this.i = new Image();
    this.indicator = new Image();
    this.indicator.src='../rm4_engine/doctype_icons/rm4_loader_996633.gif';
    this.id = id;
    this.url = url;
    this.rand = Math.floor(Math.random()*100000000000); //cache verhindern
    this.imEl= document.getElementById('popuppic');

    this.loadImage = function(){
		objRef=this;
        this.imEl.src=this.indicator.src;
        this.i.src=this.url+'?r='+this.rand;
        objRef.waitForImage();
    };
    
    this.waitForImage = function(){
        if(objRef.i.complete){
            objRef.imEl.src=this.i.src;
          //  fadeIn('popuppic', 40);
        }else{
            setTimeout('objRef.waitForImage()', 750);
        }    
    };
}

function lo(id,url){
    loa=new ImageLoader(id,url);
    loa.loadImage();
}


function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 30;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function rm4_imagepopup(a,text) {
	
var text = text.replace("_", " ");
var text = text.replace("_", " ");
var text = text.replace("__", " ");
var text = text.replace("__", " ");

l='<table width=540 cellpadding=0 cellspacing=0 style="border:3px solid #996633;cursor:pointer;padding:10px;background-color:#ffffff;"><tr><td bgcolor=#f68121 height=35 style=padding-left:4px;color:#ffffff;><b>'+text+'</td><td align=right onmousedown="hide_popup()" bgcolor=#f68121><img src="images/zoom_close2.gif" border=0 align=absmiddle alt=Close></td></tr><tr><td colspan=2 bgcolor=#ffffff style="padding-top:10px;width:540;border-top:1px solid #996633;" height=350><center><img name="popuppic" id="popuppic" src="" onload="zeige_popup()" onmousedown="hide_popup()"></td></tr></table>'

 document.getElementById("rm4_screen").style.display = "block";

 if (ie4up) {
  if (document.all.popuper.style.visibility=="visible") {hide_popup_schnell();}
  popuper.innerHTML=l;
 }
 if (ns6up) {
  if (document.getElementById("popuper").style.visibility=="visible") {hide_popup_schnell();}
  document.getElementById("popuper").innerHTML=l;
 }
 if (op5up) {
  if (document.getElementById("popuper").style.visibility=="visible") {hide_popup_schnell();}
  document.getElementById("popuper").innerHTML=l;
 }
 
 lo('popuppic', a);
 
}



function cms_getInnerHeight() {
if (window.innerHeight) // NS
return window.innerHeight;
else if (document.body && document.body.clientHeight) // IE
return document.body.clientHeight;
else return 0; // beide Funktionen unbekannt
}

function cms_getInnerWidth() {
if (window.innerWidth) // NS
return window.innerWidth;
else if (document.body && document.body.clientWidth) // IE
return document.body.clientWidth;
else return 0; // beide Funktionen unbekannt
}

function zeige_popup() {
 if (ie4up || ns6up || op5up) {
  breite=document.popuppic.width;
  hoehe=document.popuppic.height;
 }

 wb = cms_getInnerWidth();
 wh = cms_getInnerHeight();

 posx=(wb-540)/2;
 posy=120

 if (posx<0) {posx=0;}
 if (posy<0) {posy=0;}
 if (ie4up) {
  document.getElementById("popuper").style.pixelTop = posy+document.body.scrollTop;
  document.getElementById("popuper").style.pixelLeft = posx+document.body.scrollLeft;
  document.getElementById("popuper").filters.blendTrans.Apply();
  document.getElementById("popuper").style.visibility = "visible";
  document.getElementById("popuper").filters.blendTrans.Play();
 }
 if (ns6up) {
  document.getElementById("popuper").style.top = posy+pageYOffset;
  document.getElementById("popuper").style.left = posx+pageXOffset;
  document.getElementById("popuper").style.width = breite+2;
  document.getElementById("popuper").style.visibility = "visible";
 }
 if (op5up) {
  document.getElementById("popuper").style.pixelTop = posy+document.body.scrollTop;
  document.getElementById("popuper").style.pixelLeft = posx+document.body.scrollLeft;
  document.getElementById("popuper").style.visibility = "visible";
  document.getElementById("popuper").style.width = breite+2;
 }
}

function hide_popup() {
 if (ie4up) {
  document.getElementById("popuper").filters.blendTrans.Apply();
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").filters.blendTrans.Play();
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
 if (ns6up) {
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").style.top = 0;
  document.getElementById("popuper").style.left = 0;
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
 if (op5up) {
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").style.pixelTop = posy;
  document.getElementById("popuper").style.pixelLeft = posx;
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
}

function hide_popup_schnell() {
 if (ie4up) {
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").style.pixelTop = 0;
  document.getElementById("popuper").style.pixelLeft = 0;
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
 if (ns6up) {
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").style.top = 0;
  document.getElementById("popuper").style.left = 0;
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
 if (op5up) {
  document.getElementById("popuper").style.visibility = "hidden";
  document.getElementById("popuper").style.pixelTop = posy;
  document.getElementById("popuper").style.pixelLeft = posx;
  document.getElementById("rm4_screen").style.display = "none";
  document.getElementById("divcontent").style.display = "none";
 }
}



function rm4_divpopup(content) {

/*l='<table width=770 cellpadding=0 cellspacing=0 style="border:3px solid #666666;cursor:pointer;padding:10px;background-color:#ffffff;"><tr><td bgcolor=#eeeeee height=35 style=padding-left:4px;><b>'+content+'</td><td align=right onmousedown="hide_popup()" bgcolor=#eeeeee><img src="../myrm4/cms_honeywell/images/zoom_close.gif" border=0 align=absmiddle alt=Close></td></tr><tr><td colspan=2 bgcolor=#ffffff style="padding-top:10px;width:400;" height=350><center>blupp</td></tr></table>'

 document.getElementById("rm4_screen").style.display = "block";

 if (ie4up) {
  if (document.all.popuper.style.visibility=="visible") {hide_popup_schnell();}
  popuper.innerHTML=l;
 }
 if (ns6up) {
  if (document.getElementById("popuper").style.visibility=="visible") {hide_popup_schnell();}
  document.getElementById("popuper").innerHTML=l;
 }
 if (op5up) {
  if (document.getElementById("popuper").style.visibility=="visible") {hide_popup_schnell();}
  document.getElementById("popuper").innerHTML=l;
 }
 
  document.getElementById("popuper").style.top = 120;
  document.getElementById("popuper").style.left = 10;
  document.getElementById("popuper").style.visibility = "visible";*/
 

document.getElementById("rm4_screen").style.display = "block";
document.getElementById("divcontent").style.display = "block";
document.getElementById("divcontent").src ="iframe_viewer.php?mode="+content;



}

