$(document).ready(function(){
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.satnav li span").hover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).click(function() {
			window.location.replace($(this).parent().find("a").attr("href")); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			//$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	/*Toogle Edit function*/
	$("#maincontent .element").hover(function () { $(this).find(".editit").show(); },
	function () { $(this).find(".editit").slideUp('fast'); });
	
	$("#sidebar-right .element").hover(function () { $(this).find(".editit").show(); },
	function () { $(this).find(".editit").slideUp('fast'); });1
	/*Reset inout search*/
	$("#search input").focus(function() { if($(this).val()=="salons, soirées, bars, théâtres, ...") $(this).val(''); }); 
	$("#search input").blur(function() { if($(this).val()=="") $(this).val('salons, soirées, bars, théâtres, ...'); }); 
	
	$('#search').weatherfeed(['FRXX0101']);
	
	$('#rssendirect').rssfeed('http://feeds.feedburner.com/EnDirectDeTroyes?format=xml', {
    limit: 3,
	content: true
  	});
	
	if(window.twitterfeed) $('#twitterfeed').twitterfeed('sortiratroyes', { limit: 5 });
	
	if ($("#identifiant")) $("#identifiant").focus().addClass("focused");
	if ($(".formulaire")) $(".formulaire input").live('click',function(){ $(".formulaire input").removeClass('focused'); $(this).focus().addClass("focused") });
  /*
  $('#sdf').flickrfeed('52122074@N08','', {
    limit: 5,
	header: false,
	title:false,
	imagesize: 'square'
  });*/
  
   /*$("#rssendirect img").live(function()
   {
	   $(this).cjObjectScaler({
		destElem: $(this).parent(),
		method: "fill",
		fade: 150
		}); 
	}); */
	
//$('#slider').nivoSlider({ pauseTime:3000 });
});

