/* Java-Script Dokument "Delta Bike Sports" */

function initpageflip(){
	$("#pageflip").hover(function() { //On hover...
			$("#pageflip img").stop()
				.animate({
					width: '230px',
					height: '230px'
				}, 500);
			$(".msg_block").stop()
				.animate({
					width: '200px',
					height: '200px'
				}, 460);
		} , function() {
		$("#pageflip img").stop() //On Mouse Out, scroll zurück zu 50x50
			.animate({
				width: '105px',
				height: '105px'
			}, 220);
		$(".msg_block").stop() //On Mouse Out, scroll zurück zu 50x50
			.animate({
				width: '90px',
				height: '90px'
			}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
	});
}

function subnavi_ein($name){
	document.getElementById("div_subnavi_"+$name).style.display = "block";
	document.getElementById("div_naviout").style.display = "block";
}

function subnavi_aus(){
	document.getElementById("div_naviout").style.display = "none";
	var $x = document.getElementsByTagName("div");
	for(var $i=0;$i<$x.length;$i++){
		if($x[$i].className=="div_subnavi"){
			$x[$i].style.display = "none";
		}
	}
}

function switch_visible($id){
	if(document.getElementById($id).style.display!="block"){
		switchoff();
		document.getElementById($id).style.display = "block";
	} else {
		switchoff();
	}
}

function switchoff(){
	$x = document.getElementsByTagName("div");
	$l = $x.length;
	for(var $i=0;$i<$l;$i++){
		$n = $x[$i].className;
		if($n=="div_invisible"){
			$x[$i].style.display = "none";
		}
	}
}

function openpopup($width, $height, $page){
	document.getElementById("div_popup_content").innerHTML = "";
	prototype_divaustauschen($page,'div_popup_content');
	$width_half = $width/2;
	$mleft = 0 - Math.round($width_half) - 1;
	if($height==0){
		$top=144;
		document.getElementById("div_popup_content").style.height="auto";
	} else {
		$height_half = (600-$height)/2;$top = 144+Math.round($height_half);
		document.getElementById("div_popup_content").style.height=$height+"px";
	}
	document.getElementById("div_popup_content").style.width=$width+"px";
	document.getElementById("div_popup_content").style.marginLeft=$mleft+"px";
	document.getElementById("div_popup_content").style.top=$top+"px";
	document.getElementById("div_popup_hg").style.display = "block";
	document.getElementById("div_popup_content").style.display = "block";
}

function closepopup(){
	document.getElementById("div_popup_hg").style.display = "none";
	document.getElementById("div_popup_content").style.display = "none";	
}

function switchhersteller($hersteller, $hersteller_galerie, $galerie){
	prototype_divaustauschen("../view/galerie.php?galerie="+$galerie,"div_galerie_id");
	prototype_divaustauschen("../view/galerie_mini.php?galerie="+$galerie,"div_galerie_mini_id");
	prototype_divaustauschen("../view/hersteller_galerien.php?hersteller="+$hersteller+"&hersteller_galerie="+$hersteller_galerie,"div_hersteller_galerien_id");
}

//<![CDATA[

    function googlemapsload() {
	   if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("googlemaps"));
		//map.setMapType(G_HYBRID_MAP);
		map.setMapType(G_NORMAL_MAP);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(50.600646, 8.696096), 12);
		var marker = new GMarker(new GLatLng(50.600646, 8.696096));
		map.addOverlay(marker);
		var html="<strong>Delta Bike Sports GmbH</strong><br />Wingert 17<br />35396 Gießen Wieseck";
		
		GEvent.addListener(marker,"click", function(){
			marker.openInfoWindowHtml(html);
		});
		
      }
    }

    //]]>
	
	function route_berechnen(){
		$von = document.getElementById('adresse_strasse').value+', '+document.getElementById('adresse_ort').value;
		$ziel = 'Wingert 17, 35396 Gießen Wieseck';
		$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');
	}
	

