// global.js for Priority Management regional site
// over-rides of global functionality for this region
// code by CN

// Google Maps initial view
var initialLat = -32.0;
var initialLong = 145.0;
var initialZoom = 4;

function regionalPageInit() {
	
	// all pages - global site links
	var links = document.getElementsByTagName('a');
	for (var linkIndex = links.length - 1; linkIndex >= 0; linkIndex--) {
		var linkElement = links[linkIndex];
		
		// global site links
		if (linkElement.href.indexOf('http://www.prioritymanagement.com/') > -1) {
			linkElement.onclick = function() {
				openGlobalLink(this.href);
				return false;
			};
		}
	}

	// Careers page - show only Austrailia and New Zealand in country dropdown
	if (document.getElementById('careers')) {
		var countrySelect = document.getElementById('country-select');
		if (countrySelect) {
			countrySelect.options.length = 1;
			for (var countryIndex = 0; countryIndex < officeUrls.length; countryIndex++) {
				var countryName = officeUrls[countryIndex].countryName;
				if (countryName == 'Australia' || countryName == 'New Zealand') {
					countrySelect.options[countrySelect.options.length] = new Option(countryName, countryName);
				}
			}
		}
	}
	
	// Contact us page - switching forms based on associate
	if (document.getElementById('contact-us')) {
		var associateSelect = document.getElementById('associate-select');
		if (associateSelect) {
			associateSelect.onchange = function() {
				var currentAssociate = this.options[this.selectedIndex].value;
				document.getElementById('contact-form').style.display = (currentAssociate == 'Adelaide') ? 'none' : 'block';
				document.getElementById('adelaide-form').style.display = (currentAssociate == 'Adelaide') ? 'block' : 'none';
				document.getElementById('input-associate').value = currentAssociate;
			};
		}
	}
}


window.addEvent(window, 'load', function() { setTimeout("regionalPageInit()", 100) });

