var $jx =  jQuery.noConflict();  
function pauseCycle()
{
	$jx('#slideshow').cycle('pause');
	//$jx("#newplayer").dialog();

}
$jx(document).ready(function(){
		    var inprog = 0;


function clearAnimation(){
	$jx(this).parent().find("ul.subnav").stop();	
}
	//$jx("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	
	$jx("ul.topnav li .subHover").mouseover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		
			$jx(this).parent().stop().find("ul.subnav").slideDown({ duration: 200}) //When the mouse hovers out of the subnav, move it back up
			

		//$jx(this).parent().find("ul.subnav").animate({height: height},{queue:false, duration:600, easing: 'easeOutBounce'}).show();

		$jx(this).parent().hover(function() {
		}, function(){	
			$jx(this).parent().stop().find("ul.subnav").slideUp({ duration: 0}) //When the mouse hovers out of the subnav, move it back up
			
			//slideToggle($jx(this).parent().find("ul.subnav"),true).show();
		});
		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 		
			$jx(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$jx(this).removeClass("subhover"); //On hover out, remove class "subhover"
			
	});
	
var currentSlide = 0;
	
$jx("#slideshow").cycle({ 
    fx:           'fade',  // name of transition effect (or comma separated names, ex: fade,scrollUp,shuffle) 
    timeout:       6000,   // milliseconds between slide transitions (0 to disable auto advance) 
   // speed:         200,    // speed of the transition (any valid fx speed value) 
    pager:         ".inner_homerotate_nav",// selector for element to use as pager container 
    fit:           1,     // force slides to fit container 
	pagerAnchorBuilder: function(i, slide){// callback fn for building anchor links:  function(index, DOMelement) 
        return '<a class="selector-' + i + '" style="float:left; width:50px; height:7px; display:block; margin-left:10px;" href="#"></a>';
    },
	
	pagerClick: function(zeroBasedSlideIndex, slideElement){ // deselect all slides
		$jx('.homerotate_title').text(theTitle[zeroBasedSlideIndex]);
		$jx('.homerotate_text').text(theText[zeroBasedSlideIndex]);
		$jx('.selector-0').css({'background' : '#cdc3ae'});
		$jx('.selector-1').css({'background' : '#cdc3ae'});
		$jx('.selector-2').css({'background' : '#cdc3ae'});
		$jx('.selector-'+zeroBasedSlideIndex+'').css({'background' : '#958771'});
		currentSlide = zeroBasedSlideIndex;
    },      
	
	    before: function(foo, bar, opts){ // deselect all slides
		$jx('.homerotate_title').text(theTitle[currentSlide]);
		$jx('.homerotate_text').text(theText[currentSlide]);
		$jx('.selector-0').css({'background' : '#cdc3ae'});
		$jx('.selector-1').css({'background' : '#cdc3ae'});
		$jx('.selector-2').css({'background' : '#cdc3ae'});

		$jx('.selector-'+currentSlide+'').css({'background' : '#958771'});
		currentSlide +=1;
		if (currentSlide >=3) {
		currentSlide = 0;	
		}
    },
    after: function(foo, bar, opts){ // select current slide
    }, 
	sync:          1
   
});


});


