// JavaScript Document


$(document).ready(function(){
jQuery.jQueryRandom = 0;
jQuery.extend(jQuery.expr[":"],
{
    random: function(a, i, m, r) {
        if (i == 0) {
            jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
        };
        return i == jQuery.jQueryRandom;
    }
});	  

var hoverColour = "#FFF";
//when the dom has loaded
$(function(){
	$("#featured_theme ul#menu1 li.bar2:random").addClass (' active');

	//display the hover div
	$("#main_nav ul li").show("fast", function() {
		//append the background div
		$(this).append("<div></div>");
		//on link hover
		$(this).children("a").hover(function(){
			//store initial link colour
			if ($(this).attr("rel") == "") {
				$(this).attr("rel", $(this).css("color"));
			}
			//fade in the background
			$(this).parent().children("div")
				.stop()
				.css({"display": "none", "opacity": "1"})
				.fadeIn("fast");
			//fade the colour
			$(this)	.stop()
				.css({"color": $(this).attr("rel")})
				.animate({"color": hoverColour}, 350);
		},function(){
			//fade out the background
			$(this).parent().children("div")
				.stop()
				.fadeOut("slow");
			//fade the colour
			$(this)	.stop()
				.animate({"color": $(this).attr("rel")}, 250);
		});
	});
	
});


	
	
	 $('#rp_frame').cycle({ 
			fx:			'fade', 
			//speed: 		250,
			//timeout: 	0,
			pager:      '#rp_nav ul',
			//inDelay:	250, 
			//easing: 	'swing', 	
			pause:      true,
			delay: 4000,
			
			pagerAnchorBuilder: function(idx, slide) {
				return '#rp_nav ul li:eq(' + (idx) + ') a';
			}
	    });
	
});

