function _MSIE() { return (window.navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0); };
function _FireFox() { return (window.navigator.appName.toUpperCase().indexOf("NETSCAPE")>=0); };
//_MSIE() ? _MSIEUSERDATA() : (window.sessionStorage) ? _FF2XUSERDATA() : _NOUSERDATA();

function ShowSign(Wcid){
    var sUrl = "/webcast/webcast-register.aspx?id=" + Wcid;
	var ww= 450;
	var hh=320;
	var lefts =(screen.availWidth - ww)/2 ; 
	if (_MSIE()){
	var tops =(screen.availHeight - hh)/2-190; 
	}
	else{
	var tops =(screen.availHeight - hh)/2-150;
	}
	
	if(top.mainfra)
	{	 
		if((top.mainfra.location.href.toString().indexOf("case.asp") == -1))
		{
			sUrl	=	setURLParam(sUrl,"url",setURLParam("default","MUrl",top.mainfra.location.href));
		}		
        if (_MSIE())
        {
	      top.mainfra.FloatShow(sUrl, ww, hh, null, null, tops, 0 );
	    }else
	    {
	      top.mainfra.FloatShow(sUrl, ww, hh, null, null, 0, 0);
	    }
	}
	else
	{
	if (_MSIE())
	    {
	      FloatShow(sUrl, ww, hh, null, null, lefts, tops);
	    }else
	    {
	      FloatShow(sUrl, ww, hh, null, null, lefts, tops);
	    }
    } 		
};

function ShowLogin() {
    var sUrl = "webcast_login.aspx?returnURL=" + document.URL;
    var ww = 260*2+32;
    var hh = 180;
    var lefts = (screen.availWidth - ww) / 2;
    if (_MSIE()) {
        var tops = (screen.availHeight - hh) / 2 - 190;
    }
    else {
        var tops = (screen.availHeight - hh) / 2 - 150;
    }

    if (top.mainfra) {
        if ((top.mainfra.location.href.toString().indexOf("case.asp") == -1)) {
            sUrl = setURLParam(sUrl, "url", setURLParam("default", "MUrl", top.mainfra.location.href));
        }
        if (_MSIE()) {
            top.mainfra.FloatShow(sUrl, ww, hh, null, null, tops, 0);
        } else {
            top.mainfra.FloatShow(sUrl, ww, hh, null, null, 0, 0);
        }
    }
    else {
        if (_MSIE()) {
            FloatShow(sUrl, ww, hh, null, null, lefts, tops);
        } else {
            FloatShow(sUrl, ww, hh, null, null, lefts, tops);
        }
    }
};




function ReturnMallNo()
{
	if(getHashParam("mallno").length > 0) return getHashParam("mallno");
	else if(top.g_iMallNo) return top.g_iMallNo;
	else return 0;
}

// ########################################################

function DivCreate(oWin, oParent, sID, zIndex, iLeft, iTop, sWidth, sHeight, sDisplay)
{
	if (oWin && oWin.document && !oWin.document.getElementById(sID))
	{
		var e = oWin.document.createElement("DIV");
		e.id = sID;
		e.style.position = "absolute";
		e.style.zIndex = zIndex;
		e.style.left = iLeft;
		e.style.top = iTop;
		e.style.width = sWidth;
		e.style.height = sHeight;
		e.style.display = sDisplay;
		try{ oParent && oParent.appendChild(e); } catch(e) { }
		return e;
	}
	if (oWin.document.getElementById(sID)) return oWin.document.getElementById(sID);
	else return null;
};

function PageMaskCreate(oWin)
{
	if(oWin && oWin.document)
	{
		if (!oWin.document.getElementById("Fedint"))
		{
			var ebg = DivCreate(oWin, oWin.document.body, "Fedint", 65529, 0, 0, "100%", "100%", "none");
			ebg.style.backgroundColor = "#000000";
			ebg.style.opacity = 0.35;
			ebg.style.filter = "alpha(opacity=95)";
		}
		return oWin.document.getElementById("Fedint");
	}
	else return null;
};

function PageMaskShow(oWin)
{
	var e = PageMaskCreate(oWin);
	if(e)
	{
		e.style.height = Math.max((oWin.document.body.offsetHeight), oWin.document.documentElement.clientHeight)+"px";
		e.style.display = "block";
	}
};


function PageMaskHide(oWin)
{
	var e = PageMaskCreate(oWin);
	e.style.display = "none";
};

function ProcessHide(oWin)
{
	var e = ProcessCreate(oWin);
	e.style.display = "none";
};

