$(document).ready(function() {

	// Bilder preloaden .....
	$('.navImg').preload({
		find: '.gif',
		replace: '_f2.gif'
	});


    // Mouseover/out binden .....
    $('.navImg').mouseover(function() {
     if ($(this).attr("src").search(/_f2.+/)==-1)
    $(this).attr("src",$(this).attr("src").split(".gif")[0]+"_f2.gif");
    });
    $('.navImg').mouseout(function() {
      if ($(this).attr("src").search(/_f2.+/)!=-1)
    $(this).attr("src",$(this).attr("src").split("_f2.gif")[0]+".gif");
    });


	// Klappmechanismus Newsheader initialisieren...
	$(".newsHeader").click(function() {
		$(this).next().slideToggle();
        $(this).find("img").toggle();
	});

    $('.lightbox').lightBox({txtImage:'Bild' , txtOf:'von'});

//    $("table tr:odd").css("background-color","#eff6fb");
    $("#tVis tr:odd").css("background-color","#ffffff");
    $("#kontaktTable td").css("height","30px");
    $("#kontaktTable tr").find("td:first").css("padding-left","4px");
    $("#tabStandort").css("margin-left","0px");


    $("#divNewsHomeCycle").cycle();
  //  $(".lightbox").append('<img src="images/icon_zoom.png" style="position: absolute; top: 0px; right: 0px;" border="0" />');
});


/* Home */
function restoreDefaultView() {
  if (!$.browser.msie) {
    $("#divVideo").hide("fade");
    $("#divBttnPlayVideo").show("fade");
    $("#divBttnPlaySlideshow").show("fade");
    $("#divContentHome").show("fade");
    $("#divNewsHome").show("fade");
	$("#divGreenBuilding").show("fade");
  } else {
    $("#divVideo").hide();
    $("#divBttnPlayVideo").show();
    $("#divBttnPlaySlideshow").show();
    $("#divContentHome").show();
    $("#divNewsHome").show();
    $("#divGreenBuilding").show();
  }
       $("#divCycleContainer").cycle("stop");
       $("#divCycleContainer").empty();
       $('#divSlideshowBU').empty();
}

function setVideoView() {
      $("#divVideoPrevButton").hide();
    $("#divVideoNextButton").hide();
    if (!$.browser.msie) {
        $("#divBttnPlayVideo").hide("fade");
        $("#divBttnPlaySlideshow").hide("fade");
        $("#divContentHome").hide("fade");
        $("#divNewsHome").hide("fade");
        $("#divGreenBuilding").hide("fade");
        $("#divVideo").show("fade");
    } else {
        $("#divBttnPlayVideo").hide();
        $("#divBttnPlaySlideshow").hide();
        $("#divContentHome").hide();
        $("#divNewsHome").hide();
        $("#divGreenBuilding").hide();
        $("#divVideo").show();
    }
    startVideo();
}


function setLivecamView() {
      $("#divVideoPrevButton").hide();
    $("#divVideoNextButton").hide();
    if (!$.browser.msie) {
        $("#divBttnPlayVideo").hide("fade");
        $("#divBttnPlaySlideshow").hide("fade");
        $("#divContentHome").hide("fade");
        $("#divNewsHome").hide("fade");
        $("#divGreenBuilding").hide("fade");
        $("#divVideo").show("fade");
    } else {
        $("#divBttnPlayVideo").hide();
        $("#divBttnPlaySlideshow").hide();
        $("#divContentHome").hide();
        $("#divNewsHome").hide();
        $("#divGreenBuilding").hide();
        $("#divVideo").show();
    }
    showLivecam();
}

function setSlideshowView(v) {
      $("#divVideoPrevButton").show();
    $("#divVideoNextButton").show();
    if (!$.browser.msie) {
      $("#divBttnPlayVideo").hide("fade");
      $("#divBttnPlaySlideshow").hide("fade");
      $("#divContentHome").hide("fade");
      $("#divNewsHome").hide("fade");
      $("#divGreenBuilding").hide("fade");
      $("#divVideo").show("fade");
    } else {
      $("#divBttnPlayVideo").hide();
      $("#divBttnPlaySlideshow").hide();
      $("#divContentHome").hide();
      $("#divNewsHome").hide();
      $("#divGreenBuilding").hide();
      $("#divVideo").show();
    }
	startSlideShow();
}


