jQuery.inputHighlight = function(color){  
    $("input[type='text'],input[type='file'],input[type='password'],textarea").each(function(){  
        $(this).focus(function(){  
            $(this).css({"background" : color});  
        });  
        $(this).blur(function(){  
            $(this).css({"background" : "white"});  
        });  
    });  
}

function categoryProc(){	
	
	var catLeng = $('.category h1.catTitle');
	var subList = $('.category div.subList');
	for(var i =0; i<catLeng.length; i++)
	{
		catLeng[i].id = 'cat'+(i+1);
		subList[i].id = 'subList_cat'+(i+1);
	}
	var active = $('.category').find('h1.active');
	if(active.html()){
		active.addClass('selected');
		$('.category div#subList_'+active.attr('id')).show();
	}/*else{
		$('.category h1.catTitle:first').addClass('selected');
		$('.category div.subList:first').show();
	}*/
}



$(document).ready(function(){
categoryProc();								
	$.inputHighlight("#f1fbff"); // form style;
	
	$(".navbar ul").find("li.active").prev().addClass('hover_prev');
	$('.navbar li').mouseover(function(){
		$('.navbar li').removeClass('hover').removeClass('hover_prev').removeClass('selected');
		$(this).addClass('hover');
		$(this).prev().addClass('hover_prev');
	}).mouseleave(function(){
		$('.navbar li').removeClass('hover').removeClass('hover_prev');
		$(".navbar ul").find("li.active").addClass('selected').prev().addClass('hover_prev');
	});
	
	/* ====================== */
	$('.SNav a:last-child').css('border',0);
	/* ====================== */
	/*$('.category h1.catTitle').click(function(){
		$('.category div.subList').slideUp();
		$('.category h1.catTitle').removeClass('selected');
		$('.category div#subList_'+(this.id)).slideDown();
		$(this).addClass('selected');
	});*/
	/* ====================== */
	$('#subCat li').mouseover(function(){
		$('#subCat li').removeClass('hover');
		$(this).addClass('hover');
	}).mouseleave(function(){
		$('#subCat li').removeClass('hover');
	});
	
	/* =================================== tabs */
	$('.tabs li').removeClass('selected');
	$('.tabs li:first').addClass('selected');
	$('.tabsCt').hide();
	$('.tabsCt:first').show();
	
	$('.tabs li a').click(function(){
		$('.tabs li').removeClass('selected');
		$('.tabsCt').hide();
		$(this).parent().addClass('selected');
		var ctshow = $(this).attr('href');
		$(ctshow).show();
		return false;
	})
	
	/* ===================== */
	$('#post_comment_button').click(function(){
		$(this).hide();
		$('#commentList').hide();
		$('#reviewsList').hide();
		$('#post_comment_form').show();
		
	});
	$('#cancel_comment').click(function(){
		$('#post_comment_button').show();
		$('#commentList').show();
		$('#reviewsList').show();
		$('#post_comment_form').hide();
	});
	
});

