// Popup
function getPageScroll(){

			var yScroll;
		
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
			} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
			}
		
			arrayPageScroll = new Array('',yScroll) 
			return arrayPageScroll;
		}

function getPageSize(){
	
			var xScroll, yScroll;
			
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = document.body.scrollWidth;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				windowWidth = self.innerWidth;
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
		
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = windowWidth;
			} else {
				pageWidth = xScroll;
			}
		
		
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
			return arrayPageSize;
		}

		


function display(popup)

{

	//getPageSize();

	if(currentpopup == '')

	{

		var objOverlay = document.getElementById('overlay');

		// set height of Overlay to take up whole page and show

		objOverlay.style.height = (arrayPageSize[1] + 'px');

		objOverlay.style.display = 'block';

		document.getElementById(popup).style.zIndex = '200';

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

		

		currentpopup = popup;

	}

	else

	{

		document.getElementById(currentpopup).style.zIndex = '1';

		document.getElementById(currentpopup).style.display="none";

		document.getElementById(popup).style.zIndex = '200';

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

		

		currentpopup = popup;

	}

	

}



var ie = document.all;

var nn6 = document.getElementById &&! document.all;



var isdrag = false;

var x, y;

var dobj;



function movemouse( e ) {

  if( isdrag ) {

    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;

    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;

    return false;

  }

}



function selectmouse( e ) {

  var fobj       = nn6 ? e.target : event.srcElement;

  var topelement = nn6 ? "HTML" : "BODY";



  while (fobj.tagName != topelement && fobj.className != "dragme") {

    fobj = nn6 ? fobj.parentNode : fobj.parentElement;

  }



  if (fobj.className=="dragme") {

    isdrag = true;

    dobj = document.getElementById("styled_popup");

    tx = parseInt(dobj.style.left+0);

    ty = parseInt(dobj.style.top+0);

    x = nn6 ? e.clientX : event.clientX;

    y = nn6 ? e.clientY : event.clientY;

    document.onmousemove=movemouse;

    return false;

  }

}



function styledPopupClose(popup) {

  document.getElementById(popup).style.display = "none";

  

  var objOverlay = document.getElementById('overlay');

  objOverlay.style.display = 'none';

}



document.onmousedown=selectmouse;

document.onmouseup=new Function("isdrag=false");

// Basis Javascript für ISIMO
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		link_img_1_over = newImage("http://192.168.0.1/isimo/fileadmin/templates/images/allover/weis.gif");
		link_img_1_norm = newImage("http://192.168.0.1/isimo/fileadmin/templates/images/allover/trans.gif");
		preloadFlag = true;
	}
}





// Set Cookie
function SetCookie(Bezeichner,Wert,Dauer)
   {
      jetzt=new Date();
      Auszeit=new Date(jetzt.getTime()+Dauer*86400000);
      document.cookie=Bezeichner+"="+Wert+";";
   }


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}


/******************************************************************************
Making the clipobject part
******************************************************************************/	
function makeObj(obj, nest, x, y){
	nest = (!nest) ? "":'document.'+nest+'.';										
   	this.css = bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;		
	this.evnt = bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;													
	this.clip = b_clip;
	this.clipIt = b_clipIt;
	this.clipTo = b_clipTo;
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this;
}


