﻿       var pop =null;
       function ShowIframe(title,contentUrl,width,height)
        {
           pop=new Popup({ contentType:1,isReloadOnClose:false,width:width,height:height});
           pop.setContent("contentUrl",contentUrl);
           pop.setContent("title",title);
           pop.build();
           pop.show();
        }
        function ShowHtmlString(title,strHtml,width,height)
        {
            pop=new Popup({ contentType:2,isReloadOnClose:false,width:width,height:height});
            pop.setContent("contentHtml",strHtml);
            pop.setContent("title",title);
            pop.build();
            pop.show();
       }
        function ShowConfirm(title,confirmCon,id,str,width,height)
        {
            var pop=new Popup({ contentType:3,isReloadOnClose:false,width:width,height:height});
            pop.setContent("title",title);
            pop.setContent("confirmCon",confirmCon);
            pop.setContent("callBack",ShowCallBack);
            pop.setContent("parameter",{id:id,str:str,obj:pop});
            pop.build();
            pop.show();
        }
        
        function ShowAlert(title,alertCon,width,height)
        {
            pop=new Popup({ contentType:4,isReloadOnClose:false,width:width,height:height});
            pop.setContent("title",title);
            pop.setContent("alertCon",alertCon);
            pop.build();
            pop.show();
        }
        
        function ShowCallBack(para)
        {
            var o_pop = para["obj"];
            alert(para["str"]);
            var obj = document.getElementById(para["id"]);
            alert(obj.tagName);
            o_pop.close();
            //ClosePop();
            //obj.click();
            return true;
        }

        var tempid;
        function ClosePop(obj) {
            var val = $("gameid").value;
            if (tempid == val) {
                pop.close();
                return;
            }
            tempid = val;
            Ajax("../Ajax/Code.ashx?action=game&gameid=" + val, GemeRegion, "post", null);
            
	        pop.close();
	    }

	    function setValues(obj, txt) {
	        document.getElementById(obj).value = txt;
	    }

	    function GemeRegion(responseText, responseXML) {
	        var arlist = new Array(responseText.split('|'));
	        var sel = $("gameregion");
	        sel.options.length = 0;
	        for (var i = 0; i < responseText.split('|').length; i++) {
	            if (responseText.split('|')[i] = "")
	                continue;
	            var opt = document.createElement("OPTION");
	            opt.setAttribute("value", responseText.split('|')[i].split(',')[0]);
	            opt.text = responseText.split('|')[i].split(',')[1];
	            sel.options.add(opt);
	        }
	        //$("sptarget").innerHTML = $("spgamename").innerHTML;
	        $("sptarget").innerHTML = $("spgamename").innerHTML +" - "+ sel.options[sel.selectedIndex].text;
	    }
