/*
CE client side scripts
*/

function linkLookup(){
	/*
	this function will find the correct number in the crsc array based on the url of the page
	*/
	var arrArguments=linkLookup.arguments;
	var intArguments=arrArguments.length;	
	//if(bolSpeedTest)createSplitTimeMessage("in lookup");	
	if(retrieveQuerystringParameterValue(location.href, 'parentid')!='')return retrieveQuerystringParameterValue(location.href, 'parentid');
	
	var bolCheckNext=false, bolReturnValue=false;
	var strCurrentPath=document.location.pathname;
	if(intArguments>0)strCurrentPath=arrArguments[0];
	var strSearchString=document.location.search;
	var strTempId="";
	var strLeftNavPath;
	
	//rework the path so that it will match the string pattern in the site_structure.xml 
	var re = new RegExp("(/|^\.asp|^\.html|^\.htm)$");
	if (strCurrentPath.match(re)) {
		//alert("Need to add the default document");
		strCurrentPath+="index.asp";
	}
	
	//build a string that will match the data in the array
	var strUniqueIdentifier=strCurrentPath;
	//overrule for cms
	if(strCurrentPath=="/system/xopus_prepare.asp"){
		strUniqueIdentifier=strSearchString;
	}

	if(bolDebug)strLookupDebug="<b>Searching: strUniqueIdentifier="+strUniqueIdentifier+"</b><br/>";
	
	for (id in _page.leftNav) {
		//alert(_page.leftNav[id].link)
		strLeftNavPath=_page.leftNav[id].link;		
		
		if(bolDebug)strLookupDebug+="-"+strLeftNavPath+"<br/>";
		
		if (strUniqueIdentifier == strLeftNavPath){
			strTempId=id;
			break;
		}

	}
	//if(bolSpeedTest)createSplitTimeMessage("uit lookup (id="+strTempId+")");
	return strTempId
}


/*
After page has loaded
*/
function initPage(){
	//alert('loaded...');
}

/*
Runtime Code
*/
//global variables
var bolDebug=false;
var intTimerId1, intTimerId2;

//additional crsc parameters
_page.link["owner"]="/siteowner.html";
_page.showStockQuotes = false;
_page.hideFlashSectionBanner = true;
//_page.sectionSpecial = ["Annual Report 2006","/index.asp"]; /* Enter title and url special section */
//_page.sectionMain = ["Investor Relations","http://www.philips.com/about/investor/index.html"]; /* Optional: Enter title and url main section */
_page.leftNavOnload = false; /* set when the menu data will load */

//debug modus
if(document.location.search.indexOf('debug')>0 && document.location.search.indexOf('cachedebug')<1)bolDebug=true;

//get the current page id
var strPageId=linkLookup();
//alert(strPageId);

if(bolDebug)openDebugWindow(strLookupDebug+"<br/>strPageId="+strPageId, false);