/***AKTIA Locale Selection Popup (c) Riku Mäkinen, Logica 2009***/function grayOut(vis, options) {  // Pass true to gray out screen, false to ungray  // options are optional.  This is a JSON object with the following (optional) properties  // opacity:0-100         // Lower number = less grayout higher = more of a blackout  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear  // in any order.  Pass only the properties you need to set.  options = options || {};  var zindex = options.zindex || 50;  var opacity = options.opacity || 85;  var opaque = (opacity / 100);  var bgcolor = options.bgcolor || '#fff';  var dark=document.getElementById('opaqueScreenObject');  var tbody = document.getElementsByTagName("body")[0];  if (!dark) {    // The dark layer doesn't exist, it's never been created.  So we'll    // create it here and apply some basic styles.    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917	tbody.style.borderTop='5px solid #f6f6f6';           // Gray out also body's border    var tnode = document.createElement('div');           // Create the layer.        tnode.style.position='absolute';                 // Position absolutely        tnode.style.top='0px';                           // In the top        tnode.style.left='0px';                          // Left corner of the page        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars        tnode.style.display='none';                      // Start out Hidden        tnode.id='opaqueScreenObject';                   // Name it so we can find it later    tbody.appendChild(tnode);                            // Add it to the web page    dark=document.getElementById('opaqueScreenObject');  // Get the object.  }  if (vis) {    // Calculate the page width and height    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {      var pageWidth = document.body.scrollWidth+'px';      var pageHeight = document.body.scrollHeight+'px';    } else if( document.body.offsetWidth ) {      var pageWidth = document.body.offsetWidth+'px';      var pageHeight = document.body.offsetHeight+'px';    } else {      var pageWidth='100%';      var pageHeight='100%';    }	/* Window size */	var minWidth = 962; //minimum width for shader (=main content width)	var windowWidth = 0, windowHeight = 0;    if( typeof( window.innerWidth ) == 'number' ) {      //Non-IE      windowWidth = window.innerWidth;      windowHeight = window.innerHeight;    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {      //IE 6+ in 'standards compliant mode'      windowWidth = document.documentElement.clientWidth+16;      windowHeight = document.documentElement.clientHeight;    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {      //IE 4 compatible      windowWidth = document.body.clientWidth;      windowHeight = document.body.clientHeight;    }    //set the shader to cover the entire page and make it visible.    dark.style.opacity=opaque;    dark.style.MozOpacity=opaque;    dark.style.filter='alpha(opacity='+opacity+')';    dark.style.zIndex=zindex;    dark.style.backgroundColor=bgcolor;    dark.style.width=(windowWidth>minWidth?windowWidth:minWidth)+'px';    dark.style.height='9999px';    dark.style.display='block';    //set body height and overflow to hidden    tbody.style.height=windowHeight+'px';    if (windowHeight < 750 || windowWidth < 750) {      tbody.style.overflow='auto';    } else {      tbody.style.overflow='hidden';    }    localePopup(true);  } else {    dark.style.display='none';    tbody.style.borderTop='5px solid #e6e6e6';    tbody.style.height='auto';    tbody.style.overflow='visible';    localePopup(false);  }}function localePopup(vis) {  // Pass true to print locale selection popup, false to hide it  var zindex = 100;  var popup=document.getElementById('localeSelectionPopup');  if (!popup) {    // The popup layer doesn't exist, it's never been created.  So we'll    // create it here and apply some basic styles.    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917    var tbody = document.getElementsByTagName("body")[0];    var tnode = document.createElement('div');            // Create the layer.        tnode.style.display='none';                       // Start out Hidden        tnode.id='localeSelectionPopup';                  // Name it so we can find it later		tnode.innerHTML = 			'<div class="boxColumn"><h1 class="aktia-logo">AKTIA</h1><h2>Välkommen</h2><p>till Aktias webbplats!</p>' +			'<p><a href="'+se_link+'" onclick="createCookie(\'AKTIA_LOCALE_SET\',\'sv\',365);" class="button" title="Stig in">Stig in</a></p></div>';		tnode.innerHTML += 			'<div class="boxColumn"><h1 class="aktia-logo">AKTIA</h1><h2>Tervetuloa</h2><p>Aktian kotisivuille!</p>' +			'<p><a href="'+fi_link+'" onclick="createCookie(\'AKTIA_LOCALE_SET\',\'fi\',365);" class="button button-fi" title="Astu sisään">Astu sisään</a></p></div>';		tnode.innerHTML += 			'<p class="bottom">' + 			'<a href="'+en_link+'" onclick="createCookie(\'AKTIA_LOCALE_SET\',\'fi\',365);" title="In English">In English</a></p>';    tbody.appendChild(tnode);                             // Add it to the web page    popup=document.getElementById('localeSelectionPopup');// Get the object.  }  if (vis) {    popup.style.zIndex=zindex;    popup.style.display='block';  } else {    popup.style.display='none';  }}
