$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
	
	$('ul.topNav > li:first-child a').css("padding-left", "0px");
	$("ul.topNav > li:last a").css("padding-right", '0px');
	$("ul.topNav > li:last").css("border-right", '0px');
	
	$('ul.topNav li:has(ul.subMenu)').hover(
	  function () {
		  var label = $(this).find('label').html();
			$subNav = $(this).find('ul.subMenu');
			var width = 248;
			/*$subNav.append('<li>' + label+ '<span class="navArrow">&nbsp;</span></li>');*/
			$subNav.children('li').css("width", width);
			$subNav.css('left', '-10000px').css('display', 'block');
			var total_height = 0;
			
			$subNav.children('li').each(
				function(){
					total_height += parseInt($(this).height()) + 15;
				}
			);
			//total_height -= 26;
			
			var posLeft = parseInt($(this).width()) - 130;
			
			//$subNav.css('left', parseInt(posLeft / 2) + 'px').css("top", "-" + total_height + "px");
			$subNav.css('left', '0px').css("top","50px");
			$subNav.css("fast", function() {
									 $(this).fadeTo("slow", 1);
									 });
	  },
	  
	  function () {
		$(this).find('ul.subMenu').css("display", "none");
	  }
	);


        /* Page Curls */
        $(".link_certificate_iv_in_design img").hover(
        function(){
            $(this).attr('src','assets/images/l_certificate_iv_in_design-hover.png');
        },
        function(){
            $(this).attr('src','assets/images/l_certificate_iv_in_design.png');
        });

        $(".link_diploma_in_interior_design img").hover(
        function(){
            $(this).attr('src','assets/images/l_diploma_in_interior_design-hover.png');
        },
        function(){
            $(this).attr('src','assets/images/l_diploma_in_interior_design.png');
        });
});

