/* JavaScript - Document */

wmtt = null;
wmtt_plusx = 0;
wmtt_plusy = 0;

document.onmousemove = updateWMTT;

function updateWMTT(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
		wmtt.style.left = (x + wmtt_plusx) + "px";
		wmtt.style.top 	= (y + wmtt_plusy) + "px";
	}
}

var flashId = 'naviFlash';

function init(){
	$src = "../downloads/naviflash_en_v5.swf";
	//document.getElementById("div_topflash").innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="980" height="363" id="'+flashId+'" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+$src+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="transparent"><embed src="'+$src+'" quality="high" bgcolor="#ffffff" width="980" height="363" name="'+flashId+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /></object>';
	document.getElementById("div_topflash").innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="980" height="363" id="'+flashId+'" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+$src+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+$src+'" quality="high" bgcolor="#ffffff" width="980" height="363" name="'+flashId+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
    pageTracker._trackPageview("../downloads/naviflash_en_v5.swf");
}

function ladeseite($page){
	if($page=="kontakt_adresse.php"){
		 prototype_divaustauschen_success("../sites/"+$page, "div_ajaxpage", "googlemapsload()");
	} else {
		prototype_divaustauschen("../sites/"+$page, "div_ajaxpage");
	}
    pageTracker._trackPageview("../sites/"+$page);
}

//<![CDATA[

    function googlemapsload() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("googlemaps"));
		map.setMapType(G_HYBRID_MAP);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(52.418, 9.7245), 15);
		var marker = new GMarker(new GLatLng(52.418, 9.7245));
		map.addOverlay(marker);
		var html="<strong>Wohlenberg Schneidesysteme GmbH</strong><br />Wohlenbergstr. 8<br />D-30179 Hannover";
		
		GEvent.addListener(marker,"click", function(){
			marker.openInfoWindowHtml(html);
		});
		
      }
    }

    //]]>
	
	function route_berechnen(){
		$von = document.getElementById('adresse_strasse').value+', '+document.getElementById('adresse_ort').value;
		$ziel = 'Wohlenbergstr. 8, 30179 Hannover';
		$url = 'http://maps.google.de/maps?f=d&hl=de&geocode=&saddr='+$von+'&daddr='+$ziel;
		window.open($url, 'Route', 'width=960,height=700,scrollbars=yes');
	}

function flashobj(flashId){
	if(navigator.appName.indexOf("Microsoft") !=-1){
 	   return window[flashId]
	} else {
		return document[flashId]
	}
}

function doflash($v){
	flashobj(flashId).SetVariable("doit", $v);
}

function zeigebild($src, $width, $height, $bildno){
	wmtt = document.getElementById("div_ajaxbild");
	wmtt.innerHTML = '<img src="'+$src+'" width="'+$width+'" height="'+$height+'" alt="" />';
	wmtt.style.display = "block";
	wmtt_plusx = 0 - (Math.round($width)+100);
	wmtt_plusy =0 - Math.round($height*0.5);
	if($bildno==1 && wmtt_plusy<-65){
		wmtt_plusy = -65;
	}
}

function schliessebild(){
	wmtt = document.getElementById("div_ajaxbild");
	wmtt.innerHTML = '';
	wmtt.style.display = "none";
	wmtt = null;
}

function send_partner(){
	if(document.getElementById("form_land")){$land = document.getElementById("form_land").value;} else {$land = "";}
	if(document.getElementById("form_plz")){$plz = document.getElementById("form_plz").value;} else {$plz = "";}
	if(document.getElementById("form_partner")){$partner = document.getElementById("form_partner").value;} else {$partner = "";}
	$vars = "&land="+$land+"&plz="+$plz+"&partner="+$partner;
	prototype_divaustauschen_post("../sites/kontakt_partner.php", $vars, "div_ajaxpage");
    pageTracker._trackPageview("../sites/kontakt_partner.php");
}

function send_kontakt(){
	$firma = document.form_kontakt.firma.value;
	$anrede = document.form_kontakt.anrede.value;
	$name = document.form_kontakt.name.value;
	$email = document.form_kontakt.email.value;
	$strasse = document.form_kontakt.strasse.value;
	$plz = document.form_kontakt.plz.value;
	$ort = document.form_kontakt.ort.value;
	$telefon = document.form_kontakt.telefon.value;
	$nachricht = document.form_kontakt.nachricht.value;
	$send = document.form_kontakt.send.value;
	
	$vars = "&firma="+$firma+"&anrede="+$anrede+"&name="+$name+"&email="+$email+"&telefon="+$telefon+"&strasse="+$strasse+"&plz="+$plz+"&ort="+$ort+"&nachricht="+$nachricht+"&send="+$send;
	prototype_divaustauschen_post("../sites/kontakt_kontaktformular.php", $vars, "div_ajaxpage");
    pageTracker._trackPageview("../sites/kontakt_kontaktformular.php");
	return false;
}
