﻿function ajaxReq (url, param) {
	var msec = (new Date()).getTime();
	$detail_arr = param.split(",");

	if($detail_arr[0]=="nofile") {
		
		var myvalue = document.nomovieform.nomovies.value;
		
		new Ajax.Request(url, {
			method: "post",
			parameters: "cache="+msec+"&nomovies="+myvalue,
			onCreate:function (httpObj) {
			},
			onSuccess:function (httpObj) {
				$("result").innerHTML = httpObj.responseText;
			},
			onFailure:function (httpObj) {
				$("result").innerHTML = "エラーで読み込めませんでした";
			}
		});
	} else if($detail_arr[0]=="pg") {
		
		new Ajax.Request(url, {
			method: "post",
			parameters: "cache="+msec+"&npg="+$detail_arr[1]+"&tpg="+$detail_arr[2]+"&idolid="+$detail_arr[3],
			onCreate:function (httpObj) {
			},
			onSuccess:function (httpObj) {
				$("pgresult").innerHTML = httpObj.responseText;
			},
			onFailure:function (httpObj) {
				$("pgresult").innerHTML = "エラーで読み込めませんでした";
			}
		});
	}
}

function ajaxDisplay (url) {
	var msec = (new Date()).getTime();

	new Ajax.Request(url, {
		method: "post",
		parameters: "cache="+msec,
		onCreate:function (httpObj) {
		},
		onSuccess:function (httpObj) {
			$("result").innerHTML = httpObj.responseText;
		},
		onFailure:function (httpObj) {
			$("result").innerHTML = "エラーで読み込めませんでした";
		}
	});
}

function change_movies ($flash_url, $buff) {

	var $mWidth;
	var $mHeight;
	var $divMovie = document.getElementById("movies");
	$detail_arr = $buff.split(",");

	switch($detail_arr[0]) {
		case "small":
			$mWidth = 293;
			$mHeight = 241;
			break;
		case "large":
			$mWidth = 460;
			$mHeight = 378;
			break;
		case "largex":
			$mWidth = 460;
			$mHeight = 378;
			add_btns($detail_arr);
			break;
		default:
			$mWidth = 293;
			$mHeight = 241;
	}

	/* IE */
	if($mybrowser == "Explorer") {
		$flash_tags = AC_FL_RunContent('width',$mWidth,
										'height',$mHeight,
										'src',$flash_url,
										'wmode','transparent',
										'movie',$flash_url);
	/* OTHER */
	} else {
		$flash_tags = "<object width=\""+$mWidth+"\" height=\""+$mHeight+"\">";
		$flash_tags += "<param name=\"movie\" value=\""+$flash_url+"\"></param>";
		$flash_tags += "<param name=\"wmode\" value=\"transparent\"></param>";
		$flash_tags += "<embed src=\""+$flash_url+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\""+$mWidth+"\" height=\""+$mHeight+"\"></embed>";
		$flash_tags += "</object>";
	}

	$divMovie.innerHTML= $flash_tags;
	
}

function change_movies6 ($flash_url, $buff) {

	var $mWidth;
	var $mHeight;
	var $divMovie = document.getElementById("movies");
	$detail_arr = $buff.split(",");

	switch($detail_arr[0]) {
		case "small":
			$mWidth = 293;
			$mHeight = 241;
			break;
		case "large":
			$mWidth = 460;
			$mHeight = 378;
			break;
		case "largex":
			$mWidth = 460;
			$mHeight = 378;
			add6_btns($detail_arr);
			break;
		default:
			$mWidth = 293;
			$mHeight = 241;
	}
	
	$flash_tags = "<object codebase=\"http://go.divx.com/plugin/DivXBrowserPlugin.cab\" width=\""+$mWidth+"\" height=\""+$mHeight+"\" classid=\"clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616\">";
	$flash_tags += "<param name=\"autoplay\" value=\"false\">";
	$flash_tags += "<param name=\"src\" value=\""+$flash_url+"\" />";
	$flash_tags += "<param name=\"custommode\" value=\"Stage6\" />";
	$flash_tags += "<param name=\"showpostplaybackad\" value=\"false\" />";
	$flash_tags += "<embed type=\"video/divx\" src=\""+$flash_url+"\" pluginspage=\"http://go.divx.com/plugin/download/\" showpostplaybackad=\"false\" custommode=\"Stage6\" autoplay=\"false\" width=\""+$mWidth+"\" height=\""+$mHeight+"\" />";
	$flash_tags += "</object>";

	$divMovie.innerHTML= $flash_tags;
	
}