//clip part
function b_clipTo(t,r,b,l){
	if (bw.ns4){
		this.css.clip.top=t;this.css.clip.right=r;this.css.clip.bottom=b;this.css.clip.left=l;
	}
	else {
		this.css.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
	}
}
function b_clipIt(tstop,rstop,bstop,lstop,step,fn){
	if (!fn) fn = null
	var clipval = new Array()
	if (bw.dom || bw.ie4) {
		clipval = this.css.clip
		clipval = clipval.slice(5,clipval.length-1);
		clipval = clipval.split(' ')
		for (var i=0; i<4; i++) clipval[i] = parseInt(clipval[i])
	}
	else {
		clipval[0] = this.css.clip.top
	    clipval[1] = this.css.clip.right
	    clipval[2] = this.css.clip.bottom
	    clipval[3] = this.css.clip.left
	}
	totantstep = Math.max(Math.max(Math.abs((tstop-clipval[0])/step),Math.abs((rstop-clipval[1])/step)),
		Math.max(Math.abs((bstop-clipval[2])/step),Math.abs((lstop-clipval[3])/step)))
	if (!this.clipactive)
		this.clip(clipval[0],clipval[1],clipval[2],clipval[3],(tstop-clipval[0])/totantstep,
			(rstop-clipval[1])/totantstep,(bstop-clipval[2])/totantstep,
				(lstop-clipval[3])/totantstep,totantstep,0, fn)
}
function b_clip(tcurr,rcurr,bcurr,lcurr,tperstep,rperstep,bperstep,lperstep,totantstep,antstep, fn){
	tcurr=tcurr+tperstep; rcurr=rcurr+rperstep
	bcurr=bcurr+bperstep; lcurr=lcurr+lperstep
	this.clipTo(tcurr,rcurr,bcurr,lcurr)
	if(antstep<totantstep){
		this.clipactive=true
		antstep++
		setTimeout(this.obj+".clip("+tcurr+","+rcurr+","+bcurr+","+lcurr+","+tperstep+","
			+rperstep+","+bperstep+","+lperstep+","+totantstep+","+antstep+",'"+fn+"')", 40)	
	}else{
		this.clipactive = false
		eval(fn)
	}
}
/******************************************************************************
Initiating the page and the clip objects.
******************************************************************************/	
function spotInit(){
	pageWidth = (bw.ns4 || bw.ns6)?innerWidth:document.body.clientWidth;
	pageHeight = (bw.ns4 || bw.ns6)?innerHeight:document.body.clientHeight;
	oExCont = new makeObj('divExCont')
	if (bw.dom || bw.ie4){
		oExCont.css.width = pageWidth+px
		oExCont.css.height = pageHeight+px
	}
	oCircle = new makeObj('divCircle','divExCont')
	oExCont.clipTo(sStarty,sStartx+sCircleWidth,sStarty+sCircleHeight,sStartx)
	oCircle.css.left = sStartx+px
	oCircle.css.top = sStarty+px
	oCircle.css.visibility = "visible"
	if (bw.ns4)document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = moveCircle;
}
function moveCircle(e){
	x = (bw.ns4 || bw.ns6)?e.pageX:event.x
	y = (bw.ns4 || bw.ns6)?e.pageY:event.y
	oExCont.clipTo(y-sCircleHeight/2, x+sCircleWidth/2, y+sCircleHeight/2, x-sCircleWidth/2)
	oCircle.css.left = x - sCircleWidth/2 + px
	oCircle.css.top = y - sCircleHeight/2 + px
}
//This is being called when someone clicks the circle.
function showCont(){
	document.onmousemove = null
	oCircle.css.visibility = "hidden"
	oCircle.css.left = 0+px
	oCircle.css.top = 0+px
	oExCont.clipIt(-clipSpeed, pageWidth+clipSpeed, pageHeight+clipSpeed, -clipSpeed, clipSpeed, 'oExCont.css.overflow="auto"')
	
	
	// Change Visibility of anibox
	
	aniboxes0 = new makeObj('anibox0')
	aniboxes1 = new makeObj('anibox1')
	
	aniboxes0.css.display = 'none';
	aniboxes1.css.display = 'block';
	aniboxes0.css.visibility = 'hidden';
	aniboxes1.css.visibility = 'visible';
}



//Datei FindeFlash.js

  function findeFlash (flash) {
    if (document.all) {
      if (document.all[flash]) {
        return document.all[flash];
      }
      if (window.opera) {
        var movie = eval(window.document + flash);
        if (movie.SetVariable) {
          return movie;
        }
      }
      return;
    }
    if(document.layers) {
      if(document.embeds) {
        var movie = document.embeds[flash];
        if (movie.SetVariable) {
          return movie;
        }
      }
      return;
    }
    if (!document.getElementById) {
      return;
    }
    var movie = document.getElementById(flash);
    if (movie.SetVariable) {
      return movie;
    }
    var movies = movie.getElementsByTagName('embed');
    if (!movies || !movies.length) {
      return;
    }
    movie = movies[0];
    if (movie.SetVariable) {
      return movie;
    }
    return;
  }
  
  // Set naviText
  function setNaviText(name,frame,naviText)
  {
  	var movie = findeFlash(name);
	
	if (movie) {
      	
    
		// Gehe zu Bild 1,167
		movie.GotoFrame(frame);
		
		// Stelle die Variable auf den Navipunkt
		movie.SetVariable("naviText", naviText);
		
		// Play
		movie.Play();
		
		// Stop
		//movie.Stop();
		}
  }
  
  // Unset naviText
  function unsetNaviText(name,frame)
  {
  	var movie = findeFlash(name);
	if (movie) {
	
      	// Gehe zu Bild 1,1
		movie.GotoFrame(frame);
		
		// Play
		movie.Play();
  		
		}
  }
