﻿function SetAttributeForElement(Element, Attribute, Value)
{
    if($(Element).length > 0)
    {
        //jquery hatte mühe damit das Attribut value zu setzen, deshalb hier mit getElementById
        var id = $(Element).attr('id');
        document.getElementById(id).setAttribute(Attribute, Value);     
    }
}

function ToggleElementVisibilty(Element)
{
    var ElementId = '#' + Element;

    if($(ElementId).length > 0)
    {
        $(ElementId).slideToggle(300);
    }
}

function OpenAgb()
{
    var Agb = window.open("/AGB.aspx", "AGB", "width=800px, height=800px, scrollbars=yes, location=no, menubar=no, toolbar=no");
    Agb.focus();
}

function OpenImpressum()
{
    var Imp = window.open("/Impressum.aspx", "Impressum", "width=800px, height=800px, scrollbars=yes, location=no, menubar=no, toolbar=no");
    Imp.focus();
}

function OpenRadio()
{
    var r = window.open("/Radio.html", "", "width=595px, height=445px, scrollbars=no, location=no, menubar=no, toolbar=no");
    r.focus();
}

function Redirect(Url)
{
    window.location = Url;

    return;
}

function OpenGoogleMapsRoute(from)
{
    var Url = "http://maps.google.ch?saddr=" + from + "&daddr=Via Maistra 54, 7500 St. Moritz";
    window.open(Url);
}
