﻿/// <reference path="../extjs_intellisense.js" />
var globalSpaceWebRoot = ".";
$(document).ready(function(){
//    GetFriendsPowerLog(1);
});
function GetFriends(pageNo)
{
    if (globalSpaceWebRoot == "." && $("#globalSpaceWebRoot")) {
        globalSpaceWebRoot = $("#globalSpaceWebRoot").val();
    }
    var uin = $("#UserId").val();
    var param = {"uin":uin, "pageNo":pageNo};
    var url = "/" + globalSpaceWebRoot + "/friends.aspx?action=GetFriends";
    $.ajax({
      "beforeSend": AjaxBegin(),
      "type": "POST",
      "url": url,
      "data": param,
      "success": function(msg){
        AjaxEnd();
        GetFriendsHandle(msg);
      }
    });
    function GetFriendsHandle(arr){
        $("#friendsListSpan").html(arr);
    }
}
function OpenOneWindow(url,nu_width,nu_height)
{
	var nu_left=(window.screen.width-nu_width)/2-5;
	var nu_top=(window.screen.height-nu_height)/2-40;
    window.open(url,"newWindow","width=" + nu_width + ",height=" + nu_height+",left="+nu_left+",top="+nu_top+",status=yes,resizable=no");	
}

function playerMusicById(id)
{
    OpenOneWindow("/MusicPlayer/MusicBox.html?musicId="+id,651,375);
}
function GetFriendsPowerLog(pageNo){
    var uin = $("#UserId").val();
    var url = "/m/ajax?action=GetFriendsPowerLog&uin=" + uin;
    var param = {"pageNo": pageNo};
    $.post(url, param, GetFriendsPowerLogHandle);
    function GetFriendsPowerLogHandle(msg){
        $("#friendsList").html(msg);
    }
}
function JudgeNumOnly(obj) { 
	obj.value=obj.value.replace(/\D/g,'');
}

function JudgeGoPage(p_txtNumName, p_PageCount){ 
	var m_ret = true;
	var m_toPage = document.getElementById(p_txtNumName);
	if ( m_toPage.value == '' ) { 
		spaceAlert({msg:'抱歉，转到的页数不能为空，请重新输入!'});
		m_toPage.focus(); 
		m_ret = false;
	} else if( parseInt(m_toPage.value)<1 || parseInt(m_toPage.value)>p_PageCount ) { 
		spaceAlert({msg:'抱歉，只能输入1至'+p_PageCount+'的整数，请重新输入！'});
		m_toPage.focus();
		m_ret = false;
	}
	return m_ret;
}