$(function() {
//Find and remove the last pipe ...
//$('ul.rootMenu > li:last').css('background', 'none');	
	//Homepage slideshow effect
	$('.slideshow').cycle({
		fx: 'fade'
	});
	
	//If an image does not have alt attribute, add blank.
	$("img").each(function() {
		var img = $(this);
		if (!img.attr("alt") || img.attr("alt") == "")
		img.attr("alt", "*");
		});
		
	//Open all links to pdf in new window
	$("a[href*=pdf]").click(function(){
	window.open(this.href);
	return false;
});

});

function fixExitLinks(){
var myLinks = document.links;
var btype=0;
if (window.attachEvent) {
	b=1;
} else if (window.addEventListener) {
	b=2;
}
for(var i=0;i < myLinks.length;i++) {
	var thehref = myLinks[i].href.toString();
											
	if((thehref.indexOf("gov.mt") == -1) && (thehref.indexOf("localhost") == -1) && (thehref.indexOf("javascript") == -1)){
		switch (b) {
			case 1:
				myLinks[i].attachEvent("onclick",confirmExit);
				break;
			case 2:
				myLinks[i].setAttribute("onclick","return confirmExit()")
				break;
			default:
				//do nothing
			}
		}	
	}
}
function confirmExit(){
  if(confirm('NOTICE: You are entering a website that is not a Public Service entity website. Do you want to continue?')){
	return true;
  } else {
	  return false;
  }
}



