$(document).ready(function(){ 
	var currentNav=$('#mainnavnew li.current a').attr('id')+'-on.gif';
	$('#mainnavnew li.current a img').attr('src','/img/menu/'+currentNav);
	$('#filter').click(function(){
		if($(this).val()=='Product search')
		{
		$(this).val('');
		}
	});

	$("#filter").autocomplete("/ajax/search.php", {
		width: 167,
		selectFirst: false
	});
	
	
	$('#subnav li').mouseover(function(){
		$(this).find('.popupContainer').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer').hide();
	});
	
	$('#subnav li').mouseover(function(){
		$(this).find('.popupContainer2col').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer2col').hide();
	});
	
	$('#subnav li').mouseover(function(){
		$(this).find('.popupContainer3col').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer3col').hide();
	});

	$('#subnav li').mouseover(function(){
		$(this).find('.popupContainer4col').show();
	});

	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer4col').hide();
	});

	$('#subnav li').mouseover(function(){
	$(this).find('.popupfive').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupfive').hide();
	});
	
	$('#subnav li').mouseover(function(){
	$(this).find('.popupContainer5col').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer5col').hide();
	});
	
	$('#subnav li').mouseover(function(){
		$(this).find('.popupContainer1col').show();
	});
	
	$('#subnav li').mouseout(function(){
		$(this).find('.popupContainer1col').hide();
	});
	
	$('#currency>li:first').mouseover(function(){
		$(this).find('ul').show();
	});
	
	$('#currency>li:first').mouseout(function(){
		$(this).find('ul').hide();
	});
	
	$('.graybox .head,.graybox .foot').html('<div><div><!--comment--></div></div>');
	
	var options = { 
        target: '#commentArea',   // target element(s) to be updated with server response 
        success: function(data){var i = $('#commentcount').text(); i = i+1;$('#commentcount').text(i); }, 
        //beforeSubmit:  showRequest,  // pre-submit callback
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        clearForm: false        // clear all form fields after successful submit 
        //resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#commentForm').ajaxForm(options); 

	//this function will show tooltip when mouse over question icon
	var showToolTip=function(){
		$('.helper').tooltip({
	    bodyHandler: function() { 
		   return '<b></b><p></p>';
		}, 
		track: true, 
		delay: 100, 
		showURL: false, 
		showBody: " - ", 
		fade: 550 
      });
	};
	showToolTip();
	$('.mainLine .featureditem:odd').css({"margin-left":"0px"});
	/*$('#categoryRight .secondLine .galleryitem').each(function(){
		var index=$('#categoryRight .secondLine .galleryitem').index($(this))+1;
		if(index%4==0)
		{
			$(this).css({"margin":"0"});
		}
	});*/
	$('#tabs-homepage-products .homepage-featured-items .featureditem').each(function(){
		var index=$('#tabs-homepage-products .homepage-featured-items .featureditem').index($(this))+1;
		if(index%4==0)
		{
			$(this).css({"margin":"0"});
		}
	});
});
