$(function(){
    $("#topMenu li a").hover(function () {
	if ($(this).parent().is("#contactMenu")){
		return;			
	}
	if ($(this).parent().prev(":first").find("strong").length > 0) { //is there <strong> inside very previous <li></li>?
		$(this).find("span").css("background-position","-429px -210px") //find span inside #topMenu li a and change itīs background position
		$(this).parent().prev(":first").find("span").css("background-position","-170px -210px") //find span inside very previous <li><strong></strong></li> and change itīs position  
	} else {
	$(this).find("span").css("background-position","-429px -210px") //find <span></span> inside $(this) <a> and change itīs background position 
		$(this).parent().prev(":first").find("span").css("background-position","-344px -210px") //find <span></span> inside very previous <li> and change itīs background position 
	}
	if ($(this).parent().next(":first:not(#contactMenu)").find("strong").length > 0) { // finding strong in very next <li></li> except <li id="contactMenu"></li>
		$(this).find("span").css("background-position","-134px -210px") 
	} else {
		$(this).find("span").css("background-position","-429px -210px")
	}

    }, function(){ //mouse out returns original background position of all elements
		if ($(this).parent().is("#contactMenu")){
			return;			
		}
        if ($(this).parent().prev(":first").find("strong").length > 0) {
			$(this).find("span").css("background-position","-467px -210px")
			$(this).parent().prev(":first").find("span").css("background-position","-74px -210px")  
        } else {
			$(this).find("span").css("background-position","-467px -210px")
			$(this).parent().prev(":first").find("span").css("background-position","-467px -210px")
        }
		if ($(this).parent().next(":first:not(#contactMenu)").find("strong").length > 0) {
			$(this).find("span").css("background-position","-38px -210px")
		} else {
			$(this).find("span").css("background-position","-467px -210px")
		}
	});
				
});

$(function(){
	
	$("a.openNewWindow").attr('target', '_blank');
	
	$("a.openNewWindow").click(function () {
		window.open($(this).attr('href'), 'window', null);
		return false;
	});
});
