// JavaScript Document

// JavaScript Document

// +++++++++++++++++++++Navigation++++++++++++++++++++++++++++++++++++++++++++++
function popup(element) 
{
  document.write("" + element);
}


/* -------MENU OBEN-------- */

// cursor over
function navi_over(element) {
  element.className = "navibutthover";		
}

// cursor out
function navi_out(element) {
  if(element.innerText!="Home") {
    if (element.className != "navibuttact") {
      element.className = "navibuttout";
    }
  }
}



/*--------MENU LINKS-----------*/

// cursor over
function menu_over(element, text) {
    element.className = text;
}

// cursor out
function menu_out(element, text) {
    element.className = text;
}

	
/* -----------HOME-----------------*/
function home() 
{
  document.getElementById('0815').style.borderRight = "0px";
  if(document.getElementById('overlay')){
	document.getElementById('overlay').style.visibility="hidden";
  }
  if(parent.document.getElementById('overlay')){
	parent.document.getElementById('overlay').style.visibility="hidden";
  }
}
	
	
	

function sub_over(element){
		element.className = "subhover";
}

function vorladen() {
  load_img.src = 'fileadmin/Ilsemann/Images/ladebalken.gif';
}

function sub_out(element){
		element.className = "sub";
		
	}

function flag_over(element,bild){
  switch(bild){
    case 0:
      element.src="fileadmin/Ilsemann/Images/de_flag_akt.jpg"; break;

    case 1:
      element.src="fileadmin/Ilsemann/Images/eng_flag_akt.jpg"; break;
     case 2:
      element.src="fileadmin/Ilsemann/Images/ru_flag_akt.jpg"; break;
      case 3:
      element.src="fileadmin/Ilsemann/Images/sp_flag_akt.jpg"; break;

    default: break;
  
  }
		
}

function flag_out(element,bild){
  switch(bild){
    case 0:
      element.src="fileadmin/Ilsemann/Images/de_flag.jpg"; break;

    case 1:
      element.src="fileadmin/Ilsemann/Images/eng_flag.jpg"; break;
     case 2:
      element.src="fileadmin/Ilsemann/Images/ru_flag.jpg"; break;
      case 3:
      element.src="fileadmin/Ilsemann/Images/sp_flag.jpg"; break;

    default: break;
  
  }
		
}
	
function start_click(){
		location.href= "index.php?id=20";
		
}

// +++++++++++++++++++++Produktgallerie+++++++++++++++++++++++++++++++++++++++++
function set_bild(element) {
var klein = element.src;
document.getElementById("GrossBild").firstChild.src= klein;
}

var inhalt_var;
var contentClip_var;
var layout_var;
var up_var;
var down_var;
var drag_var;
var ruler_var;




function pruefenLink(element, text) {
document.write(element.src);
if (element == null) {
document.getElementById(text).firstChild.src = "http://www.groundandmore.de/typo3/fileadmin/Ilsemann/Images/pixel.gif";
}
}

function reiter_over(element){
	if(element.className =="reiter"){
		element.className = "reiterhover";
	}
		
}
function reiter_out(element){
	if(element.className !="reiteract"){
		element.className = "reiter";
	}		

}
// +++++++++++++++++++++Karte++++++++++++++++++++++++++++++++++++++++++++++

var karte=1;
function setKarte(num){
  load_img.src = 'fileadmin/Ilsemann/Images/ladebalken.gif';
  for (var i = 1; i <4; i++){
    document.getElementById("karte"+i).style.visibility="hidden";
      document.getElementById("reiter"+i).className="reiter";
  }
  karte=num;
  document.getElementById("karte"+num).style.visibility="visible"; 
  document.getElementById("reiter"+num).className="reiteract";
  document.getElementById("kartebild").firstChild.src="fileadmin/Ilsemann/Bilder/Karten/Heino_Ilsemann_GmbH_Deutschland"+karte+".jpg";  
  if (num==1) 
      inhalt.location.replace("http://www.groundandmore.de/typo3/index.php?id=1374&L=0");
  if (num==2)
      inhalt.location.replace("http://www.groundandmore.de/typo3/index.php?id=1356&L=0");
  if (num==3)
      inhalt.location.replace("http://www.groundandmore.de/typo3/index.php?id=1351&L=0");

}
function setBildkarte(element){
  var name= element.firstChild.innerHTML;
  name= name.replace(/\s/g,"_");
  name= name.replace(/\W/g,"");
  document.getElementById("kartebild").firstChild.src= "fileadmin/Ilsemann/Bilder/Karten/"+name+karte+".jpg";
}










