window.onload ="GUnload()"

window.onload = function(){



	$("#box_left a#prev").animate({opacity: 0.3}, 500);

	 $("#box_left ul:first li").click(function (event) {
	 	event.preventDefault();
	  	var cname= $(this).attr('class').split(' ').slice(0); 

	  if(!$("#box_left #"+cname).is(":visible"))
		{
			$("#box_left ul:first li").removeClass("active");
			$(this).addClass("active");
			$("#box_left [id^='tab']").hide();
			$("#box_left #"+cname).fadeIn("slow");
		}
	});


	$("#box_left a#prev").click(function () {	
							
		if( $("#box_left #tab_partners dl dd").eq(1).hasClass("active")  )
			{
				$("#box_left a#prev").animate({opacity: 0.3}, 700);
				$("#box_left a#prev").css("cursor","default");
			}


		if( !$("#box_left dt.active").is(":first-child") && !$(this).hasClass("prevent")  ){
		
			$(this).addClass("prevent");
		
			$("#box_left dd.active").fadeOut("fast", function(){
				$("#box_left dd.active").prevAll("dd").eq(0).fadeIn(700);
									});

			$("#box_left dt.active").fadeOut("fast", function(){
				$("#box_left dd.active").prevAll("dt").eq(1).fadeIn(700);	
									});

			$("#box_left dd.active img").animate({ marginLeft: "213px"}, 700 , "easeInOutSine", 						
				function() {				
					$("#box_left dd.active").prevAll("dt").eq(1).addClass("active");
					$("#box_left dd.active").prevAll("dd").eq(0).addClass("active");
					$("#box_left dd.active:last").removeClass("active");
					$("#box_left dt.active:last").removeClass("active");					
		
					});			

			$("#box_left dd.active").prevAll("dd").eq(0).children("a").children("img")
				.css("marginLeft", "-213px")
				.show()
				.animate({ marginLeft: "0px"}, 700, "easeInOutSine",

					function() {
						$("#box_left a#prev").removeClass("prevent");						
					});

			$("#box_left a#next").animate({opacity: 1}, 500);
			$("#box_left a#next").css("cursor","pointer");

			
		}


	
	});


	$("#box_left a#next").click(function () {

		if( $("#box_left #tab_partners dl dd:last").prevAll().eq(1).hasClass("active")  )
			{
				$("#box_left a#next").animate({opacity: 0.3}, 700);	
				$("#box_left a#next").css("cursor","default");				
			}
			

		if( !$("#box_left dd.active").is(":last-child") && !$(this).hasClass("prevent")  ){
		
			$(this).addClass("prevent");

			$("#box_left dt.active").fadeOut("fast", function(){
				$("#box_left dd.active").nextAll("dd").eq(0).fadeIn(700);	
									});
		
			$("#box_left dd.active").fadeOut("fast", function(){
				$("#box_left dd.active").next("dt").fadeIn(700);
									});


			$("#box_left dd.active img").animate({ marginLeft: "-213px"}, 700 , "easeInOutSine", 						
				function() {				
					$("#box_left dd.active").next("dt").addClass("active");
					$("#box_left dd.active").nextAll("dd").eq(0).addClass("active");
					$("#box_left dd.active:first").removeClass("active");
					$("#box_left dt.active:first").removeClass("active");					

					
					});			

			$("#box_left dd.active").nextAll("dd").eq(0).children("a").children("img")
				.css("marginLeft", "213px")
				.show()
				.animate({ marginLeft: "0px"}, 700, "easeInOutSine",

					function() {
						$("#box_left a#next").removeClass("prevent");						
					});

			$("#box_left a#prev").animate({opacity: 1}, 500);
			$("#box_left a#prev").css("cursor","pointer");

			
		}


	
	});
	


	$("#box_left dl dd dl dt a").click(function () {
	
		if( !$(this).parent().next("dd").is(":visible") ) {
			$(this).parent().parent().parent().children("p").slideUp("slow");		
			$(this).parent().parent().children("dd").slideUp("slow");
			$("#box_left dl dd dl dt a" ).css("background-position", "right top");
			$(this).parent().next("dd").slideToggle("slow");
			$(this).css("background-position", "right bottom");
		}

		else {
			$("#box_left dl dd dl dt a" ).css("background-position", "right top");			
			$(this).parent().parent().parent().children("p").slideDown("slow");	
			$(this).parent().next("dd").slideToggle("slow");
		}
	
	});


	$("#box_left li.tab_map").click(function () {
		

		if (GBrowserIsCompatible()) {

			var map = new GMap2(document.getElementById("map_canvas"));

			var center = new GLatLng(51.050446,17.092431);
			map.setCenter(center, 15);

			map.addControl(new GSmallMapControl());

			var icon = new GIcon();
			icon.image = "gfx/img/itmarker.png";
			icon.iconSize = new GSize(58, 52);
			icon.iconAnchor = new GPoint(19, 66);
			icon.infoWindowAnchor = new GPoint(31, 8);

			map.addOverlay(new GMarker(center, icon));

		}

	});



	 $("#box_middle ul li").click(function () {
		var cname= $(this).attr('class').split(' ').slice(0); 

	  if(!$("#box_middle dl#"+cname).is(":visible"))
		{
			$("#box_middle ul li").removeClass("active");
			$(this).addClass("active");
			$("#box_middle dl[id^='tab']").hide();
			$("#box_middle dl#"+cname).fadeIn("slow");
		}

	});


	$("#box_right #switch .contact").click(function (event) {
			event.preventDefault();
			$("#box_right #switch .contact").hide();
			$("#box_right #contact").hide();
			
			$("#box_right #mailform").fadeIn("slow");
			$("#box_right #switch .mailform").show();
	});



	$("#box_right #switch .mailform").click(function (event) {
			event.preventDefault();
			$("#box_right #switch .mailform").hide();
			$("#box_right #mailform").hide();
			
			$("#box_right #contact").fadeIn("slow");
			$("#box_right #switch .contact").show();
	});

	
	
	$("#box_right input.mailadress").click(function () { $(this).attr("value","");});
	$("#box_right textarea").click(function () { $(this).text("");});


	$("#box_middle dl dd dl dt").click(function () {
	
		if( !$(this).next("dd").is(":visible") ) {
			$(this).parent().parent().children("p").slideUp("slow");		
			$(this).parent().children("dd").slideUp("slow");
			$(this).parent().children("dt").children("a").css("background-position", "left top");
			$(this).next("dd").slideToggle("slow");
			
			$(this).children("a").css("background-position", "left bottom");
		}

		else {
			$(this).parent().children("dt").children("a").css("background-position", "left top");
			$(this).parent().parent().children("p").slideDown("slow");	
			$(this).next("dd").slideToggle("slow");
		}
	
	});

	$("#box_middle img, #box_middle dl").click(function () {
			$(this).next("p").slideDown("slow");
			$(this).next("p").next("dl").children("dd").slideUp("slow");
			$(this).next("p").next("dl").children("dt").children("a").css("background-position", "left top");
	});
	
	$("#box_right a.gmaps").click(function () {
		
			$("#box_left li.tab_map").trigger('click');
		
	});

	if ($("#send_message").length == 1) {
		$("#send_message").hide();
		$("#send_message").slideDown('fast');
		setTimeout('$("#send_message").slideUp()', 10000);
	}


}

