//var MAC = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

$('document').ready(function()
{	
  //console.log(MAC);
  if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
      ipad_style();
	}
  //chrome
 /*$("#content-wrapper #content #scrollable ul").css({'margin':'0 0 0 11%'});*/
		
	$('#toggle').toggle(function(){
		$('#menu-toggle').animate({width:'79px'});
		$('#nav').animate({width:'toggle'});
		$(this).css({background: 'url("multimedia/menu-arrow.png") no-repeat scroll 95% -12px transparent'});
	},function() {
		$('#menu-toggle').animate({width:'105px'});
		$('#nav').animate({width:'toggle'});
		$(this).css({background:'url("multimedia/menu-arrow.png") no-repeat scroll 95% 4px transparent'});
	});

  menu_action_in();
  menu_action_out();
 // text_blur();
	
    /* To remove Product A-Z from accordian */
	$("a.no-accordian").unbind();
	$('a.no-accordian').find('span').remove();
	

  	
});  /* end of document get ready */

 /* bind click for each menu item */ 
   function menu_action_in()
{   
	$('#nav li.menu').each(function(index)
		  {
				 $(this).bind('mouseover',function()
			   {       
						$(this).addClass('selected');	
					   //$('a',$(this)).addClass('selected1'); 
						//$('.subnav',$(this)).fadeTo('slow', 1).addClass('menu-visibility');
			
						$('.subnav',$(this)).fadeTo('slow', 1).show();
						
}); 
						
				});
	 
}

       /* Mouse leave for each menu item */
	 function menu_action_out()  
	 {
	   $('#nav li.menu').each(function(index)
		  {
			 $(this).bind('mouseleave',function()
		   { 
            //$('.subnav .accordion a.ui-state-active',$(this)).trigger("click");
           
			$(this).removeClass('selected');
			 //$('a',$(this)).removeClass('selected1');  
			 //$('.subnav',$(this)).fadeTo('slow', 1).removeClass('menu-visibility');
			 $('.subnav',$(this)).fadeTo('slow', 1).hide();
			 $('.subnav .submenu',$(this)).hide();
			 $('.subnav .headerbar',$(this)).removeClass('selected').addClass('default');
			 //$('.subnav .accordion a.ui-state-active',$(this)).trigger("mouseover");
		  });
		});  
	}	
	
	function text_blur()  
	 { 
       /* var searchLabel1 = $('#search label').remove().text();
		$('#search input').val(searchLabel1)
		
		$('#search input').focus(function() {
			if (this.value == searchLabel1)
			$(this).val('');
			$(this).parent('#search').addClass('clicked');
			$('.menu > a').animate({'padding-right':'20px','padding-left':'20px'},"fast");
            //$(this).parent('#search').animate({width:'190px'},"fast");
			$(this).animate({width:'160px'},"fast");
			})
		
		$('#search input').blur(function() {
			if (this.value == '')
			$(this).val(searchLabel1);
			$(this).parent('#search').removeClass('clicked');
			$('.menu > a').animate({'padding-right':'25px','padding-left':'25px'},"fast");
			//$(this).parent('#search').animate({width:'131px'},"fast");
			$(this).animate({width:'100px'},"fast");
		});*/
		var searchLabel1 = $('#search-btn label').remove().text();
		$('#search-btn input').val(searchLabel1)
		.focus(function() {
			if (this.value == searchLabel1)
			$(this).val('');
			
		})
			
		.blur(function() {
			if (this.value == '')
			$(this).val(searchLabel1);
			
		});
		
	 }
	 
	 function ipad_style()
	 {
		$("#masthead #nav-wrapper").css({'width':'81%'});
	   	$("#content-wrapper #content #scrollable ul").css({'margin':'0 0 0 4.65%'});
		$("#footer").css({'width':'78%'});
		$("#footer .footer-box").css({'width':'97.5%'});
			
	 }

