﻿function S_goPage(pageNo) {
	var n = document.navi;
	n.action = "index.aspx"
	n.PageNumber.value = pageNo;	
	n.submit();
}

function S_LatestPost(BloodType){	
	var n = document.navi;
	n.vw.value= BloodType;
	n.action = "index.aspx";
	n.submit();
}

function S_UserProfileImage(hashcode, size)
{
	if (eval('ProfileAvatarFirst_'+hashcode)!="1")
	{	
		if (eval( "ProfileImgPath_" + hashcode )!="")
			var UserImagePath = "http://mypage.plaync.jp/UF/image/" + eval( "ProfileImgPath_" + hashcode ) + eval( "ProfileImgFile_" + hashcode );
		else
			var UserImagePath = "http://mypage.plaync.jp/UF/image/no_image.gif";
		document.write("<img src='" + UserImagePath + "' width=" + size + " height=" + size + " border=0>");
	}
	else
	{
		var AvatarSwf = "http://static.plaync.jp/mypage/swf/" + eval("ProfileAvatarSFile_" + hashcode);
		var AvatarBgColor = eval("ProfileAvatarBgColor_" + hashcode);
		document.write("<div style='background-color:"+AvatarBgColor+"; width:"+size+"px; height:"+size+"px;'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+size+"' height='"+size+"'><param name='movie' value='" + AvatarSwf + "'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='" + AvatarSwf + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer'type='application/x-shockwave-flash' width='"+size+"' height='"+size+"'></embed></object></div>");
	}
}

function S_UserProfileImageKeyword(hashcode, size)
{
	if (eval('ProfileAvatarFirst_'+hashcode)!="1")
	{	
		if (eval( "ProfileImgPath_" + hashcode )!="")
			var UserImagePath = "http://mypage.plaync.jp/UF/image/" + eval( "ProfileImgPath_" + hashcode ) + eval( "ProfileImgFile_" + hashcode );
		else
			var UserImagePath = "http://mypage.plaync.jp/UF/image/no_image.gif";				
	}
	else
	{
		var UserImagePath = "http://static.plaync.jp/mypage/img/" + eval('ProfileAvatarImgFile_' + hashcode);		
		size = 65;
	}
	document.write("<img src='" + UserImagePath + "' width=" + size + " height=" + size + " border=0>");
}

function S_UserProfileSmaillImage(hashcode)
{
	if (eval( "ProfileImgPath_" + hashcode )!="")
		var UserImagePath = "http://mypage.plaync.jp/UF/image/" + eval( "ProfileImgPath_" + hashcode ) + "S" + eval( "ProfileImgFile_" + hashcode );
	else
		var UserImagePath = "http://mypage.plaync.jp/UF/image/no_image.gif";

	document.write("<img src='" + UserImagePath + "' width=70 height=70 border=0>");
}

// Channel Navigation -- Start

var isLogin = "";
var targetService = "";

function SetChannel(num)
{
	if (num==0)
	{
		var swfFname = "channelguide_blog.swf";
		targetService = "http://blog.plaync.jp";
	}
	else if (num==1)
	{
		var swfFname = "channelguide_mypage.swf";
		targetService = "https://mypage.plaync.jp";
	}
	else
	{
		var swfFname = "channelguide_blog.swf";
		targetService = "http://blog.plaync.jp";
	}
		
	if(document.body.clientWidth<930)
		return;

	document.write("<div id=T style='position:absolute; top:267px; width:0px; left:50%; z-index:1'><div id=C style='position:relative; top:-160px;left:370px;z-index:50;'>  <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='100' height='237'>    <param name='movie' value='http://static.plaync.jp/www/swf/" + swfFname +"'>    <param name='quality' value='high'>	<param name='wmode' value='transparent'>    <embed src='http://static.plaync.jp/www/swf/" + swfFname +"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100' height='237'></embed>  </object></div></div>");
}

function goMyBlog()
{
	if (isLogin==0)
		document.location = "https://ssl.plaync.jp/login/login.aspx?RetUrl="+targetService;
	else
		document.location = "http://blog.plaync.jp/?tp=makeblog";
}

