

jQuery.fn.menutopdropdown=function(){

	$(this).hover(function(){ //When trigger is clicked...



    //alert($(this).attr("class")); //On hover over, add class "subhover"

    if($(this).hasClass("current_page_item")){

      $(this).addClass("dup");

    }else{

      $(this).addClass("current_page_item"); //On hover over, add class "subhover"

    }

		//Following events are applied to the subnav itself (moving subnav up and down)

		$(this).find("ul.subnav").show(); //Drop down the subnav on click



		$(this).mouseleave(function(){

			$(this).find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up

		});



		//Following events are applied to the trigger (Hover events for the trigger)

		}, function(){	//On Hover Out

      if($(this).hasClass("dup")){

        $(this).removeClass("dup");

      }else{

        $(this).removeClass("current_page_item"); //On hover over, add class "subhover"

      }

      //alert($(this).attr("class")); //On hover over, add class "subhover"

	});

}



jQuery.fn.submenudropdown=function(){

	$(this).hover(function(){ //When trigger is clicked...



  if($(this).hasClass("current_page_item")){

    $(this).addClass("dup");

    $(this).parents('li:has("#submenu")').addClass("dup"); //On hover over, add class "subhover"

  }else{

    $(this).addClass("current_page_item"); //On hover over, add class "subhover"

    $(this).parents('li:has("#submenu")').addClass("dup"); //On hover over, add class "subhover"

  }

	//Following events are applied to the subnav itself (moving subnav up and down)

	$(this).find("ul.subnav").show(); //Drop down the subnav on click



	$(this).hover(function() {

	}, function(){

		$(this).find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up

	});



	//Following events are applied to the trigger (Hover events for the trigger)

	}, function(){	//On Hover Out

    if($(this).hasClass("dup")){

      $(this).removeClass("dup");

      $(this).parents('li:has("#submenu")').removeClass("dup"); //On hover over, add class "subhover"

    }else{

      $(this).removeClass("current_page_item"); //On hover over, add class "subhover"

      $(this).parents('li:has("#submenu")').removeClass("dup"); //On hover over, add class "subhover"

    }

	});

}



jQuery(document).ready(function($) {

  // find all the input elements with title attributes

	$('input[title!=""]').hint();



	$("#menutop > li").not(':has(ul#submenu)').menutopdropdown();

	$("#menutop > li > ul#submenu > li:has('ul.subnav')").submenudropdown();

  setTimeout("animate2()",2000);

  $('#sidebar').height($('#middle').height());

});


//left-right
function animate1(){
  var speed=8000;
  $('div.message').children().eq(0).animate({left:'+=940'},speed);
  $('div.message').children().eq(1).delay(speed/2).animate({left:'+=940'},speed);
  $('div.message').children().eq(2).delay(speed).animate({left:'+=940'},speed);
  $('div.message').children().queue(function(speed){
    $(this).eq(0).css('left','-460px');
    $(this).eq(1).css('left','-460px');
    $(this).eq(2).css('left','-440px');
    $(this).dequeue();
  });
  setTimeout("animate1()",speed*1.8);
}

//right-left
function animate2(){
  var speed=10000;
  $('div.message').children().eq(0).animate({right:'+=940'},speed);
  $('div.message').children().eq(1).delay(speed/2).animate({right:'+=940'},speed);
  $('div.message').children().eq(2).delay(speed/1.2).animate({right:'+=800'},speed);
  $('div.message').children().eq(0).animate({right:'-=940'},1);
  $('div.message').children().eq(1).animate({right:'-=940'},1);
  $('div.message').children().eq(2).animate({right:'-=800'},1);
  setTimeout("animate2()",speed*1.8);
}
