       var gameWindow;
	   
	   var randomTunnel="domainTunnel" + Math.floor(Math.random()*1000)
/*
       var flashvarsA = {};
       var paramsA = {};
       var attributesA = {};

       flashvarsA.connectionName = randomTunnel;
       flashvarsA.domain = document.domain;
       flashvarsA.isServer = true;

       paramsA.wmode = "transparent";

       attributesA.id = "domaintunnelserver";
       attributesA.name = "domaintunnelserver";

       swfobject.embedSWF("/modal/DsDomainTunnel.swf", "domainTunnelHolderServer", "1", "1", "9.0.0", "/modal/expressInstall.swf", flashvarsA, paramsA, attributesA);
*/
		function writeDomainTunnel(d) {
			d.write("<object height=\"1\" width=\"1\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"domaintunnelserver\">\n");
			d.write("             <param value=\"transparent\" name=\"wmode\"/>\n");
			d.write("             <param value=\"connectionName=" + randomTunnel + "&domain=" + document.domain + "&isServer=true\" name=\"flashVars\"/>\n");
			d.write("             <param value=\"/modal/DsDomainTunnel.swf\" name=\"movie\"/>\n");
			d.write("             <embed name=\"domaintunnelserver\" height=\"1\" width=\"1\" src=\"/modal/DsDomainTunnel.swf\"\n");
			d.write("                             flashVars=\"connectionName=" + randomTunnel + "&domain=" + document.domain + "&isServer=true\" wmode=\"transparent\"/>\n");
			d.write("</object>");
		}

		// Internet Explorer and Mozilla-based browsers refer to the Flash application object differently.
		// This function returns the appropriate reference, depending on the browser.
	   function getTunnel()
	   {
	   		if (navigator.appName.indexOf ("Microsoft") != -1) {
				return window["domaintunnelserver"];
			} else {
				return document["domaintunnelserver"];
			}
	   }

       function resize_iframe()
       {

             var height=window.innerWidth;//Firefox
             if (document.body.clientHeight)
             {
                    height=document.body.clientHeight;//IE
             }
             document.getElementById("content").style.height=parseInt(height-
             document.getElementById("content").offsetTop-8)+"px";
       }

       window.onresize=resize_iframe; 


       function openGameWindow(source, width, height)
       {
			var tunnel = getTunnel();
			if(tunnel != null) {
				var newTunnel = tunnel.reconnect();
				if (typeof(newTunnel) == 'string') {
					randomTunnel = newTunnel;
				}
			}

			if (source.indexOf('#') > 0) { source = source + "&?connectionName=" + randomTunnel; } else { source = source + "?connectionName=" + randomTunnel; }
			modalWindow.windowId = "myModal";
			modalWindow.width = width;
			modalWindow.height = height;
			modalWindow.content = "<iframe width='100%' height='100%' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
			modalWindow.open();
       }
       
       function openFreeGameWindow(source, width, height)
       {
           modalWindow.windowId = "freeModal";
           modalWindow.width = width;
           modalWindow.height = height;
           modalWindow.content = "<iframe width='" + width + "' height='" + height + "' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
           modalWindow.openCentered();
       }

       function closeGame()
       {
           modalWindow.close();
       }

        function setContentFrameLocation(url)
        {
                if (url.substr(0, 4) != "http")
                        url = 'https://' + server + url;

                top.frames['contentArea']['content'].location.href = url;
				closeGame();
        }

        function setMainLocation(url)
        {
                if (url.substr(0, 4) != "http") 
                        url = 'https://' + server + url;

                top.location.href = url;
				closeGame();
        }

		function postToUrl(base, path, params) 
		{
			var form = base.createElement("form");
			form.setAttribute("method", "post");
			form.setAttribute("action", path);

			for(var key in params) 
			{
				var hiddenField = base.createElement("input");
				hiddenField.setAttribute("type", "hidden");
				hiddenField.setAttribute("name", key);
				hiddenField.setAttribute("value", params[key]);
				form.appendChild(hiddenField);
			}
			base.body.appendChild(form);
			form.submit();       
			base.body.removeChild(form);
		}

		function createSubscription(couponRequest)
		{                    
			postToUrl(top.frames['contentArea']['content'].document, 'https://'+server +'/DTCF/games/CLTO/createSubscription.do', {'xml':couponRequest});   
			closeGame();        
		}
