function rf_ad(){
if(typeof(ads)==='function' && typeof(ads.refreshAll)==='function'){
ads.refreshAll();
}
}
var sign_list='';
$(document).ready(function(){
	sign_list=$("#petscope_content").html();
	$("#petscope_content ul.sign_list dt a").bind("click", function(e){
		rf_ad();
		select_scope(e);
	});
});
function select_scope(event){
		event.preventDefault();
		$("#sample_reading_table").show();
		var type=arguments[1]!==undefined?arguments[1]:false;
		var day=arguments[2]!==undefined?arguments[2]:false;
		var sign=$(event.target).html();
		if(type===false){
			type=$('input:radio[name=pet]:checked').val();
		}
		if(day){
			day='&day='+day;
		}
		else{
			day='';
		}
		$('#petscope_content').html($("#daily_petscope #"+sign+"_scope").html());
		$("#petscope_content dl.horo_desc dt strong").html("Your "+type+"scope");
		$("#petscope_content ul.other_horoscopes li a").bind("click", function(e){
			rf_ad();
			select_scope(e,type);
		});
		$("#petscope_content dl.horoscope_dates dd a").bind("click", function(e){
			rf_ad();
			select_scope(event,type,$(e.target).html());
		});
		$("#petscope_content dd a.back").bind("click", function(e){
			e.preventDefault();
			rf_ad();
			$("#sample_reading_table").hide();
			$("#petscope_content").html(sign_list);
			$("#petscope_content ul.sign_list dt a").bind("click", function(e){
				select_scope(e);
			});
		});
		$.ajax({
			url:'/petscope.php?sign='+sign+'&scope_type='+type+day,
			success:function(data){
				if(data==''){data='There is no horoscope'};
				$('#petscope_content .horoscope').html(data);
				}
		});
}