// JavaScript Document
$(document).ready(function() {
	
	if ($.client.browser == "Explorer" && $.browser.version == "6.0") {
		alert("You may experience some problems using this website, please upgrade to the latest version of Internet Explorer or download the free version of Firefox");	
	}
	
	// give 0 border to images in links
	$("a img").attr("border","0");
	$("a[href='#']").click(function() {
		return false;
	});
	
	$("a[href^='http://']").click(function() {
		$(this).attr("target","blank");
	});
	
	// give wuma icons middle valign
	$("ul.menu li a img").attr("align","absmiddle");
	$("ul.menu li a img").css("padding-bottom",5);
	
	// drop down men
	$("ul.menu li.products").hover(function() {
		$(this).children("ul").css("display","block");
	},
	function() {
		$(this).children("ul").css("display","none");
	});
	
	$("ul.menu li.gallery").hover(function() {
		$(this).children("ul").css("display","block");
	},
	function() {
		$(this).children("ul").css("display","none");
	});
	
	// apply supersleight to png's
	//$("img[src^='.png']").supersleight();
	
	// give classes to first and last LI elements of the dropdown
	$("ul.dropdown li:first-child").wrapInner("<div></div>");
	$("ul.dropdown li:last-child").addClass("last");
	$("ul.dropdown li:first-child").addClass("first");
	
	if (window.location.href.indexOf("puppy.php") != -1) {
		$("body").addClass("puppy");	
	}
	
	if ($.client.browser == "Explorer" && $.browser.version == "6.0") {
		
		$("*").each( function()
		{
			if( $(this).css("background-image").indexOf( ".png" ) != -1 )
			{
				$(this).supersleight({apply_positioning:true});
			}
		});
		$("ul.menu > li img[src$='.png']").supersleight({apply_positioning:'true'});
		
		// replace WUMA icon in order for it to show
		$("ul.menu li.products > ul.dropdown li img").replaceWith("<span class=\"wumatext\">WUMA</span>");
	}
	
	$("table#gallery a").fancybox({'overlayOpacity' : 0.5});
	//$("#gallery a").animateToSelector({selectors: ["#gallery a:hover"], properties: ['border-width','border-style','border-color'], events: ['mouseover','mouseout'], duration: 1000});	

	$("div.title a").click(
		function() {
			// get UL next to div.title
			var thisDiv = $(this).parent().next();
			if (thisDiv.is(":not(:visible)")) {
				$("div.container_links ul:visible").each(function () {
					var newUL = $(this);
					newUL.hide();
					newUL.prev("div.title").children("img").attr("src","images/arrow.gif");
				});
				thisDiv.prev("div.title").children("img").attr("src","images/arrow_down.gif")
				thisDiv.fadeIn();
			}
		});
	
	
	
	$("#apDiv34 div.container_links:first-child ul").css({display: "block"});
	$("#apDiv34 div.container_links:first-child div.title img").attr("src","images/arrow_down.gif");
	
});
