$j = jQuery.noConflict();

// Date for form processor
var getDate=new Date()
var getYear=getDate.getYear()
if (getYear < 1000)
getYear+=1900
var getDay=getDate.getDay()
var getMonth=getDate.getMonth()+1
if (getMonth<10)
getMonth="0"+getMonth
var getCurrentDay=getDate.getDate()
if (getCurrentDay<10)
getCurrentDay="0"+getCurrentDay
theDate = +getMonth+"/"+getCurrentDay+"/"+getYear;

hasHovered = false;
var currentKiddie = 0;
var howLong = 4000;
//seconds * 1000

function rotateUl(ul){
	if (hasHovered==false) {
		childCount = $j(ul + " li").length;
		currentChild = currentKiddie;
		(currentChild == childCount - 1) ? currentChild = 0 : currentChild++;
		$j(ul).children().removeClass("active");
		$j(ul + " li").eq(currentChild).addClass("active");
        $j("img#active-image").attr("src", $j(ul + " li").eq(currentChild).find("img").attr("src"));
        $j("img#active-image").attr("alt", $j(ul + " li").eq(currentChild).find("img").attr("alt"));
        $j("a#active-link").attr("href", $j(ul + " li").eq(currentChild).find("a").attr("href"));
		currentKiddie = currentChild;
	} 
}


// FancyBox params
$j(document).ready(function(){
    $j("a.fancybox").fancybox();
    

	//rotateUl('ul#pNav-active')

    $j("ul#pNav-active li").click(function(){
        window.location = $j(this).find("a").attr("href");
        return false;
    });
    
    li = $j("ul#pNav-active li").mouseover(function(){
		currentKiddie=li.index(this);
		$j("ul#pNav-active").children().removeClass("active");
        $j(this).addClass("active");
        $j("img#active-image").attr("src", $j(this).find("img").attr("src"));
        $j("img#active-image").attr("alt", $j(this).find("img").attr("alt"));
        $j("a#active-link").attr("href", $j(this).find("a").attr("href"));
    });
    
    $j("div.products").mouseover(function(){
        hasHovered=true;

    });
	
	$j("div.products").mouseout(function(){
        hasHovered=false;
    });
    
		window.currentTimer = setInterval("rotateUl('ul#pNav-active')", howLong);
});


