var bDebug;
bDebug = 0;
//***********************************************************************************
// Common windows open functions
//***********************************************************************************
var currWin = null;
//=============================================
function your_popup(url, winName, features)
{
	try
	{
		if (currWin != null && !currWin.closed)
		currWin.close();
		
		currWin = window.open(url, winName,features);
		currWin.focus();
	} catch(e) { if(bDebug==1) alert(e); }	
}
//=============================================
function openInquiry(str) 
{
	try
	{
		runpeter=open(str,"new1","toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,status=no,width=500,height=580");
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================
function openMailTo(str) 
{
	try
	{
		runpeter=open(str,"new1","toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,status=no,width=350,height=500");
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================
function openEBrochure(url) 
{
	try
	{
		POP = window.open( url, "WIN_SUB", "status=0,scrollbars=no,resizable=0,width=1024,height=768" );
		POP.focus();
	} catch(e) { if(bDebug==1) alert(e); }
}
//***********************************************************************************
// Layer Control functions
//***********************************************************************************
//=============================================
function HideLayer()
{
	try
	{
		document.all['layerFrame'].style.pixelLeft=0;
		document.all['layerFrame'].style.pixelTop=0;
		document.all['layerFrame'].style.pixelWidth=0;
		document.all['layerFrame'].style.pixelHeight=0;
		document.all['layerFrame'].style.visibility="hidden";	
		
		nFlag = -1;
		
		//layerFrame.location.href ="about:blank";
		//document.frames('layerFrame').document.body.innerHTML="";
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================
// Show Layer New
//=============================================
function ShowContent(strType, intIndex)
{
	var strNewURL;
	var strOldURL
	strNewURL = "";

	try
	{
		if(strType == "3dmall")
		{
			strNewURL = strType + "_" + intIndex + "/" + "clp300_3d__3dmall__.html";
		}
		else if(strType == "vrmall")
		{
			strNewURL = strType + "_" + intIndex + "/" + "clp300n__vrmall__.html";
		}
		else
		{
			strNewURL = strType + "_" + intIndex + "/" + strType + "/" + strType + ".html";
		}
		strOldURL = layerFrame.location.href;
		
		if(strOldURL != strNewURL)
		{
			var intLeft, intTop, intWidth, intHeight;
			intLeft = 0;
			intTop = 0;
			intWidth = 0;
			intHeight = 0;
			switch (strType)
			{
				case "zoom" :
				{
					intLeft = 550;
					intTop = 170;
					intWidth = 490;
					intHeight = 500;
					break;
				}
				case "3dmall" :
				{
					intLeft = 100;
					intTop = 170;
					intWidth = 400;
					intHeight = 400;
					break;
				}
				case "vrmall" :
				{
					intLeft = 68;
					intTop = 225;
					intWidth = 517;
					intHeight = 338;
					break;
				}
				default  :
				{
					intLeft = 0;
					intTop = 0;
					intWidth = 0;
					intHeight = 0;
					break;
				}
			}										

			layerFrame.location.href = strNewURL;
	
			document.all['layerFrame'].style.pixelLeft=intLeft;
			document.all['layerFrame'].style.pixelTop=intTop;
			document.all['layerFrame'].style.pixelWidth=intWidth;
			document.all['layerFrame'].style.pixelHeight=intHeight;
		
			document.all['layerFrame'].style.visibility="visible";
		}
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================
//***********************************************************************************
// 2D Zoom control functions
//***********************************************************************************
function my_gotoPage(nPage)
{
	try
	{
		layerFrame.my_gotoPage(nPage);
	} catch(e) { if(bDebug==1) alert(e); }
}
//***********************************************************************************
// VRmall Control functions
//***********************************************************************************

function playEvent(nEvent)
{
	try
	{
		layerFrame.VRmallViewer.PlayEventByID(nEvent);
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================
function reset()
{
	try
	{
		VRmallViewer.ResetAll();
		layerFrame.reset();
	} catch(e) { if(bDebug==1) alert(e); }
}
//=============================================

//=============================================
//***********************************************************************************
function Maximize()
{
	try
	{
		m_nScreenWidth = window.screen.width;
		m_nScreenHeight = window.screen.height;
		m_clientWidth = document.body.clientWidth+4;
		m_clientHeight = document.body.clientHeight+4;
		if( (m_nScreenWidth > m_clientWidth) || ( m_nScreenHeight > m_clientHeight ) )
		{
			//alert(m_nScreenWidth + "," + m_clientWidth + "," + m_nScreenHeight + "," + m_clientHeight);
			self.moveTo(1,1);
			HDBrowserUtil.SetMaximize(true);
		}
	} catch(e) { if(bDebug==1) alert(e); }
}
//***********************************************************************************
function CloseWindow()
{
	try
	{
		window.self.close();
	} catch(e) { if(bDebug==1) alert(e); }
}
//***********************************************************************************