function GotoWeatherDE() { window.location.href='wetter.php'; }
function GotoWeatherEN() { window.location.href='weather.php'; }

function loadWeatherDE() {
	if ($('#weather').length) {
		wcontent='<span id="wtxt"><img src="../images/'+w_img1+'" width="38" height="38" border="0" alt="" /> <span>'+w_txt+'</span></span><table><tr><td class="bold">Location</td><td class="bold">H&ouml;he</td><td class="bold">Temp.</td><td class="bold">Schneeh&ouml;he</td><td class="bold">Schneequalit&auml;t</td></tr><tr><td>S&ouml;lden</td><td>1.377 m</td><td>'+w_tmp_1+' &deg;C</td><td>'+w_sh_1+'</td><td>'+w_sq_1+'</td></tr><tr><td>Skigebiet</td><td>2.525 m</td><td>'+w_tmp_2+' &deg;C</td><td>'+w_sh_2+'</td><td>'+w_sq_2+'</td></tr><tr><td>Gletscher</td><td>3.000 m</td><td>'+w_tmp_3+' &deg;C</td><td>'+w_sh_3+'</td><td>'+w_sq_3+'</td></tr></table>';
		$("#weather").append(wcontent);	
		$('#weather').show();		
	} else {
		$("#weather").hide();
	}
}

function loadWeatherEN() {
	if ($('#weather').length) {
		wcontent='<span id="wtxt"><img src="../images/'+w_img1+'" width="38" height="38" border="0" alt="" /> <span>'+w_txt+'</span></span><table><tr><td class="bold">Location</td><td class="bold">Height</td><td class="bold">Temp.</td><td class="bold">Snowheight</td><td class="bold">Snowquality</td></tr><tr><td>S&ouml;lden</td><td>1.377 m</td><td>'+w_tmp_1+' &deg;C</td><td>'+w_sh_1+'</td><td>'+w_sq_1+'</td></tr><tr><td>Ski area</td><td>2.525 m</td><td>'+w_tmp_2+' &deg;C</td><td>'+w_sh_2+'</td><td>'+w_sq_2+'</td></tr><tr><td>Glacier</td><td>3.000 m</td><td>'+w_tmp_3+' &deg;C</td><td>'+w_sh_3+'</td><td>'+w_sq_3+'</td></tr></table>';
		$("#weather").append(wcontent);
		$('#weather').show();
	} else {
		$('#weather').hide();
	}
}

function GmapsLoad(e) {
	var gbp = new google.maps.LatLng(46.969098, 11.010329);
	var mapOptions = {
      zoom: 18,
      center: gbp,
	  mapTypeControl: true,
	  mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      mapTypeId: google.maps.MapTypeId.HYBRID
    }
    
	var map = new google.maps.Map(document.getElementById("map"), mapOptions);	
	var vlayer = new google.maps.KmlLayer('http://www.bellaria-soelden.at/downloads/garni_bellaria_soelden.kml',{ preserveViewport: true });
	vlayer.setMap(map);
	
	google.maps.event.addListenerOnce(map, "tilesloaded", function() {
		var resButton = document.createElement("div");
		resButton.style.width = "32px";
		resButton.style.height = "32px";
		resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_bigger.png')";		
		resButton.style.position = "absolute";
		resButton.style.right = "0px";
		resButton.style.bottom = "0px";
	
		var mapdiv = map.getDiv();
		mapdiv.appendChild(resButton);
	
		var terms = mapdiv.firstChild.childNodes[2];
		terms.style.marginRight = "38px";
		resButton.index = 1;
		google.maps.event.addDomListener(resButton, 'mouseover', function() {
			if ($("#map").attr('class')=="default") {
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_bigger_hover.png')";
			} else {
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_smaller_hover.png')";
			}
		});
		google.maps.event.addDomListener(resButton, 'mouseout', function() {
			if ($("#map").attr('class')=="default") {
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_bigger.png')";
			} else {
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_smaller.png')";
			}
		});		
		google.maps.event.addDomListener(resButton, 'click', function() {
			if ($("#map").attr('class')=="default") {
				$("#root").hide();
				$("#top").hide();
				var m=$("#map").detach();
				$("body").prepend(m);
				$("#map").removeClass().addClass('fullscreen');
				$("#map").css("width",$(window).width()+"px");
				$("#map").css("height",$(window).height()+"px");
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_smaller.png')";
			} else {
				$("#root").show();
				$("#top").show();				
				var m=$("#map").detach();
				$("#gm").prepend(m);
				$("#map").removeClass().addClass('default');
				$("#map").css("width","100%");
				$("#map").css("height","100%");
				resButton.style.backgroundImage = "url('http://www.bellaria-soelden.at/images/resize_bigger.png')";
			}
			google.maps.event.trigger(map, 'resize');
			map.setCenter(gbp);			
		});
		$(document).keyup(function(e) {
			if (e.which == 27) {
				$("#root").show();
				$("#top").show();				
				var m=$("#map").detach();
				$("#gm").prepend(m);
				$("#map").removeClass().addClass('default');
				$("#map").css("width","100%");
				$("#map").css("height","100%");	
				google.maps.event.trigger(map,'resize');
				map.setCenter(gbp);				
			}
		});
	});
}

function submit_form_DE() { document.getElementById("kontakt").action="kontakt.php"; document.getElementById("kontakt").submit(); }
function submit_form_EN() { document.getElementById("kontakt").action="contact.php"; document.getElementById("kontakt").submit(); }
