// Check browser type
var isDOM = false, isIE4 = false, isNN4 = false, keyCode = false;
if( document.layers )				isNN4 = true;
else if( document.all )				isIE4 = true;
else if( document.getElementById ) 	isDOM = true;

// Handles mouse over images
function active( state, element ) {
	var img	= element.firstChild;
	if( !img.orginalSrc & state == "on" ){
		img.orginalSrc = new String( img.src.replace( ".gif", "" ) );
		img.orginalWidth = img.width;
	}
	if( state == "on" ) { img.src = img.orginalSrc + "_hi.gif";   img.width = img.orginalWidth;  }
	if( state == "off" ) {	img.src = img.orginalSrc + ".gif";  img.width = img.orginalWidth; }
	return true;
}

function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}


// required flash version
var requiredVersion = 10;
<!--
var maxVersion = 14;
var actualVersion = 0;
var v_flashInstalled = false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
jsVersion = 1.1;
for (var x = 2; x <= maxVersion; x++){
    eval("var flash" + x + "Installed = false")
}
if(isIE && isWin){
    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    for (var y = 2; y <= maxVersion; y++){
        eval(document.write('flash'+y+'Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+y+'"))) \n'));
    }
    document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

// Mozilla FireFox Fix for Flash
if(isDOM)
{
	if (navigator.plugins["Shockwave Flash"] != null & navigator.plugins["Shockwave Flash"].length > 0)
	{
		var flashDesc = navigator.plugins["Shockwave Flash"].description;
		var vStart = flashDesc.indexOf(".");
		var vEnd = flashDesc.indexOf(".") - 2;
		var flashVer = parseInt(flashDesc.substring(vStart,vEnd));
		actualVersion = flashVer;
	}
}

detectFlash()

function detectFlash(){
    if (navigator.plugins){
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){
            var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
            var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
            var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
            for (var z = 2; z <= maxVersion; z++){
                eval("flash" + z + "Installed = flashVersion == " + z)
            }
        }
    }
    for (var i = 2; i <= maxVersion; i++){
        if (eval("flash" + i + "Installed") == true) actualVersion = i;
    }
    if (actualVersion >= requiredVersion){
        v_flashInstalled = true;
    } else {
        v_flashInstalled = false;
    }
}

function writeOutMainBranding(sFlashFile, sPicture, sLink, version, width, height){
	 if (actualVersion < version){
        document.write('<img width="'+width+'" height="'+height+'" src="'+sPicture+'" border="0">');
    } else {
				sFlashFile = sFlashFile
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="mainbrand" width="'+width+'" height="'+height+'" id="mainbrand"><param name="movie" value="'+sFlashFile+'"><param name="quality" value="best"><param name="menu" value="false"><param name="BGCOLOR" value="#ffffff"><embed src="'+sFlashFile+'" width="'+width+'" height="'+height+'" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" name="mainbrand" menu="false" bgcolor="#ffffff"></embed></object>');
    }
}

function writeFlash(sFlash, sPicture, width, height, myLink){
	 if (actualVersion < 6){
		 	if(myLink){
				document.write('<a href="'+myLink+'" target="_blank"><img width="'+width+'" height="'+height+'" src="'+sPicture+'" alt=""></a>');
			} else {
      	document.write('<img width="'+width+'" height="'+height+'" src="'+sPicture+'" alt="">');
			}
    } else {
				sFlashFile = sFlash;
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="icn" width="'+width+'" height="'+height+'" id="icn"><param name="movie" value="'+sFlashFile+'"><param name="wmode" value="transparent"><param name="quality" value="best"><param name="menu" value="false"><param name="BGCOLOR" value="#ffffff"><embed src="'+sFlashFile+'" width="'+width+'" height="'+height+'" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" name="icn" menu="false" bgcolor="#ffffff" wmode="transparent"></embed></object>');
    }
}

//avaa jakelulistasovelluksen jolle annetaan URL. käyttää CMS:n metodeja.
function CMS_openWindowDistributionListManager( strDlgURL )
{
	WBC_openWindowOnFocus(strDlgURL, "WBC_winDistrubutionListManager", WBC_UseDefaultSizing(window.top));
}