// Scrollbar


// Made by geeeet@ghtml.com
// Keep these two lines and you're free to use this code

// Known bugs :
// If ie4.5 mac, please press apple-t to remove sidebar, otherwise everything is pushed 20px to the right...

// Corrected bugs :
// 25.01.2001 - When the height of the span "content" was less than the height of the span "contentClip" a javascript error occured, function changed : move()
// 21.02.2001 - Scrolling text wasn't selectable in ie, function changed : move()
// 05.03.2001 - Ie x and y coordinates was wrong when page was scrolled, function changed : getMouse()

// 19.04.2001 - Finally able to remove browser-scrollbar if content is longer than the browser is high:
// Just put this in the style-tag right before the end head-tag:
// body {margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; width:100%;height:100%;overflow:hidden}

// Touch me here :-)
var upH = 11; // Height of up-arrow
var upW = 11; // Width of up-arrow
var downH = 11; // Height of down-arrow
var downW = 11; // Width of down-arrow
var dragH = 100; // Height of scrollbar
var dragW = 11; // Width of scrollbar
var scrollH = 440; // Height of scrollbar
var speed = 4; // Scroll speed

// And now... go to the bottom of the page...

// Browser detection
var dom = document.getElementById ? true:false;
var nn4 = document.layers ? true:false;
var ie4 = document.all ? true:false;

var mouseY; // Mouse Y position onclick
var mouseX; // Mouse X position onclick

var clickUp = false; // If click on up-arrow
var clickDown = false; // If click on down-arrow
var clickDrag = false; // If click on scrollbar
var clickAbove = false; // If click above scrollbar
var clickBelow = false; // If click below scrollbar

var timer = setTimeout("",500); // Repeat variable
var upL; // Up-arrow X
var upT; // Up-arrow Y
var downL; // Down-arrow X
var downT; // Down-arrow Y
var dragL; // Scrollbar X
var dragT; // Scrollbar Y
var rulerL; // Ruler X
var rulerT; // Ruler Y
var contentT; // Content layer Y;
var contentH; // Content height
var contentClipH; // Content clip height
var scrollLength; // Number of pixels scrollbar should move
var startY; // Keeps track of offset between mouse and span
var divName="content";
var startdragT;


var rand_w; // Randbreite links
var xxx = 0;

// Change ContentClip

function change_div(name,self){
if (xxx != 0)
{
  document.getElementById("tableInhalt").appendChild(inhalt_var);
  document.getElementById("tableContent").appendChild(contentClip_var);
  document.getElementById("tableInhalt").removeChild(layout_var);
  document.getElementById("tableRule").appendChild(up_var);
  document.getElementById("tableRule").appendChild(down_var);
  document.getElementById("tableRule").appendChild(drag_var);
  document.getElementById("tableRule").appendChild(ruler_var);        
}
xxx = 0;

	divName= name;
	//das jeweilige content anzeigen 
	if(name=="content"){
		document.getElementById("content").style.visibility="visible";
		document.getElementById("content2").style.visibility="hidden";
		document.getElementById("content3").style.visibility="hidden";
		document.getElementById("reiter2").className="reiter";
		document.getElementById("reiter3").className="reiter";
	}
	if(name=="content2"){
		document.getElementById("content2").style.visibility="visible";
		document.getElementById("content").style.visibility="hidden";
		document.getElementById("content3").style.visibility="hidden";
		document.getElementById("reiter1").className="reiter";
		document.getElementById("reiter3").className="reiter";
	}
	if(name=="content3"){
		document.getElementById("content3").style.visibility="visible";
		document.getElementById("content").style.visibility="hidden";
		document.getElementById("content2").style.visibility="hidden";
		document.getElementById("reiter1").className="reiter";
		document.getElementById("reiter2").className="reiter";
	}
	self.className= "reiteract"
	set_scroller();
}

