//*----------------------------------------------------------
//  headerpic.js
//  Display the variable image in the header depending on the 
//  current filename. 
//*----------------------------------------------------------

	var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
	var thefile = location.href.substring(dir.length,location.href.length+1);
	
 	fileroot = thefile.substring(0,thefile.lastIndexOf('.')-2); //* (remove -e.html or -f.html)
	pos = thefile.indexOf('-');				// Postition of first hyphen (from 0)
	filepref = leftString(thefile,pos);		// Prefix

//  filepref = thefile.substring(0,thefile.IndexOf('-')-0); //* (remove -e.html or -f.html)
//  alert(filepref);	
//  a = "whatsnew".length;
//  alert(a)
//  b = fileroot.substring(0,"dept-water".length);
//	alert(b)

fn = "h-lighthouse";  //* Default pic	

//* Determine image based on filename (overrides prefix)
//if (fileroot == "testpage3")	fn = "h-lighthouse";

//* Determine image based on Prefix
switch (filepref)
{
	case "whatsnew":	fn = "h-computerkids";	break ;
	case "visit":   	fn = "h-lighthouse";	break;
	case "comm":		fn = "h-communitygroup";	break;
	case "cityhall":	fn = "h-cityhall";		break;
	case "bus":			fn = "h-business";		break;
	case "dept":		fn = "h-departments";	break;
	case "contact":		fn = "h-contact";		break;
	default:  			fn = "h-bridge";
	//alert(fileroot.substring(0,"dept-rec-pool".length));
}

//*---------------------------------------
//*  COMMUNITY
//*---------------------------------------
  if (fileroot.substring(0,"comm-churches".length) == "comm-churches" )			fn = "h-church";
  if (fileroot.substring(0,"comm-churches".length) == "comm-churches" )			fn = "h-community";
  if (fileroot.substring(0,"comm-events".length) == "comm-events" )				fn = "h-irishdancers";
  if (fileroot.substring(0,"comm-medical".length) == "comm-medical" )			fn = "h-medical";
  if (fileroot.substring(0,"comm-libraries".length) == "comm-libraries" )		fn = "h-library";
  if (fileroot.substring(0,"comm-rec".length) == "comm-rec" )					fn = "h-track";
  if (fileroot.substring(0,"comm-schools".length) == "comm-schools" )			fn = "h-alphabet";
  if (fileroot.substring(0,"comm-seniors".length) == "comm-seniors" )			fn = "h-seniors";
  if (fileroot.substring(0,"comm-rec".length) == "comm-rec" )					fn = "h-track";
  if (fileroot.substring(0,"comm-rec".length) == "comm-rec" )					fn = "h-track";
  if (fileroot.substring(0,"comm-churches".length) == "comm-churches" )			fn = "h-church";
  if (fileroot.substring(0,"comm-citymap".length) == "comm-citymap" )			fn = "h-map";
  if (fileroot.substring(0,"comm-leisure".length) == "comm-leisure" )			fn = "h-biker";
  
//*---------------------------------------
//*   VISIT
//*---------------------------------------  
  if (fileroot.substring(0,"visit-intro".length) == "visit-intro" )				fn = "h-salmon";
  if (fileroot.substring(0,"visit-howtogethere".length) == "visit-howtogethere" )	fn = "h-map";
  if (fileroot.substring(0,"visit-winter".length) == "visit-winter" )				fn = "h-snowmobile";
  if (fileroot.substring(0,"visit-angling".length) == "visit-angling" )			fn = "h-angling";
  if (fileroot.substring(0,"visit-eat".length) == "visit-eat" )					fn = "h-dining";
  if (fileroot.substring(0,"visit-mrta".length) == "visit-mrta" )				fn = "h-lakeview";
  
//*---------------------------------------
//*  BUSINESS
//*---------------------------------------
 
  if (fileroot.substring(0,"bus-infra".length) == "bus-infra" )	fn = "h-sold";
  if (fileroot.substring(0,"bus-infra".length) == "bus-infra" )	fn = "h-sold";
//  if (fileroot.substring(0,"bus-keysectors-tourism".length) == "bus-keysectors-tourism" )	fn = "h-sold";
  if (fileroot.substring(0,"bus-overview-profile".length) == "bus-overview-profile" )	fn = "h-group";
  if (fileroot.substring(0,"bus-yourbus-demographics".length) == "bus-yourbus-demographics" )	fn = "h-group";
  if (fileroot.substring(0,"bus-yourbus-intro".length) == "bus-yourbus-intro" )	fn = "h-lemonade";
  if (fileroot.substring(0,"bus-yourbus-rebrokers".length) == "bus-yourbus-rebrokers" )	fn = "h-sold";
  if (fileroot.substring(0,"bus-infra-realestate".length) == "bus-infra-realestate" )	fn = "h-sold";
  if (fileroot.substring(0,"bus-infra-telecom".length) == "bus-infra-telecom" )	fn = "h-fibre";  
