Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt( navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE")+5))==6;
Prototype.Browser.IE7 = Prototype.Browser.IE && !Prototype.Browser.IE6;

// TODO - encapsulate this better
window.atmo = {
	log: [],
	eventQueue: new com.atmospherebbdo.Events.OrderedEventQueue()
};

// name global navigation images
document.observe('dom:loaded', function ()
{
  com.atmospherebbdo.Session.getPageInfo();
	
  if ( com.atmospherebbdo.Page.mediaType() === "print" )
  {
  	initPrint();
  }
  else
  { 
	  if (Prototype.Browser.IE && $('h1'))
	  {
	    Event.observe(window, "load", function(){
			initScreen();
		});
	  }
	  else
	  {
	    initScreen();
	  }  
  }
});


 
function delayStuff()
{
	var num = 1.3;
	for (var xyz=0; xyz<10000; xyz++)
	{
		num *= num;
	}
}
// global variable which is accessble in wwwcas.js file.
var sidebar=null;
var homeCategoriesArray = new Array(
	['Learning about Qualcomm','-1'],
	['Finding a Career','7.2,7.3,7.4,7.5,7.8,7.9'],
	['Investing in Qualcomm','7.2,7.3,7.4,7.5,7.8,7.9,7.14'],
	['Partnering with Qualcomm','7.2,7.3,7.4,7.5,7.8,7.9,7.14'],
	['Technical Information','7.2,7.3,7.4,7.5,7.8,7.9,7.14'],
	['The Latest News','-1']
);
var identifier=null;
var homeNavReq;

// called by Flash whenever the identifer is detected or changed
// identifierToken is one of the following strings:
//	'default'
//	'Learning about Qualcomm'
//	'Finding a Career'
//	'Investing in Qualcomm'
//	'Partnering with Qualcomm'
//	'Technical Information'
//	'The Latest News'

function onIdentifierSelection(identifierToken)
{
	//alert(identifierToken);
//	displayHomeAjax(identifierToken);

}
function asynchGet(homeURL){
	if(window.ActiveXObject){
       homeNavReq = new ActiveXObject("Microsoft.XMLHTTP");
    } else if(window.XMLHttpRequest) {
       homeNavReq = new XMLHttpRequest();
    }
   homeNavReq.open("GET", homeURL, true);
   homeNavReq.send(null);
   homeNavReq.onreadystatechange = processReqChange;
}

function processReqChange() {
	var sidebarmarkup =new Array();
	newshtml ='';
	if (homeNavReq.readyState == 4) {
		if (homeNavReq.status == 200) {
            // process response
			newsmarkup = displayHomeAjaxValue();
			try
			{
				 //alert("1"+identifier);
				bannermarkup = homeBannerDisplay(identifier)
				//alert("htmlmarkup :"+htmlnewsmarkup);
				//alert("2");
				sidebarmarkup.push('<ul id="home-panels">');
				//alert("3");
				sidebarmarkup.push(newsmarkup);
				//alert("4");
				sidebarmarkup.push(bannermarkup);
				//alert("5");
				sidebarmarkup.push('</ul>');
				//alert(sidebar);
				sidebar = sidebarmarkup.join('');
				 // alert(sidebar);
				 document.getElementById("sidebar").innerHTML = sidebar;
			  }
			catch (err)
			{
				alert("EXCEPTION N: ");
			}
        }
    }
}

function displayHomeAjaxValue(){
	var xmlDoc;
	if(document.implementation && document.implementation.createDocument) {
      	// MOZILLA
		var oParser = new DOMParser();
		xmlDoc = oParser.parseFromString(homeNavReq.responseText,"text/xml");
    } else if (window.ActiveXObject){
		//IE
      	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async="false";
	    xmlDoc.loadXML(homeNavReq.responseText);
    }
	var pressResult = new Array();

try  {
	if(xmlDoc != null){
		var pressDate = xmlDoc.getElementsByTagName("PRESSDATE");
		var pressUrl = xmlDoc.getElementsByTagName("PRESSURL");
		var pressHeadline = xmlDoc.getElementsByTagName("PRESSHEADLINE");
		
		if (pressHeadline.length != 0){
			pressResult.push("<li class=\"news first active\"><a href=\"#\" class=\"plus\">Headline News</a>");
			pressResult.push("<div class=\"panel-content\">");
			pressResult.push("<ul class=\"show-when-closed\">");

			var iLength;
			if(pressHeadline.length > 2){
				iLength = 2;
			} else {
				iLength = pressHeadline.length
			}

			for (var i = 0; i < iLength; i++){
				var pressReleaseDate = pressDate.item(i).getAttribute("date");
				var pressReleaseUrl = pressUrl.item(i).getAttribute("url");
				var pressReleaseHeadline = pressHeadline.item(i).getAttribute("headline");
				pressResult.push("<li class=\"box\">");
				pressResult.push("<a href="+pressReleaseUrl+">");
				pressResult.push(pressReleaseHeadline);
				pressResult.push("</a>");
				pressResult.push("<div class=\"date\">");
				pressResult.push(pressReleaseDate);
				pressResult.push("</div>");
				pressResult.push("</li>");
			}
			pressResult.push("</ul>");

			if(pressHeadline.length > 2){
				pressResult.push("<ul class=\"show-when-opened\" style=\"overflow: visible; display: none;\">");
				for (var i = 2; i < pressHeadline.length; i++){
					var pressReleaseDate = pressDate.item(i).getAttribute("date");
					var pressReleaseUrl = pressUrl.item(i).getAttribute("url");
					var pressReleaseHeadline = pressHeadline.item(i).getAttribute("headline");
					pressResult.push("<li class=\"box\">");
					pressResult.push("<a href="+pressReleaseUrl+">");
					pressResult.push(pressReleaseHeadline);
					pressResult.push("</a>");
					pressResult.push("<div class=\"date\">");
					pressResult.push(pressReleaseDate);
					pressResult.push("</div>");
					pressResult.push("</li>");
				}
				pressResult.push("</ul>");
			}
			 pressResult.push("</div>");
			 pressResult.push("</li>");			
		}
	
 return pressResult.join('');
	}
	}
	catch(err) {
		alert("exception "+err.description);
	}
}

function homeBannerDisplay(identifierToken) {
	var allBanner= $('bannerhidden').value;
	//alert(allBanner);
	var finalResult = new Array();
	//alert(allBanner);
	try
	{
		finalResult.push("<li class=\"promos first active\">");
		finalResult.push("<a class=\"plus\">Connect</a>");
		finalResult.push("<div class=\"panel-content\">");
		finalResult.push(findShowClosedProfileBanners(allBanner,identifierToken));
		//finalResult.push(findShowOpenProfileBanners(allBanner,identifierToken));
		finalResult.push("</div>");
		finalResult.push("</li>");
		resultantMarkUp = finalResult.join('');
	}
	catch (err)
	{
		alert("EXCE dd:"+err.description);
	}
	//finalResult = finalResult+"</div>";
	return resultantMarkUp ;
}

function findShowClosedProfileBanners(allBanner,identifierToken) {
	var closedBanner = new Array();
    var banner= allBanner.split('::');
	var bannerLength = banner.length;
	try
	{
	
	closedBanner.push("<ul class=\"show-when-closed\" style=\"overflow: visible;\">"); //style=\"overflow: visible;\" 
 //alert(" bannerLength : "+bannerLength);
	for (var i = 0; i < bannerLength; i++){
		singleBanner = banner[i].split(':');
		profileId = singleBanner[0] ;
		image= singleBanner[1] ;
		url = singleBanner[2] ;
		text = singleBanner[3] ;
		target= singleBanner[4] ;
	   if(profileId=='All' || profileId == identifierToken || profileId.indexOf(identifierToken)!=-1) {
		 // alert("text"+text);
	     closedBanner.push(bannerMarkUp(image,url,text,target));
		}
	}
	  closedBanner.push("</ul>");
	} catch (err)
	{
		alert("EX : clsoed banner")
	}
		//alert("clsoed baner : "+closedBanner.join(''));
  return closedBanner.join('');
}

function findShowOpenProfileBanners(allBanner,identifierToken) {
	 var openBanner = new Array();
	 var banner= allBanner.split('::');
	 var bannerLength = banner.length;
 openBanner.push("<ul class=\"show-when-opened  \" style=\"overflow: visible;\"  >");
 try
 {
	for (var i = 0; i < bannerLength; i++){
	//	alert(" i : "+banner[i]);
	 singleBanner = banner[i].split(':');
		profileId = singleBanner[0] ;
		image= singleBanner[1] ;
		url = singleBanner[2] ;
		text = singleBanner[3] ;
		target= singleBanner[4] ;
		
		if(profileId !='All' && profileId != identifierToken && profileId.indexOf(identifierToken)==-1 ) {
    openBanner.push(bannerMarkUp(image,url,text,target));
	}
 }
	openBanner.push("</ul>");
 }catch (err)
	{
		alert("EX : open banner")
	}
//alert("open banner :"+openBanner.join(''));
 return openBanner.join('');
}

function bannerMarkUp(image,url,text,target) {
	//alert(image);
	var bannerHtml= new Array();
	bannerHtml.push('<li>');
	bannerHtml.push('<div class="sifr-image bottom" style="width: 184px; height:88px; background: url(');
	bannerHtml.push(image);
	bannerHtml.push(') no-repeat 0 0;">');
	bannerHtml.push('<a href=\"');
	bannerHtml.push(url);
	bannerHtml.push('\" target=\"');
	bannerHtml.push(target);
	bannerHtml.push('\" title=\"');
	bannerHtml.push(text);
	bannerHtml.push(' \" style=\"width: 184px; height: 88px\">');
	bannerHtml.push(text);
	bannerHtml.push('</a>');
	bannerHtml.push('<div class=\"copy-holder\"><div class=\"inner\">');
	bannerHtml.push('<p class=\"use-sifr\">');
	bannerHtml.push(text);
	bannerHtml.push('</p>');
	bannerHtml.push('</div></div></div>');
	bannerHtml.push('</li>');
	finalMarkUp= bannerHtml.join('');
	//alert(finalMarkUp);
	return finalMarkUp;
}
function onAJAXIdentifierSelection(identifierToken)
{
  // alert("onAJAXIdentifierSelection  bacis js   : "+identifierToken)
	var categoryId = null;
	bannermarkup = null;
	identifier = identifierToken;
	try
	{
		
	if(identifierToken != null && identifierToken != ''){
		if(homeCategoriesArray != null){
			for (var i=0; i < homeCategoriesArray.length; i++) {
				if(homeCategoriesArray[i][0] == identifierToken){
					categoryId = homeCategoriesArray[i][1]
				}
			}
		}
	}
	}
	catch (err)
	{
		alert("err"+err.description)
	}

	// alert(">"+categoryId+"<");
	if(categoryId != null && categoryId != ''){
				// this is for dev/test/prod
		var homeURL = "/HomeAJAXServlet?categoryid="+categoryId+"&sid="+Math.random();
		// this is only for localhost
		//var homeURL = "/wwwnew/HomeAJAXServlet?categoryid="+categoryId+"&sid="+Math.random();
		asynchGet(homeURL);			
	}
  }

function displayHomeAjax(identifierToken){
  Util.log("entering displayHomeAjaxValue()");
// using default return value for now; Houmann's team is to replace this with 
// actual content
//alert("end");
         // This method will make a AJAX call and create a markups for news and banners.
		onAJAXIdentifierSelection(identifierToken); // The wwwcas.js has the implementation the functionality.

/*	var sidebar ='<ul id="home-panels">';
	sidebar = sidebar + '<li class="news first active">';
	sidebar = sidebar + '<a href="#" class="plus">Headline News</a>';
	sidebar = sidebar + '<div class="panel-content">';
	sidebar = sidebar + '<ul class="show-when-closed">';
	sidebar = sidebar + '<li class="box">';
	sidebar = sidebar + '<a href="/news/releases/2008/080910_Qualcomm_and_Navistar_Announce_Alliance.html">Qualcomm and Navistar Announce Alliance to Deliver Qualcomm Mobile Computing Platform via Navistar Dealers in the United States </a>';
	sidebar = sidebar + '<div class="date">September 10, 2008</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '<li class="box">';
	sidebar = sidebar + '<a href="/news/releases/2008/080910_Qualcomm_and_Freestyle_Audio_Reveal.html">Qualcomm and Freestyle Audio Reveal First Product to Feature Color mirasol Displays</a>';
	sidebar = sidebar + '<div class="date">September 10, 2008</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '</ul>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '<li class="promos first active">';
	sidebar = sidebar + '<a class="plus" href="#">Connect</a>';
	sidebar = sidebar + '<div class="panel-content">';
	sidebar = sidebar + '<ul class="show-when-closed">';
	sidebar = sidebar + '<li>';
	sidebar = sidebar + '<div class="sifr-image bottom" style="width: 184px; height:88px; background: url(/images/homepagebanners/home_banner_mobilecontent.jpg) no-repeat 0 0;">';
	sidebar = sidebar + '<a target="_self" href="/products_services/mobile_content_services/" title="Mobile Content & Services" style="width: 184px; height: 88px">Mobile Content & Services</a>';
	sidebar = sidebar + '<div class="copy-holder">';
	sidebar = sidebar + '<div class="inner">';
	sidebar = sidebar + '<p class="use-sifr">Mobile Content & Services</p>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '<li>';
	sidebar = sidebar + '<div class="sifr-image bottom" style="width: 184px; height:88px; background: url(/images/homepagebanners/home_banner_pathway.jpg) no-repeat 0 0;">';
	sidebar = sidebar + '<a target="_self" href="/innovation/pathway/" title="Pathway to Innovation" style="width: 184px; height: 88px">Pathway to Innovation</a>';
	sidebar = sidebar + '<div class="copy-holder">';
	sidebar = sidebar + '<div class="inner">';
	sidebar = sidebar + '<p class="use-sifr">Pathway to Innovation</p>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '<li>';
	sidebar = sidebar + '<div class="sifr-image bottom" style="width: 184px; height:88px; background: url(/images/homepagebanners/home_banner_viewpoints.jpg) no-repeat 0 0;">';
	sidebar = sidebar + '<a target="_self" href="/news/executive_viewpoints/" title="Executive Viewpoints" style="width: 184px; height: 88px">Executive Viewpoints</a>';
	sidebar = sidebar + '<div class="copy-holder">';
	sidebar = sidebar + '<div class="inner">';
	sidebar = sidebar + '<p class="use-sifr">Executive Viewpoints</p>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '</ul>';
	sidebar = sidebar + '</div>';
	sidebar = sidebar + '</li>';
	sidebar = sidebar + '</ul>';*/
	//alert("sidebar : "+sidebar);
	//alert("update");
 	alert("AJax call over");
	var atmo     = com.atmospherebbdo,
	    settings = atmo.Config.SifrSettings;
	 
	atmo.Sifr.showHiddenElements();
	
    atmo.Sifr.activate();
    sIFR.replace(settings.swfs.gothamThin, {    
        selector: '.inner .use-sifr',
        css: {
            '.sIFR-root': {
                'color': '#FFFFFF'
            }
        },
        wmode: 'transparent'
    });
	
//	var xmlDoc;
//	if(document.implementation && document.implementation.createDocument) {
//      	// MOZILLA
//		var oParser = new DOMParser();
//		xmlDoc = oParser.parseFromString(homeNavReq.responseText,"text/xml");
//    } else if (window.ActiveXObject){
//		//IE
//      	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
//        xmlDoc.async="false";
//	    xmlDoc.loadXML(homeNavReq.responseText);
//    }
//
//	if(xmlDoc != null && xmlDoc != '')
//	{
//		var pressDate = xmlDoc.getElementsByTagName("PRESSDATE");
//		var pressUrl = xmlDoc.getElementsByTagName("PRESSURL");
//		var pressHeadline = xmlDoc.getElementsByTagName("PRESSHEADLINE");
//		var fldResult = '';
//		if (pressHeadline.length != 0){
//			fldResult = "<div class=\"panel-content\" id=\"homenewsid\">";
//			fldResult = fldResult + "<ul class=\"show-when-closed\">";
//
//			var iLength;
//			if(pressHeadline.length > 2){
//				iLength = 2;
//			} else {
//				iLength = pressHeadline.length
//			}
//
//			for (var i = 0; i < iLength; i++){
//				var pressReleaseDate = pressDate.item(i).getAttribute("date");
//				var pressReleaseUrl = pressUrl.item(i).getAttribute("url");
//				var pressReleaseHeadline = pressHeadline.item(i).getAttribute("headline");
//				fldResult = fldResult + "<li class=\"box\">";
//				fldResult = fldResult + "<a href="+pressReleaseUrl+">";
//				fldResult = fldResult + pressReleaseHeadline;
//				fldResult = fldResult + "</a>";
//				fldResult = fldResult + "<div class=\"date\">";
//				fldResult = fldResult + pressReleaseDate;
//				fldResult = fldResult + "</div>";
//				fldResult = fldResult + "</li>";
//			}
//			fldResult = fldResult + "</ul>";
//
//			if(pressHeadline.length > 2){
//				fldResult = fldResult + "<ul class=\"show-when-opened\" style=\"overflow: visible; display: none;\">";
//				for (var i = 2; i < pressHeadline.length; i++){
//					var pressReleaseDate = pressDate.item(i).getAttribute("date");
//					var pressReleaseUrl = pressUrl.item(i).getAttribute("url");
//					var pressReleaseHeadline = pressHeadline.item(i).getAttribute("headline");
//					fldResult = fldResult + "<li class=\"box\">";
//					fldResult = fldResult + "<a href="+pressReleaseUrl+">";
//					fldResult = fldResult + pressReleaseHeadline;
//					fldResult = fldResult + "</a>";
//					fldResult = fldResult + "<div class=\"date\">";
//					fldResult = fldResult + pressReleaseDate;
//					fldResult = fldResult + "</div>";
//					fldResult = fldResult + "</li>";
//				}
//				fldResult = fldResult + "</ul>";
//			}
//			fldResult = fldResult + "</div>";
//		}
//		document.getElementById("homenewsid").innerHTML = fldResult;
//	}
  Util.log("leaving displayHomeAjaxValue()");
}

/* TT 6/27
	Added this function to fix the case where the left nav
	does not have any level two items and the content area
	was sliding to the left edge of the page, I insert a block
	with a height value to simulate left nav content
*/
function fillEmptyLocalNav() {
  Util.log("entering fillEmptyLocalNav()");
	var ulElem = $$('#local-navigation > ul').first();
	// Util.log("ulElem == "+ulElem);
	// Util.log("ulElem.select('li.level-2').length == "+ulElem.select('li.level-2').length);
	if( ulElem && ulElem.select('li.level-2').length == 0 )
	{
		//Util.log("No level two nav, inserting filler block");
		ulElem.up().insert( '<div style="height:150px;"></div>' );
	}
  Util.log("leaving fillEmptyLocalNav()");
}

function initPrint()
{
	com.atmospherebbdo.Page.applyPrintOnlyStyles();
	com.atmospherebbdo.Sifr.doReplacements();
	com.atmospherebbdo.Sifr.showHiddenElements();
}

function initScreen()
{
	var isHomepage = $$('body#h1').length;
	var atmo = com.atmospherebbdo;

	Util.preloadImages();
	atmo.Sifr.addListeners();
	atmo.Sifr.doReplacements();
	atmo.Sifr.showHiddenElements();
	Util.runAfterEvent("sifr-all-replacements-completed", addSwfAddressListener);
	Util.runAfterEvent("sifr-all-replacements-completed", atmo.Page.setupTabs);

	atmo.Page.applyGeneralListStyles();
	atmo.Page.applyGlobalNavigationStyles();
	atmo.Page.applyHoverStyles();
	atmo.Page.applySelectAllBehavior();
	atmo.Page.applyTableStyles();
	atmo.Page.setSearchText();
	atmo.Page.stylePaginationAndSiteTools();
	//atmo.Page.rewriteLocalNav();

	// the homepage gets special treatment:
	if (isHomepage)
	{
		// has a unique accordion (to be added back in)
		//setupHomepageAccordion();
	}
	else
	{
    // other pages have the regular accordion
		setupAccordions();
	}
	positionGlobalNavThumbs();
}

function addSwfAddressListener()
{
	Util.log("entering addSwfAddressListener()");
	var firstRun = true,
		showStory,
		onLocationChange,
		defaultStoryId = "default",
		stories = $$( 'div.story' ).collect( function( story ) { return story.id; } );
	
	if (!stories.length) { return; }
	
	var doShow   = function ( story )
	{
		//Util.log("entering doShow() for story: "+story);

		$(story).setStyle({position: '', left: '0px', visibility: 'visible'});

		//Util.log("leaving doShow() for story: "+story);

	};
	var doHide   = function ( story )
	{
		Util.log("entering doHide() for story: "+story);
		$(story).setStyle({position: 'absolute', left: '-100000px'});
		Util.log("leaving doHide() for story: "+story + " with width "+$(story).getWidth());
	};
	//var scrollEffect;
	var doScroll = function ( story )
	{
		//Util.log("entering doScroll() for story: "+story);
		window.scrollEffect = new Effect.ScrollTo( story,
		{
			duration: 4.0,
			delay: 0.5
		});
		//Util.log("leaving doScroll() for story: "+story);
	};
	var cancelScroll = function ()
	{
		//Util.log("entering cancelScroll()");
		if (window.scrollEffect)
		{
			window.scrollEffect.cancel();
		}
		//Util.log("leaving cancelScroll()");

	}

    // Stop scrolling if user clicks anywhere
	Event.observe(window, 'click', cancelScroll.bindAsEventListener(this));


	var currentStoryId = null;
	var currentUrl = null;

	storyExists = function ( story )
	{
		Util.log("entering storyExists() for story: "+story);
		var storyEl = document.getElementById( story );
		return ( storyEl && storyEl.hasClassName( 'story' ) );
		
	};

	showStory = function( storyId )
	{
		//Util.log("entering showStory() for story: "+storyId);
		// Make sure we have a storyId
		if ( !storyId || !storyExists( storyId ) )
		{
			storyId = defaultStoryId;
		}

		// Ignore if it's already the current one
		if ( currentStoryId && storyId == currentStoryId ) return;

		currentStoryId = storyId;

		// Show the correct one, hide all others
		for ( var i=0, numStories = stories.length; i < numStories; i++ )
		{
			if ( stories[i] == storyId )
			{
				doShow( stories[i] );
			}
			else
			{
				doHide( stories[i] );
			}
		}
		//Util.log("leaving showStory() for story: "+storyId);
	};

	onLocationChange = function( )
	{
		Util.log("entering onLocationChange("+url+")");
		
		var url = window.location.href,
		    matches = url.match( /(.+)#(\S+)/ );

		// if there's an anchor
		if ( matches && matches.length > 0 )
		{
			var base   = matches[1];
			var anchor = matches[2].replace(/^\//, ''); // Kill any of IE's extra slashes
			if (anchor.charAt(anchor.length-1) == '/') // remove it again?
			{
				anchor = anchor.substring(0, anchor.length -1);
			}

			// if the anchor has "slideshow" in it
			if ( anchor.match( /slideshow/i ) )
			{
				showStory( anchor );
				doScroll( anchor );
			}
			else
			{
				showStory( anchor );
			}
		}

		// No anchor, show default
		else
		{
			showStory();
		}
		Util.log("leaving onLocationChange()");
	};
	
	// Fire on initial load
	Util.runAfterEvent("sifr-all-replacements-completed", function() { onLocationChange(); });

	if ( stories.length > 0 )
	{
		var interval;

		// Periodically checks to see if the url has changed
		var checkUrl = function ()
		{
			//Util.log("entering checkUrl()");
			// Clear the timeout for now
			if ( interval ) window.clearTimeout( interval );

			// See if the url has changed (or this is the first run)
			if ( !currentStoryId || window.location.href != currentUrl )
			{
				currentUrl = window.location.href;

				if (firstRun)
				{
					firstRun = false;
				}
				else
				{
					onLocationChange();
				}
			}

			// Set the timeout
			interval = window.setTimeout( checkUrl, 500 );
			//Util.log("leaving checkUrl()");
		};

		checkUrl();
				}
			}







    

