/* <![CDATA[ */
jQuery(document).ready(function($) {
								
  $('.second_nav>ul>li>a').hover(function(){
	  $(this).parent().css('background-color','#CCC');
	  $(this).parent().children('ul').find('li').css('background-color','#FFF');
	  $(this).parent().find('ul>li>a').css('background-color','#FFF');
	  //$(this).parent().find('ul>li>ul a').css('background-color','#CCC');
	 },function(){
	  $(this).parent().css('background-color','#FFF');
	  $(this).parent().children('ul').find('li').css('background-color','#CCC');
	  $(this).parent().find('ul>li>a').css('background-color','#CCC');
	  //$(this).parent().find('ul>li>ul a').css('background-color','#CCC');
     });
  
  $('.second_nav>ul>li ul>li>a').hover(function(){
	  $(this).parent().css('background-color','#FFF');
	  $(this).css('background-color','#FFF');
	 },function(){
	  $(this).parent().css('background-color','#CCC');
	  $(this).css('background-color','#CCC');
	 });
  
  $('#nav>ul>li>ul a').hover(function(){
	 $(this).parent().css('background-color','#CCC');
  },function(){
	 $(this).parent().css('background-color','#FFF');
  });
  
  $('.second_nav2 a').hover(function(){
	$(this).parent().css('background-color','#CCC');
  },function(){
    $(this).parent().css('background-color','#FFF');
  });
  
  $('.right_block li a').hover(function(){
	$(this).parent().css('background-color','#CCC');
  },function(){
    $(this).parent().css('background-color','#FFF');
  });
  
  $('.btn img').click(function(){$('#head form').submit();});
  $('#nav span img').click(function(){$('#head form').submit();});
  $('.btn_onp img').click(function(){$('#searchform_onpage').submit();});
  
   $ardwn = $('#arrow_down').html();
   $arlft = $('#arrow_left').html();
   
   //top navigation start
  $("#nav>ul>li>ul li:has(ul)").append($arlft);
  $("#nav>ul>li:has(ul)").append($ardwn);
  
  function view_nav() {
	  if ($(this).children('ul').outerHeight() < 200 ){
		  $(this).children('ul').css('height','200px');
		  $(this).children('ul').css('border-bottom','1px solid #333');
	  }
	  $(this).children('ul').slideDown('fast');
	  $top_val = $(this).outerHeight();
	  $left_val = '0px';
	  $(this).children('ul').css('top',$top_val);
	  $(this).children('ul').css('left',$left_val);
  }
  function hide_nav() {
	  $(this).children('ul').slideUp('fast');
  }
  
  var menuconfig = {    
     interval: 200,
     sensitivity: 4,
	 over: view_nav,
	 timeout: 200,
     out: hide_nav
     };
	 
  	$("#nav>ul>li:has(ul)").hoverIntent(menuconfig);
  
   function view_childnav() {
	   if ($(this).children('ul').outerHeight() < 200 ){
		  $(this).children('ul').css('height','200px');
		  $(this).children('ul').css('border-bottom','1px solid #333');
	  }
	  $(this).children('ul').slideDown('fast');
	  $top_val = ($(this).outerHeight()/2) -  ($(this).outerHeight());
	  $left_val = $(this).outerWidth() - ($(this).outerWidth()/4);
	  $(this).children('ul').css('top',$top_val);
	  $(this).children('ul').css('left',$left_val);
   }
   
   function hide_childnav() {
	   $(this).children('ul').slideUp('fast');
   }
   
   var childmenuconfig = {    
     interval: 200,
     sensitivity: 4,
	 over: view_childnav,
	 timeout: 100,
     out: hide_childnav
     };
	 
  $("#nav>ul>li>ul li:has(ul)").hoverIntent(childmenuconfig);
  
  //top navigation end
  
   $expandbtn = $('#expand').html();
   $collapsebtn = $('#collapse').html();
  //side navigation start
    $(".second_nav>ul li:has(ul)>a").prepend('<span class="ex_col_btn">' + $expandbtn + '</span>');
	$(".ex_col_btn").toggle(function(event){
		event.preventDefault();
		$(this).parent().parent().children('ul').slideDown('fast');
		$(this).html($collapsebtn);
	},function(event){
		event.preventDefault();
		$(this).parent().parent().children('ul').slideUp('fast');
		$(this).html($expandbtn);
	});
  //side navigation end
  
});
/* ]]> */
