// generalLinks.js

generalLinks = null;

/************************************************************************
 *	LoadGeneralLinks -	create the array of link objects for the general*
 *					 	links											*
 ************************************************************************/
LoadGeneralLinks = function()
{
	generalLinks = new Array
	(						 
		{// City of Calgary Building Permit
			href  : "http://www.calgary.ca/portal/server.pt/gateway/PTARGS_0_0_766_229_0_43/http;/content.calgary.ca/CCA/City+Business/Planning+and+Building/Permits/Building+Permits/Building+Permits.htm",
			title : "Building Permit – City of Calgary",
			name  : "Building Permit"
		},
		
		{// City of Calgary Development Permit
			href  : "http://www.calgary.ca/portal/server.pt/gateway/PTARGS_0_0_766_229_0_43/http;/content.calgary.ca/CCA/City+Business/Planning+and+Building/Permits/Development+Permits/Development+Permit+Application+Requirements.htm",
			title : "Development Permit – City of Calgary",
			name  : "Development Permit"
		},
		
		{// VISTA
			href  : "https://vista.calgary.ca/",
			title : "VISTA",
			name  : "VISTA"
		}
	);
	
}

/************************************************************************
 *	BuildGeneralLinks -	create the HTML markup using the array of link  *
 *					 	objects											*
 ************************************************************************/
BuildGeneralLinks = function()
{	
	// make sure links are created first
	if(generalLinks == null){
		LoadGeneralLinks();
	}	
	
	// get general-links div
	linksDiv = document.getElementById('general-links');

	// verify general-links div can be found
	if(linksDiv == null) { 
		alert("BuildGeneralLinks :: Error locating the document element 'general-links'."); 
		return;
	}
		
	// write div segment header data
	var HTML = '<h3>General Links</h3><div><ol>';
	
	// Loop through outline elements
	for(var linkNum=0; linkNum<generalLinks.length; linkNum++)
	{		
		HTML += '<li><a class="gLink" href="' + generalLinks[linkNum].href + '" ' +
				 	   'title="' + generalLinks[linkNum].title + '" target="_blank" ' +
					   'onmouseover="self.status=\'' + generalLinks[linkNum].title + '\'; return;" ' +
					   'onmouseout="self.status=\'\'; return;">'+generalLinks[linkNum].name + '</a></li>';
	}
	
	// write div segment footer data
	HTML += '</ol></div>';
	
	// update document object
	linksDiv.innerHTML = HTML;
}

// end of file