function change_moviesam ($flash_url, $buff) {

	var $mWidth;
	var $mHeight;
	var $divMovie = document.getElementById("movies");
	$detail_arr = $buff.split(",");

	switch($detail_arr[0]) {
		case "small":
			$mWidth = 293;
			$mHeight = 241;
			break;
		case "large":
			$mWidth = 460;
			$mHeight = 378;
			break;
		case "largex":
			$mWidth = 460;
			$mHeight = 378;
			addam_btns($detail_arr);
			break;
		default:
			$mWidth = 293;
			$mHeight = 241;
	}

	$flash_tags = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+$mWidth+"' height='"+$mHeight+"' id='aa' align='middle'>";
	$flash_tags += "<param name='allowScriptAccess' value='always' />";
	$flash_tags += "<param name='movie' value='"+$flash_url+"&width="+$mWidth+"&height="+$mHeight+"&skin=' />";
	$flash_tags += "<param value='transparent' name='wmode' />";
	$flash_tags += "<embed src='"+$flash_url+"&width="+$mWidth+"&height="+$mHeight+"&skin=' quality='high' bgcolor='#ffffff' name='FlashMovie' wmode='transparent' align='middle' width='"+$mWidth+"' height='"+$mHeight+"' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	$flash_tags += "</object>";

	$divMovie.innerHTML= $flash_tags;
	
}

function change_moviesdm ($flash_url, $buff) {

	var $mWidth;
	var $mHeight;
	var $divMovie = document.getElementById("movies");
	$detail_arr = $buff.split(",");

	switch($detail_arr[0]) {
		case "small":
			$mWidth = 293;
			$mHeight = 241;
			break;
		case "large":
			$mWidth = 460;
			$mHeight = 378;
			break;
		case "largex":
			$mWidth = 460;
			$mHeight = 378;
			adddm_btns($detail_arr);
			break;
		default:
			$mWidth = 293;
			$mHeight = 241;
	}

	$flash_tags = "<div><object width=\""+$mWidth+"\" height=\""+$mHeight+"\">";
	$flash_tags += "<param name=\"movie\" value=\""+$flash_url+"\"></param>";
	$flash_tags += "<param name=\"allowFullScreen\" value=\"true\"></param>";
	$flash_tags += "<param name=\"allowScriptAccess\" value=\"always\"></param>";
	$flash_tags += "<embed src=\""+$flash_url+"\" type=\"application/x-shockwave-flash\" width=\""+$mWidth+"\" height=\""+$mHeight+"\" allowFullScreen=\"true\" allowScriptAccess=\"always\"></embed>";
	$flash_tags += "</object></div>";

	$divMovie.innerHTML= $flash_tags;
	
}

function add_btns ($detail) {

	var $divInfo = document.getElementById("addinfo");

	$info_tags = "<form class=\"fleft\" action=\"getmovie.php\" method=\"post\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"ダウンロード\" />";
	$info_tags += "<input name=\"video_id\" type=\"hidden\" value=\""+$detail[1]+"\" />";
	$info_tags += "<input name=\"thum_url\" type=\"hidden\" value=\""+$detail[3]+"\" />";
	$info_tags += "<input name=\"title\" type=\"hidden\" value=\""+$detail[4]+"\" />";
	$info_tags += "</form>";
	$info_tags += "<form class=\"fleft\" action=\"index_individual.php\" method=\"get\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"他の動画も見る\" />";
	$info_tags += "<input name=\"act\" type=\"hidden\" value=\"individual\" />";
	$info_tags += "<input name=\"pg\" type=\"hidden\" value=\"0\" />";
	$info_tags += "<input name=\"idolid\" type=\"hidden\" value=\""+$detail[2]+"\" />";
	$info_tags += "</form>";
	
	$divInfo.innerHTML= $info_tags;
}

