
// EDU_Sites.js
//
//     Created:  2005.05.09
//    Requires:  EDU_setup.js
// Description:  Instruments the http://www.intel.com/education/ static content websites
//				 for SiteCatalyst web analytics.

//
// Conventions for the majority of sites
//


var wa_geo = "asmo-na";
var wa_language = metatagsObj['language'] || "unassigned";
var wa_org1 = "edww";												// Support
var wa_org2 = "asmo-na";											// Sites
var wa_org3 = "US";
var wa_org4 = "unassigned";										     	// Family category:  2nd directory in path
var wa_orgX = "unassigned"; //location.pathname.toLowerCase();	                  	// last hierarchy variable:  the URL's full path.
var wa_reportSuites = "intelcorpeduc";									// WAP 1.1 feature


// use the URL's full path as our page name,
var wa_pageName = location.pathname.toLowerCase();

// Handle a special case: 
// http://support.intel.com, www.intel.com/support, support.intel.com/support, 
// and support.intel.com/index.htm should all be mapped to /support/
if (wa_pageName == "/") { wa_pageName = "/support/"; }  

// Capture all index pages as index.htm.
// e.g. /support/chipsets/ should be renamed to /support/chipsets/index.htm
wa_pageName = wa_pageName.replace(/(\/)$/, "/index.htm");
wa_orgX = wa_pageName.replace(/(\/)$/, "/index.htm");

// If wa_orgX exceeds the 80 character limit, left-truncate.
if (wa_orgX.length > 80) { wa_orgX = wa_orgX.substring(wa_orgX.length-80, wa_orgX.length); }