function MaskStart(lWin)
{
	for (var i=0; i<arguments[0].length; ++i)
	{
		try{ PageMaskShow(arguments[0][i]); } catch(e) { }
	}
};

function MaskEnd(lWin)
{
	for (var i=0; i<arguments[0].length; ++i)
	{
		try{ PageMaskHide(arguments[0][i]); } catch(e) { }
	}
};

function WaitStart(lWin, lTxt, bTxt)
{
	for (var i=0; i<arguments[0].length; ++i)
	{
		if(arguments[0][i])
		{
			PageMaskShow(arguments[0][i]);
		}
	}
	if(arguments[0][0] && !bTxt) ProcessShow(arguments[0][0], lTxt);
};

function WaitEnd(lWin)
{
	for (var i=0; i<arguments[0].length; ++i)
	{
		try{ PageMaskHide(arguments[0][i]);} catch(e){ }
	}
	try{ ProcessHide(arguments[0][0]); } catch(e) { }
};

function FloatShow(sUrl, iWidth, iHeight, OnOK, OnCancel, iLeft, iTop, oWin, fras, zIndex)
{
	var izIndex = zIndex?zIndex:65530;
	oWin = oWin || window;
	iLeft = typeof(iLeft)=="number" ? iLeft : 75;
	iTop = typeof(iTop)=="number" ? iTop : 45;
	var ifras = null;
	if (typeof(fras) != "undefined" && fras != null && fras != "null")
	{
	  ifras = fras;
	}else
	{
		ifras = [window, top.mainfra, top.leftfra, top.topfra];
	}
	FloatShow.Show = function(sUrl, iWidth, iHeight, iLeft, iTop)
	{
		MaskStart(ifras);
		var e = DivCreate(oWin, oWin.document.body, "Fedintal", izIndex, 0, 50, "100%", "1", "none");
		if(e && "object" == typeof(e) && "div" == e.tagName.toString().toLowerCase())
		{
		e.style.top = (Math.max(Math.min(oWin.document.documentElement.scrollTop+100, Math.max(oWin.document.body.offsetHeight-100,100)), 50))+"px";
		e.innerHTML = '<table id="w_head" align="center" style="position:absolute;left:'+iLeft+'px;top:'+iTop+'px;"><tr><td align="center"><iframe allowtransparency=true id="Fed_X" name="Fed_X" width="'+iWidth+'" height="'+iHeight+'" frameborder="0" scrolling="no"></iframe></td></tr></table><div id="d_border" style="display:none;border:1px dotted #000000; position:absolute;"></div>';
		e.getElementsByTagName("IFRAME")[0].src = sUrl;
		e.style.display = "block";
		}
		else throw "create div failed ";
	};
	
	FloatShow.Hide = function()
	{
	  MaskEnd([window, top.mainfra, top.leftfra, top.topfra]);
	  
		if (arguments[0])
		{
		  var fra = arguments[0];
		  if (fra && fra.document)
		  {
		    if(fra.document.getElementById("Fedintal"))
				fra.document.getElementById("Fedintal").style.display = "none";	
		  }
		}else
		{
			if(document.getElementById("Fedintal"))
				document.getElementById("Fedintal").style.display = "none";	
		}
	};
	
	FloatShow.DireOnCancel = function()
	{
		OnCancel && OnCancel(arguments[0]);
	};

	FloatShow.OnOK = function()
	{
		FloatShow.Hide();
		OnOK && OnOK(arguments[0]);
	};

	FloatShow.OnCancel = function()
	{
		FloatShow.Hide();
		OnCancel && OnCancel(arguments[0]);
	};

	FloatShow.AutoSize = function()
	{
		try
		{
			function FindIFrame(sName) { for (var i=0; i<window.frames.length; ++i) { if (window.frames[i].name==sName) { return window.frames[i]; } } return null; };
			var e = document.getElementById("Fed_X");
			var w = _MSIE() ? window.frames["Fed_X"] : FindIFrame("Fed_X");
			if ((w.document.documentElement.scrollTop=500) && (w.document.documentElement.scrollTop!=0))
			{
				e.height = parseInt(e.height)+w.document.documentElement.scrollTop+"px";
				w.document.documentElement.scrollTop = 0;
			}
			if ((w.document.documentElement.scrollLeft=500) && (w.document.documentElement.scrollLeft!=0))
			{
				e.width = parseInt(e.width)+w.document.documentElement.scrollLeft+"px";
				w.document.documentElement.scrollLeft = 0;
			}
		}
		catch(e)
		{
		}
	};

	FloatShow.Show(sUrl, iWidth, iHeight, iLeft, iTop);
};

