$(document).ready(function(){
	
	
	$(".mensubs").hover(function(){
		$("."+$(this).attr('id')).show().hover(function(){
			$(this).show();		
		},function(){
			$(this).hide();	
		});		
	},function(){
		$("."+$(this).attr('id')).hide();	
	});	
	
});

function submit_vote(x){
	var val = $("input[@name=poll]:checked").val();
	if(val==undefined  || val<=0) alert('Please select one of the voting options.');
	else{
		$.post('ajax/aj_poll_vote.php',{poll:x, answer:val }, function(data) {
	  		alert(data);
	  		$(".voteresults").fadeIn();
	  		tot = $("#vote_btn").attr('tot');
	  		$(".vote_opts").each(function(){ 
	  			cur = $(this).attr('cur');
	  			if($(this).val()==val) cur++;  				
  				perc=math.round((cur/tot)*100)*100/100;
  				$("#vres_"+val).html(perc+"%");
	  		});
		});
	}
}

function process_add_click(x,y){
	$.post('ajax/aj_click_counter.php',{id:x,updt_ct:'1'}, function(data) {
		if(data=='1'){
	  		window.location=y;
	  	}else{
			return false;
		}
	});
	return false;
}

function change_daytime(x,y){
	$.post('ajax/aj_change_daytime.php',{type:x}, function(data){ window.location=y; });
}

function galblock_toggle(x,y){
	$("#gal_showall").show().bind("click",function(){
		$(".galblocks,#allgall,#viewgal_"+x).fadeIn('slow');	
		$(".gallys").hide();	
		$(this).hide();	
	});
	$(".galblocks,.gallys,#allgall,.viewgals").hide();
	$("#gal_"+x+",#gally_"+x).fadeIn('slow');
	$.post('ajax/aj_show_gallery.php',{folder:y}, function(data){ 
		$("#gally_"+x).html(data);
	});
}

function galimg_pop(x){
	$.post('ajax/aj_show_gallery.php',{img:x}, function(data){ 
		$("#galhold").html(data).fadeIn('slow');
	});
	
	$("#galback").show().bind("click",function(){ $("#galhold").html(''); $("#galback").fadeOut(); });
}
