// JavaScript Document

$(document).ready(function() {
	$("ul.menu li").hover(function() {
		$(this).children("ul").css("display","block");
	},
	function() {
		$(this).children("ul").css("display","none");
	});
	
	$("a[href='#']").click(function() {
		return false;
	});
	
	$("a[href*='.pdf']").click(function() {
		$(this).attr("target", "_blank");
	});
	
	$("#media-content a").children("img").parent().each(function() {
		$(this).lightBox();
	});
	
	$("div.contact_maps .background").hover(function () {
		$(this).css("cursor","pointer");
		if (!$.browser.msie) {
			$(this).children(".over").fadeIn("fast");
		} else {
			$(this).children(".over").show();
		}
	}, function () {
		if (!$.browser.msie) {
			$(this).children(".over").fadeOut("fast");
		} else {
			$(this).children(".over").hide();
		}
	});
	
	$("div.contact_maps").click(function () {
		var className = $(this).attr("class");
		
		if (className.indexOf("johannesburg") >= 0) {
			window.open("http://maps.google.com/maps?q=-26.04539,27.955517&num=1&sll=-26.043905,27.956686&sspn=0.014382,0.015235&ie=UTF8&ll=-26.045525,27.954894&spn=0.007191,0.007617&z=17");
		}
		
		if (className.indexOf("capetown") >= 0) {
			window.open("http://maps.google.com/maps?q=6+Wilge+Rd,+Cape+Town,+South+Africa&hl=en&sll=37.0625,-95.677068&sspn=66.320747,79.013672&z=17");
		}
		
		if (className.indexOf("durban") >= 0) {
			window.open("http://maps.google.com/maps?q=-29.863023,31.003772&num=1&sll=-29.863208,31.003463&sspn=0.006941,0.007617&hl=en&ie=UTF8&ll=-29.863208,31.003463&spn=0.006941,0.007617&z=17");
		}
		
		if (className.indexOf("umhlanga") >= 0) {
			window.open("http://maps.google.com/maps?q=-29.731253,31.068821&num=1&sll=-29.73248,31.07093&sspn=0.006295,0.006295&ie=UTF8&ll=-29.733936,31.067147&spn=0.0278,0.03047&z=15");
		}
	});
});