function add6_btns ($detail) {

	var $divInfo = document.getElementById("addinfo");

	$info_tags = "<form class=\"fleft\" action=\"getmovie.php\" method=\"post\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"ダウンロード\" />";
	$info_tags += "<input name=\"video_id\" type=\"hidden\" value=\"S6:"+$detail[1]+"\" />";
	$info_tags += "<input name=\"thum_url\" type=\"hidden\" value=\""+$detail[3]+"\" />";
	$info_tags += "<input name=\"title\" type=\"hidden\" value=\""+$detail[4]+"\" />";
	$info_tags += "</form>";
	$info_tags += "<form class=\"fleft\" action=\"index_individual.php\" method=\"get\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"他の動画も見る\" />";
	$info_tags += "<input name=\"act\" type=\"hidden\" value=\"individual\" />";
	$info_tags += "<input name=\"pg\" type=\"hidden\" value=\"0\" />";
	$info_tags += "<input name=\"idolid\" type=\"hidden\" value=\""+$detail[2]+"\" />";
	$info_tags += "</form>";
	
	$divInfo.innerHTML= $info_tags;
}

function addam_btns ($detail) {

	var $divInfo = document.getElementById("addinfo");

	$info_tags = "<form class=\"fleft\" action=\"getmovie.php\" method=\"post\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"ダウンロード\" />";
	$info_tags += "<input name=\"video_id\" type=\"hidden\" value=\"AM:"+$detail[1]+"\" />";
	$info_tags += "<input name=\"thum_url\" type=\"hidden\" value=\""+$detail[3]+"\" />";
	$info_tags += "<input name=\"title\" type=\"hidden\" value=\""+$detail[4]+"\" />";
	$info_tags += "</form>";
	$info_tags += "<form class=\"fleft\" action=\"index_individual.php\" method=\"get\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"他の動画も見る\" />";
	$info_tags += "<input name=\"act\" type=\"hidden\" value=\"individual\" />";
	$info_tags += "<input name=\"pg\" type=\"hidden\" value=\"0\" />";
	$info_tags += "<input name=\"idolid\" type=\"hidden\" value=\""+$detail[2]+"\" />";
	$info_tags += "</form>";
	
	$divInfo.innerHTML= $info_tags;
}

function adddm_btns ($detail) {

	var $divInfo = document.getElementById("addinfo");

	$info_tags = "<form class=\"fleft\" action=\"getmovie.php\" method=\"post\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"ダウンロード\" />";
	$info_tags += "<input name=\"video_id\" type=\"hidden\" value=\"DM:"+$detail[1]+"\" />";
	$info_tags += "<input name=\"thum_url\" type=\"hidden\" value=\""+$detail[3]+"\" />";
	$info_tags += "<input name=\"title\" type=\"hidden\" value=\""+$detail[4]+"\" />";
	$info_tags += "</form>";
	$info_tags += "<form class=\"fleft\" action=\"index_individual.php\" method=\"get\">";
	$info_tags += "<input class=\"sfont\" name=\"submit\" type=\"submit\" value=\"他の動画も見る\" />";
	$info_tags += "<input name=\"act\" type=\"hidden\" value=\"individual\" />";
	$info_tags += "<input name=\"pg\" type=\"hidden\" value=\"0\" />";
	$info_tags += "<input name=\"idolid\" type=\"hidden\" value=\""+$detail[2]+"\" />";
	$info_tags += "</form>";

	$divInfo.innerHTML= $info_tags;
}

