function Twitter() {

    $("#dialog:ui-dialog").dialog("destroy");

    $("#dialog").dialog({
        height: 450,
        width: 220,
        modal: true
    });

    $("#twitter").getTwitter({
        userName: "adpead",
        numTweets: 5,
        loaderText: "Loading tweets...",
        slideIn: true,
        slideDuration: 750,
        showHeading: false,
        showProfileLink: true,
        showTimestamp: true
    });

   

}

function ScaleImage(selector,preferdHeight) {
    var currentHeight = $(selector).height();
    var currentWidth = $(selector).width();
    var ratio =  currentWidth / currentHeight;

    $(selector).height(preferdHeight);
    $(selector).width(preferdHeight*ratio);
}

function AutoResolution() {
    if ((screen.width > 1024) && (screen.height > 768)) {
        SetCss("/css/ProClassicSeriesLayoutLarge.css");
        SetCss("/css/ProClassicSeriesColours.css");
    }
    else  {
        SetCss("/css/ProClassicSeriesLayoutSmall.css");
        SetCss("/css/ProClassicSeriesColoursSmall.css");
     }
}

function SetCss(cssName) {
    if ($('.wysiwyg_editor')) {
        $("head").append("<link>");
        css = $("head").children(":last");
        css.attr({
            rel: "stylesheet",
            type: "text/css",
            href: cssName

        });
    }
    function init_wysiwyg_editor() {$(".wysiwyg_editor").wysiwyg();}
}

function GetRouteMap() {
    $("#dialogRouteMap").dialog({ height: 560, width: 620, maxHeight: 700, maxWidth: 900, buttons: { "Print": function () { $("#routeMap").print(); } }
    });
}

function GetRouteProfile() {
    $("#dialogRouteProfile").dialog({ height: 360, width: 800, maxHeight: 700, maxWidth: 900, buttons: { "Print": function () { $("#routeProfile").print(); } } });

}

function GetWeatherReport() {
    return $("#weatherReport")[0].innerHTML;
}