// Remove the root "/" and replace with a space.  We do this so 
// the report page name will show up as e.g. supp: support/chipsets/index.htm
wa_pageName = wa_pageName.replace(/^\//, " "); 


var Directory = new Array();

// Populate the Array
//			Array(Level,	"keyword from path" , Org Value to assign	,IsFurtherOrgValues)


//*********************************************************************************************
//  Edit this section only
//*********************************************************************************************
var j = 0; 

// Array 0 -- URL / item 0
Directory[j++]= new Array(0, "education"			,"Education Homepage" ,false);	
Directory[j++]= new Array(0, "expansion"			,"Intel Teach US Extranets",false);	
Directory[j++]= new Array(0, "odyssey"				,"Innovation Odyssey",false);
Directory[j++]= new Array(0, "scripts-expansion"	,"Intel Teach US Extranets",false);			
Directory[j++]= new Array(0, "scripts-preservice"	,"Intel Teach US Extranets",false);			
Directory[j++]= new Array(0, "scripts-seeingreason"	,"Seeing Reason",false);			
Directory[j++]= new Array(0, "scripts-syndication"	,"Syndication",false);			
Directory[j++]= new Array(0, "scripts-teach"		,"Intel Teach",false);		
Directory[j++]= new Array(0, "workspace"			,"Tools Workspace",false);	

// Array 1  -- URL / dir /item 1 / 
Directory[j++]= new Array(1, "cleanroom"			,"Learning About Technology",false);		
Directory[j++]= new Array(1, "clubhouse"			,"Computer Clubhouse",false);		
Directory[j++]= new Array(1, "communityed"			,"Community/Informal Education",false);		
Directory[j++]= new Array(1, "cyberchase"			,"Elementary/Primary and Secondary Education",false);		
Directory[j++]= new Array(1, "design"				,"Design and Discovery",false);	
Directory[j++]= new Array(1, "designdiscovery"		,"Design and Discovery",false);			
Directory[j++]= new Array(1, "designprojects"		,"Unit Plans - Designing Effective Projects",false);			
Directory[j++]= new Array(1, "emergingtech"			,"Learning About Technology",false);		
Directory[j++]= new Array(1, "exemplary_planning"	,"Unit Plans - Designing Effective Projects",false);				
Directory[j++]= new Array(1, "guide"				,"Elementary/Primary and Secondary Education",false);	
Directory[j++]= new Array(1, "handhelds"			,"Learning with Handhelds",false);		
Directory[j++]= new Array(1, "highered"				,"HigherEd",true);	
Directory[j++]= new Array(1, "icc"					,"Computer Clubhouse",false);
Directory[j++]= new Array(1, "institutes"			,"Elementary/Primary and Secondary Education",false);		
Directory[j++]= new Array(1, "intellearn"			,"Intel Learn",false);		
Directory[j++]= new Array(1, "isef"					,"ISEF and Affiliated Fairs",false);
Directory[j++]= new Array(1, "journey"				,"The Journey Inside",false);	
Directory[j++]= new Array(1, "journeyinside"		,"The Journey Inside",false);			
Directory[j++]= new Array(1, "la"					,"Education Homepage",false);
Directory[j++]= new Array(1, "learn"				,"Intel Learn",false);	
Directory[j++]= new Array(1, "lectureseries"		,"HigherEd",false);			
Directory[j++]= new Array(1, "makingchips"			,"Learning About Technology",false);		
Directory[j++]= new Array(1, "manufacturing"		,"Learning About Technology",false);			
Directory[j++]= new Array(1, "math"					,"Elementary/Primary and Secondary Education",false);
Directory[j++]= new Array(1, "mpworks"				,"Learning About Technology",false);	
Directory[j++]= new Array(1, "news"					,"Newsletter online views",false);
Directory[j++]= new Array(1, "news&success"			,"Elementary/Primary and Secondary Education",false);		
Directory[j++]= new Array(1, "newtotech"			,"Learning About Technology",false);		
Directory[j++]= new Array(1, "odyssey"				,"Innovation Odyssey",false);	
Directory[j++]= new Array(1, "odysseyinfo"			,"Innovation Odyssey",false);		
Directory[j++]= new Array(1, "projectdesign"		,"Unit Plans - Designing Effective Projects",false);			
Directory[j++]= new Array(1, "recognitionofexcellence"	,"Elementary/Primary and Secondary Education",false);				
Directory[j++]= new Array(1, "research"				,"HigherEd",false);	
Directory[j++]= new Array(1, "schoolsofdistinction"	,"Elementary/Primary and Secondary Education",false);				
Directory[j++]= new Array(1, "sections"				,"Elementary/Primary and Secondary Education",false);	
Directory[j++]= new Array(1, "seeingreason"			,"Seeing Reason",false);		
Directory[j++]= new Array(1, "showingevidence"		,"Showing Evidence",false);			
Directory[j++]= new Array(1, "site_support"			,"User Support - Education",false);		
Directory[j++]= new Array(1, "sts"					,"STS and Other Science Fairs",false);
Directory[j++]= new Array(1, "syndication"			,"Syndication",false);		
Directory[j++]= new Array(1, "teach"				,"Intel Teach",false);	
Directory[j++]= new Array(1, "teachfuture"			,"Intel Teach",false);		
Directory[j++]= new Array(1, "teachstandards"		,"Elementary/Primary and Secondary Education",false);			
Directory[j++]= new Array(1, "tools"				,"Thinking Tools",false);	
Directory[j++]= new Array(1, "transworks"			,"Learning About Technology",false);		
Directory[j++]= new Array(1, "unitplans"			,"Unit Plans - Designing Effective Projects",false);		
Directory[j++]= new Array(1, "visualranking"		,"Visual Ranking",false);			


// Array 2  -- URL / dir / dir / item 2 / 
Directory[j++]= new Array(2, "clasificacionvisual"	,"Visual Ranking",false);				
Directory[j++]= new Array(2, "contributions"		,"Intel Contributions",false);			
Directory[j++]= new Array(2, "dd_*"					,"Design and Discovery",false);
Directory[j++]= new Array(2, "design"				,"Design and Discovery",false);	
Directory[j++]= new Array(2, "eecs*"				,"EECS",false);
Directory[j++]= new Array(2, "embedded"				,"Model Curriculum",false);		
Directory[j++]= new Array(2, "entrepreneur"			,"Model Curriculum",false);		
Directory[j++]= new Array(2, "explicandounarazon"	,"Seeing Reason",false);				
Directory[j++]= new Array(2, "global_tour"			,"Global Tour",false);		
Directory[j++]= new Array(2, "herramientas"			,"Thinking Tools",false);		
Directory[j++]= new Array(2, "microelectronics"		,"Model Curriculum",false);			
Directory[j++]= new Array(2, "modelcurriculum.htm"	,"Model Curriculum",false);				
Directory[j++]= new Array(2, "mostrandoevidencias"	,"Showing Evidence",false);				
Directory[j++]= new Array(2, "multicore"			,"Model Curriculum",false);		
Directory[j++]= new Array(2, "networking"			,"Model Curriculum",false);		
Directory[j++]= new Array(2, "networking"			,"Model Curriculum",false);		
Directory[j++]= new Array(2, "news"					,"Newsletter online views",false);
Directory[j++]= new Array(2, "research"				,"Student Research",false);	
Directory[j++]= new Array(2, "research_programs.htm","Student Research",false);					
Directory[j++]= new Array(2, "seeingreason"			,"Seeing Reason",false);		
Directory[j++]= new Array(2, "showingevidence"		,"Showing Evidence",false);			
Directory[j++]= new Array(2, "soporte"				,"User Support - Education",false);	
Directory[j++]= new Array(2, "studentcontest"		,"Student Programs",false);			
Directory[j++]= new Array(2, "studentlogin"			,"Tools Workspace",false);		
Directory[j++]= new Array(2, "studentprograms.htm"	,"Student Programs",false);				
Directory[j++]= new Array(2, "studentprojectlist"	,"Tools Workspace",false);				
Directory[j++]= new Array(2, "tji"					,"The Journey Inside",false);
Directory[j++]= new Array(2, "visualranking"		,"Visual Ranking",false);			
Directory[j++]= new Array(2, "vlsi.htm"				,"Model Curriculum",false);	
Directory[j++]= new Array(2, "wild_prof_dev"		,"Wild Ride",false);			
Directory[j++]= new Array(2, "wildride"				,"Wild Ride",false);	
Directory[j++]= new Array(2, "wildride_prof_dev"	,"Wild Ride",false);				
Directory[j++]= new Array(2, "wireless"				,"Model Curriculum",false);		


// Array 3  -- URL / dir / dir / dir / item 3 /
Directory[j++]= new Array(3, "aprender"				,"Intel Learn",false);	
Directory[j++]= new Array(3, "clubhouse"			,"Computer Clubhouse",false);		
Directory[j++]= new Array(3, "comunitaria"			,"Community/Informal Education",false);		
Directory[j++]= new Array(3, "disenar"				,"Design and Discovery",false);	
Directory[j++]= new Array(3, "inteleducar"			,"Intel Teach",false);		
Directory[j++]= new Array(3, "isef"					,"ISEF and Affiliated Fairs",false);
Directory[j++]= new Array(3, "primariaysecundaria"	,"Elementary/Primary and Secondary Education",false);				
Directory[j++]= new Array(3, "sr_*"					,"Seeing Reason",false);
Directory[j++]= new Array(3, "universitaria"		,"HigherEd",false);
Directory[j++]= new Array(3, "vr_*"					,"Visual Ranking",false);


// Array 4  -- URL / dir / dir / dir / dir / item 4 /
Directory[j++]= new Array(4, "seeingreason"			,"Seeing Reason");
Directory[j++]= new Array(4, "showingevidence"		,"Showing Evidence");
Directory[j++]= new Array(4, "visualranking"		,"Visual Ranking");

// Array 5  -- URL / dir / dir / dir / dir / dir / item 5 /
Directory[j++]= new Array(5, "sr_*"					,"Seeing Reason",false);
Directory[j++]= new Array(5, "vr_*"					,"Visual Ranking",false);

//*********************************************************************************************
//							Do not modify the code below 
//*********************************************************************************************


var BranchesDeep = pathObj.dir.length; 
var wa_org_temp;

var parentBit = false;
var localParentBit = false;

//*********************************************************************************************
//							  Main Loop
//*********************************************************************************************

for(var i = 0; i <= BranchesDeep; i++)
{		
	if (pathObj.dir[i] != undefined) 
	{		
		localParentBit = parentBit;
		wa_org_temp = GetWAPString(i, pathObj.dir[i]);		
								
		if(wa_org_temp != undefined)
		{	
			//document.write(i);				
			if(localParentBit == true)  // org4 value has been set so keep it's value
				wa_orgX = wa_org_temp;			
			else
			{
				//ensure that stray pages don't just inherit the Education Homepage value
				if((pathObj.dir[i].toLowerCase() == "education" && BranchesDeep > 1) || 
					(pathObj.dir[i].toLowerCase() == "la" && BranchesDeep > 2 ))
					{
						wa_org_temp = "unassigned" 
					}
				
				wa_org4 = wa_org_temp;  // org4 value has NOT been so SET it's value											 
			}
		}
		
		wa_org_temp = GetWAPString(BranchesDeep, pathObj.fileName);
		if(wa_org_temp != undefined)
			wa_orgX = wa_org_temp;		
		
		wa_org_temp = null;			
		
	}
	
}




//********************************************************************************************
// GetWAPString(level, dir)
//        input:  level [int]	: which directory location \ 0 \ 1 \ 2 \ 3 \ 4 \ etc....
//		  input:  dir [string]	: the directory folder to search for in the Directory array
//       output:  WAP string from lookup
//  description:  retrieves the appropriate WAP value from the Directory array
//
//********************************************************************************************
function GetWAPString(level, dir)
{
  for (var i=0; i<Directory.length; i++)    
  {	
	if(Directory[i][0] == level )
	{	
		//if(Directory[i][1].toLowerCase().indexOf("*") > -1)
		//		document.write('<br><font size=2 color=red>'+Directory[i][1].toLowerCase()+'***************</font><br>');
		
		
			
			if(Directory[i][1].toLowerCase() == dir.toLowerCase())
			{				
				parentBit = Directory[i][3];		
				return Directory[i][2];		//returns WAP value			
			}
			else if(Directory[i][1].toLowerCase().indexOf("*") > -1)
			{	//checks for the presence of a wild card.			
				var subStr = Directory[i][1].substring(0,Directory[i][1].length-1); 
				if(dir.toLowerCase().indexOf(subStr) > -1)
				{					
					parentBit = Directory[i][3];		
					return Directory[i][2];		//returns WAP value	
					
				}
				
			}			
	}	
  }
}


//**********************************************************
//             Specific to Intel Corp
//**********************************************************
if(wa_org4 == 'Intel Teach')
{
	switch(pathObj.dir[0].toLowerCase())
			{			
			case 'scripts-expansion':
				wa_orgX = "In-Service";
				break;
			case 'scripts-preservice':
				wa_orgX = "Pre-Service";
				break;
			case 'scripts-teach':
				wa_orgX = "Teach";
				break;
			}
}
if (pathObj.dir[1] != undefined && pathObj.dir[1].toLowerCase() == 'la')
{ 
	wa_geo = "asmo-lar";
	wa_org2 = "asmo-lar";
	wa_org3 = "LA";	
}
if (pathObj.dir[0] != undefined && pathObj.dir[0].toLowerCase() == 'cr')
{ 
	wa_geo = "asmo-lar";
	wa_org2 = "asmo-lar";
	wa_org3 = "CR";	
}

//**********************************************************
//				End Intel Corp Specific code
//**********************************************************


//document.write('<br><font size=2 color=red>org4:'+wa_org4+'</font><br>');
//document.write('<font size=2 color=red>orgX:'+wa_orgX+'</font><br>');
//document.write('<font size=2 color=red>geo:'+wa_geo+'</font><br>');