




/*
     FILE ARCHIVED ON 16:03:14 Dec 8, 2010 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 8:01:36 Feb 23, 2012.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
function SetupContact(website_description, counter)
{
	if (counter == 1)
	{
		document.write("<a href=\"mailto:adriana.davies@heritagecommunityfdn.org?Subject="+website_description+" Web Site\" title=\"Contact Adriana Davies by Email\">Contact Adriana Davies by Email</a>");
	}
	else if (counter == 2)
	{
		document.write("<a href=\"mailto:nena@heritagecommunityfdn.org?Subject="+website_description+" Web Site\" title=\"Contact Nena Jocic-Andrejevic by Email\">Contact Nena by Email</a>");
	}
	else
	{
		document.write("<a href=\"mailto:info@heritagecommunityfdn.org?Subject="+website_description+" Web Site\" title=\"Contact us by Email\">Contact us by Email</a>");
	}
}

//function that swaps pictures
function Switch(imgName,imgObjName) 
{
  if (document.images) 
  {
   document.images[imgName].src = eval(imgObjName + ".src");
  }
}

//Function to open new windows
function openWin(URL, Width, Height)
{

aWindow=window.open(URL,"PopUp","width="+Width+",height="+Height+",resizable=yes,scrollbars=yes,left=100,top=60");
    
    aWindow.resizeTo(Width, Height);
    
    aWindow.focus();
    if(aWindow.opener == null)
    {
        aWindow.opener = window;
        aWindow.opener.name = "opener";
    }

}

//Function to pop up windows for images.
function Imgpop(level,szImgSource,szDescription,nCopyrightNum)
{
    popSource = szImgSource;
    popDescription = szDescription;
    popCopyright = nCopyrightNum;
	popUrl = "";

    if (popDescription == "description")
        popDescription = "";
    
	popImage = "<img src=" + popSource + " border='0' width='500' alt=" + popDescription + " />";
    width=650;
    height=750;

    //If resolution is 640x480
    if(screen.width < 800)
        height=350;
    //If resolution is 800x600
    else if(screen.width < 1024)
        height=500;

    for(i=1; i<=level; i++)
	{
		popUrl = popUrl + "../";
	}
	popUrl = popUrl + "inc/popup.html";
//	document.write("The Url is " + popUrl);
	openWin(popUrl,width,height);
}
//Function to pop up windows for ward information.
function DisplayWard(Information)
{
    popSource = "";
    popDescription = "";
    popCopyright = "";
	popUrl = "";

    if (popDescription == "description")
        popDescription = "";
    
	popImage = Information;
    width=650;
    height=750;

    //If resolution is 640x480
    if(screen.width < 800)
        height=350;
    //If resolution is 800x600
    else if(screen.width < 1024)
        height=500;

    for(i=1; i<=level; i++)
	{
		popUrl = popUrl + "../";
	}
	popUrl = popUrl + "inc/popup.html";
//	document.write("The Url is " + popUrl);
	openWin(popUrl,width,height);
}

//Function to pop up windows for footnotes.
function openFootnote(level,szDescription)
{
    popDescription = szDescription;
 
    if (popDescription == "description")
        popDescription = "";
    
    width=400;
    height=150;

    for(i=1; i<=level; i++)
	{
		popUrl = popUrl + "../";
	}
	popUrl = popUrl + "footnote.html";
    openWin(popUrl,width,height);
}

// The following code uses the AJAX technology to update the SubCategories 
var xmlHttp
var select_counter

function getSearchResults()
{
	Organization = document.getElementById("organization").value;
	Mandate = document.getElementById("mandate").value;
	Corp_Structure_Id = document.getElementById("corp_structure_id").value;
	Discipline_Id = document.getElementById("discipline_id").value;
	Sub_Discipline_Id = document.getElementById("sub_discipline_id").value;
	Facility_Type_Id = document.getElementById("facility_type_id").value;
	Function_Id = document.getElementById("function_id").value;
	Usage_Group_Id = document.getElementById("usage_group_id").value;
	Ward_Id = document.getElementById("ward_id").value;

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return
	}
	var url="administration/getSearchResults.php";
	url=url+"?organization="+Organization;
	url=url+"&mandate="+Mandate;
	url=url+"&corp_structure_id="+Corp_Structure_Id;
	url=url+"&discipline_id="+Discipline_Id;
	url=url+"&sub_discipline_id="+Sub_Discipline_Id;
	url=url+"&facility_type_id="+Facility_Type_Id;
	url=url+"&function_id="+Function_Id;
	url=url+"&usage_group_id="+Usage_Group_Id;
	url=url+"&ward_id="+Ward_Id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=getSearchResultsInfo;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function getSearchResultsInfo()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Search_Links").innerHTML=xmlHttp.responseText 
	} 
}

function getSelectInfo(counter)
{
	select_counter = Number(counter);
	switch (select_counter)
	{
		case 1:
			showSelectInfo("corp_structure_id", 0 , "corp_structure");
			break;
		case 2:
			showSelectInfo("discipline_id", 0, "discipline");
			document.getElementById("sub_discipline").innerHTML="<input type='hidden' value='' id='sub_discipline_id' />" ;
			break;
		case 3:
			showSelectInfo("facility_type_id", 0, "facility_type");
			break;
		case 4:
			showSelectInfo("usage_group_id", 0, "usage_group");
			break;
		case 5:
			showSelectInfo("function_id", 0, "function");
			break;
		case 6:
			showSelectInfo("ward_id", 0, "ward");
			break;
	}
}

function showSelectInfo(field_name, field_value, table_name)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="administration/getSelectInfo.php"
	url=url+"?field_name="+field_name
	url=url+"&field_value="+field_value
	url=url+"&table_name="+table_name
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=setupSelectInfo
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function setupSelectInfo()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		info = xmlHttp.responseText;
		start_location = info.search(/id=/)+4;
		end_location = info.search(/ name/);
		field_name = info.substr(start_location, end_location-start_location-4);
		document.getElementById( field_name ).innerHTML=xmlHttp.responseText ;
		select_counter = select_counter + 1;
		if (select_counter < 7)
		{
			getSelectInfo(select_counter);
		}
	}
}

function showSelectSubDisciplineInfo()
{
	Discipline_Id = document.getElementById("discipline_id").value;
	field_name = "sub_discipline_id";
	field_value = Number(0);
	table_name = "sub_discipline";
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return
	}
	var url="administration/getSelectSubDisciplineInfo.php";
	url=url+"?discipline_id="+Discipline_Id;
	url=url+"&field_name="+field_name;
	url=url+"&field_value="+field_value;
	url=url+"&table_name="+table_name;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=setupSelectSubDisciplineInfo;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function setupSelectSubDisciplineInfo()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("sub_discipline").innerHTML=xmlHttp.responseText;
	}
}

function showSearchInfo(id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="administration/getSearchInfo.php"
	url=url+"?id="+id
	url=url+"&amp;sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedForSearchInfo
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedForSearchInfo() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("search_info").innerHTML=xmlHttp.responseText 
	} 
}

function showWardInfo(id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="administration/getWardInfo.php"
	url=url+"?id="+id
	url=url+"&amp;sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedForWardInfo
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedForWardInfo() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("ward_info").innerHTML=xmlHttp.responseText 
	} 
}

function showWardLinks(ward)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="administration/getWardLinks.php"
	url=url+"?ward="+ward
	url=url+"&amp;sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedForWardLinks
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedForWardLinks() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("ward_links").innerHTML=xmlHttp.responseText 
	} 
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function InsertAudio(AudioNameAndPath)
{
	if (window.ActiveXObject)
	{
		document.write('<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://wayback.archive-it.org/2217/20101208160314/http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" width="260" height="45" align="middle">\n');
		document.write('<param name="src" value='+ AudioNameAndPath +' />\n');
		document.write('<param name= "autoplay" value= "true" />\n');
		//the embed is in here because of old browser functionality
		document.write('<embed src='+ AudioNameAndPath +' type="audio/x-mpeg" autoplay="true" width="260" height= "45" align= "middle" bgcolor="E7EADF" pluginspage="http://wayback.archive-it.org/2217/20101208160314/http://www.apple.com/quicktime/download/">\n');
		document.write('</embed>\n');
		document.write('</object>\n');
	}
	else
	{
		document.write('<object type="audio/x-mpeg" data='+ AudioNameAndPath +' width="260" height="45">\n');
        document.write('<param name="autoplay" value="true" />\n');
        document.write('<param name="controller" value="true" />\n');
        document.write('</object>\n');
	}
}
