// suite called by the header of a page to allow common scripts to be called

// check periodically that they're still logged on (called from header every 30 seconds if user logged on)
function getLogonStatus()
	{
	log_xmlHttp=GetXmlHttpObject()
	if (log_xmlHttp==null)
	{
	// alert ("Browser does not support HTTP Request")
	return
	} 

	var log_url="/scripts/getLogonStatus.asp"

	log_xmlHttp.onreadystatechange=checkLogon;
	log_xmlHttp.open("GET",log_url,true)
	log_xmlHttp.send(null)
	}

function checkLogon() 
	{ 
	if (log_xmlHttp.readyState==4 || log_xmlHttp.readyState=="complete")
		{ 
		eval(log_xmlHttp.responseText);
		if(redirect=="yes") { window.location.href="/account_moved.asp"; }
		} 
	} 

// function called by registration/renewal forms to return the correct price based on selection of 4 variables (calls AJAX function to get it from the database and calculate server-side)
function calculateSubscription(Account_ID, Account_Type, User_Limit, Duration)
	{
	sub_xmlHttp=GetXmlHttpObject()
	if (sub_xmlHttp==null)
	{
	// alert ("Browser does not support HTTP Request")
	return
	} 

	var sub_url="/scripts/getSubscriptionCost.asp?Account_ID="+Account_ID+"&Account_Type="+Account_Type+"&User_Limit="+User_Limit+"&Duration="+Duration;
	sub_xmlHttp.open("GET",sub_url,false)
	sub_xmlHttp.send(null)
	
	eval(sub_xmlHttp.responseText);
	return sub_TotalCost;
	}


// function to enable AJAX requests by pages (used in dynamix popups and flexible forms
var xmlHttp
function GetXmlHttpObject()
	{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
		{
		objXMLHttp=new XMLHttpRequest()
		}
	else if (window.ActiveXObject)
		{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	return objXMLHttp
	}