/*@cc_on _d=document;eval('var document=_d')@*/
root_url = 'http://game-blog-ranking.com/';
function countAccess(url,site_url) {
	var pars = 'site_url='+encodeURIComponent(site_url)+'&url='+encodeURIComponent(url);
	var res = new Ajax.Request(root_url + 'cntup.php', {parameters:pars, method:'get'});
}
$(function(){
	$("#game_serach").submit(function(){
			var keyword = $("input:text").val();
			$("#result").load(root_url + "load.html");
			setTimeout( function() {
				$("#result").load(root_url + "search.php?keyword=" + encodeURIComponent(keyword) );
			}, 1500 );
			return false;
	});
});
$(function(){
	$("#game_serach_footer").submit(function(){
			var keyword = $("#keyword_footer").val();
			$("#result_footer").load(root_url + "load.html");
			setTimeout( function() {
				$("#result_footer").load(root_url + "search.php?keyword=" + encodeURIComponent(keyword) );
			}, 1500 );
			return false;
	});
});
$(function(){
	$("#game_serach_ranking").submit(function(){
			var keyword = $("input:text").val();
			$("#result").load(root_url + "load.html");
			setTimeout( function() {
				$("#result").load(root_url + "search_ranking.php?keyword=" + encodeURIComponent(keyword) );
			}, 1500 );
			return false;
	});
});
$(function(){
	$("#game_serach_select").submit(function(){
			var keyword = $("input:text").val();
			var c = $("#c").val();
			var g = $("#g").val();
			var g2 = $("#g2").val();
			var g3 = $("#g3").val();
			$("#result").load(root_url + "load.html");
			setTimeout( function() {
				$("#result").load(root_url + "search_game_select.php?keyword=" + encodeURIComponent(keyword) + "&c=" + c  + "&g=" + g + "&g2=" + g2 + "&g3=" + g3 );
			}, 1500 );
			return false;
	});
});
$(function(){
	$("#game_serach_select_footer").submit(function(){
			var keyword = $("#keyword_footer").val();
			var c = $("#c").val();
			var g = $("#g").val();
			var g2 = $("#g2").val();
			var g3 = $("#g3").val();
			$("#result_footer").load(root_url + "load.html");
			setTimeout( function() {
				$("#result_footer").load(root_url + "search_game_select.php?keyword=" + encodeURIComponent(keyword) + "&c=" + c  + "&g=" + g + "&g2=" + g2 + "&g3=" + g3 );
			}, 1500 );
			return false;
	});
});

/*
function chk_form_resign(f){
	if(confirm("登録を解除しますか？"))
	return true;
	else return false;
}
*/
function chk_form_password(f){
	if(confirm("入力したメールアドレス宛てにパスワードを送信します"))
	return true;
	else return false;
}
function chk_form_game(f){
	if(confirm("ゲームを追加します"))
	return true;
	else return false;
}
function chk_form_blog(f){
	if(confirm("ブログを追加します"))
	return true;
	else return false;
}
function chk_form_join_blog(f){
	if(confirm("この内容で登録します"))
	return true;
	else return false;
}
function chk_form_edit_blog(f){
	if(confirm("この内容で変更します"))
	return true;
	else return false;
}
function chk_form_send(f){
	if(confirm("この内容で送信します"))
	return true;
	else return false;
}
function upd_form(f){
	if(confirm("登録内容を変更します"))
	return true;
	else return false;
}
function delete_form(f){
	if(confirm("このゲームを削除してよろしいですか？"))
	return true;
	else return false;
}
function delete_blog_form(f){
	if(confirm("ブログを削除してよろしいですか？"))
	return true;
	else return false;
}
function delete_mail_form(f){
	if(confirm("削除してよろしいですか？"))
	return true;
	else return false;
}

function setfocus() {
	if (document.input && document.input.mail) {
		document.input.mail.focus();
	}
}


function game_select_admin(){
	window.open("/admin/game_select.php", "game_select", "width=660,height=600,scrollbars=yes,resizable=yes");
}
function game_select(c,g,g2,g3){
	window.open(root_url + "game_select.php?c=" + c + "&g=" + g + "&g2=" + g2 + "&g3=" + g3, "game_select", "width=660,height=600,scrollbars=yes,resizable=yes");
}
function add_comment(f){
	if(f.comment.value==""){
		alert('コメントを入力してください。');
		return false;
	}else{
		if(confirm("コメントを書き込みます"))
		return true;
		else return false;
	}
}

/* 半角英文字チェック */
function AlphabetCheck(my_URL) {
   var str = my_URL;
   if( str.match( /[^A-Za-z\s.-]+\.\+\?/) ) {
      return 1;
   }
   return 0;
}

/* 半角数字チェック */
function NumberCheck(my_URL) {
   var str = my_URL;
   if( str.match( /[^0-9]\.\+\?+/) ) {
      return 1;
   }
   return 0;
}
function AllCheck(data) {
   var check = 0;
   check += AlphabetCheck(data);
   check += NumberCheck(data);
   if( check > 0 ) {
      return 1;
   }
   return 0;
}
