var PeeVeePlayer = function(contenturl, playsecond)
{
	this.contenturl = contenturl;
	this.playsecond = playsecond;
}

var PVP = PeeVeePlayer.prototype;

/** this is a tags, which changes its page. */
PVP.write = function()
{
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="496" height="440" id="dummy_player_large" align="middle">');
  document.write('<param name="allowScriptAccess" value="sameDomain" />');
  document.write('<param name="movie" value="http://video.monstar.fm/player_large.swf?video_id='+this.contenturl+'" />');
  document.write('<param name="quality" value="high" />');
  document.write('<embed src="http://video.monstar.fm/player_large.swf?video_id='+this.contenturl+'" quality="high" width="496" height="440" name="dummy_player_large" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  document.write('</object>');
}

/** this is a function for player on popup. */
PVP.showAndPlay = function(artistname, category, title)
{
	var divbox = document.createElement('DIV');
	var screen = divbox.appendChild(document.createElement('DIV'));
		with(screen.style){
			color = "#000";
			overflow="hidden";
			margin="0em";
			padding = "10px 10px 10px 10px";
			textAlign="left";
			display="block";
		}
	screen.innerHTML = this.getTag();
    var hrForEmbed = screen.appendChild(document.createElement('HR'));
    hrForEmbed.color = "#C2FF03";
	var embedHtml = screen.appendChild(document.createElement('DIV'));
		with(embedHtml.style){
			color = "#000";
			overflow = "auto";
			margin = "0em";
			padding = "0em";
			textAlign = "left";
			width = "100%";
		}
	embedHtml.innerHTML = this.getEmbedHtml();

	var type = message("video.category." + category);
	var title = message("video.title.artist",[title, artistname, type]);
	
	monstar.openInternalDialog(title, 516, '', divbox);
}

/** this is a function for player on popup. it includes link for artist and song or album */
PVP.showDetailAndPlay = function(artistname, category, title, artistUrl, content, contentUrl)
{
	var divbox = document.createElement('DIV');
	var screen = divbox.appendChild(document.createElement('DIV'));
		with(screen.style){
			color = "#000";
			overflow="hidden";
			margin="0em";
			padding = "10px 10px 10px 10px";
			textAlign="left";
		}
	var player = screen.appendChild(document.createElement('DIV'));
		with(player.style){
			color = "#000";
			overflow = "hidden";
			margin = "0em";
			padding = "0 0 1 0em";
			textAlign="left"; 
		}
	player.innerHTML = this.getTag();
	var detail = screen.appendChild(document.createElement('DIV'));
		with(detail.style){
			color = "#000";
			overflow = "auto";
			margin = "0em";
			padding = "0em";
			textAlign = "center";
			width = "100%";
		}
	var aicon = detail.appendChild(document.createElement('IMG'));
	aicon.src = pkg.contextPath + '/_images/newsmail/icon-a.gif';
	var artistTag = detail.appendChild(document.createElement('A'));
	artistTag.href = artistUrl;
	artistTag.appendChild(document.createTextNode(artistname));
	if(content) {
		detail.appendChild(document.createTextNode('  '));
		var sicon = detail.appendChild(document.createElement('IMG'));
		sicon.src = pkg.contextPath + '/_images/newsmail/icon-s.gif';
		var contentTag = detail.appendChild(document.createElement('A'));
		contentTag.href = contentUrl;
		contentTag.appendChild(document.createTextNode(content));
	}
    var hrForEmbed = screen.appendChild(document.createElement('HR'));
    hrForEmbed.color = "#C2FF03";
	var embedHtml = screen.appendChild(document.createElement('DIV'));
		with(embedHtml.style){
			color = "#000";
			overflow = "auto";
			margin = "0em";
			padding = "0em";
			textAlign = "left";
			width = "100%";
		}
	embedHtml.innerHTML = this.getEmbedHtml();
	
	var type = message("video.category." + category);
	var title = message("video.title.artist",[title, artistname, type]);
	
	monstar.openInternalDialog(title, 516, '', divbox);
}

/* tags for popup. */
PVP.getTag = function()
{
	var text = "";
	text += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="496" height="440" id="dummy_player_large" align="middle">';
	text += '<param name="allowScriptAccess" value="sameDomain" />';
	text += '<param name="movie" value="http://video.monstar.fm/player_large.swf?video_id='+this.contenturl+'" />';
	text += '<param name="quality" value="high" />';
	text += '<embed src="http://video.monstar.fm/player_large.swf?video_id='+this.contenturl+'" quality="high" width="496" height="440" name="dummy_player_large" align="middle" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"/>';
	text += '</object>';
	
	return text;
}

PVP.getEmbedHtml = function()
{
	var text = "";
	text += '<font size="-1"><b>この動画をブログで紹介する</b></font>';
	text += '<form class="pevEmbedTagForm" id="form2" name="embedform" method="post" action="">';
	text += '<input  name="embedTagSize" id="embedTagSize" onClick="setPVEmbedTag(14984,33870,\''+this.contenturl+'\');" type="radio" value="0" checked="checked" />サイズ大　&nbsp;<input  name="embedTagSize" id="embedTagSize" onClick="setPVEmbedTag(14984,33870,\''+this.contenturl+'\');" type="radio" value="1" />サイズ中　&nbsp;<input  name="embedTagSize" id="embedTagSize" onClick="setPVEmbedTag(14984,33870,\''+this.contenturl+'\');" type="radio" value="2" />サイズ小　&nbsp;<br />';
	text += '<select id="embedtagType" onClick="setPVEmbedTag(14984,33870,\''+this.contenturl+'\');">';
	text += '<option value="1" selected >ブログを選択</option><option value="1">サーバーインストール型（MovableType等）</option><option value="1">livedoor Blog</option><option value="1">So-net blog</option><option value="1">ココログ</option><option value="1">FC2ブログ</option><option value="1">ゴルフダイジェスト・オンライン</option><option value="1">ドリコムブログ</option><option value="1">JUGEM</option><option value="1">AutoPage </option><option value="1">ヤプログ！</option><option value="1">a-blog</option>';
	text += '<option value="1">TypePad</option><option value="1">チカッパ！</option><option value="2">DHP Blog</option><option value="3">ウェブリブログ</option><option value="4">Yahoo!ブログ</option><option value="5">ドリームブログ </option><option value="2">てぃーだブログ</option><option value="2">ブログ人</option><option value="5">みんカラ</option><option value="3">Excite ブログ</option><option value="3">goo ブログ</option><option value="3">楽天広場 </option><option value="3">アメーバブログ</option><option value="3">はてなダイアリー</option><option value="3">MSNスペース</option><option value="3">AOLダイアリー</option><option value="3">オリコンブログ</option><option value="2">Blogger</option><option value="3">Blog City</option><option value="1">SeeSaaブログ</option><option value="1">わからない・その他</option>';
	text += '</select><br /><input style="width:90%;" onClick="this.select();" name="embedtag" id="embedtag"  type="text" /></form>';
    return text;
}

function fullsize(param){
  moveTo(0,0);
  resW = screen.availWidth;
  resH = screen.availHeight;
  inputText = "fullscreen=1,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,left=0,top=0,width=" + resW + ",height=" + resH;
  testnum = window.open('http://video.monstar.fm/fullscreenplayer.jsp?Movie=' + param, 'newWin', inputText);
}

