﻿var openPlayerID = ""; var isCarrouselPlayer = ""
function openPlayer(id) { openPlayerID = id; $("#slides").hide(); $("#play_" + id).show(); }
function openCarrouselPlayer(id) { openPlayerID = id; isCarrouselPlayer = 1; $("#slides").hide(); $("#play_" + id).show(); }
function closePlayer() { $("#play_" + openPlayerID).hide(); $("#slides").show(); isCarrouselPlayer = ""; openPlayerID = ""; }
function showSlide(slide) { if (isCarrouselPlayer == "") { $("#slides div.slide").hide(); $("#slides div.slide" + slide).show(); $("#buttons li").removeAttr("id"); $("#buttons .jcarousel-item-" + slide).attr("id", "button_selected"); } }
function slideToSelectedButton(page) {
    if (carrouselPage > page) { $(".jcarousel-prev").click(); }
    else if (carrouselPage < page) { $(".jcarousel-next").click(); }
    if (carrouselPage != page) { setTimeout(function() { slideToSelectedButton(page); }, 425); } 
}
function insertMailToTag(domainName, userName) {
    var emailId; var atSign = "@"
    emailId = userName; emailId = "" + emailId + atSign; emailId = emailId + domainName; document.write("<a href='mail" + "to:" + emailId + "'>" + emailId + "</a>");
}
function showSubnav(nr) {
    if (typeof (hideSubnavTimeout) != "undefined") { clearTimeout(hideSubnavTimeout); }
    $('.subnav').hide(); var navitems = $("DIV.navigation DIV.item").children('A.nav'); for (var i = 0; i < navitems.length; i++) { hideNavHover($(navitems[i]).attr("itm")); }
    document.getElementById('pnlSubNav' + nr).style.display = ''; showNavHover(nr);
}
function hideSubnav(nr) { hideSubnavTimeout = setTimeout(function() { document.getElementById('pnlSubNav' + nr).style.display = 'none'; hideNavHover(nr); }, 500); }
function showNavHover(nr) { $('.iNavAct' + nr).show(); $('.iNav' + nr).hide(); }
function hideNavHover(nr) { if ($('.iNav' + nr).attr("default") == "1") { $('.iNavAct' + nr).hide(); $('.iNav' + nr).show(); } }
function showPopup(title, group, teaser, url, image) { document.getElementById('puTitle').innerHTML = title; document.getElementById('puTitle').href = url; document.getElementById('puGroup').innerHTML = group; document.getElementById('puGroup').href = url; document.getElementById('puTeaser').innerHTML = teaser; document.getElementById('puImage').src = image; document.getElementById('puImage').alt = title; document.getElementById('puLink').href = url; document.getElementById('puImgLink').href = url; document.getElementById('popup').style.display = ''; }
function closePopup() { document.getElementById('popup').style.display = 'none'; }
function doClick(buttonName, e) { var key; if (window.event) { key = window.event.keyCode; } else { key = e.which; } if (key == 13) { var btn = document.getElementById(buttonName); if (btn != null) { newBtnName = buttonName.replace(/_/g, "$"); if (DES_BtnClick(buttonName)) { __doPostBack(newBtnName, e) } event.keyCode = 0 } } } function doButtonClick(buttonName, e) { var key; if (window.event) { key = window.event.keyCode; } else { key = e.which; } if (key == 13) { var btn = document.getElementById(buttonName); if (btn != null) { event.keyCode = 0 } } }
function stopScroller() { if (document.getElementById('container')) { $("div#container").stop(true); } }
function startScroller() { if (document.getElementById('container')) { var duration = $(".wrapper").length * 4000; var speed = (parseInt($("div#container").width()) + parseInt($("div#viewer").width())) / duration; var dir = ($("div#container").hasClass("ltr")) ? "ltr" : "rtl"; var totalDistance = parseInt($("div#container").width()) + parseInt($("div#viewer").width()); var distanceLeft = ($("div#container").hasClass("ltr")) ? totalDistance - (parseInt($("div#container").css("left")) + parseInt($("div#container").width())) : totalDistance - (parseInt($("div#viewer").width()) - (parseInt($("div#container").css("left")))); var newDuration = distanceLeft / speed; $("div#container").animator($("div#container"), newDuration, dir, speed, duration, 0); } }
function correctHomeCellHeight() { var rightHeight = document.getElementById('tdRight').offsetHeight; var leftHeightRest = rightHeight - 321; document.getElementById('tdLeftRest').style.height = leftHeightRest + "px"; }
function resizeImage() {
    var window_height = parseInt($(window).height()); var window_width = parseInt($(window).width()); var image_width = parseInt($('#bg_oerolsite').attr('width')); var image_height = parseInt($('#bg_oerolsite').attr('height')); var height_ratio = window_height / image_height
    var width_ratio = window_width / image_width
    if (height_ratio > width_ratio) { var new_height = Math.ceil(height_ratio * image_height); var new_width = Math.ceil(height_ratio * image_width); } else { var new_height = Math.ceil(width_ratio * image_height); var new_width = Math.ceil(width_ratio * image_width) }
    $('#bg_oerolsite').attr('width', new_width);
}
$(document).ready(function() { if (document.getElementById('bg_oerolsite')) { document.getElementById('bg_oerolsite').style.display = ''; resizeImage(); $(window).bind('resize', resizeImage); } });