// scrollbalken wieder hochsetzten
function set_scroller(){
  	dragT=startdragT;
  	contentT=0;
  	moveTo();
}


// Mousedown
function down(e){

	if((document.layers && e.which!=1) || (document.all && event.button!=1)) return true; // Enables the right mousebutton
	getMouse(e);
	startY = (mouseY - dragT);
	
	// If click on up-arrow
	if(mouseX >= upL && (mouseX <= (upL + upW)) && mouseY >= upT && (mouseY <= (upT + upH))){
		clickUp = true;
		return scrollUp();
	}	
	// Else if click on down-arrow
	else if(mouseX >= downL && (mouseX <= (downL + downW)) && mouseY >= downT && (mouseY <= (downT + downH))){
		clickDown = true;
		return scrollDown();
	}
	// Else if click on scrollbar
	else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH))){
		clickDrag = true;
		return false;
	}
	else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){
		// If click above drag
		if(mouseY < dragT){
			clickAbove = true;
			clickUp = true;
			return scrollUp();
		}
		// Else click below drag
		else{
			clickBelow = true;
			clickDown = true;
			return scrollDown();
		}
	}
	// If no scrolling is to take place
	else{
		return true;
	}
}

// Drag function
function move(e){
	if(clickDrag && contentH > contentClipH){
		getMouse(e);
		dragT = (mouseY - startY);
		
		if(dragT < (rulerT))
			dragT = rulerT;		
		if(dragT > (rulerT + scrollH - dragH))
			dragT = (rulerT + scrollH - dragH);
		
		contentT = ((dragT - rulerT)*(1/scrollLength));
		contentT = eval('-' + contentT);

		moveTo();
		
		// So ie-pc doesn't select gifs
		if(ie4)
			return false;
	}
}

function up(){
	clearTimeout(timer);
	// Resetting variables
	clickUp = false;
	clickDown = false;
	clickDrag = false;
	clickAbove = false;
	clickBelow = false;
	return true;
}

// Reads content layer top
function getT(){
	
		contentT = parseInt(document.getElementById(divName).style.top);
}

// Reads mouse X and Y coordinates
function getMouse(e){
	if(ie4){
		mouseY = event.clientY + document.body.scrollTop;
		mouseX = event.clientX + document.body.scrollLeft;
	}
	else if(nn4 || dom){
		mouseY = e.pageY;
		mouseX = e.pageX;
	}
}

// Moves the layer
function moveTo(){

if (document.getElementById("drag") != null)
{
		document.getElementById(divName).style.top = contentT + "px";
		document.getElementById("drag").style.top = dragT + "px";
		document.getElementById("ruler").style.top = dragT + "px";
	}
	
}

// Scrolls up
function scrollUp(){
	getT();
	
	if(clickAbove){
		if(dragT <= (mouseY-(dragH/2)))
			return up();
	}
	
	if(clickUp){
		if(contentT < 0){		
			dragT = dragT - (speed*scrollLength);
			
			if(dragT < (rulerT))
				dragT = rulerT;
				
			contentT = contentT + speed;
			if(contentT > 0)
				contentT = 0;
			
			moveTo();
			timer = setTimeout("scrollUp()",25);
		}
	}
	return false;
}

// Scrolls down
function scrollDown(){
	getT();
	
	if(clickBelow){
		if(dragT >= (mouseY-(dragH/2)))
			return up();
	}

	if(clickDown){
		if(contentT > -(contentH - contentClipH)){			
			dragT = dragT + (speed*scrollLength);
			if(dragT > (rulerT + scrollH - dragH))
				dragT = (rulerT + scrollH - dragH);
			
			contentT = contentT - speed;
			if(contentT < -(contentH - contentClipH))
				contentT = -(contentH - contentClipH);
			
			moveTo();
			timer = setTimeout("scrollDown()",25);
		}
	}
	return false;
}

// reloads page to position the layers again
function reloadPage(){
	location.reload();
}

load_img = new Image();

