function prepGoogleMaps(sDivID){
	var iLat = 51.904639;
	var iLong = -8.353858;
	var iZoom = 14;
	
	if (document.getElementById(sDivID) != null){
		// Load the map
		loadGoogleMaps(sDivID, iLat, iLong, iZoom);

		// Register the unload function
		$(window).unload( function () { GUnload(); } );
	}
}

function loadGoogleMaps(sDivID, iLat, iLong, iZoom){
	if (GBrowserIsCompatible()) {
		var gMap = new GMap2(document.getElementById(sDivID));
		var icon = new GIcon();
		var sPointHTML = '<p><strong>Fastnet Recruitment</strong><br />Eastgate Business Park<br />Little Island<br />Cork<br /></p>';
		var marker;

		point = new GLatLng(iLat,iLong);
		marker = createMarker(point,sPointHTML);

		gMap.addControl(new GSmallMapControl());
		gMap.addControl(new GMapTypeControl());
		gMap.setCenter(new GLatLng(iLat, iLong), iZoom);
		gMap.addOverlay(marker);
	}
}

function createMarker(point,html){
	var oMarker = new GMarker(point);
	GEvent.addListener(oMarker, "click", function() {
	oMarker.openInfoWindowHtml(html);});
	return oMarker;
}

function hideElement(sElementID){
	var oElement = document.getElementById(sElementID);
	if (oElement != null){
		oElement.style.display = 'none';
	}
}
function showElement(sElementID){
	var oElement = document.getElementById(sElementID);
	if (oElement != null){
		oElement.style.display = '';
	}
}
function doPrint(){
	window.print();
	return false;	
}

function pageOnLoad(bRecall){
	var oHeader = $('#dvPageHeader');
	var oFooter = $('#dvFooter');
	var oPageLeft = $('#dvPageLeft');
	var oPageRight = $('#dvPageRight');
	var oQuickSearch = $('div .dvJobQuickSearch');
	var oJobContainer = $('#dvJobContainer');

	var iHeaderHeight = 0;
	var iFooterTop = 0;
	var iContentAreaHeight = 0;
	var iPageLeftHeight = 0;
	var iPageRightHeight = 0;
	
	iHeaderHeight = oHeader.height();
	iFooterTop = oFooter.position().top;
	iContentAreaHeight = iFooterTop - iHeaderHeight;
	iPageLeftHeight = oPageLeft.height();
	iPageRightHeight = oPageRight.height();
	//alert('iContentAreaHeight: '+iContentAreaHeight);
	//alert('iPageLeftHeight: '+iPageLeftHeight);
	//alert('iPageRightHeight: '+iPageRightHeight);
	
	oQuickSearch.height(oQuickSearch.height() + (iContentAreaHeight - iPageLeftHeight));
	if (oJobContainer.height() != null){
		oJobContainer.height(oPageRight.height() + (iContentAreaHeight - iPageRightHeight) - 96);
	}else{
		oPageRight.height(oPageRight.height() + (iContentAreaHeight - iPageRightHeight) - 25);
	}
}
function pageOnLoad_old(bRecall){
	var oFooter = $('#dvFooter');
	var oHeader = $('#dvPageHeader');
	var oPageLeft = $('#dvPageLeft');
	var oPageRight = $('#dvPageRight');
	var oQuickSearch = $('div .dvJobQuickSearch');
	var oJobContainer = $('#dvJobContainer');
	var iPageLeftHeight = 0;
	var iPageRightHeight = 0;
	var iHeightDifference = 0;
	var iFooterTop = 0;
	var iHeaderHeight = 0;
	var iCommonOffsets = 0;
	
	//return false;
	
	iPageLeftHeight = oPageLeft.height();
	iPageRightHeight = oPageRight.height() + 25;
	iFooterTop = oFooter.position().top;
	iHeaderHeight = oHeader.height();

	
	if (iPageLeftHeight < iPageRightHeight){
		iHeightDifference = iPageRightHeight - iPageLeftHeight;
		//alert('iPageLeftHeight: '+iPageLeftHeight+'\niPageRightHeight: '+iPageRightHeight+'\nIncrease Left by '+iHeightDifference+'px.');
		oQuickSearch.height(oQuickSearch.height() + iHeightDifference);
	}else if (iPageLeftHeight > iPageRightHeight){
		iHeightDifference = iPageLeftHeight - iPageRightHeight;
		//alert('iPageLeftHeight: '+iPageLeftHeight+'\niPageRightHeight: '+iPageRightHeight+'\nIncrease Right by '+iHeightDifference+'px.');
		if (oJobContainer.height() != null){
			oJobContainer.height(oJobContainer.height() + iHeightDifference);
		}else{
			oPageRight.height(oPageRight.height() + iHeightDifference);
		}
	}
	
	if (bRecall){
		setTimeout('pageOnLoad(false);', 100);
	}
}

function popupEmailJob(sJ){
	popupWin('/cf/emailtofriend.cfm?j='+sJ,650,280);
}
function popupWin(sURL, iWidth, iHeight) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(sURL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + iWidth + ",height=" + iHeight + "');");
}
function fadeInHomepageLogos(){
	var oLogoLists = $('div.dvHPLogos ul');
	for (i=0;i<oLogoLists.length;i=i+1){
		if (i == iCurrentHPLogo){
			$(oLogoLists[i]).fadeIn(1500);
		}
	}
	setTimeout('fadeOutHomepageLogos()', 6500);
}
function fadeOutHomepageLogos(){
	var oLogoLists = $('div.dvHPLogos ul');
	for (i=0;i<oLogoLists.length;i=i+1){
		if (i == iCurrentHPLogo){
			iCurrentHPLogo = iCurrentHPLogo + 1;
			if (iCurrentHPLogo == oLogoLists.length){
				iCurrentHPLogo = 0;
			}
			$(oLogoLists[i]).fadeOut(1500, function(){fadeInHomepageLogos();});
		}
	}
}

function triggerGAGoal(sGoalPath){
	try{
		pageTracker._trackPageview(sGoalPath);
	}catch(err){
		//alert(err.description);
	}
}

function goToURL(sURL){
	try{
		window.location.href = sURL;	
	}catch(err){
		//alert(err.description);
	}
}