function goMyBlogAdmin()
{
	if (isLogin==0)
		document.location = "https://ssl.plaync.jp/login/login.aspx?RetUrl="+targetService;
	else
		document.location = "http://blog.plaync.jp/?tp=makeblog&ad=1";
}

// Channel Navigation -- End 

function Trim(str)
{
	var strTemp = str;
    strTemp = RTrim(strTemp);
	strTemp = LTrim(strTemp);
	return strTemp;
}

function RTrim(strTemp)
{
	var nLoop = 0;
	var strReturn = strTemp;
	while (nLoop < strTemp.length){
		if ((strReturn.substring(strReturn.length - 1, strReturn.length) == " ") || (strReturn.substring(strReturn.length - 1, strReturn.length) == "　"))
		{
			strReturn = strTemp.substring(0, strTemp.length - (nLoop + 1));
		}
		else{
			break;
		}
		nLoop++;
	}
	return strReturn;
}

function LTrim(strTemp)
{
	var nLoop = 0;
	var strReturn = strTemp;
	while (nLoop < strTemp.length){
		if ((strReturn.substring(0, 1) == " ") || (strReturn.substring(0, 1) == "　")){
			strReturn = strTemp.substring(nLoop + 1, strTemp.length);
		}
		else{
			break;
		}
		nLoop++;
	}
	return strReturn;
}

//
// User Profile View Function
//

function PiframePopupToggle (url, obj, top, left) {
  if (obj.style.display == 'none') {
    obj.src = url;
    obj.style.top = top;
    obj.style.left = left;
    obj.style.display = '';
  }
  else {
    if (parseInt(obj.style.top) == top && parseInt(obj.style.left) == left) {
      obj.src = 'about:blank';
      obj.style.display = 'none';
    }
    else {
      obj.src = url;
      obj.style.top = top;
      obj.style.left = left;
      obj.style.display = '';
    }
  }
}

function userProfileView (unickname) 
{
  url = "http://mypage.plaync.jp/profileview.aspx?unickname=" + unickname;
  var obj = document.getElementById ('ProfileViewFrame');
  PiframePopupToggle (url, obj, Menu_top, Menu_left);
  
//  clearTimeout(Menu_timerID2);
//  Menu_timerID2 = setTimeout("ProfileRemove();", Menu_runSec);
}

var Menu_timerID = null;
var Menu_timerID2 = null;
var Menu_runSec = 2000;
var Menu_nickName;
var Menu_top;
var Menu_left;
var Menu_top_p;
var Menu_left_p;

function ShowMenuList(e, nickname)
{
  	Menu_nickName = nickname;
	ncsj.user.ManageFriend.requestUserInformation(Menu_nickName);
	
	/*
  	var evt = e ? e : window.event;
  	var posx=0;
  	var posy=0;

  	if (evt.pageX || evt.pageY) { // pageX/Y Check
    		posx = evt.pageX ;
    		posy = evt.pageY ;
  	} else if (evt.clientX || evt.clientY) { //clientX/Y Check Opera
    		posx = evt.clientX + document.documentElement.scrollLeft;
            		posy = evt.clientY + document.documentElement.scrollTop ;
    		if (window.event) { // IE Check
      			posx += document.body.scrollLeft;
      			posy += document.body.scrollTop;
     		}
  	}

	Menu_top =  posy  + 8;
	Menu_left = posx;

	Menu_top_p = evt.screenY;
	Menu_left_p = evt.screenX;

	if (document.getElementById('view').style.display == "none")
		document.getElementById('view').style.display = "";	
	
	document.getElementById('view').style.left = Menu_left+"px"
	document.getElementById('view').style.top = Menu_top+"px"	

	clearTimeout(Menu_timerID);
	Menu_timerID = setTimeout("MenuRemove();", Menu_runSec);
	*/
}

function MenuView(nickname)
{
	Menu_nickName = nickname;
  	
	ncsj.user.ManageFriend.requestUserInformation(Menu_nickName);
	/*

	Menu_top =  document.body.scrollTop + event.clientY + 8;
	Menu_left = document.body.scrollLeft + event.clientX;

	Menu_top_p = event.clientY + 8 + 100;
	Menu_left_p = event.clientX + 10;

	if (view.style.display == "none")
		view.style.display = "";

	view.style.pixelLeft = Menu_left
    view.style.pixelTop = Menu_top

	clearTimeout(Menu_timerID);
	Menu_timerID = setTimeout("MenuRemove();", Menu_runSec);
	*/
}

