// This function is used when rendering flash files.
function writeContent(id, content)
{
	var elem = document.getElementById(id);
	if (elem != null)
	{
		elem.innerHTML = content;
	}
}

// **** Code to get, set and get value of a cookie ****
function GetCookie (name) 
{ 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; 

	while (i < clen) 
	{ 
		var j = i + alen; 
		if (document.cookie.substring(i, j) == arg)
		{ 
			return getCookieVal (j); 
		}

		i = document.cookie.indexOf(" ", i) + 1; 
		if (i == 0)
		{ 
			break; 
		}
	} 

	return null; 
}  

function getCookieVal(offset) 
{ 
	var endstr = document.cookie.indexOf(";", offset); 

	if (endstr == -1) 
		endstr = document.cookie.length; 

	return unescape(document.cookie.substring(offset, endstr)); 
}
	function GetMall(mallID)
	{
		if (mallID != "")
		{
			location.href="/mall/default.aspx?ID=" + mallID;
		}
	}
	function GetMallByState(stateCode)
	{
		if (stateCode != "")
		{
			document.location.href = "/findamall/default.aspx?State=" + stateCode;
		}
	}
	function entsub()
	{
		if (window.event && window.event.keyCode == 13)
		{
        	document.forms[0].action = "/register/index.aspx";
            document.forms[0].submit();
		}
		else
			return true;
	}
    function LoginUser()
    {
    	document.forms[0].action = "/register/index.aspx";
        if(document.getElementById("rdoHeader").checked)
            document.forms[0].submit();
        else
        {
	        document.location.href="/register/register.aspx";
        }
    }

function SetCookie (name, value) 
{ 
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	var path = (argc > 3) ? argv[3] : null; 
	var domain = (argc > 4) ? argv[4] : null; 
	var secure = (argc > 5) ? argv[5] : false; 

	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
			  ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + 
			  ((secure == true) ? "; secure" : ""); 
} 
// ****  End of Cookie section ****

// **** Code of create a DHTML pop up ****
function Callback()
{    
    if (xmlHttp.readyState == 4) 
    {            
		if (xmlHttp.status == 200)
		{               
          setData(xmlHttp.responseText);    
		}
	} 	
}

function DisplayDropDowns(sMode)
{
	var x=0;
	var y=0;
	var bHide=false;
	
	
	for(x=0;x<document.forms.length;x++)
	{
		for(y=0;y<document.forms[x].elements.length;y++)
		{
			if(document.forms[x].elements[y].type=="select-one") { document.forms[x].elements[y].style.display = sMode; } 			
		}
	}
	if(bHide==true) { DisplayDropDowns("none"); }
}

function closeWindow(divName) {

	if (opener && !opener.closed) 
	{
		window.close();
	}
	else if (document.getElementById(divName)) 
	{
		var dataDiv = document.getElementById(divName);
		if (dataDiv.style.display != "none") 
		{
			clearData();		
		}
	} 
	else 
	{
		window.close();
	}
}

function popUp() 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open('../tellafriend.aspx', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=450,left = 0,top = 0');");
}
				
function popUpTenantPrint()
{
	window.open('tenant_print.aspx' + window.location.search, 'printWin','toolbar=0,scrollbars=1,location=0,width=640,height=800');
}
				
function popUpEventPrint()
{
	window.open('event_print.aspx' + window.location.search, 'printWin','toolbar=0,scrollbars=1,location=0,width=500,height=700');
}


/* Other function used for DHTML pop ups but are pop up specific. 
siteSurvey(), setData(responseData), clearData(), 
*/
// **** End of DHTML Popup section ****
