/**
 * main js-functions
 * @author s.ludwig
 */

function getViewportSize()
{
    var size = [0, 0];
    if (typeof window.innerWidth != "undefined") 
    {
        size = [window.innerWidth, window.innerHeight];
    }
    else 
        if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) 
        {
            size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
        }
        else 
        {
            size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight];
        }
    return size;
}

function createFullBrowserFlash()
{
    window.onresize = function()
    {
/*
        var el = document.getElementById("wrapper");
        var size = getViewportSize();
        el.style.width = size[0] < 1016 ? "1016px" : "100%";
        el.style.height = size[1] < 606 ? "606px" : "100%";
 */
    };
    window.onresize();
}

if (swfobject.hasFlashPlayerVersion("9.0.28")) 
{
    var params = {
      bgcolor: "#FFFFFF",
      allowfullscreen: 'true',
      menu: 'false',
      base: '/flash/',
      scale: 'noscale',
      wmode: 'transparent'
    };
    var flashvars = {
    	MMredirectURL: 'window.location',
    	MMdoctitle: 'document.title'
    };
    if(language != '')
    {
    	flashvars.language = language;
    }
    if(timestamp != '')
    {
    	flashvars.timestamp = timestamp;
    }
	var attributes = {
		id: "flashContent"    	
    };
    var ei = {
        location: '/assets/swf/expressInstall.swf', 
        width: '214',
        height: '137',
        params: {
            wmode: 'opaque'
        },
        expressInstallError: errorCallback
    };
	swfobject.addDomLoadEvent(createFullBrowserFlash)
    swfobject.embedSWF("/Main.swf", "flashContent", "1000", "590", "9.0.28", ei, flashvars, params, attributes);
} 
else
{
    window.onload = notSupportedFlashPlayer;
}

function errorCallback(error) 
{
   document.getElementById('flashContent').style.display = 'block'; //important for ie
   notSupportedFlashPlayer();
}

function notSupportedFlashPlayer()
{
    var textSwitch = $('textSwitch');    
    textSwitch.setProperty('class', 'text_flash');
    textSwitch.setHTML(noFlashText);
    new Element('a', {
        'class': 'flashLink',
        'href': 'http://www.adobe.com/go/getflashplayer',
        'target': '_blank'
    }).injectAfter(textSwitch).setHTML(noFlashLink);
    if ($defined($('expressinstall')) == true )
    {
        $('expressinstall').remove();
    }
    $('flashContent').setStyle('display', 'block'); //ie-Bug: leaves display 'none'
    $('alternateText').setProperty('class', 'alternativ_text_flash').setHTML(noFlashAlternateText);
    $('alternateLink').setProperties({
        'class': 'alternativ_link_flash',
        'href': alternateTarget
    }).setHTML(noFlashAlternateLink);
	
}

function expressInstallInit() {
    
}