// Preload jaja
function eventLoader()
{
  if(document.getElementById('rand'))
  {
    rand_w = document.getElementById('rand').offsetWidth;
		document.getElementById('contentClip').style.left= rand_w + document.getElementById('contentClip').offsetLeft + 'px';
		
    if (document.getElementById('up') != null)
		{
		  document.getElementById('up').style.left= rand_w + document.getElementById('up').offsetLeft + 'px';
		}
		
    if (document.getElementById('down') != null)
      document.getElementById('down').style.left= rand_w + document.getElementById('down').offsetLeft + 'px';
		
    if (document.getElementById('drag') != null)
		  document.getElementById('drag').style.left= rand_w + document.getElementById('drag').offsetLeft + 'px';
		if (document.getElementById('ruler') != null)
		  document.getElementById('ruler').style.left= rand_w + document.getElementById('ruler').offsetLeft + 'px';
	}
	
	if(document.getElementById('sellp'))
    document.getElementById('sellp').style.left= rand_w + document.getElementById('sellp').offsetLeft + 'px';
    
  // Up-arrow X and Y variables
	if (document.getElementById('up') != null) 
  {
	  upL = parseInt(document.getElementById("up").style.left);
	  upT = parseInt(document.getElementById("up").style.top);
	}
	
  if (document.getElementById("down") != null)
  {
		// Down-arrow X and Y variables
		downL = parseInt(document.getElementById("down").style.left);
		downT = parseInt(document.getElementById("down").style.top);
	}
	
  if (document.getElementById("drag") != null)
  {
		// Scrollbar X and Y variables
		dragL = parseInt(document.getElementById("drag").style.left);
		dragT = parseInt(document.getElementById("drag").style.top);
		startdragT = parseInt(document.getElementById("drag").style.top);
	}
	
  if (document.getElementById("ruler") != null)
  {
		// Ruler Y variable
		rulerT = parseInt(document.getElementById("ruler").style.top);
	}
	if (document.getElementById("content") != null)
	{
		// Height of content layer and clip layer
		contentH = parseInt(document.getElementById("content").offsetHeight);
		contentClipH = parseInt(document.getElementById("contentClip").offsetHeight);
		document.getElementById("content").style.top = 0 + "px";
	}
		
	//content2 und content3 verstecken
	  if(document.getElementById("content2")){
  	//document.getElementById("content2").style.visibility="hidden";
	  //document.getElementById("content3").style.visibility="hidden";
    }
	// Number of pixels scrollbar should move
	scrollLength = ((scrollH-dragH)/(contentH-contentClipH));
	// Initializes event capturing
	if(nn4){
		document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
		window.onresize = reloadPage;
	}
	

	
	//document.onmousedown = down;
	//document.onmousemove = move;
	//document.onmouseup = up;
	setTimeout('overlay()',500);
	
}


function overlay(){
if (document.getElementById('menuLinks') != null)
  document.getElementById('menuLinks').style.width="193";
  
  if(document.getElementById('overlay')){
	document.getElementById('overlay').style.visibility="hidden";
  }
  if(parent.document.getElementById('overlay')){
	parent.document.getElementById('overlay').style.visibility="hidden";
  }
}



/* ------------------GALLERY--------------------*/

// Beim Laden von Gallery
function gallery() {
// wenn nur EINE Maschine
  if (document.getElementById('scrollIn').offsetWidth < 250) 
  {
    document.getElementById('scrollIn').style.left = "255px";
  }
  // wenn nur ZWEI Maschinen
  if (document.getElementById('scrollIn').offsetWidth < 700 && document.getElementById('scrollIn').offsetWidth > 250) 
  {
    document.getElementById('scrollIn').style.left = "135px";
  }
  // wenn nur DREI Maschinen
  if (document.getElementById('scrollIn').offsetWidth < 900 && document.getElementById('scrollIn').offsetWidth > 700) {
    document.getElementById('scrollIn').style.left = "-10px";
  }
	setTimeout('scroller()',1000);
	setTimeout('overlay();', 1000);
}

// Gallery Scroller 
var xpos = 0;
var durchlauf = 0;
var starter = 0;
var leftPoint = 0;
function scroller() {
  if (document.getElementById('scrollIn').offsetWidth > 730) {
    clearTimeout(starter);
    xpos-= 1;
  	document.getElementById('scrollIn').style.left = xpos +"px";
    if( xpos <= -(document.getElementById('scrollIn').offsetWidth - 704)){
      xpos=0;
    }
  	starter = setTimeout('scroller()',20);
  }
}

