$(document).ready(function() {
	
	KODEMALL.search = (function () {
		
		$(".input-search-box").bind('keydown', function (e) {		
			if(e.keyCode === 13) {
				$("#mall-search-btn").trigger('click');
			}		
		});
		
		$("#mall-search-btn").bind('click', function() {		
			var sellersearch = $(".input-search-box").val();
			var searchby = $("input[name='search_by']:checked").val(); 
			if(sellersearch != 'find product or seller...' && sellersearch != 'NULL' && sellersearch != ''){
				if(searchby == 'product'){
					url = KODEMALL.mall_base_url + 'index.php?route=catalog/product/search&keyword='+sellersearch;
				}else if(searchby == 'seller'){
					url = KODEMALL.mall_base_url +'index.php?route=catalog/store/search&keyword='+sellersearch;
				}					
				location = url;
			}		
		});
		
		//every textarea, input with this class  
		$("input.wmark , textarea.wmark").live('click', function () {		 
			var text = $(this).attr('title');
			if($(this).val() == text){
			   $(this).val('');
			   $(this).css({'color' : '#000'});
			}		
		}).blur(function(){		
			if($(this).val() == ''){
				$(this).val($(this).attr('title'));
				$(this).css({'color' : '#B7B7B7'});
			}
		});
		
	}) (),
	
	KODEMALL.filter = (function () {
		$('select#filter').bind('change',function(){
			location = $(this).val();
		});		
	}) ()
	
});


