﻿var SiteUrl = "http://www.jonalloy.com/";

$(document).ready(function() {
    if ($.browser.msie) {
        fixTransparentPNG();
    }

    getSiteUrl();
    
});

function fixTransparentPNG() {
    var browser = navigator.appVersion.indexOf("MSIE");
    var versie = parseInt(navigator.appVersion.substr(browser+4, 4));

    if (versie < 7) {
        $('img[@src$=.png]').ifixpng(); // Transparante PNG fix voor < IE6
    }
}

function getSiteUrl() {
    realtime.GetSiteUrl(onSucceededSiteUrl, OnFailedSiteUrl);
}

function onSucceededSiteUrl(result, userContext, methodName) {
    // SiteUrl haalt asynchroon de SiteUrl uit de web.config.
    // Omdat de slideshows pas mag gestart worden als SiteUrl goed
    // opgehaald is, starten we hier de slideshows.
    SiteUrl = result;

    WaitForSiteUrl();
}

function OnFailedSiteUrl(error, userContext, methodName) {
    //alert("Er was een probleem bij het ophalen van de siteurl. Probeer opnieuw aub");

    WaitForSiteUrl();
}

function WaitForSiteUrl() {
    loadFlash();
}

function loadFlash() {

    var flashvars = {};
    var params = {};
    var attributes = {};

    swfobject.embedSWF(SiteUrl + "swf/project_jonalloy.swf", "FlashVideo", "512", "328", "6.0.0", SiteUrl + "expressInstall.swf", flashvars, params, attributes)

}