// Gallery Pause
function pause() {
  clearTimeout(starter);
}

//????
var Timer;

// Gallery Scroller Left
function ScrollLeft()
{
  if (document.getElementById('scrollIn').offsetWidth > 730) {
    clearTimeout(starter);
    xpos -= 5;
    document.getElementById('scrollIn').style.left = xpos +"px";
    if( xpos <= -(document.getElementById('scrollIn').offsetWidth - 704)){
      xpos=0;
    }
    starter = setTimeout('ScrollLeft()',20);   
	}
}


// Gallery Scroller Right
function ScrollRight()
{
  if (document.getElementById('scrollIn').offsetWidth > 730) {
    clearTimeout(starter);
    xpos += 5;
    document.getElementById('scrollIn').style.left = xpos +"px"  ;
    if( xpos >= 0){
      xpos = -(document.getElementById('scrollIn').offsetWidth-704);
    }
    starter = setTimeout('ScrollRight()',20); 
	}
}




function contactMouse(element, text) {
  element.className = text;
}


function strProdukt()
{
  overlay();
}
  /*  document.getElementById("content1").style.visibility="hidden";
    document.getElementById("content1").style.position="absolute";
    
    document.getElementById("content2").style.visibility="hidden";
    document.getElementById("content2").style.position="absolute";*/
    
    /*document.getElementById("content1").style.visibility="visible";
    document.getElementById("content1").style.position="relative";
    
    document.getElementById("content2").style.visibility="visible";
    document.getElementById("content2").style.position="relative";*/
var layout_var = 0;


function set_layout_bild() {

  if (layout_var == 0) {
    document.getElementById("div_cont").style.display="none";
    
    document.getElementById("contentClip").style.display="none";
    
    document.getElementById("content3").style.display="none";
    
    document.getElementById("div_pict").style.display = "";
    layout_var = 1;
  }
  else if (layout_var == 1){
    document.getElementById("div_cont").style.display = "";
    
    document.getElementById("contentClip").style.display = "";

    document.getElementById("content3").style.display = "";
    
    document.getElementById("div_pict").style.display="none";
    layout_var = 0;
  }
  else {
    document.getElementById("div_cont").style.display = "";
    
    document.getElementById("contentClip").style.display = "";

    document.getElementById("content3").style.display="";
    
    document.getElementById("div_pict").style.display="none";
    layout_var = 0;
  
  }
}

function set_size_of_layout_small()
{
  var picture_width = document.getElementById("layout_bild_small").offsetWidth;
  var picture_height = document.getElementById("layout_bild_small").offsetHeight;
  var new_height = picture_height * 300 / picture_width;
  
  document.getElementById("layout_bild_small").style.width = "300";
  document.getElementById("layout_bild_small").style.height = new_height;
  
}

function set_size_of_layout_big()
{
  var picture_width = document.getElementById("layout_bild_big").offsetWidth;
  var picture_height = document.getElementById("layout_bild_big").offsetHeight;
  var new_height = picture_height * 500 / picture_width;
  
  document.getElementById("layout_bild_big").style.width = "500";
  document.getElementById("layout_bild_big").style.height = new_height;
}

function change_by_reiter(content_name, itself)
{
  if (content_name != "content1")
  {
  	document.getElementById("content1").style.visibility="hidden";
  	document.getElementById("content1").style.position="absolute";
  	document.getElementById("reiter1").className="reiter";
  }
  if (content_name != "content2")
  {  	
		document.getElementById("content2").style.visibility="hidden";
    document.getElementById("content2").style.position="absolute";
		document.getElementById("reiter2").className="reiter"; 
  }		
  if (content_name != "content3")	
  {
		document.getElementById("content3").style.visibility="hidden";
		document.getElementById("content3").style.position="absolute";
		document.getElementById("reiter3").className="reiter";	
    layout_var = 2;
    set_layout_bild();		
	}
	
	if (content_name == "content1" || content_name == "content2")
	{

  }
	document.getElementById(content_name).style.visibility="visible";
  document.getElementById(content_name).style.position="relative";	
  itself.className= "reiteract"

}

function allo()
{
  alert("He");
}







	
	