//Main entry point (on Load)
var gsApp, gsPage, gsParams, gbGoogleAnalytics;

function Main()
{

	sQueryFull=document.location.toString().split("#!", 2);
	sQuery=$.parseQuery(sQueryFull[1]);
	
	gsApp = "SpinPages";
	gsPage = "page";
	gsParams = "&zone=Default";
	
	//Load the dynamic divs
	if(typeof sQuery.App != "undefined")
	{
		gsApp = sQuery.App;
		
		if(typeof sQuery.Page != "undefined")
			gsPage = sQuery.Page;
		else
			gsPage = "main";
			
		sParams=sQueryFull[1].replace("App=" + gsApp, "");
		sParams=sParams.replace("&Page=" + gsPage, "");
		gsParams=sParams;
	}
	
	//Load the LG
	Navigation.fvRequestApp("SpinPages", "lookingglass.php", divApps, false);
	
	//Build div dependancies table
	fvBuildDTable();
}


//Dependancies bootstrap
function fvBuildDTable()
{
	tDependancies = null;
	tDependancies = new Dependancies();
		
	//Clears the enlarged profile and replaces it with the compact profile when exiting profile pages
	tDependancies.addDependancy("connections/info.php");
	tDependancies.addDiv("profile-pic", document.getElementById("profile-pic").innerHTML);

	//Required
	tDependancies.addDependancy("unknown");
}


//Background process worker thread (onload)
function BGPW_ready(BGPW)
{
	if(window.frames['BGPW'].document.body.innerHTML != "")
	{
		TransferResponse(window.frames['BGPW'].document.body.innerHTML, divBody);	
	}
}


/*
window.onerror = function()
{
		return true;
}
*/
