/*
======================================================================================================
siteLookUp.js  (july 6 2008)

file creates a hash object for the purpose of site page lookups based on the category ids in the
system

gotoSiteUrl takes in a category id and an entity id then does a lookup in the hash table for the
appropriate page based on the categoryid and constructs a proper url and redirects
======================================================================================================
*/
function site_Hash()
{
	this.length = 0;
	this.items = new Array();
	for (var i = 0; i < arguments.length; i += 2) {
		if (typeof(arguments[i + 1]) != 'undefined') {
			this.items[arguments[i]] = arguments[i + 1];
			this.length++;
		}
	}

	this.removeItem = function(in_key)
	{
		var tmp_value;
		if (typeof(this.items[in_key]) != 'undefined') {
			this.length--;
			var tmp_value = this.items[in_key];
			delete this.items[in_key];
		}

		return tmp_value;
	}

	this.getItem = function(in_key) {
		return this.items[in_key];
	}

	this.setItem = function(in_key, in_value)
	{
		if (typeof(in_value) != 'undefined') {
			if (typeof(this.items[in_key]) == 'undefined') {
				this.length++;
			}

			this.items[in_key] = in_value;
		}

		return in_value;
	}

	this.hasItem = function(in_key)
	{
		return typeof(this.items[in_key]) != 'undefined';
	}
}

/*
init the site lookup hash object
*/
var siteLookUp=new site_Hash(
17,'AboutUs.aspx',
18,'PatientsFamily.aspx',
19,'Visitors.aspx',
20,'JoinOurTeam.aspx',
21,'NewsEvents.aspx',
22,'Donations.aspx',
23,'Resources.aspx',
24,'ContactUs.aspx',
25,'HistoryMission.aspx',
26,'AB_details.aspx',
27,'FactsStats.aspx',
28,'InnovationExcellence.aspx',
29,'CaringPeople,CaringForPeopleVideo.aspx',
30,'Governance.aspx',
31,'Foundation.aspx',
32,'Reports.aspx',
33,'StrategicPlanning.aspx',
34,'MediaRoom.aspx',
35,'Careers.aspx',
36,'ContactUs.aspx',
45,'PF_OverviewChecklist.aspx',
46,'PF_WhyChooseCKHA.aspx',
47,'AB_details.aspx',
48,'PF_Admitting.aspx',
49,'PF_YourStay.aspx',
50,'PF_PatientFamilyCare.aspx',
51,'PF_TestProcedures.aspx',
52,'PF_RightsResponbilites.aspx',
53,'PF_BeInvolved.aspx',
54,'PF_InfectionPrevention.aspx',
55,'PF_DischargeBilling.aspx',
56,'PF_RetailPharmacy.aspx',
57,'PF_GiftShops.aspx',
58,'PF_HowAreDoing.aspx',
59,'PF_MapsandParking.aspx',
60,'PF_FAQ.aspx',
61,'V_OverviewChecklist.aspx',
62,'V_MapsandParking.aspx',
63,'V_InfectionPrevention.aspx',
64,'V_GiftShops.aspx',
65,'V_RetailPharmacy.aspx',
66,'V_HospitalAmenties.aspx',
67,'V_HowAreWeDoing.aspx',
68,'V_FAQ.aspx',
69,'JT_OverviewChecklist.aspx',
70,'JT_WhyChooseCKHA.aspx',
71,'JT_Careers.aspx',
72,'JT_PhysicianOpportunities.aspx',
73,'JT_StudentOpportunities.aspx',
74,'JT_VolunteerOpportunities.aspx',
75,'JT_PatientFamilyCouncil.aspx',
76,'JT_OurCommunity.aspx',
77,'JT_FAQ.aspx',
78,'NE_Overview.aspx',
79,'NewsEventsDetails.aspx',
80,'NewsEventsDetails.aspx',
81,'NE_MediaRoom.aspx',
82,'NE_HealthWellbeingMagazine.aspx',
83,'NE_CaringPeople.aspx',
85,'D_Overview.aspx',
86,'D_HowToDonate.aspx',
87,'D_DonorRecognition.aspx',
88,'D_Foundation.aspx',
89,'R_Overview.aspx',
90,'R_BeInvolved.aspx',
91,'R_LookingForADoctor.aspx',
92,'R_InfectionPrevention.aspx',
93,'R_Reports.aspx',
99,'R_HelpfulLinks.aspx',
100,'C_PhoneLisiting.aspx',
101,'C_HowAreWeDoing.aspx',
102,'C_ExecutiveContacts.aspx',
103,'C_MapsParking.aspx',
42,'DirectorsLogin.aspx',
43,'BoardMemberProfiles.aspx',
44,'MeetingDatesHighlights.aspx',
37,'Annual.aspx',
38,'R_Performance.aspx',
39,'AccessPlan.aspx',
40,'AccountAgreement.aspx',
41,'ProvincialReport.aspx',
84,'NE_CorporateGuidelines.aspx',
94,'R_Annual.aspx',
95,'R_Performance.aspx',
96,'R_AccessPlan.aspx',
97,'R_AccountabilityAgreement.aspx',
124,'kenscorner.aspx',
127,'a_boardhighlights.aspx',
164,'privacypolicy.aspx',
163,'legal.aspx',
115,'NEVirtualTour.aspx',
116,'NE_10yearsckha.aspx',
98,'R_ProvincialReport.aspx');

/*
 construct site url and redirect
 use the category id from system to find proper page
 add the query parm plus the entityid and redirect
 default to SiteContent page if no page is found
*/
function gotoSiteUrl(categoryId,entityId){
	var queryParm='?mainContent.QueryId.Id=' + entityId;
	//get site url
	var gotoPage = siteLookUp.getItem(categoryId) + queryParm;
	if(gotoPage==null || gotoPage.length<=0){ gotoPage='SiteContent.aspx?centerContent.QueryId.Id=' + entityId; }
	window.location=gotoPage;
}
