// Hide popup
function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) 
	{
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
		return false;
    } 
	else 
	{
        if (document.layers) 
		{
            document.layers[id].visibility = NNtype;
			return false;
        } 
		else 
		{
            if (document.all) 
			{
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
				return false;
			}
		}
	}
}

function setCookie(name, value, Days, path) {
	var expires = new Date()
    expires.setTime(expires.getTime() + 3600000*24*Days);
	document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path))
}
 
function getCookie(name) {
	var search = name + "="
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
 		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset)
 			if (end == -1) {
				end = document.cookie.length
			}
		return unescape(document.cookie.substring(offset, end))
		}
	}
}	

function showXmasCard() {
        var test_cookie = getCookie("ch5_xmas09")
        setCookie("ch5_xmas09", "True", 1, "/");
        if (test_cookie == null) {
			output = "<div id='popupLayer' style='position:absolute; left:50%; top:50px; margin-left:-395px; width:790px; height:500px; z-index:10; border:1px solid #848b8f;'>";
			output += "<div style='position:absolute; left:-1px; top:-27px; width:100%; padding:5px 0 7px 0; text-align:right; background:#fff url(/stc/2009/img/ch5/bg-popup-top.gif) left bottom repeat-x; border:1px solid #848B8f;'><a href='#' onClick=\"toggleVisibility('popupLayer','hidden','hidden','hidden')\" style='margin-right:10px; text-decoration:none;'>Sulje</a></div>"
			output += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='790' height='500' id='joulukortti2009' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='false' /><param name='movie' value='/stc/joulukortti2009/joulukortti2009.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='/stc/joulukortti2009/joulukortti2009.swf' quality='high' bgcolor='#ffffff' width='790' height='500' name='joulukortti2009' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
			output += "</div>";
			return output;
		} 
		 else {
			output = "";
			return output; 
		}
	}

/*
function showPopup() {
        var test_cookie = getCookie("ch5_popup4")
        setCookie("ch5_popup4", "True", 1, "/");
        if (test_cookie == null) {
			output = "<div id='popupLayer' style='position:absolute; left:30%; top:157px; width:400px; height:267px; z-index:1; border:1px solid #2F2E31'>";
			output += "<img src=\"/stc/images/kesa-banneri2009.jpg\" width=\"400\" height=\"267\" alt=\"Popup\" border=\"0\" usemap=\"#ch5Map\"><map name=\"ch5Map\">";
			output += "<area alt=\"Sulje\" coords=\"380,0,400,20\" shape=\"rect\" href=\"#\" onClick=\"toggleVisibility('popupLayer','hidden','hidden','hidden')\">";
			output += "</map>";
			output += "</div>";
			return output;
		} 
		 else {
			output = "";
			return output; 
		}
	}
*/
document.write(showXmasCard());