function ProfileRemove()
{
	var obj = document.getElementById ('ProfileViewFrame');
	obj.style.display = "none";
}

function MenuRemove()
{
	document.getElementById('view').style.display = "none";
	//view.style.display = "none";
}

function MenuMouseOver(mn)
{
	clearTimeout(Menu_timerID);
	Menu_timerID = setTimeout("MenuRemove();", Menu_runSec);
	mn.style.backgroundColor="#FFFFFF";
}

function MenuMouseOut(mn)
{
	clearTimeout(Menu_timerID);
	Menu_timerID = setTimeout("MenuRemove();", Menu_runSec-1000);
	mn.style.backgroundColor="#F1F5FF";
}

function MenuGoMessage()
{
	MenuRemove();
	ncsj.user.ManageFriend.createMessage(Menu_nickName);
	/*
	var url = "http://mypage.plaync.jp/?tp=message&at=default&vw=writeout&MsgTo=" + escape(Menu_nickName);
	buWindow=window.open(url,"MenuPopup","width=300, height=420,top="+Menu_top_p+",left="+Menu_left_p);
	buWindow.opener=self;
	buWindow.focus();
	*/
}

function MenuGoBlog()
{
	MenuRemove();
	var url = "http://blog.plaync.jp/?tp=jumpblog&nickname=" + encodeURIComponent(Menu_nickName);

	top.document.location.href = url;
}

function MenuGoProfile()
{
	MenuRemove()
	//alert(Menu_nickName);
	ncsj.user.ManageFriend.requestUserInformation(Menu_nickName);
/*
	var url = "http://mypage.plaync.jp/profileview.aspx?unickname=" + escape(Menu_nickName);
	buWindow=window.open(url,"MenuPopup","width=400, height=204,top="+Menu_top_p+",left="+Menu_left_p);
	buWindow.opener=self;
	buWindow.focus();
*/

//	userProfileView (escape(Menu_nickName));
}

function MenuPntView()
{
	document.write("<style>#mymenu {font-family:'ＭＳ Ｐゴシック';	font-size:11px;	color: #666666;	text-decoration: none; } #tdmenu { padding-top:3px; padding-bottom:2px;}</style>");
	document.write("<div id=view style='DISPLAY:none; LEFT: 0px; POSITION:absolute; TOP:0px;z-index:20000;'><table width='100' border='0' cellspacing='0' cellpadding='0'><tr><td align='center' style='border:solid 1px #B8C8D8; background-color:#F1F5FF; padding-top:3px; padding-bottom:3px;' ><table width='88'  border='0' cellspacing='0' cellpadding='0'><tr><td id='tdmenu' align='left'  valign='top' onMouseOver=MenuMouseOver(this); onMouseOut=MenuMouseOut(this);><a href='javascript:MenuGoBlog();' id='mymenu'>ブログに行く</a></td></tr><tr><td height='1' background='http://static.plaync.jp/blog/service/img/dot_line_blue_02.gif'></td></tr><tr><td id='tdmenu' align='left' valign='top' onMouseOver=MenuMouseOver(this); onMouseOut=MenuMouseOut(this);><a href='javascript:MenuGoProfile()' id='mymenu'>プロフィールを見る</a></td></tr><tr><td height='1' background='http://static.plaync.jp/blog/service/img/dot_line_blue_02.gif'></td></tr><tr><td id='tdmenu' align='left' valign='top' onMouseOver=MenuMouseOver(this); onMouseOut=MenuMouseOut(this);><a href='javascript:MenuGoMessage()' id='mymenu'>メッセージを送る</a></td></tr></table></td></tr></table></div>");
	document.write("<iframe id=ProfileViewFrame src='about:blank' frameborder=0 scrolling=no width=400 height=204 style='display:none; background-color:#ffffff; position:absolute; left:0px; top:0px;z-index:200;'></iframe>");
}
MenuPntView();