function fav_add () {
	$info_tags = "<p class=\"addfav\"><strong>[ブックマーク登録]</strong><br />";
	$info_tags += "<a href=\"javascript:void window.open('http://del.icio.us/post?url='+encodeURIComponent(document.location.href)+'&amp;title='+encodeURIComponent(document.title));\" title=\"add to del.icio.us\"><img src=\"img/icon_delicious.gif\" alt=\"del.icio.usにブックマーク\" title=\"del.icio.usにブックマーク\" width=\"16\" height=\"16\" /></a>";
	$info_tags += "<a href='javascript:void(0)' onClick='window.open(\"http://clip.nifty.com/create?url=\"+encodeURIComponent(location.href)+\"&amp;title=\"+encodeURIComponent(document.title));return false;' title=\"ニフティクリップにブックマーク\" target=\"_blank\"><img src=\"img/icon_nifty.gif\" width=\"16\" height=\"16\" alt=\"ニフティクリップにブックマーク\" title=\"ニフティクリップにブックマーク\" /></a>";
	$info_tags += "<a href=\"http://b.hatena.ne.jp/append?http://www.gvtune.com/\"><img src=\"img/icon_hatebu.gif\" alt=\"hatenaにブックマーク\" title=\"hatenaにブックマーク\" width=\"16\" height=\"16\" /></a>";
	$info_tags += "<a href=\"javascript:void window.open('http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t='+encodeURIComponent(document.title)+'&amp;u='+encodeURIComponent(window.location.href)+'&amp;opener=bm&amp;ei=UTF-8','popup','width=550px,height=480px,status=1,location=0,resizable=1,scrollbars=0,left=100,top=50',0);\"><img src=\"img/icon_yahoo.gif\" width=\"16\" height=\"16\" alt=\"Yahoo!にブックマーク\" title=\"Yahoo!にブックマーク\" /></a>";
	$info_tags += "<a href=\"http://clip.livedoor.com/page/http://www.gvtune.com/\" target=\"_blank\" style=\"background:none;\"><img src=\"img/icon_livedoor.gif\" width=\"16\" height=\"16\" alt=\"livedoorクリップにブックマーク\" title=\"livedoorクリップにブックマーク\" style=\"border: none;\" /></a>";
	$info_tags += "<a href='javascript:void(0)' onClick='window.open(\"http://tags.blogpeople.net/tags_addlink.jsp?u=\"+encodeURIComponent(location.href)+\"&amp;ti=\"+(document.title));return false;' title=\"BlogPeople Tagsにブックマーク\" target=\"_blank\"><img src=\"img/icon_blogpeople.gif\" alt=\"BlogPeople Tagsにブックマーク\" title=\"BlogPeople Tagsにブックマーク\" width=\"16\" height=\"16\" /></a>";
	$info_tags += "<a href='javascript:void(0)' onClick='window.open(\"http://bookmark.fc2.com/user/post?url=\"+encodeURIComponent(location.href)+\"&amp;title=\"+encodeURIComponent(document.title));return false;' title=\"FC2ブックマークにブックマーク\" target=\"_blank\"><img src=\"img/icon_fc2.gif\" width=\"16\" height=\"16\" alt=\"FC2ブックマークにブックマーク\" title=\"FC2ブックマークにブックマーク\" /></a>";
	$info_tags += "<a href='javascript:void(0)' onClick='window.open(\"http://newsing.jp/nbutton?url=\"+encodeURIComponent(location.href)+\"&amp;title=\"+encodeURIComponent(document.title));return false;' title=\"newsingにブックマーク\" target=\"_blank\"><img src=\"img/icon_newsing.gif\" width=\"16\" height=\"16\" alt=\"newsingにブックマーク\" title=\"newsingにブックマーク\" /></a>";
	$info_tags += "<a href='javascript:void(0)' onClick='window.open(\"http://digg.com/submit?phase=2&url=\"+encodeURIComponent(location.href)+\"&amp;title=\"+encodeURIComponent(document.title));return false;' title=\"diggにブックマーク\" target=\"_blank\"><img src=\"img/icon_digg.png\" width=\"16\" height=\"16\" alt=\"diggにブックマーク\" title=\"diggにブックマーク\" /></a>";
	$info_tags += "<a href=\"http://buzzurl.jp/entry/http://www.gvtune.com/\" title=\"Buzzurlにブックマーク\" target=\"_blank\"><img src=\"img/icon_buzzurl.gif\" width=\"16\" height=\"16\" alt=\"Buzzurlにブックマーク\" title=\"Buzzurlにブックマーク\" /></a>";
	$info_tags += "</p>";
	document.write($info_tags);
}