/* Content-Seiten */
function slideDefaultView() {
    if (!$.browser.msie) {
      $("#divVideo").hide("fade");
      $("#divBttnPlayVideo").show("fade");
      $("#divBttnPlaySlideshow").show("fade");
      $("#divSlider").css("top","");
    } else {
      $("#divVideo").hide();
      $("#divBttnPlayVideo").show();
      $("#divBttnPlaySlideshow").show();
      $("#divSlider").css("top","");
    }
	$("#divPfeilScroller").show();
		$("#divGreenBuilding").show();   
     $("#divCycleContainer").cycle("stop");
     $("#divCycleContainer").empty();
     $('#divSlideshowBU').empty();
}

function slideVideoView() {
    $("#divVideoPrevButton").hide();
    $("#divVideoNextButton").hide();
	$("#divPfeilScroller").hide();
		$("#divGreenBuilding").hide();
    if (!$.browser.msie) {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide("fade");
        $("#divBttnPlaySlideshow").hide("fade");
        $("#divVideo").show("fade");
    } else {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide();
        $("#divBttnPlaySlideshow").hide();
        $("#divVideo").show();
    }
    startVideo();
}


function slideLivecamView() {
    $("#divVideoPrevButton").hide();
    $("#divVideoNextButton").hide();
	$("#divPfeilScroller").hide();
	$("#divGreenBuilding").hide();
    if (!$.browser.msie) {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide("fade");
        $("#divBttnPlaySlideshow").hide("fade");
        $("#divVideo").show("fade");
    } else {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide();
        $("#divBttnPlaySlideshow").hide();
        $("#divVideo").show();
    }
    showLivecam();
}



function slideSlideshowView(v) {
    $("#divVideoPrevButton").show();
    $("#divVideoNextButton").show();
	$("#divPfeilScroller").hide();
    if (!$.browser.msie) {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide("fade");
        $("#divBttnPlaySlideshow").hide("fade");
        $("#divVideo").show("fade");
    } else {
        $("#divSlider").animate({"top":"96px"},500);
        $("#divBttnPlayVideo").hide();
        $("#divBttnPlaySlideshow").hide();
        $("#divVideo").show();
    }
    startSlideShow();
}

function startSlideShow() {
    $("#divCycleContainer").empty().append('<img src="/UserFiles/rivergate/Images/slideshow/1.jpg" width="640" height="360" alt="Die neue Dimension einer einzigartigen Immobilie"  /><img src="/UserFiles/rivergate/Images/slideshow/2.jpg" width="640" height="360" alt="Der Standort liegt an einem der leistungsf&auml;higsten Knotenpunkte des &ouml;ffentlichen- und Individualverkehrs in Wien" /><img src="/UserFiles/rivergate/Images/slideshow/3.jpg" width="640" height="360" alt="Ein Blick auf die blaue Donau spendet neue Energie" /><img src="/UserFiles/rivergate/Images/slideshow/4.jpg" width="640" height="360" alt="Ein Fahrradraum mit exklusiver Garderobe und Dusche erm&ouml;glichen diesen Luxus" /><img src="/UserFiles/rivergate/Images/slideshow/5.jpg" width="640" height="360" alt="Die luftige Bauweise garantiert faszinierende Blicke in die nahe Natur" /><img src="/UserFiles/rivergate/Images/slideshow/6.jpg" width="640" height="360" alt="Die eigene Br&uuml;cke bietet einen direkten Zugang zur blauen Donau" /><img src="/UserFiles/rivergate/Images/slideshow/7.jpg" width="640" height="360" alt="Die ökologische Nutzung naturnaher Ressourcen wie Erdwärme und Geothermie sorgen für niedrige Energiekosten" />');
    $("#divCycleContainer").cycle({fx: "fade",timeout: 8000, speed: 500, next:   '#divVideoNextButton', prev:   '#divVideoPrevButton', after: onAfter});
}

function showLivecam() {
    $("#divCycleContainer").empty().append('<img src="http://rivergate.accxmedia.net/livecam/images/aktuell.jpg" width="640" height="360" alt="Livecam-Bild wird geladen..." />');
    $('#divSlideshowBU').empty().append('Beobachten Sie den Baufortschritt des RIVERGATE. Bildaktualisierung alle 60 Minuten.');
}

function startVideo() {
    $("#divCycleContainer").empty().append('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="640" height="360"><param name="movie" value="/images/de/film/Unbenannt-1.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="/images/de/film/Unbenannt-1.swf" wmode="transparent" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="360"></embed></object>');
}

function onAfter() {
    $('#divSlideshowBU').empty().append(this.alt);
}