/*
	(c) copyright, Peter Russ, 4D f/x, 2003
    This software may only be used with
    written permission by peter.russ@4dfx.de
	To use this software get your quote!
    This software may not be used, altered,
    printed in any form with out written permission
    by peter.russ@4dfx.de

    (c) copyright, 2003 by
    Peter Russ
    Hauptstr. 2
    82229 Seefeld
    Germany


*/
	// PreCheck to Reload
    var _fdfx_reload=window.location.search;
    var dontReload=false;
    if (_fdfx_reload!="")
    {
    	var pos=_fdfx_reload.indexOf('&fdfx=');
        if (pos>-1)
        {
			pos=location.href.indexOf('&fdfx=');
        	_fdfx_reload=location.href.substr(0,pos);
            location.replace(_fdfx_reload);
        }
    }

	function CancelRightMouseClick (evt) {
	  if (document.all) evt=window.event;
	  evt.cancelBubble = true;
	  var kcode=(document.all)?evt.button:evt.which;
	  if (kcode==2 || kcode==3) {
	    return false;
	  }
	  return true;
	}
	document.onmousedown = CancelRightMouseClick;

   function Zerb_init(){
//   		location.reload();
	window.setTimeout("Zerb_init()",1000);
   }
   function SwapAbleImage() {
   		this.stillImage=null;
        this.swapImage=null;
        this.title="";
        this.getStillImage=SI_getStillImage;
        this.getStillImageSrc=SI_getStillImageSrc;
        this.getSwapImage=SI_getSwapImage;
        this.getSwapImageSrc=SI_getSwapImageSrc;
        this.getTitle=SI_getTitle;
        a=SwapAbleImage.arguments[0];
        if (a.length>2) {this.title=a[2];}
        if (a.length>1) {if (a[1]!="") {this.swapImage=new Image(); this.swapImage.src=a[1];}}
        if (a.length>0) {this.stillImage=new Image(); this.stillImage.src=a[0];}
   }

   function SI_getStillImage(){return this.stillImage;}
   function SI_getStillImageSrc(){return (this.stillImage==null)?null:this.stillImage.src;}
   function SI_getSwapImage(){return this.swapImage;}
   function SI_getSwapImageSrc(){return (this.swapImage==null)?null:this.swapImage.src;}
   function SI_getTitle(){return this.title;}

   function MM_swapImgRestore()
   {
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
      document.MM_sr=null;
      window.status="";
      return true;
   }
   function MM_preloadImages()
   {
      var d=document; if(d.images){
      	if(!d.MM_p) d.MM_p=new Array();
        var a=MM_preloadImages.arguments;
        for (var i=0; i<a.length;i++)
        for(var key in a[i]){
      		d.MM_p[key]=new SwapAbleImage(a[i][key]);
        }
      }
   }
   function MM_findObj(n, d)
   {
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
   }
   function MM_swapImage()
   {
      var i,key,src, title,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
      for(i=0;i<a.length;i++){
		key=a[i];
      	if ((x=MM_findObj(key))!=null){
	        if (document.MM_p){
	            if (x.sSrc){
	                document.MM_sr[j++]=x;
	                x.src=x.sSrc;
	                window.status=x.status;
	            } else {
	                if (document.MM_p[key]){
	                    src=document.MM_p[key].getSwapImageSrc();
                        title=document.MM_p[key].getTitle();
                        if (!x.title || x.title=="") x.title=title;
                        x.status=title.replace(/\n/," ");
                        window.status=x.status;
	                    if (src!=null){
	                        document.MM_sr[j++]=x;
	                        if(!x.oSrc) x.oSrc=x.src;
	                        x.src=src;
	                        if (!x.sSrc) x.sSrc=src;
                            document.MM_p[key]=null;
	                    }
	                }
	            }
	        }
        }
      }
      return true;
   }
	var wNS=document.layers;
	var wMS=document.all;
	function openWindow(url,fname,h,w,sb,rs){
	   if (h==null) h=screen.availHeight;
	   if (w==null) w=screen.availWidth;
       if (wMS){
         posX="left";
         posY="top";
       } else {
		 h=h+12; w=w+12;
         posX="screenX";
         posY="screenY";

       }
	   var sY=(screen.availHeight-h)/2;
	   var sX=(screen.availWidth-w)/2;
	   fstatus=posX+"="+sX+","+posY+"="+sY+",width="+w+",height="+h+",location=0,menubar=0,status=0,scrollbars="+sb+",resizable="+rs+",dependent=1,hotkeys=0";
	   f=window.open(url,fname,fstatus);
	   return f;
	}
    function logout(id)
    {
    	var url="index.php?id="+id+"&logout=1&logintype=logout";
        location.replace(url);
    }
	function resizeWindow(w,h)
    {
    	if (window.opener)
    	{
	        if (h==null)
	        {
	            hs=document.body.scrollHeight;
	            hi=document.body.clientHeight;
	            h=(hs>hi)?hs:hi;
	            h +=40;
	        }
	        if (w==null) w=document.body.clientWidth;
	        window.resizeTo(w,h);
	        window.focus();
        }
    }
    var mouseOverStorer=null;
    var eleStorer=null;
    function reMove(disp){
    	if (window.event)
        {
            if ( window.event.y<parseInt(disp.style.top) ||
            	 window.event.y>(parseInt(disp.style.top)+parseInt(disp.style.height))
               )
            {
        		disp.innerHTML=null;
				disp.style.display="none";
            }
        } else {
        	disp.innerHTML=null;
			disp.style.display="none";
        }
		if (eleStorer!=null)
        {
        	eleStorer.onMouseover=mouseOverStorer;
        }
    }
    function mover(disp,obj,height){
   		eleStorer=document.getElementById(obj);
        mouseOverStorer=eleStorer.onMouseover;
        eleStorer.onMouseover=null;
        var dele=document.getElementById(disp);
        var dm =-height;
       	dm +=(window.innerHeight)?window.innerHeight:document.documentElement.offsetHeight;
        dele.style.top=dm;
        window.status=dele.style.top;
        dele.innerHTML=eleStorer.innerHTML;
        dele.style.height=height;
        dele.style.display="block";
        dele.onMouseout=reMove;
    }

    function setWindowTitle(ele,text,fett)
    {
    	if (fett==null) fett="Gutscheinmarketing";
        if (ele) ele.innerHTML="<b>"+fett+"::</b>"+text;
    }

	function doSwap(swap)
    {
    	MM_swapImage(swap);
    }

	function preloadImages()
    {
		path="/img/";
        var imgSrc=new Array();
    	imgSrc["img_minimize"]=new Array(path+"icn.minimize.off.gif",path+"icn.minimize.on.gif","minimieren");
    	imgSrc["img_close"]=new Array(path+"icn.close.off.gif",path+"icn.close.on.gif","schließen");
        MM_preloadImages(imgSrc);
     }