 //window.onload = function () {
 //headlines
 //    if ($('h1').length > 0) {
 //        var myObj = $('h1');
 //        var headlineWidth = parseInt(myObj[0].offsetWidth);
 //        $('h1').css('width', headlineWidth);
 //        $('h1').css('display', 'block');
 //        $('h1').css('padding', 5);
 //    }
 //	if ($('h2').length > 0) {
 //        $('h2').each(function (i) {
 //		var myh2Obj = $(this);
 //        var h2headlineWidth = parseInt(myh2Obj[0].offsetWidth);
 //        $(this).css('width', h2headlineWidth);
 //        $(this).css('display', 'block');
 //        $(this).css('padding', 5);
 //		});
 //    }
 //}
 $(function () {
     $('.start').hide();
     // Options for SuperBGImage
     $.fn.superbgimage.options = {
         id: 'superbgimg',
         // id for the containter
         z_index: 1,
         // z-index for the container
         inlineMode: 1,
         // 0-resize to browser size, 1-do not resize to browser-size
         showimage: 1,
         // number of first image to display
         vertical_center: 1,
         // 0-align top, 1-center vertical
         transition: 1,
         // 0-none, 1-fade, 2-slide down, 3-slide left, 4-slide top, 5-slide right, 6-blind horizontal, 7-blind vertical, 90-slide right/left, 91-slide top/down
         transitionout: 1,
         // 0-no transition for previous image, 1-transition for previous image
         randomtransition: 0,
         // 0-none, 1-use random transition (0-7)
         showtitle: 0,
         // 0-none, 1-show title
         slideshow: 1,
         // 0-none, 1-autostart slideshow
         slide_interval: 2500,
         // interval for the slideshow
         randomimage: 0,
         // 0-none, 1-random image
         speed: 'slow',
         // animation speed
         preload: 1,
         // 0-none, 1-preload images
         onShow: superbgimage_show,
         // function-callback show image
         //onClick: superbgimage_click, // function-callback click image
         onHide: superbgimage_hide,
         // function-callback hide image
         //onMouseenter: superbgimage_mouseenter, // function-callback mouseenter
         //onMouseleave: superbgimage_mouseleave, // function-callback mouseleave
         //onMousemove: superbgimage_mousemove // function-callback mousemove
     };



     // initialize SuperBGImage
     $('#thumbs').superbgimage();
     if ($('#thumbs').children('a').length == 1) {
         $.fn.superbgimage.options = {
             slideshow: 0
         }
         $('#control').html('');
         $('#thumbs').children('a').css('display', 'none');
     }

     //auf der DIC Seite abfragen ob superbgimg die classe dic hat, wenn ja slideshow auf 10000 verlängern
     //    if ($('#superbgimg').hasClass('dic') == true) {
     //       $.fn.superbgimage.options = {
     //         slide_interval: 10000,
     //      }
     //   }
     // function callback on hiding image


     function superbgimage_hide(img) {
         $('#showtitle').hide();
     }

     // function callback on showing image
     // get title and display it


     function superbgimage_show(img) {
         $('#superbgimage').css('background', 'none');
         $('#superbgimage').append($('#showtitle'));
         $('#showtitle p.imagecount').html('image ' + img + ' of ' + $.superbg_imgIndex);
         if ($('#thumbs').css('display') == 'block') {
             $('#showtitle p.title').html($('#thumbs a' + "[rel='" + img + "']").attr('title'));
         } else {
             $('#showtitle p.title').html($('#thumbs2 a' + "[rel='" + img + "']").attr('title'));
         }
         $('#showtitle').fadeIn('fast');
     }

     // start slideshow on home page
     $('.start').click(function () {
         $('#thumbs').startSlideShow();
         $('.stop').show();
         $('.start').hide();
     });


     // stop slideshow on home page
     $('.stop').click(function () {
         $('#thumbs').stopSlideShow();
         $('.start').show();
         $('.stop').hide();

     });
	 
	 if ($("#vimeoplayer").length > 0) {
         $('#vimeoplayer').vimeo();
     }

     //Location mover for maps
     if ($("#playvideo").length > 0) {
         $("#videobox").hide();
     }

     //$("#playvideo").toggle(function () {
//         $("#superbgimg").hide();
//         $("#videobox").show();
//         projekktor('#videobox').setPlay();
//         log('playing video');
//         $("#playvideo").addClass('playingvideo');
//     }, function () {
//         projekktor('#videobox').setPause();
//         $("#videobox").hide();
//         $("#superbgimg").show();
//         log('stop playing video');
//         $("#playvideo").removeClass('playingvideo');
//     });


     $(".micromap").click(function () {
         console.log('animate map to top');
         $("#locations").animate({
             top: "-540px", //0
         }, 500);
     });

     $(".macromap").click(function () {
         console.log('animate map to bottom');
         $("#locations").animate({
             top: "0", //-540
         }, 500);
     });

     $(".hotspots").click(function () {
         console.log('animate map to bottom');
         $("#locations").animate({
             top: "-1080px",
         }, 500);
     });
	 
	 $(".wege").click(function () {
         console.log('animate map to bottom');
         $("#locations").animate({
             top: "-1620px",
         }, 500);
     });

     //set href to imagemaps
     $(".winx_over").click(function () {
         //window.location.href = 'winx.html';
		 window.location.href = 'index.php?article_id=10&clang='+getURLParam('clang');
     });

     $(".primus_over").click(function () {
         //window.location.href = 'primus.html';
		 window.location.href = 'index.php?article_id=29&clang='+getURLParam('clang');
     });

     $(".panorama_over").click(function () {
         //window.location.href = 'panorama.html';
		 window.location.href = 'index.php?article_id=11&clang='+getURLParam('clang');
     });

     $(".porta_over").click(function () {
         //window.location.href = 'porta.html';
		 window.location.href = 'index.php?article_id=30&clang='+getURLParam('clang');
     });

     $(".palazzi_over").click(function () {
         //window.location.href = 'patio.html';
		 window.location.href = 'index.php?article_id=31&clang='+getURLParam('clang');
     });

     $(".palais_over").click(function () {
         //window.location.href = 'palais.html';
		 window.location.href = 'index.php?article_id=32&clang='+getURLParam('clang');
     });

     $('.winx_over').hover(

     function () {
         $('.winx').addClass("showhover");
     }, function () {
         $('.winx').removeClass("showhover");
     });
     $('.primus_over').hover(

     function () {
         $('.primus').addClass("showhover");
     }, function () {
         $('.primus').removeClass("showhover");
     });
     $('.panorama_over').hover(

     function () {
         $('.panorama').addClass("showhover");
     }, function () {
         $('.panorama').removeClass("showhover");
     });
     $('.porta_over').hover(

     function () {
         $('.porta').addClass("showhover");
     }, function () {
         $('.porta').removeClass("showhover");
     });
     $('.palazzi_over').hover(

     function () {
         $('.palazzi').addClass("showhover");
     }, function () {
         $('.palazzi').removeClass("showhover");
     });
     $('.palais_over').hover(

     function () {
         $('.palais').addClass("showhover");
     }, function () {
         $('.palais').removeClass("showhover");
     });

     // check if browser is Mircosoft Internet Explorer
     var ident = $.browser.msie;
     if (ident == true) {
         console.log('fuckn ie detected dont run maphighlighting');
     } else {
         $('.map').maphilight({
             fill: true,
             stroke: false,
             fillColor: 'ffffff',
             fillOpacity: '0.3'
         });
     }

     $(".110628").click(function () {
         window.location.href = 'news_110628.html';
     });
     $(".110516").click(function () {
         window.location.href = 'news_110516.html';
     });
	 
	 function getURLParam(strParamName) {
		 var strReturn = "";
		 var strHref = window.location.href;
		 if (strHref.indexOf("?") > -1) {
			 var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
			 var aQueryString = strQueryString.split("&");
			 for (var iParam = 0; iParam < aQueryString.length; iParam++) {
				 if (aQueryString[iParam].indexOf(strParamName + "=") > -1) {
					 var aParam = aQueryString[iParam].split("=");
					 strReturn = aParam[1];
					 break;
				 }
			 }
		 }
		 return strReturn;
 	}
	//shadowbox
	if(typeof Shadowbox != 'undefined'){
		Shadowbox.init({
			animate: true,
			modal: true,
			continuous: true,
			displayCounter: true,
			displayNav: true,
			overlayColor: "#000000",
			overlayOpacity: 0.7
		});
	}
 });

 
