jQuery(document).ready(function(){
	var iconpath = jQuery("#searchform").attr('iconpath');
	jQuery("input.search-plug").css({ background: "url("+iconpath+"icon-"+ctype+".png) no-repeat scroll 5px center #FFFFFF" });
	
	jQuery(".dtype").each(function(){
		jQuery(this).click(function(){
			var ctype = jQuery(this).val();
			jQuery("#dtype").val(ctype);
		});
	});
	jQuery(".ftype").each(function(){
		jQuery(this).click(function(){
			var ctype = jQuery(this).val();
			var iconpath = jQuery("#searchform").attr('iconpath');
			jQuery("input.search-plug").css({ background: "url("+iconpath+"icon-"+ctype+".png) no-repeat scroll 5px center #FFFFFF" });
		});
	});
	jQuery("#rpg_search_box").focus(function(){
		if(this.value=='Search...')
		this.value = "";
	});
	jQuery("#rpg_search_box").blur(function(){
		if(this.value=='')
		this.value = "Search...";
	});
	jQuery(".ytbv").hover(function(){
		jQuery(this).next().show();
	},
	function(){
		jQuery(this).next().hide();
	});
});

function dopost(obj){
	var iconpath = jQuery("#searchform").attr('iconpath');
	jQuery(obj).parent().css({ background: "url("+iconpath+"loading.gif) no-repeat scroll left center transparent " });
	var item = {};
	item.ajax = 1;
	div = jQuery(obj).parent().parent().parent().parent()
	item.title = div.find(".ta").html();
	item.content = div.find(".description").html();
	item.url = div.find(".ta").attr("href");
	item.cat = jQuery("#searchform").attr('cat');
	item.auth = jQuery("#searchform").attr('auth');
	item.search = jQuery('#rpg_search_box').val();
	jQuery.post('/',item,function(data){
			data = data.replace("<ul class='nfaul pbcaul'></ul>",''); //temp fix
			if(data){
					window.location.href = data;
			}
			jQuery(obj).parent().css({ background: "url("+iconpath+"downloads.jpg) no-repeat scroll left center transparent " });
		});
}