//*---------------------------------------
//*  DEPARTMENTS
//*---------------------------------------  
//  if (fileroot.substring(0,"visit-mrta".length) == "visit-mrta" )				fn = "h-fireworks";
  if (fileroot.substring(0,"dept-water".length) == "dept-water" )				fn = "h-waterdrop";
  if (fileroot.substring(0,"dept-fire".length) == "dept-fire" )					fn = "h-firetruck";
  if (fileroot.substring(0,"dept-clerks".length) == "dept-clerks" )					fn = "h-signdoc";
  if (fileroot.substring(0,"dept-chart-fire".length) == "dept-chart-fire" )		fn = "h-firetruck";
  if (fileroot.substring(0,"dept-dev".length) == "dept-dev" )					fn = "h-lighthouse";
  if (fileroot.substring(0,"dept-finance".length) == "dept-finance" )			fn = "h-calculator";
  if (fileroot.substring(0,"dept-works".length) == "dept-works" )				fn = "h-hardhats";
  if (fileroot.substring(0,"dept-chart-works".length) == "dept-chart-works" )	fn = "h-hardhats";
  if (fileroot.substring(0,"dept-works-faq2".length) == "dept-works-faq2" )		fn = "h-trashcollect";
  if (fileroot.substring(0,"dept-works-faq3".length) == "dept-works-faq3" )		fn = "h-traffic";
   
  if (fileroot.substring(0,"dept-rec".length) == "dept-rec" )		fn = "h-sportskids";
  if (fileroot.substring(0,"dept-rec-fac-playgrounds".length) == "dept-rec-fac-playgrounds" )		fn = "h-2kids";
  if (fileroot.substring(0,"dept-rec-fac-soccer".length) == "dept-rec-fac-soccer" )		fn = "h-soccer";
  if (fileroot.substring(0,"dept-rec-fac-pools".length) == "dept-rec-fac-pools" )		fn = "h-swimmer2";
  if (fileroot.substring(0,"dept-rec-fac-tennis".length) == "dept-rec-fac-tennis" )		fn = "h-tennis";
  if (fileroot.substring(0,"dept-rec-fac-track".length) == "dept-rec-fac-track" )		fn = "h-track";
  if (fileroot.substring(0,"dept-rec-fac-ballfields".length) == "dept-rec-fac-ballfields" )		fn = "h-baseball";
  if (fileroot.substring(0,"dept-rec-prog-youth".length) == "dept-rec-prog-youth" )		fn = "h-skateboard";
  if (fileroot.substring(0,"dept-rec-pool".length) == "dept-rec-pool" )		fn = "h-swimmer";
  if (fileroot.substring(0,"dept-rec-poolsched-swimforlife".length) == "dept-rec-poolsched-swimforlife" )		fn = "h-kidsswim";
  if (fileroot.substring(0,"dept-rec-prog-aquatic".length) == "dept-rec-prog-aquatic" )		fn = "h-kidsswim";
  if (fileroot.substring(0,"dept-rec-prog-seniors".length) == "dept-rec-prog-seniors" )		fn = "h-seniorscouple";
  if (fileroot.substring(0,"dept-rec-prog-fitness".length) == "dept-rec-prog-fitness" )		fn = "h-volleyball";
  if (fileroot.substring(0,"dept-rec-trailsparks".length) == "dept-rec-trailsparks" )	fn = "h-hikers";
  if (fileroot.substring(0,"dept-rec-ent".length) == "dept-rec-ent" )		fn = "h-fireworks";
  if (fileroot.substring(0,"dept-rec-skating-sched".length) == "dept-rec-skating-sched" )		fn = "h-skate";
  if (fileroot.substring(0,"dept-rec-timberwolves".length) == "dept-rec-timberwolves" )		fn = "h-timberwolves";
  if (fileroot.substring(0,"dept-police".length) == "dept-police" )		fn = "h-policebadge";

//*---------------------------------------
//*  MISC
//*---------------------------------------    
  if (fileroot.substring(0,"search".length) == "search" )		fn = "h-searchguy";

// if (fileroot.substring(0,"dept-water".length) == "dept-water")		fn = "h-waterdrop";

document.write ('<img src="../assets/' + fn + '.jpg" alt="" width="126" height="118" border="0">');
	
function rightString (InString, num)  {
	OutString=InString.substring (InString.length-num, InString.length);
	return (OutString);
}
function leftString (InString, num)  {
	OutString=InString.substring (InString, num);
	return (OutString);
}
