var bUseVQQPlayer = false;//是否使用VQQPlayer控件
var bRandomPlay = false;//是否随机播放
var bMusicLoaded=false;
var qusicName;
var idAutoPlay;

var dlServerList = new Array();
dlServerList[0] = "219.133.62.235";
dlServerList[1] = "219.133.62.236";
dlServerList[2] = "219.133.62.247";
dlServerList[3] = "219.133.62.248";

// blog.js
function diaryShowUp(iType)
{
	if(iType == 1)
		document.write("<font color = 'red'>[顶]</font>");
}
function getDiaryTypeString(id)
{
	var diaryType=new Array("大杂烩","个性签名","个人日记","天下杂侃","情感天地","休闲搞笑","原创文学","影音数码","体育博彩","游戏动漫","衣食住行");
	if(id > 0 && id < 11)
		return diaryType[id];
	else if(id == 21)
		return "投&nbsp;&nbsp;&nbsp;&nbsp;票";
	else if(id == 101)
		return "偶像评论";
}
function getDiaryType(id)
{
	var diaryType=new Array("大杂烩","个性签名","个人日记","天下杂侃","情感天地","休闲搞笑","原创文学","影音数码","体育博彩","游戏动漫","衣食住行");
	if(id > 0 && id < 11)
		document.write(diaryType[id]);
	else if(id == 21)
		document.write("投&nbsp;&nbsp;&nbsp;&nbsp;票");
	else if(id == 101)
		document.write("偶像评论");
}

function formatReplace(srcString) {
	var regstr = new RegExp("\n", "g");
	srcString=srcString.replace(regstr, "<br>");
	var regstr = new RegExp(" ", "g");
	srcString=srcString.replace(regstr, "&nbsp;");
	return srcString;
}

function htmlReplace(srcString) {
	var regstr = new RegExp("<", "g");
	srcString=srcString.replace(regstr, "&lt;");

	regstr = new RegExp(">", "g");
	srcString=srcString.replace(regstr, "&gt;");
	
	return srcString;
}

function picsize(obj,MaxWidth,MaxHeight){
  img=new Image();
  img.src=obj.src;
if (img.width>MaxWidth && img.height>MaxHeight){
	if (img.width/img.height>MaxWidth/MaxHeight) {
		obj.height=MaxWidth*img.height/img.width;
		obj.width=MaxWidth;
	}else {
		obj.width=MaxHeight*img.width/img.height;
		obj.height=MaxHeight;
	}
}else if (img.width>MaxWidth) {
	obj.height=MaxWidth*img.height/img.width;
	obj.width=MaxWidth;
}else if (img.height>MaxHeight) {
	obj.width=MaxHeight*img.width/img.height;
	obj.height=MaxHeight;
}else{
		obj.width=img.width;
		obj.height=img.height;
}
}


function ubbReplace(srcString, replacewhat) {
	 srcString = htmlReplace(srcString);
	 srcString = formatReplace(srcString);

	//<a> replace em label
	if(replacewhat.indexOf('a') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[em\\]e([0-9]{1,3})\\[\\/em\\]", "g");
		srcString = srcString.replace(regstr, "<img src='http://imgcache.qq.com/qzone/em/e$1.gif'width='20' height='20' hspace='3' vspace='3' align='absmiddle'>");
	}
	//<b> replace url label
	if(replacewhat.indexOf('b') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[url\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/url\\]", "g");
		srcString = srcString.replace(regstr, "<a href='$1' target='_blank'>$1</a>");

		var regstr = new RegExp("\\[url=([\u2E80-\u9FFFa-z0-9:_\\/\\-A-Z\\ ,.]{1,})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/url\\]", "g");
		srcString = srcString.replace(regstr, "<a href='$2' target='_blank'>$1</a>");
	}
	//<c> replace img label
	if(replacewhat.indexOf('c') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[img\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/img\\]", "g");
		srcString = srcString.replace(regstr, "<a href='$1' target='_blank'><img onload='picsize(this,450,750)' onmouseover='picsize(this,450,750)' src='$1' border='0'><a> ");
	}
	 //<d> replace flash label
	if(replacewhat.indexOf('d') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[flash,([0-9]{1,3}),([0-9]{1,3})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?~&=\%/+;\/]{1,})\\[\\/flash\\]", "g");
		srcString = srcString.replace(regstr, "<EMBED menu='false' src='$3' width='$1' height='$2'>");
		var regstr = new RegExp("\\[flasht,([0-9]{1,4}),([0-9]{1,4}),([0-9]{1,4}),([0-9]{1,4})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?~&=\%/+;\/]{1,})\\[\\/flasht\\]", "g");	
		srcString = srcString.replace(regstr, "<param name='wmode' value='transparent'><EMBED menu='false' src='$5' width='$1' height='$2' type=application/octet-stream wmode='transparent' quality='high' style='position: absolute; left: $3; top: $4'></EMBED>");

	  var regstr = new RegExp("\\[flash\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&~=\%/+;\/]{1,})\\[\\/flash\\]", "g");
		srcString = srcString.replace(regstr, "<EMBED menu='false' src='$1'>");
	}
	 //<e> replace video label
	if(replacewhat.indexOf('e') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[video,([0-9]{1,3}),([0-9]{1,3}),([truefals]{4,5}),([truefals]{4,5})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/video\\]", "g");
		srcString = srcString.replace(regstr, "<EMBED enableContextMenu='False' src='$5' width='$1' height='$2' loop = '$3' autostart='$4'>");
		var regstr = new RegExp("\\[video,([truefals]{4,5}),([truefals]{4,5})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/video\\]", "g");
		srcString = srcString.replace(regstr, "<EMBED enableContextMenu='False' src='$3' loop = '$1' autostart='$2'>");

	}

	 //<f> replace audio label
	if(replacewhat.indexOf('f') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[audio,([truefals]{4,5}),([truefals]{4,5}),([invisible]{7,9})\\]([\u2E80-\u9FFF0-9a-zA-Z.:_\\-?&=\%/+;\/]{1,})\\[\\/audio\\]", "g");
		srcString = srcString.replace(regstr, "<EMBED src='$4' loop= '$1' autostart='$2' uiMode='invisible'>");
	}
	//<g> replace quote label
	if(replacewhat.indexOf('g') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[quote\\]", "g");
		srcString = srcString.replace(regstr, "<DIV class=pback STYLE='MARGIN:5PX 20PX'><font color=red>以下为引用:</font><br>");
		var regstr = new RegExp("\\[\\/quote\\]", "g");
		srcString = srcString.replace(regstr, "<br> </DIV>");
	}

	//<h>  replace font label
	if(replacewhat.indexOf('h') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[ftc=([a-zA-z#0-9]{1,10})\\]", "g");
		srcString = srcString.replace(regstr, "<font color='$1'>");
		var regstr = new RegExp("\\[fts=([1-6]{1,1})\\]", "g");
		srcString = srcString.replace(regstr, "<font size='$1'>");
		var regstr = new RegExp("\\[ftf=([\u4E00-\u9FFFa-zA-Z_0-9\\,\\ ]{1,})\\]", "g");
		srcString = srcString.replace(regstr, "<font face='$1'>");		
		var regstr = new RegExp("\\[ffg,([a-zA-z#0-9]{1,10}),([a-zA-z#0-9]{1,10})\\]", "g");
		srcString = srcString.replace(regstr, '<font style="filter: glow(color=$1,strength=3); height:10px; color:$2; padding:1px">');
		var regstr = new RegExp("\\[/ft\\]", "g");
		srcString = srcString.replace(regstr, "</font>");	
		
	}

	//<i> replace email label
	if(replacewhat.indexOf('i') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[email\\]([0-9a-zA-Z._@\\@-]{1,})\\[\\/email\\]", "g");
		srcString = srcString.replace(regstr, "<a href='mailto:$1' target='_blank'>$1</a>");
		var regstr = new RegExp("\\[email=([\u4E00-\u9FFFa-zA-Z\\ ,.]{1,})\\]([0-9a-zA-Z._@\\@-]{1,})\\[\\/email\\]", "g");
		srcString = srcString.replace(regstr, "<a href='mailto:$2' target='_blank'>$1</a>");
	}

	//<j> replace font style
	if(replacewhat.indexOf('j') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[B\\]", "g");
		srcString = srcString.replace(regstr, "<B>");

		var regstr = new RegExp("\\[\\/B\\]", "g");
		srcString = srcString.replace(regstr, "</B>");

		var regstr = new RegExp("\\[M\\]", "g");
		srcString = srcString.replace(regstr, "<center>");

		var regstr = new RegExp("\\[\\/M\\]", "g");
		srcString = srcString.replace(regstr, "</center>");

		var regstr = new RegExp("\\[R\\]", "g");
		srcString = srcString.replace(regstr, "<center style='text-align: right'>");

		var regstr = new RegExp("\\[\\/R\\]", "g");
		srcString = srcString.replace(regstr, "</center>");

		var regstr = new RegExp("\\[U\\]", "g");
		srcString = srcString.replace(regstr, "<U>");

		var regstr = new RegExp("\\[\\/U\\]", "g");
		srcString = srcString.replace(regstr, "</U>");

		var regstr = new RegExp("\\[I\\]", "g");
		srcString = srcString.replace(regstr, "<I>");

		var regstr = new RegExp("\\[\\/I\\]", "g");
		srcString = srcString.replace(regstr, "</I>");
	}
	//<k> replace marquee style
	if(replacewhat.indexOf('k') != -1 || replacewhat == 'all')
	{
		var regstr = new RegExp("\\[marque\\]", "g");
		srcString = srcString.replace(regstr, "<marquee>");

		var regstr = new RegExp("\\[\\/marque\\]", "g");
		srcString = srcString.replace(regstr, "</marquee>");
	}

	return srcString;
}

function ubbDel(srcString) {
	 srcString = htmlReplace(srcString);


		var regstr = new RegExp("\\[em\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/em\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[url\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/url\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[img\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/img\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[flash,([0-9]{1,3}),([0-9]{1,3})\\]", "g");
		srcString = srcString.replace(regstr, "");
			var regstr = new RegExp("\\[flash,([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})\\]", "g");
		srcString = srcString.replace(regstr, "");
	  var regstr = new RegExp("\\[flash\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/flash\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[video,([0-9]{1,3}),([0-9]{1,3}),([truefals]{4,5}),([truefals]{4,5})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[video,([truefals]{4,5}),([truefals]{4,5})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/video\\]", "g");
		srcString = srcString.replace(regstr, "");




		var regstr = new RegExp("\\[audio,([truefals]{4,5}),([truefals]{4,5}),([invisible]{7,9})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/audio\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[quote\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/quote\\]", "g");
		srcString = srcString.replace(regstr, "");



		var regstr = new RegExp("\\[ftc=([a-zA-z#0-9]{1,10})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[ffg,([a-zA-z#0-9]{1,10}),([a-zA-z#0-9]{1,10})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[fts=([1-6]{1,1})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[ftf=([\u4E00-\u9FFFa-zA-Z_0-9\\,\\ ]{1,})\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[\\/ft\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[email\\]", "g");
		srcString = srcString.replace(regstr, "");
		var regstr = new RegExp("\\[email=([\u4E00-\u9FFFa-zA-Z\\ ,.]{1,})\\]", "g");
		srcString = srcString.replace(regstr, "");
			var regstr = new RegExp("\\[\\/email\\]", "g");
		srcString = srcString.replace(regstr, "");



		var regstr = new RegExp("\\[B\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[\\/B\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[center\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[\\/center\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[U\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[\\/U\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[I\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[\\/I\\]", "g");
		srcString = srcString.replace(regstr, "");


		var regstr = new RegExp("\\[marque\\]", "g");
		srcString = srcString.replace(regstr, "");

		var regstr = new RegExp("\\[\\/marque\\]", "g");
		srcString = srcString.replace(regstr, "");


	return srcString;
}


function ubbOutput(obj)
{
	var srcString = obj.value;
	srcString = formatReplace(srcString);
	srcString = ubbReplace(srcString,'aa');
	document.write(srcString);
}

function  showSign(srcString)
{
	if(srcString != "" && srcString.length>3)
  {
	 	srcString = ubbReplace(srcString, 'abchij');
		document.write('<hr align="center" width="95%" size="0" noshade class="linet">');
	 	document.write(srcString);
	}
}

function showBrief(srcString)
{
	if(srcString != "NOBRIEF " && srcString != " ")
	{
		srcString = htmlReplace(srcString);
	 	srcString = formatReplace(srcString);
	 	document.write(srcString);
	}
}

////////////////////////////////////////////////////
//检查输入值是否为integer,flag表示是否可以包含+-号
function checkInteger(object_value,flag){
    if (object_value.length == 0)return true;
	var decimal_format = ".";
	var check_char;
	check_char = object_value.indexOf(decimal_format);
    if (check_char < 1)
		return checkNumber(object_value,flag);
    else
		return false;
}
////////////////////////////////////////////////////////
//检查输入值是否为数字，flag为1时不允许包含正负号
function checkNumber(object_value,flag){
    if (object_value.length == 0)return true;
	var start_format;
	if (flag == 0)
		start_format = " .+-0123456789";
	else
		start_format = ".0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;
    //The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(object_value.charAt(0))
    //Was it a decimal?
	if (check_char == 0)
	    return false;//decimal = true; Can not be decimal;
	else if (check_char < 1)
		return false;
		else if (check_char <4 && object_value.length == 1)
			return false;
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < object_value.length; i++){
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1){
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}else if (check_char == 0){
			if (decimal || digits)
				trailing_blank = true;// ignore leading blanks
		}else if (trailing_blank)
			return false;
		else
			digits = true;
	}//All tests passed, so...
    return true;
}

function goStaticpage(formname,allNum,goNum,url)
{

var gopage=new Number(goNum);
var allpage=new Number(allNum);

	if(gopage<=0 || gopage>allpage)
	{
		alert('对不起，您输入的页面超过了有效范围，请重新输入！');
		return false;
	}
	formname.action=url;
	return true;
}

function havePic(id)
{
	if(id%2 != 0)
	{
		document.write("[<font color='#FF0000'>图</font>]");
	}
}

function newopen()
{
	var url_1="/cgi-bin/photo/cgi_show_upload2";
	window.open(url_1,"","scrollbars=no,height=320,width=500");
}

function showAnswerTimes(id)
{
	if(id > 0)
	{
		document.write("<font color='#FF0000'>"+id+"</font>");
	}
	else
	{
		document.write(id);
	}
}

function showVisitTimes(id)
{
	if(id > 100)
	{
		document.write("<font color='#FF0000'>"+id+"</font>");
	}
	else
	{
		document.write(id);
	}
}

var INT_MAX_LENGTH = 14;

////////////////////////////////////////////////
//校验输入的特殊字符
function validateSpe(value){
	for (var i = 0; i < value.length; i++){
	  	if (//(value.charAt (i) == '\"')
	     	//|| (value.charAt (i) == '^')
	   	((value.charAt(i)>'&')&&(value.charAt(i)<'('))   //"'"
	     	//||((value.charAt(i)>'[')&&(value.charAt(i)<']')) //"\"
	     	//|| (value.charAt (i) == '/')
	     	//|| (value.charAt (i) == '&')
	     	//|| (value.charAt (i) == '#')
	     	//|| (value.charAt (i) == '$')
	     	//|| (value.charAt (i) == '%')
	     	//|| (value.charAt (i) == '|')
	     	//|| (value.charAt (i) == '+')
	     	//|| (value.charAt (i) == '*')
	     	|| (value.charAt (i) == '<')
	     	|| (value.charAt (i) == '>')
	     	)
  		return false;
 	}
 	return true;
}

////////////////////////////////////////////////////
//检查输入值是否为integer,flag表示是否可以包含+-号
function checkInteger(object_value,flag){
    if (object_value.length == 0)return true;
	var decimal_format = ".";
	var check_char;
	check_char = object_value.indexOf(decimal_format);
    if (check_char < 1)
		return checkNumber(object_value,flag);
    else
		return false;
}
////////////////////////////////////////////////////////
//检查输入值是否为数字，flag为1时不允许包含正负号
function checkNumber(object_value,flag){
    if (object_value.length == 0)return true;
	var start_format;
	if (flag == 0)
		start_format = " .+-0123456789";
	else
		start_format = ".0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;
    //The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(object_value.charAt(0))
    //Was it a decimal?
	if (check_char == 0)
	    return false;//decimal = true; Can not be decimal;
	else if (check_char < 1)
		return false;
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < object_value.length; i++){
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1){
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}else if (check_char == 0){
			if (decimal || digits)
				trailing_blank = true;// ignore leading blanks
		}else if (trailing_blank)
			return false;
		else
			digits = true;
	}//All tests passed, so...
    return true;
}

/////////////////////////////////////////
// check mail address format
function isMailAddress(address){
	var j=0;
	if(address == '')return false;
	if(address.length < 3)return false;//only: a@b
	if(hasBlank(address))return false;
	if(address.indexOf('@') >= 1){
		for(var i=0; i<address.length; i++){
			if(address.charAt(i)=='@')j++;
		}
		if(j>1)return false;
		if( (address.charAt(0)=='@') || (address.charAt(address.length-1)=='@') ){
			return false;//leading and last character cannot be @
		}else{
			if(!validateSpe(address)){
				return false;
			}
			return true;
		}
	}else{
		return false;
	}
	return true;
}


/////////////////////////////////////
//检查输入值中是否有空格
function hasBlank(value){
	var i = 0;
	for(var j=0; j<value.length; j++){
		if(value.charAt(j)==' ')i++;
	}
	if(i==0){
		return false;//no blank
	}
	return true;//blank
}

/*ubb function*/
var ubbtexta, ubbtextb, ubbtextc;
function ubbtietu(contentObj)
{
	ubbtexta = prompt("请输入图片的地址","http://");
  if(ubbtexta == null)
		return;
	ubbtextb = "[img]"+ubbtexta+"[\/img]";
	contentObj = eval(contentObj);
	contentObj.value += ubbtextb;
	//diary_form.content.value += ubbtextb;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}

function ubbfont(ftype, obj)
{
	ubbtexta = prompt("请输入文字","");
  if(ubbtexta == null || ubbtexta=="" || ubbtexta == '')
		return;
	ubbtextb = "["+ftype+"]"+ubbtexta+"[\/"+ftype+"]";
	obj=eval(obj);
	obj.value += ubbtextb;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}
function ubbselectfont(ftype,objselect, objconnect)
{
	ubbtexta = prompt("请输入文字","");
	if(ubbtexta == null || ubbtexta == "" || ubbtexta == '')
		return;
	objselect=eval(objselect);
	objconnect=eval(objconnect);
	ubbtextb=objselect.value;
	if(ftype == "face")
	{
		ubbtextb="[ftf="+ubbtextb+"]"+ubbtexta+"[/ft]"
	}
	else if(ftype == "size")
	{
		ubbtextb="[fts="+ubbtextb+"]"+ubbtexta+"[/ft]"
	}
	else if(ftype == "color")
	{
		ubbtextb="[ftc="+ubbtextb+"]"+ubbtexta+"[/ft]"
	}
	else
	{
		return;
	}
	objconnect.value += ubbtextb;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}

function ubbhyperlink(obj)
{
	ubbtexta = prompt("请输入链接要显示的文字,只能包含中文,英文字母,或中英文混合","请点击这里");
	ubbtextb = prompt("请输入URL地址","http://");
  if(ubbtextb == null)
		return;
	if(ubbtexta == null || ubbtexta == "" || ubbtexta == '')
	{
		ubbtextc = "[url]"+ubbtextb+"[\/url]";
	}
	else
	{
		ubbtextc = "[url="+ubbtexta+"]"+ubbtextb+"[\/url]";
	}
	obj=eval(obj);
	obj.value += ubbtextc;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}
function ubbemail(obj)
{
	ubbtexta = prompt("请输入链接要显示的文字,只能包含中文,英文字母,或中英文混合","请发email给我");
 	ubbtextb = prompt("请输入email地址","abc@abc.com");
	if(ubbtextb == "abc@abc.com" || ubbtextb == null || !isMailAddress(ubbtextb))
	{
		return;
	}
	else
	{
		if(ubbtexta == null || ubbtexta == "" || ubbtexta == '')
		{
			ubbtextc = "[email]" + ubbtextb + "[/email]";
	  }
		else
		{
			ubbtextc = "[email="+ubbtexta+"]" + ubbtextb + "[/email]";
		}
	}
	obj=eval(obj);
	obj.value += ubbtextc;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}

function ubbflash(obj)
{
	ubbtexta = prompt("请输入Flash的URL地址","http://");
	ubbtextb = prompt("请输入Flash高度和宽度","350,200");
  if(ubbtexta == null)
		return;
	ubbtextb = "[flash,"+ubbtextb+"]"+ubbtexta+"[\/flash]";
	obj=eval(obj);
	obj.value += ubbtextb;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}
function ubbquote(obj)
{
	obj=eval(obj);
	ubbtexta = obj.value;
	ubbtextb = "[quote]"+ubbtexta+"[/quote]";
	diary_form.content.value = ubbtextb;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}
function ubbvideo(obj)
{
	var autostart = "true";
	ubbtexta = prompt("请输入视频文件地址","");
	if(ubbtexta == null || ubbtexta == "" || ubbtexta == '')
		return;
	ubbtextb = prompt("请输入视频文件显示大小","350,200");
	if(ubbtextb == null || ubbtextb == "" || ubbtextb == '')
	{
		ubbtextb = "350,200";
	}
	ubbtextc = prompt("请输入是否自动播放,默认为自动播放(yes自动，no不自动播放）","yes");
	{
		if(ubbtextc != "yes")
			autostart = "false";
	}
	var strvideo = "[embed,"+ubbtextb+","+autostart+"]"+ubbtexta+"[/embed]";
	obj=eval(obj);
	obj.value += strvideo;
	ubbtexta = ""; ubbtextb = ""; ubbtextc = "";
}

function ubbvideom(obj)
{
	var str;
	var surl, size, vheight, vwidth, vauto, vloop;
	obj=eval(obj);
	var val= showModalDialog("/client/blog/ubbpage/video.htm", "", "dialogWidth:360px;dialogHeight:225px;status:no;help:no");
		if(!val)
			return;
	surl = val[0], size=val[1], vheight=val[2], vwidth=val[3],vauto=val[4], vloop=val[5];
	if(vauto != 'true')
		vauto = 'false';
	if(vloop != 'true')
		vloop = 'false';
	if(surl == null || surl == '' || surl == undefined)
		return;
	if(size == 'auto')
	{
		str = "[video,"+vauto+","+vloop+"]"+surl+"[/video]";
		obj.value += str;
	}
	else if(size == 'define')
	{
		if(!checkInteger(vheight,1) || !checkInteger(vwidth,1))
			return;
		str = "[video,"+vwidth+","+vheight+","+vauto+","+vloop+"]"+surl+"[/video]";
		obj.value += str;
	}
	else
	{
		return;
	}
}

function ubbflashm(obj)
{
	var str;
	var surl, size, vheight, vwidth, tflash, tleft,ttop;
	obj=eval(obj);
	var val= showModalDialog("/client/blog/ubbpage/flash.htm", "", "dialogWidth:360px;dialogHeight:250px;status:no;help:no");
		if(!val)
			return;
	surl = val[0], size=val[1], vheight=val[2], vwidth=val[3], tflash=val[4], tleft=val[5], ttop=val[6];
	if(surl == null || surl == '' || surl == undefined)
		return;
	if(tflash == false)
	{
		if(size == 'auto')
		{
			str = "[flash]"+surl+"[/flash]";
			obj.value += str;
		}
		else if(size == 'define')
		{
			if(!checkInteger(vheight,1) || !checkInteger(vwidth,1) || !(vheight) || !(vwidth))
				return;
			str = "[flash,"+vwidth+","+vheight+"]"+surl+"[/flash]";
			obj.value += str;
		}
	}
	else
	{
		if(!checkInteger(tleft,1) || !checkInteger(ttop,1) || !(ttop) || !(tleft))
				return;
		if(size == 'auto')
		{
			str = "[flasht,350,300,"+tleft+","+ttop+"]"+surl+"[/flasht]";
			obj.value += str;
		}
		else if(size == 'define')
		{
			if(!checkInteger(vheight,1) || !checkInteger(vwidth,1) || !(vheight) || !(vwidth))
				return;
			str = "[flasht,"+vwidth+","+vheight+","+tleft+","+ttop+"]"+surl+"[/flasht]";
			obj.value += str;
		}
	}
	return;
	
}
function ubbaudiom(obj)
{
	var str;
	var surl, vauto, vloop, vshow;
	obj=eval(obj);
	var val= showModalDialog("/client/blog/ubbpage/audio.htm", "", "dialogWidth:360px;dialogHeight:170px;status:no;help:no");
		if(!val)
			return;
	surl = val[0], vauto=val[1], vloop=val[2]; vshow=val[3];
	if(vauto != 'true')
		vauto = 'false';
	if(vloop != 'true')
		vloop = 'false';
	if(vshow != 'true')
		vshow = 'invisible';
	else
		vshow = 'visible';

	if(surl == null || surl == '' || surl == undefined)
		return;
	str = "[audio,"+vauto+","+vloop+","+vshow+"]"+surl+"[/audio]";
	obj.value += str;
}

function ubbfacem(obj)
{
	var str;
	obj=eval(obj);
	var val= showModalDialog("/client/blog/ubbpage/face.htm", "", "dialogWidth:360px;dialogHeight:190px;status:no;help:no");
		if(!val)
			return;
		val = "[em]e"+val+"[/em]";
	obj.value += val;
}

function ubbpicturem(obj)
{
	var str;
	var val= showModalDialog("/client/blog/ubbpage/picture_inc.htm", obj, "dialogWidth:380px;dialogHeight:210px;status:no;help:no");
		if(!val)
			return;
		val = "[img]"+val+"[/img]";
	obj.value += val;
}

function ubbcolorm(obj)
{
	var str, ffg;
	obj=eval(obj);
	var val= showModalDialog("http://imgcache.qq.com/qzone/client/color.htm", "", "dialogWidth:360px;dialogHeight:150px;status:no;help:no");
	if(!val)
		return;
	ubbtexta = prompt("请输入文字","");
	if(ubbtexta == null || ubbtexta == "" || ubbtexta == '')
		return;
	str = val[0], ffg = val[1];
	if(ffg == true)
		str = "[ffg,#"+str+",#FFFFFF]"+ubbtexta+"[/ft]";
	else
		str = "[ftc=#"+str+"]"+ubbtexta+"[/ft]";
	obj.value += str;
}

function openUserSpaceDiary(sUin, sUrl)
{
	var openUrl = "http://q-zone.qq.com/client/?uin="+sUin+"&url="+escape(sUrl);
    if (getCookie("clientver") == "")
        window.open(openUrl, "space", "width=925,height=655,scrollbars=yes");
    else
        window.top.location=openUrl;
}
// common.js
function contheight (sName)
{
	if (parent.document.all[sName]!=null) {
		parent.document.all[sName].style.height = document.body.scrollHeight;
	}
}

function setFileCookie(name,value)
{
	var expires=new Date();
	expires.setTime(expires.getTime()+10*12*30*24*3600*1000);
	document.cookie = name + "=" + value + ";expires="+expires.toGMTString()+"; path=/; domain=qq.com";
}

function setCookie(name,value)
{
	document.cookie = name + "=" + value + "; path=/; domain=qq.com";
}

function getCookie(name)
{
	var search;
	search = name + "=";
	offset = document.cookie.indexOf(search);
	if (offset != -1) {
		offset += search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
	}
	else
		return "";
}

function deleteCookie(name)
{
  setCookie(name, "");
}

function GetHistoryUrl()
{
	var str = "";
	str += window.location;
	var url;
	if (str.lastIndexOf("?") == str.length -1)
	{
		url = str.slice(0, -1);
	}
	else
	{
		url = str;
	}
	return url;
}

function Click()
{
	window.event.returnValue = false;
}

/*******************************
	判断是否是ASCII字符
*/
function IsAscii(ch)
{
	if(ch > 0 && ch <= 255)
	{
		return true;
	}
	else
	{
		return false;
	}
}
/*******************************
	字符串长度，返回的是字符的长度。一个汉字的长度为2
*/
function StrLenOfAscii(str)
{
	var str_len;
	str_len = 0;
	for(var i=0;i<str.length;i++)
	{
		if(IsAscii(str.charCodeAt(i)))
		{
			str_len += 1;
		}
		else
		{
			str_len += 2;
		}
	}
	return str_len;
}
/**********************************************************
	根据需要的长度将字符串截断
	input : str要截断的字符串 length要截断的长度
	output: 截断后的字符串。
	如果截断后字符串长度比要求的大一，则末尾为一个英文字母加一个汉字的形式，将后面的汉字截掉
	如...d号＝＝》...d ，以保证长度不超长
*/
function TruncateStr(str,length)
{
	var len,idx;
	len = 0;
	idx = 0;
	if(length>=StrLenOfAscii(str)) return str;
	var str_result = "";
	length=length-1;
	while (len < length)
	{
		str_result += str.charAt(idx);
		if(IsAscii(str.charCodeAt(idx)))
		{
			len += 1;
		}
		else
		{
			len += 2;
		}
		idx += 1;
	}
	if(len > length)
	{
		str_result = str_result.substr(0,str_result.length-1);
	}

	return str_result+".";
}

function replaceVal(sHtml, sName, sValue)
{
	var aParamName;
	var sParamValue;
	var aSplit;
	var length;
	var i;
	var reg = new RegExp("{"+sName+"(.[0-9]+){0,1}}", "g");

	aParamName= sHtml.match(reg);
	if (aParamName == null) {
		return sHtml;
	}
	for (i=0; i<aParamName.length; i++)
	{
		aSplit = aParamName[i].split(".");
		if (aSplit.length > 1) {
			// 需要截断到指定长度的
			length = new Number(aSplit[1].replace("}",""));
			sParamValue = TruncateStr(sValue,length);
		}
		else {
			// 显示全部
			sParamValue = sValue;
		}

		sHtml= sHtml.replace(aParamName[i], sParamValue);
	}
	return sHtml;
}


//功能：扩展日期函数，支持YYYY-MM-DD或YYYY-MMDD hh:mm:ss字符串格式
//返回：如果正确，则返回javascript中支持UTC日期格式，如果错误，则返回false
//举例： var myDate = Date_Ex("2004-12-21 23:01:00"); //返回正确的日期
//       var myDate = Date_Ex("2004-12-21");     //返回正确的日期
//       var myDate = Date_Ex("2004-23-12 12:60:29");//返回false，且提示日期或时间超出有效范围
function Date_Ex(value1)
{
	var strDate = value1;
	if (strDate.length == 0)
		return false;

	//先判断是否为短日期格式：YYYY-MM-DD，如果是，将其后面加上00:00:00，转换为YYYY-MM-DD hh:mm:ss格式
	var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/;   //短日期格式的正则表达式
	var r = strDate.match(reg);

	if (r != null)   //说明strDate是短日期格式，改造成长日期格式
		strDate = strDate + " 00:00:00";

	reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})/;
	r = strDate.match(reg);
	if (r == null)
	{
		alert("你输入的日期格式有误，正确格式为：2004-12-01 或 2004-12-01 12:23:45");
		return false;
	}

	var d = new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);
	return d;
}

/**
 按照URL参数的格式解析 szQueryString，解析的结果存放在一个ARRAY里面，可以直接用名字索引到值
 **/
function query_string_parse(szQueryString)
{
	var g_QueryArray= new Array();
	var iStart = 0;
	var iFrom = 0;
	var iPos;

	var regstr = new RegExp("&amp;", "g");
	szQueryString = szQueryString.replace(regstr, "&");

	while (iFrom < szQueryString.length)
	{
		iPos = szQueryString.indexOf('=', iFrom);
		if (iPos < 0) {
			break;
		}
		szName = szQueryString.substring(iFrom, iPos);
		iFrom = iPos+1;

		iPos = szQueryString.indexOf('&', iFrom);
		if (iPos < 0) {
			iPos = szQueryString.length;
		}
		szValue = szQueryString.substring(iFrom, iPos);
		iFrom = iPos+1;

		g_QueryArray[szName] = szValue;
	}
	return g_QueryArray;
}
/**  网页上显示用户资料信息
 **/
function printSex(sex)
{
	if (sex=='1')
		document.write("男");
	else if (sex=='2')
		document.write("女");
	else document.write("");
}

function printAstro (astro)
{
	switch (astro) {
		case -1:
			document.write(""); break;
		case 0:
			document.write("白羊座"); break;
		case 1:
			document.write("金牛座"); break;
		case 2:
			document.write("双子座"); break;
		case 3:
			document.write("巨蟹座"); break;
		case 4:
			document.write("狮子座"); break;
		case 5:
			document.write("处女座"); break;
		case 6:
			document.write("天秤座"); break;
		case 7:
			document.write("天蝎座"); break;
		case 8:
			document.write("射手座"); break;
		case 9:
			document.write("魔羯座"); break;
		case 10:
			document.write("水瓶座"); break;
		case 11:
			document.write("双鱼座"); break;
	}
}
function printBloodType(btype)
{
	switch (btype) {
		case -1:
			document.write(""); break;
		case 0:
			document.write("O型"); break;
		case 1:
			document.write("A型"); break;
		case 2:
			document.write("B型"); break;
		case 3:
			document.write("AB型"); break;
		default:
			document.write("其它");
	}
}

function printBirthday(birthday)
{
	var bir = Date_Ex(birthday);
	var year = bir.getFullYear();
	var month = bir.getMonth()+1;
	var date = bir.getDate();
	if (year == 1899 && month == 11 && date == 30)
		document.write("");
	else
		document.write(year+"年"+month+"月"+date+"日");
}


function displayAstro (astro)
{
	switch (astro) {
		case -1:
			return "";
		case 0:
			return "白羊座";
		case 1:
			return "金牛座";
		case 2:
			return "双子座"; 
		case 3:
			return "巨蟹座";
		case 4:
			return "狮子座";
		case 5:
			return "处女座";
		case 6:
			return "天秤座";
		case 7:
			return "天蝎座";
		case 8:
			return "射手座";
		case 9:
			return "魔羯座";
		case 10:
			return "水瓶座";
		case 11:
			return "双鱼座";
	}
}
function displayBloodType(btype)
{
	switch (btype) {
		case -1:
			return ""; 
		case 0:
			return "O型"; 
		case 1:
			return "A型"; 
		case 2:
			return "B型"; 
		case 3:
			return "AB型";
		default:
			return "其它";
	}
}

function displayBirthday(birthday)
{
 	var subDate;

	if (birthday == "")
	{		
		return "";
	}

 	subDate = getSubDate(birthday);

 	return subDate[0]+"年"+subDate[1]+"月"+subDate[2]+"日";
}

function displayIdolHeight(id)
{
	if (id <=0)
		 return "";
	else
		return id+"厘米";
}

function displayIdolWeight(id)
{
	if (id <=0)
		return "";
	else
		return id+"公斤";
}

function printAge(age)
{
	ivar = parseInt(age);
	if (!ivar)
		document.write("");
	else	if (ivar == -1)
				document.write("");
			else
				document.write(ivar);
}
function printFavor(favorstr, objform)
{
	var favorlist= favorstr.split("|");
	var favorid;
	for (len=0; len<favorlist.length; len++) {
		if (favorlist[len]== "") continue;
		favorid= parseInt(favorlist[len]);
		if (favorid > 19) break;
		if (len > 0)
			document.write("、");
		document.write(objform.elements[favorid].name);
	}
}

function openUserSpaceAlbum(sUin, sUrl) {
	var openUrl = "http://q-zone.qq.com/client/?uin="+sUin+"&url="+escape(sUrl);
    if (getCookie("clientver") == "")
        window.open(openUrl, "space", "width=925,height=655");
    else
        window.top.location=openUrl;
}

function openUserSpace(uin)
{
	var openUrl = "index.asp?Jauid="+uin;
	alert(openUrl);
	//if (parseInt(uin)==10)
	//{
	//	alert("该用户使用了隐身草道具，真实身份已被隐藏");
	//	return;
	//}    
	if (getCookie("clientver") == ""){
		alert("OK");
        window.open(openUrl, "space", "width=925,height=655");}
    else{ alert("NO");
        window.top.location=openUrl;}

}

function addFavorUin(uin)
{
	var openUrl = "/cgi-bin/favor/cgi_add_favor?other_uin="+uin;
	window.hidentarget.location=openUrl;
}
/* 打开用户的家园 */
function openUserHome(uin) {
	bt(6);
	tall('迷你屋','thome','http://home.qq.com/home/initial.shtml?author=tencent&uin='+g_iUin);
}

function openBlogUrl(sUrl) {
	bt(2);
	g_aParams["url"]= sUrl;
	tall("日志", "blogd", "/client/tblog.shtml");
}

function openAlbum(albumid) {
	var sUrl = "/cgi-bin/photo/cgi_photo_bigview_s?uin="+window.top.g_iUin+"&albumid="+albumid;
	bt(5);
	g_aParams["url"]= sUrl;
	tall("相册", "photod", "/client/tphoto.shtml");
}

function openAlbumUrl(sUrl){
	bt(5);
	g_aParams["url"] = sUrl;
	tall("相册", "photod", "/client/tphoto.shtml");
}

function openMusicUrl(sUrl){
	bt(3);
	g_aParams["url"] = sUrl;
	tall("音乐盒", "musicd", "/client/tmusic.shtml");
}

function avoidEscapeChar(varstr, charstr)
{
	var invalid_str="";
	for (i=0; i<charstr.length; i++) {
		if (varstr.indexOf(charstr.charAt(i)) >=0)
		{
			invalid_str += charstr.charAt(i)+" ";
		}
	}
	return invalid_str;
}
/* 检查表单中是否有特殊字符
 */
function checkFormValue (objForm) {
	var invalid_str="";
	var test_str="'\"<>\\";
	for (var len=0; len<objForm.elements.length; len++)
	{
		if (objForm.elements[len].type == "text") {
			invalid_str +=avoidEscapeChar(objForm.elements[len].value, test_str);

		}
		else if (objForm.elements[len].type == "textarea") {
			invalid_str +=avoidEscapeChar(objForm.elements[len].value, test_str);
		}
		if (invalid_str != "") {
			alert("请不要在输入中包含 " + invalid_str + "等字符。");
			objForm.elements[len].focus();
			objForm.elements[len].select();
			return false;
		}
	}
	return true;
}
/* 不允许输入'script'*/
function scriptFilter(str) {
	var reg= new RegExp("script", "gi");
	if (str.match(reg)) return null;
	else return str;
}
// data.js
var aName=new Array();
var aId=new Array();
var aPreUrl=new Array();
var aPicUrl=new Array();
var Aid;
var g_hasPlant=0;
function getElementText(doc, xpath) {
	var retval = "";
	if (!doc) return "";
	var v = doc.selectSingleNode(xpath);
	if (v) {
		retval = v.text;
	}
	return retval;
}
function diyWndReplace(str){
	var regstr = new RegExp("meta", "gi");
	srcString=str.replace(regstr, "&m;");
	var regstr = new RegExp("cookie", "g");
	srcString=srcString.replace(regstr, "&c;");
	var regstr = new RegExp("Location", "gi");
	srcString=srcString.replace(regstr, "&o;");
	var regstr = new RegExp("craker", "gi");
	srcString=srcString.replace(regstr, "&i;");
	return srcString;
	}
function scriptFind(str){
	var reg = new RegExp("Location|onload|meta|iframe|cookie|craker|innerHTML|object", "gi");
	var returnStr = str.match(reg);
	return returnStr;
}
function init() {
	g_FlowerXDoc= LoadXMLData(3);
	LoadXMLData(0, start);
	floatinitial();
}

function start() {
	var xDoc= LoadXMLData(0);
	g_DataXDoc= xDoc; // 原来的商城需要黄钻标识
	g_StyleID= getElementText(xDoc,"/data/style");
	if (g_StyleID== 0) g_StyleID=1;
	setCSS(g_StyleID);
	document.onkeydown= DocumentOnKeyDown;
	document.onkeyup= DocumentOnKeyUp;
	document.ondblclick= LayerOnClick;
	showRigItems();
	if (bIndex) addSystemWindows();
	document.all["loading"].innerHTML="";
}
function leaveEditMode() {
	if (g_EditFlag==1) {
		if (confirm("需要保存修改后的方案吗？")) {
			saveScenario();
			return 1;
		}
		else {
			g_EditFlag= 0;
		}
	}
	if (g_EditMode !=0) return 0;
	g_EditFlag= 0;

	document.all.dset.style.visibility= "hidden";
	for (var i=0; i < g_WndArray.length; i++) {
		g_WndArray[i].remove();
	}
	g_WndArray.length= 0;
	initd.innerHTML= "";
	g_EditMode=1;
	showRigItems();
	addSystemWindows();
	clean();
	return 0;
}

function enterEditMode() {
	mallFlag=1;
	if (g_EditFlag==1) {
		if (confirm("需要保存修改后的方案吗？")) {
			saveScenario();
			return 1;
		}
		else {
			g_EditFlag= 0;
		}
	}

	if (g_EditMode ==0) return 0;
	document.all.dset.style.visibility="visible";
	for (var i=0; i < g_WndArray.length; i++) {
		g_WndArray[i].remove();
	}
	g_WndArray.length= 0;
	initd.innerHTML= "";
	g_EditMode=0;
	showRigItems();
	addSystemWindows();
	DIYsys(helpZY);
	return 0;
}

function setScenarioNo (no) {
	var xDoc= LoadXMLData(0);
	var value= xDoc.selectSingleNode("/data/scenari_no");
	if (value) {
		value.text= no;
	}
}

function deleteArrayElement(objArray, idx) {
	objArray.splice(idx, 1);
}

/** 取自定义用户窗口属性
*/
function getDIYWindowProperty(id, prop) {
	var xDoc= LoadXMLData(0);
	return getElementText(xDoc, "/data/windows/window["+id+"]/"+prop);
}

function saveScenario() {
	if (g_EditFlag==0) {
		alert("方案无修改");
	}
	else {
		clsDate = new Date();
		var xDoc= LoadXMLData(0);
		sUrl= "/cgi-bin/mall/cgi_save?item_list="+encodeWindows()+"&change_scenario=1" +
			"&scenari_no="+ getElementText(xDoc,"/data/scenari_no") +"&styleid="+
			top.g_StyleID + "&PcacheTime="+clsDate.getTime();
		tall('保存方案','save', sUrl);
		mallFlag=0;
	}
}

function encodeWindows() {
	var sWndStr= "";
	var s_FlowerPot= false;
	for (i=0; i<g_WndArray.length; i++) {
		if (!g_WndArray[i].alive) continue;
		type = parseInt(g_WndArray[i].type);
		switch (type) {
			case 1: // 皮肤
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_0_0_0_0_"+ g_WndArray[i].imgtype;
				break;
		}
	}
	for (i=0; i<g_WndArray.length; i++) {
		if (!g_WndArray[i].alive) continue;
		type = parseInt(g_WndArray[i].type);
		switch (type) {
			case 2:  // 挂件
			case 3:  // banner
			case 6:  // 播放器
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_"
					+ g_WndArray[i].div.style.pixelLeft + "_"
					+ g_WndArray[i].div.style.pixelTop + "_"
					+ g_WndArray[i].div.style.pixelWidth + "_"
					+ g_WndArray[i].div.style.pixelHeight + "_"
					+ g_WndArray[i].div.style.zindex;
				break;
			case 4: // 鼠标方案
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_0_0_0_0_0";
				break;
			case 5: // 飘浮物
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_0_"
					+ g_WndArray[i].mode + "_"
					+ g_WndArray[i].num + "_0_0";
				break;
			case 7: // 花藤
				if (s_FlowerPot) break;
				s_FlowerPot= true;
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_0_0_0_"+GFflag+"_"+flowerDis;
				break;
			case 8: // 个性标志
			case 11: // 大头贴（大）
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_0_0_0_0_0";
				break;
			case 12:  // 公告栏
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_"
					+ g_WndArray[i].div.style.pixelLeft + "_"
					+ g_WndArray[i].div.style.pixelTop + "_"
					+ g_WndArray[i].div.style.pixelWidth + "_"
					+ g_WndArray[i].div.style.pixelHeight + "_"
					+ g_WndArray[i].div.style.zindex;
				pubX=g_WndArray[i].div.style.pixelLeft;
				pubY=g_WndArray[i].div.style.pixelTop;
				break;
		}
	}

	for (i=0; i<g_WndArray.length; i++) {
		if (!g_WndArray[i].alive) continue;
		type = parseInt(g_WndArray[i].type);
		switch (type) {
			case 97: // 系统层(小)
			case 98: // 系统层(大)
			case 99: // 用户自定义层
				if (sWndStr != "") sWndStr += "|";
				sWndStr +=  g_WndArray[i].type + "_"
					+ g_WndArray[i].itemno + "_"
					+ g_WndArray[i].div.style.pixelLeft + "_"
					+ g_WndArray[i].div.style.pixelTop + "_"
					+ g_WndArray[i].div.style.pixelWidth + "_"
					+ g_WndArray[i].div.style.pixelHeight + "_"
					+ g_WndArray[i].div.style.zindex;
				break;
		}
	}
	return sWndStr;
}

function getDynamicXmlData(itemno, callback) {
	var sUrl= "";
	switch (itemno) {
		case 0: // 装扮方案
		case 1: // 心情日记
		case 2: // 留言本
		case 3: // 用户资料
		case 4: // 互动
		case 8: // 花藤
			sUrl+= "/fcg-bin/cgi_access_self.fcg?uin="+top.g_iUin+"&type="+itemno;
			break;
		case 5: // 相册
			sUrl+= "/cgi-bin/photo/cgi_mini_photo?uin="+top.g_iUin;
			break;
		case 7: // 音乐盒
			sUrl="/cgi-bin/music/cgi_musicbig_xml?uin="+top.g_iUin;
			break;
		case 9: //新版音乐盒首页
			sUrl="/cgi-bin/music/cgi_musicmain_xml?uin="+top.g_iUin;
			break;
		case 10: // 音乐播放列表, 不要使用该分类
			sUrl="/cgi-bin/music/cgi_playlist_xml?uin="+top.g_iUin;
			break;
		case 11: // 自定义窗口
			sUrl+="/fcg-bin/cgi_diy_window.fcg?uin="+top.g_iUin+"&type=11&wndid="+Ditemnos;
			break;
		case 12: // 公告栏
			sUrl+="/cgi-bin/user/cgi_pboardxml_showmsg?typeid=12&uin="+top.g_iUin;
			break;
		case 13: //偶像
			sUrl+="/cgi-bin/music/cgi_musicidol_xml?uin="+top.g_iUin;
			break;
		case 14: //音乐排行榜
			sUrl+="/cgi-bin/music/cgi_ranklist_xml?uin="+top.g_iUin;
			break;
		case 15: //音乐收藏
			sUrl+="/cgi-bin/music/cgi_musicalbum_xml?uin="+top.g_iUin;
			break;
		case 16: //相册
			sUrl="http://q-zone.qq.com/cgi-bin/photo/cgi_album_xml?uin="+top.g_iUin;
			break;
		case 17: //用户所有的歌曲列表
			sUrl="http://q-zone.qq.com/cgi-bin/music/cgi_music_songxml?uin="+top.g_iUin;
			break;
		default:
			return null;
	}
	cgi_loader.loadXMLAsync(itemno, sUrl, callback);
}


function getsid(iUin) {
	return (iUin%5+1);
}

function getStaticXmlData(itemno, callback, err_callback) {
	var sUrl;
	if (itemno == 9||itemno ==13||itemno==14||itemno==15) itemno= 7; // 小音乐盒还是用大音乐盒的数据
	sUrl= "/"+g_iUin+"/"+itemno;

	return loader.loadXMLAsync(itemno, sUrl, callback, err_callback);
}

function RefreshXMLData(type) {
	g_XDoc[type]= null;
	g_StaticMode= 0xFFFFFFFF; // load dynamic data source
	return LoadXMLData(type);
}

function LoadXMLData(itemno, callback) {
	if ((g_XDoc[itemno]) && (g_XDoc[itemno].xml!="")) {
		if (LoadXMLData.arguments.length >=2) {
			callback();
		}
		return g_XDoc[itemno];
	}
	if ((1<<(31-itemno))&g_StaticMode) {
		getDynamicXmlData(itemno, callback);
	}
	else {
		var err_callback= function() {
			getDynamicXmlData(itemno, callback);
		}
		getStaticXmlData(itemno, callback, err_callback);
	}
	return g_XDoc[itemno];
}

function addSystemWindows() {
	var xDoc= LoadXMLData(0);
	var diyWnds= xDoc.selectNodes("/data/windows/window");
	Ditemnos=0;
	for (var i=0; i<diyWnds.length; i++) {
		addSystemWindow( parseInt(getDIYWindowProperty(i, "type")),
			parseInt(getDIYWindowProperty(i, "itemno")),
			parseInt(getDIYWindowProperty(i, "posx")),
			parseInt(getDIYWindowProperty(i, "posy")),
			parseInt(getDIYWindowProperty(i, "width")),
			parseInt(getDIYWindowProperty(i, "height")),
			parseInt(getDIYWindowProperty(i, "zindex")) );
		if (parseInt(getDIYWindowProperty(i, "type"))==99)
			Ditemnos+=parseInt(getDIYWindowProperty(i, "itemno"))+"|";
	}
	if (Ditemnos!="") {
		Ditemnos= Ditemnos.substring(0,Ditemnos.length-1);
		LoadXMLData(11, setSelfWndContent);
	}
	setSystemWindowsContent();
}

function showSystemWindows()
{
	addSystemWindows();
}

function setSystemWindowsContent()
{
	for (var i=0; i<g_WndArray.length; i++) {
		setWindowContent(i);
	}
}
/** 设置自定义窗口的内容
*/
function setSelfWndContent() {
	var hWnd;
	for (var i=0; i<g_WndArray.length; i++) {
		hWnd= g_WndArray[i];
		if (hWnd.type ==99) tSelf(i, hWnd.itemno);
	}
}

/**  设置系统窗口的内容
*/
function setWindowContent(hId) {
	var hWnd= g_WndArray[hId];
	if (hWnd.type == 97) { // 小系统窗口
		switch (hWnd.itemno) {
			case 1:
				LoadXMLData(3, new Function("minfo("+hId+")"));
				break;
			case 2:
				LoadXMLData(1, new Function("mblog("+hId+")"));
				break;
			case 3:
				LoadXMLData(4, new Function("malt("+hId+")"));
				break;
			case 4:
				LoadXMLData(5, new Function("mphoto("+hId+")"));
				break;
			case 5:
				LoadXMLData(13, new Function("mmusic("+hId+")"));
				break;
			case 6:
				mhome(hId);
				break;
			case 7:
				LoadXMLData(2, new Function("mgb("+hId+")"));
				break;
			case 8:
				LoadXMLData(13, new Function("idol("+hId+")"));
				break;
			case 9:
				LoadXMLData(14, new Function("rank("+hId+")"));
				break;
			case 10:
				LoadXMLData(15, new Function("coll("+hId+")"));
				break;
		}
		return;
	}
	if(hWnd.type == 98) {  // 大系统窗口
		switch (hWnd.itemno) {
			case 1:
				LoadXMLData(3, new Function("binfo("+hId+")"));
				break;
			case 2:
				LoadXMLData(1, new Function("bblog("+hId+")"));
				break;
			case 3:
				LoadXMLData(4, new Function("balt("+hId+")"));
				break;
			case 4:
				LoadXMLData(5, new Function("bphoto("+hId+")"));
				break;
			case 5:
				LoadXMLData(7, new Function("bmusic("+hId+")"));
				break;
			case 6:
				bhome(hId);
				break;
			case 7:
				LoadXMLData(2, new Function("bgb("+hId+")"));
				break;
		}
		return;
	}
}
/////////取装扮属性//////////

function getRigProperty(id, prop) {
	var xDoc= LoadXMLData(0);
	return getElementText(xDoc, "/data/items/item[" + id + "]/" + prop);
}

function showRigItems() {
	var xDoc= LoadXMLData(0);
	var rigItems= xDoc.selectNodes("/data/items/item");
	var Ttype= new String();
	var Titemno = new String();
	var Tposx = new String();
	var Tposy = new String();
	var Twidth = new String();
	var Theight = new String();
	var Tzindex = new String();
  for (var i=0; i<rigItems.length; i++) {
		Ttype= parseInt(getRigProperty(i,"type"));
		Titemno= parseInt(getRigProperty(i,"itemno"));
		Tposx= parseInt(getRigProperty(i,"posx"));
		Tposy= parseInt(getRigProperty(i,"posy"));
		Twidth= parseInt(getRigProperty(i,"width"));
		Theight= parseInt(getRigProperty(i,"height"));
		Tzindex= parseInt(getRigProperty(i,"zindex"));
		if(Ttype==12&&pubkey==1){
			var pubDoc= LoadXMLData(12);
			pubItems= pubDoc.selectNodes("/data/item");
			for(var j=0; j<pubItems.length; j++){
				pubid[j]=pubDoc.selectSingleNode("/data/item[" + j + "]/id").text;
				pubmsg[j]=pubDoc.selectSingleNode("/data/item[" + j + "]/msg").text;
			}
			pubkey=0;
		}space_addItem(Ttype,Titemno,Tposx,Tposy,Twidth,Theight,Tzindex);
		if(Ttype==7) g_hasPlant=1;
	}
	//	if(hotkey!=1) makeHot();
}

//////////////////////////////取花藤属性////////////////////////
function showFloLevel() {
	var floItems= g_FlowerXDoc.selectSingleNode("/data/level");
	return floItems.text;
}
function showFloSun() {
	var floItems= g_FlowerXDoc.selectSingleNode("/data/sun");
	return floItems.text;
}
function showFloLove() {
	var floItems= g_FlowerXDoc.selectSingleNode("/data/love");
	return floItems.text;
}
function showFloRain() {
	var floItems= g_FlowerXDoc.selectSingleNode("/data/rain");
	return floItems.text;
}
function showFloNutri() {
	var floItems= g_FlowerXDoc.selectSingleNode("/data/nutri");
	return floItems.text;
}

function showGardener() {
	var floItems= top.g_FlowerXDoc.selectSingleNode("/data/gardener");
	return floItems.text;
}
function showMark() {
  var floItems= top.g_FlowerXDoc.selectSingleNode("/data/mark");
	if (floItems==null)
  return 7;
else
	return floItems.text;
}
function spx(ablumID){
	var px=LoadXMLData(16);
	var pxs= px.selectNodes("/data/album");
	//var id=pxs[0].getAttributeNode("id").text;
	//var aName=new Array();
	//var aPreUrl=new Array();
	//var aPicUrl=new Array();
for(i=0;i<pxs.length;i++){
	aName[i]=pxs[i].getAttributeNode("name").text
	aId[i]=pxs[i].getAttributeNode("id").text
	if(aId[i]==ablumID){
		var ps=px.selectNodes("/data/album["+i+"]/pic");
		for(j=0;j<ps.length;j++){
			aPreUrl[j]=ps[j].getAttributeNode("pre").text
			aPicUrl[j]=ps[j].getAttributeNode("url").text
			}
		}
	}

}


// date.js
function FillYearNew(yearID){
	var yearList=document.all(yearID);
	var oOption = document.createElement("OPTION");
		oOption.text="--";
		oOption.value="0000";
		oOption.selected=true;
		yearList.add(oOption);
	for(var I=1900;I<2025;I++){
		var oOption = document.createElement("OPTION");
		oOption.text=""+I;
		oOption.value=""+I;
		//if(I==1979)	oOption.selected=true;
		yearList.add(oOption);
	}
}

function FillMonthNew(monthID){
	var monthList=document.all(monthID);
	var oOption = document.createElement("OPTION");
	oOption.text="--";
	oOption.value="00";
	oOption.selected=true;
	monthList.add(oOption);
	for(var I=1;I<13;I++){
	var oOption = document.createElement("OPTION");
/*		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
*/			oOption.text=""+I;
			oOption.value=""+I;
/*		}
*/		monthList.add(oOption);
	}
}

function FillDayNew(dayID,maxDay){
	var count=document.all(dayID).length;
	for(var I=0;I<count;I++)
		document.all(dayID).remove(0);
	var oOption = document.createElement("OPTION");
	oOption.text = "--";
	oOption.value = "00";
	oOption.selected = true;
	document.all(dayID).add(oOption);
	for(var I=1;I<=maxDay;I++){
	var oOption = document.createElement("OPTION");
/*		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
*/			oOption.text=""+I;
			oOption.value=""+I;
/*		}*/
			
		document.all(dayID).add(oOption);
	}		
}

function YearChangeNew(yearID,monthID,dayID){
	document.all(monthID).selectedIndex=0;
	MonthChangeNew(yearID,monthID,dayID);
}

function MonthChangeNew(yearID,monthID,dayID){
	var nowYear=parseInt(document.all(yearID).value);
	var nowMonth=parseInt(document.all(monthID).value);
	var maxDay=30;
	
	if(IsLeapYear(nowYear)){
	 if (nowMonth==2)
		maxDay=29;	
	}else{
	 if (nowMonth==2)
		maxDay=28;	
	}
 	if((nowMonth==1) || (nowMonth==3) || (nowMonth==5) || (nowMonth==7) || (nowMonth==8) || (nowMonth==10) || (nowMonth==12))
		maxDay=31;
	FillDayNew(dayID,maxDay);
	document.all(dayID).selectedIndex=0;		
}
function FillYear(yearID){
	var yearList=document.all(yearID);
	for(var I=2005;I<2025;I++){
		var oOption = document.createElement("OPTION");
		oOption.text=""+I;
		oOption.value=""+I;
		if(I==1979)	oOption.selected=true;
		yearList.add(oOption);
	}
}



function FillMonth(monthID){
	var monthList=document.all(monthID);
	for(var I=1;I<13;I++){
	var oOption = document.createElement("OPTION");
		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
			oOption.text=""+I;
			oOption.value=""+I;
		}
		monthList.add(oOption);
	}
}

function FillDay(dayID,maxDay){
	var count=document.all(dayID).length;
	for(var I=0;I<count;I++)
		document.all(dayID).remove(0);
		
	for(var I=1;I<=maxDay;I++){
	var oOption = document.createElement("OPTION");
		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
			oOption.text=""+I;
			oOption.value=""+I;
		}
			
		document.all(dayID).add(oOption);
	}		
}
//FillYear in Dateing 2002-09-09 By sammi
function FillYearInDate(yearID){
	var yearList=document.all(yearID);
	mydate=new Date();
	myyear= mydate.getYear();
	for(var I=2002;I<=2015;I++){
		var oOption = document.createElement("OPTION");
		oOption.text=""+I;
		oOption.value=""+I;
		if((myyear+1)==new Number(I))	oOption.selected=true;
		yearList.add(oOption);
	}
}
function FillMonthInDate(monthID){
	var monthList=document.all(monthID);
	mydate=new Date();
	mymonth=mydate.getMonth()+1;	
	for(var I=1;I<13;I++){
	var oOption = document.createElement("OPTION");
		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
			oOption.text=""+I;
			oOption.value=""+I;
		}
		if((mymonth+1)==new Number(I))	oOption.selected=true;
		monthList.add(oOption);
	}
	
}
function FillDayInDate(dayID,maxDay){
	var count=document.all(dayID).length;
	mydate=new Date();
	mymonth=mydate.getMonth()+1;
	myday= mydate.getDate();		
	for(var I=0;I<count;I++)
		document.all(dayID).remove(0);
		
	for(var I=1;I<=maxDay;I++){
	var oOption = document.createElement("OPTION");
		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
			oOption.text=""+I;
			oOption.value=""+I;
		}		
		if((myday+5)==new Number(I))	oOption.selected=true;
		if( myday+5>30 )	
		{
			var selectName = document.FORM.month;
			for(var i=0;i<selectName.options.length;i++)
			{
				if(selectName.options[i].value==mymonth+1)
					selectName.options[i].selected=true;
			}   
		}
		document.all(dayID).add(oOption);
	}		
}
function FillDayInDate1(dayID,maxDay){
	var count=document.all(dayID).length;
	for(var I=0;I<count;I++)
		document.all(dayID).remove(0);
		
	for(var I=1;I<=maxDay;I++){
	var oOption = document.createElement("OPTION");
		if(I<10){
			oOption.text="0"+I;
			oOption.value="0"+I;
		}else{
			oOption.text=""+I;
			oOption.value=""+I;
		}
		mydate=new Date();
		myday= mydate.getDate();		
		if((myday+1)==new Number(I))	oOption.selected=true;
		document.all(dayID).add(oOption);
	}		
}

function YearChange(yearID,monthID,dayID){
	document.all(monthID).selectedIndex=0;
	MonthChange(yearID,monthID,dayID);
}

function MonthChange(yearID,monthID,dayID){
	var nowYear=parseInt(document.all(yearID).value);
	var nowMonth=parseInt(document.all(monthID).value);
	var maxDay=30;
	
	if(IsLeapYear(nowYear)){
	 if (nowMonth==2)
		maxDay=29;	
	}else{
	 if (nowMonth==2)
		maxDay=28;	
	}
 	if((nowMonth==1) || (nowMonth==3) || (nowMonth==5) || (nowMonth==7) || (document.all(monthID).value=='08') || (nowMonth==10) || (nowMonth==12))
		maxDay=31;
	FillDay(dayID,maxDay);
	document.all(dayID).selectedIndex=0;		
}

function GetNowDate(yearID,monthID,dayID){
	return document.all(yearID).value+document.all(monthID).value+document.all(dayID).value;
}
//when's format is YYYYMMDD
function ChangeDate(yearID,monthID,dayID,when){
	var str=new String(when);
	var year=str.substring(0,4);
	var month=str.substring(4,6);
	var day=str.substring(6,8);

	Find(yearID,year)
	Find(monthID,month)
	Find(dayID,day)
}	

function Find(id,value){
	for(var I=0;I<document.all(id).length;I++){
		if(document.all(id).options(I).value==value){
			document.all(id).selectedIndex=I;
			break;
		}
	}		
}

<!--- is the Year LeapYear? True is Leap --->
function IsLeapYear(Year) 
{
	if(Math.round(Year/4) == Year/4){
		if(Math.round(Year/100) == Year/100){
			if(Math.round(Year/400) == Year/400)
				return true;
			else return false;
		}else return true;
	}
	return false;
}

function FillAge(ageID){
	var ageList=document.all(ageID);
	var oOption = document.createElement("OPTION");
		oOption.text="--";
		oOption.value="-1";
		oOption.selected=true;
		ageList.add(oOption);
	for(var I=0;I<106;I++){
		var oOption = document.createElement("OPTION");
		oOption.text=""+I;
		oOption.value=""+I;
		//if(I==1979)	oOption.selected=true;
		ageList.add(oOption);
	}
}// js.js
var upok=0;var g_tempVal=[];
function bt(num){
	for (i=1;i<=8;i++)
	{
		top.eval("bt_"+i).style.background = "url('http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_off.gif')";
	}
	top.eval("bt_"+num).style.background = "url('http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_on.gif')";
}
function show(num,maxnum) {
	for (i=1;i<=maxnum;i++)
	{
	eval("i"+i).style.display="none";
	eval("b"+i).style.fontWeight="";
	}
	eval("i"+num).style.display="";
	eval("b"+num).style.fontWeight="bold";
}
function showm(num,maxnum,sUrl,sType) {
	for (i=1;i<=maxnum;i++)
	{
	eval("m"+i).style.color="#7D7D7D";
	}
	eval("m"+num).style.color="#DE7CA3";
	if (sUrl!="") {
		if (sType!="") mallinfo.tinfo.location=sUrl; 
		else mallinfo.location=sUrl;
	}
}
function tall(cname,ename,surl) {
	sAll='<table width="640" border="0" cellpadding="0" cellspacing="0"><tr>'
	sAll+='<td class="tl"></td><td class="title">'
	sAll+='<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> '
	sAll+=cname
	sAll+='</td><td align="right" class="title">'
	sAll+='&nbsp;'
	sAll+='</td><td class="tr"></td></tr></table>'
	sAll+='<table width="640" height="480"  border="0" cellpadding="0" cellspacing="1" class="out">'
	sAll+='<tr><td class="mm">'
	sAll+='<iframe name="'
	sAll+=ename
	sAll+='" id="'
	sAll+=ename
	sAll+='" width="100%" height="100%" allowTransparency="true" scrolling=yes border="0" frameborder="0" src="'
	sAll+=surl
	sAll+='">数据读取中…</iframe>'
	sAll+='</td></tr></table>'
	initd.innerHTML=sAll;
	sAll='';
}
function dPhoto(albumid){
	tph='<table width=100% height=100%  border=0 cellpadding=0 cellspacing=1 class=out><tr>'
	tph+='<td><iframe name=tphoto id=tphoto width=100% height=100% allowTransparency=true scrolling=yes border=0 frameborder=0 src="/client/photo/new_list.htm?'
	tph+=albumid
	tph+='">数据读取中…</iframe></td></tr></table>';
	top.initd.innerHTML=tph;	
}
function mall(sBig) {
	leaveEditMode();
	mallFlag=1;
	var mcn=1,mclass=new Array
	mclass[mcn++]=new Array("皮肤",10,false,'')
	mclass[mcn++]=new Array("小装饰",17,false,'')
	mclass[mcn++]=new Array("主题",42,false,'')
	mclass[mcn++]=new Array("酷炫DIY",55,false,'DIYplayer(helpZY)')
	mclass[mcn++]=new Array("养植物",58,false,'DIYflower(helpZY)')
	mclass[mcn++]=new Array("大头贴",29,false,'DIYphoto(helpZY)')
	mclass[mcn++]=new Array("迷你屋","http://home.qq.com/mall/mall.shtml",false,'')
	mclass[mcn++]=new Array("开通黄钻",'/client/mall/yellow.htm',true,'')
	mclass[mcn++]=new Array("活动","/client/mall/static/index.shtml",false,'')
	sAll='<table  width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">'
	sAll+='<tr><td colspan="4"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr>'
	sAll+='<td width="6" height="32" background="http://imgcache.qq.com/qzone/mall/m_t_l.gif"></td>'
	sAll+='<td class="mall_m"><font color="#6B6D6C">&nbsp;'
	mclassn=mclass.length-1;
	for (i=1;i<mclass.length;i++) 
	{
		sAll=sAll+'<span onclick="show('+i+','+mclassn+');'
		if (parseInt(mclass[i][1]) && (mclass[i][0]!="大头贴")&& (mclass[i][0]!="酷炫DIY")) sAll+="mallinfo.location='http://imgcache.qq.com/qzone/mall/static/itemlist_"+mclass[i][1]+"_1.htm'";
		else if (parseInt(mclass[i][1]) && (mclass[i][0]=="大头贴")) sAll+="mallinfo.location='http://q-zone.qq.com/client/mall/bigface.htm?http://imgcache.qq.com/qzone/mall/static/itemlist_"+mclass[i][1]+"_1.htm'";
		else if (parseInt(mclass[i][1]) && (mclass[i][0]=="酷炫DIY")) sAll+="mallinfo.location='http://q-zone.qq.com/client/mall/pub.htm?http://imgcache.qq.com/qzone/mall/static/itemlist_"+mclass[i][1]+"_1.htm'";
		else if ((mclass[i][0]=="活动")||(mclass[i][0]=="开通黄钻")) sAll+="mallinfo.location='"+mclass[i][1]+"'";
		else sAll+="window.open('"+mclass[i][1]+"')";
		if (mclass[i][3]!="") sAll+=';'+mclass[i][3];
		sAll+='" '
		sAll+=' id="b'+i+'" class="hand">'
		if (mclass[i][2]) sAll+='<font color=#FF0000><b>'+mclass[i][0]+'</b></font></span>';
		else sAll+=mclass[i][0]+'</span>';
		if (i<mclass.length-1) sAll+='|';
	}
	sAll+='</font></td>'
	sAll+='<td align="right" class="mall_m">'
	sAll+='<span class="button" onclick="myitem()" >'
	sAll+='<img src="http://imgcache.qq.com/qzone/mall/myitem.gif" hspace=2" border="0" alt="我的物品" align="absmiddle"></span>'
	sAll+='<span class="button" onclick="mallinfo.location='
	sAll+="'http://q-zone.qq.com/cgi-bin/user/cgi_query_balance?entry=client'"
	sAll+='">'
	sAll+='<img src="http://imgcache.qq.com/qzone/mall/mymoney.gif" hspace="2" border="0" alt="查询余额" align="absmiddle"></span>'
	sAll+='<img src="http://imgcache.qq.com/qzone/mall/gwc.gif" border="0" align="absmiddle" hspace="2" class=hand onclick="top.create_shopping_bag()"><img src="http://imgcache.qq.com/qzone/mall/save_bt.gif" border="0" align="absmiddle" hspace="2" class=hand onclick="top.saveMall()"></td>'
	sAll+='<td width="6" height="32" background="http://imgcache.qq.com/qzone/mall/m_t_r.gif"></td></tr></table></td></tr>'
	sAll+='<form name="form1" method="get" action="/cgi-bin/mall/cgi_search_item" target="mallinfo"><tr>'
	sAll+='<td width="450" height="20" valign="middle">'
	var dn=1,data=new Array
	data[dn++]=new Array("浪漫",11,1,'')
	data[dn++]=new Array("可爱",12,1,'')
	data[dn++]=new Array("另类",13,1,'')
	data[dn++]=new Array("简洁",18,1,'')
	data[dn++]=new Array("其他",40,1,'')	
	data[dn++]=new Array("浪漫",64,2,'')
	data[dn++]=new Array("可爱",69,2,'')
	data[dn++]=new Array("搞怪",66,2,'')
	data[dn++]=new Array("酷炫",70,2,'')
	data[dn++]=new Array("礼品",68,2,'')
	data[dn++]=new Array("心情",65,2,'')
	data[dn++]=new Array("情侣",53,3,'')
	data[dn++]=new Array("星座生肖",42,3,'')
	data[dn++]=new Array("塔罗",44,3,'')
	data[dn++]=new Array("车",46,3,'')
	data[dn++]=new Array("QQ族",47,3,'')
	data[dn++]=new Array("影视",54,3,'')
	data[dn++]=new Array("成人",80,3,'')
	data[dn++]=new Array("特卖",81,3,'')
	//data[dn++]=new Array("个性logo",35,4,'DIYlogo(helpZY)')
	data[dn++]=new Array("公告栏",55,4,'')
	data[dn++]=new Array("播放器",51,4,'DIYplayer(helpZY)')
	data[dn++]=new Array("1级植物",58,5,'')
	data[dn++]=new Array("2级植物",59,5,'')
	data[dn++]=new Array("3级植物",60,5,'')
	data[dn++]=new Array("4级植物",61,5,'')
	data[dn++]=new Array("5级植物",62,5,'')
	data[dn++]=new Array("藏宝阁","/cgi-bin/prop/cgi_prop_treasure",5,'')
	data[dn++]=new Array("浪漫",71,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("搞怪",72,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("另类",73,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("其他",77,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("影视",74,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("封面",75,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("心情",79,6,'DIYphoto(helpZY)')
	data[dn++]=new Array("",0,7,'')
	data[dn++]=new Array("黄钻贵族专区",52,8,'')
	data[dn++]=new Array("黄钻贵族是什么",'/client/mall/yellow.htm',8,'')
	data[dn++]=new Array("",0,9,'')
	datan=data.length-1;
	for (n=1;n<mclass.length;n++){
		sAll+='<div id="i'+n+'" style="display:none">'
		for (i=1;i<data.length;i++) 
		{
			if ((data[i][2]==n) && (data[i][0]!="")){
				sAll+='<span class=mallt id="m'+i+'" onclick="'
				if (mclass[n][0]=="大头贴") sAll+="showm("+i+","+datan+",'http://imgcache.qq.com/qzone/mall/static/itemlist_"+data[i][1]+"_1.htm','photo')";
				else if (data[i][0]=="个性logo") sAll+="showm("+i+","+datan+",'http://q-zone.qq.com/client/mall/logo.htm?http://imgcache.qq.com/qzone/mall/static/itemlist_"+data[i][1]+"_1.htm','')";
				else if (data[i][0]=="公告栏") sAll+="showm("+i+","+datan+",'http://q-zone.qq.com/client/mall/pub.htm?http://imgcache.qq.com/qzone/mall/static/itemlist_"+data[i][1]+"_1.htm','')";
				else if (!parseInt(data[i][1])) sAll+="showm("+i+","+datan+",'"+data[i][1]+"','')";
				else sAll+="showm("+i+","+datan+",'http://imgcache.qq.com/qzone/mall/static/itemlist_"+data[i][1]+"_1.htm','')";
				if (data[i][3]!="") sAll+=";"+data[i][3];
				sAll+='">·'+data[i][0]+'</span>';
				if (mclass[n][0]=="养植物") k=1; else k=0;
			}else if ((data[i][2]==n) && (data[i][0]=="")) {
				sAll+='<span id="m'+i+'"></span>';
				k=1;
			}
		}
		if (k==0) sAll+='&nbsp;&nbsp;<img src="http://imgcache.qq.com/qzone/mall/mpmoney.gif" width="28" height="15" hspace="3" class=hand align="absmiddle" onclick="mpmoney()" alt="购买热门排序"><img src="http://imgcache.qq.com/qzone/mall/mptime.gif" width="24" height="15" hspace="3" class=hand align="absmiddle" onclick="mptime()" alt="上架时间排序">'
		sAll+='</div>'
	}
	sAll+='</td><td width="50" height="20" valign="middle"><select name="price">'
	sAll+='<option value="0" selected>价格不限</option>'
	sAll+='<option value="1">0.5Q币以下</option>'
	sAll+='<option value="2">0.5Q币以上</option>'
	sAll+='<option value="3">1 Q币以上</option>'
	sAll+='<option value="4">2 Q币以上</option>'
	sAll+='<option value="5">3 Q币以上</option>'
	sAll+='<option value="6">4 Q币以上</option>'
	sAll+='</select></td>'
	sAll+='<td width="50" valign="middle"><input name="item_name" type="text" size="10" maxlength="6" value="请输关键字"  onMouseDown="if(this.value == \'请输关键字\') this.value=\'\';"></td>'
	sAll+='<td width="60" align="center" valign="middle"><input type="image" src="http://imgcache.qq.com/qzone/mall/mall_00.gif" width="49" height="16" border="0" align="absmiddle"></td>'
	sAll+='</tr></form>'
	sAll+='<tr><td colspan="4"><iframe name="mallinfo" id="mallinfo" width="643" height="445" allowTransparency="true" scrolling=auto border="0" frameborder="0" src="'
	if(sBig==2){
	sAll+='http://imgcache.qq.com/qzone/mall/static/itemlist_51_1.htm';
	}else if(mall.arguments.length==0){
	sAll+='http://imgcache.qq.com/qzone/mall/static/itemlist_50_1.htm';
	}else{
    sAll+='http://q-zone.qq.com/client/mall/bigface.htm?http://imgcache.qq.com/qzone/mall/static/itemlist_29_1.htm?#'+sBig;
    sAll+='">数据读取中…</iframe></td></tr></table>'
		initd.innerHTML=sAll;
		sAll='';
    show(6,mclassn);
    return;
    }
	sAll+='">数据读取中…</iframe></td></tr></table>'
	initd.innerHTML=sAll;
	sAll='';
}

/////modify by justinyang (支付统一流程)(bag_list记录点击购买的)///////////////////////////////
//当type为0时不保存方案，为1时保存方案
function saveMall(){
	if (g_EditFlag==0) {
		alert("方案无修改");
	}
	else {
		clsDate = new Date();
		var xDoc= LoadXMLData(0);
		sUrl= "/cgi-bin/mall/cgi_save?item_list="+encodeWindows()+"&bag_list="+get_shopping_bag()+
			"&change_scenario=1"  + "&scenari_no="+ getElementText(xDoc,"/data/scenari_no") +"&styleid="+
				top.g_StyleID + "&PcacheTime="+clsDate.getTime();
		mallinfo.location= sUrl;
		mallFlag=0;
	}
}

function mpmoney(){
	mUrl=top.mallinfo.location.href;
	var str = mUrl.split("_");
	if (str[1]!="" && str[1]!=null) {
		if (str[1]!="desc"){
			sUrl=str[0]+"_desc_"+str[1]+"_"+str[2];
			top.mallinfo.location=sUrl;
		}
	}
} 

function mptime(){
	mUrl=top.mallinfo.location.href;
	var str = mUrl.split("_");
	if (str[1]!="" && str[1]!=null) {
		if (str[1]=="desc"){
			sUrl=str[0]+"_"+str[2]+"_"+str[3];
			mallinfo.location=sUrl;
		}
	}
} 

function guideButton (idx) {
	if (leaveEditMode() != 0) return;
	bt(idx);
	switch (idx) {
		case 1:
			clean();initd.innerHTML= ''; showSystemWindows(); break;
		case 2:
			clean();tall('日　志','tblog','/client/tblog.shtml?'+g_iUin); break;
		case 3:
			clean();tall('音乐盒','tmusic','/client/tmusic.shtml?uin='+g_iUin); 
			pdDIYmusic();
			break;
		case 4:
			clean();tall('留言板','tgb','/fcg-bin/cgi_blog_hostmsg.fcg?uin='+g_iUin); break;
		case 5:
			clean();tall('相　册','tphoto','/client/tphoto.shtml'); break;
		case 6:
			clean();tall('迷你屋','thome','http://home.qq.com/home/initial.shtml?author=tencent&uin='+g_iUin); break;
		case 7:
			clean();tall('个人信息','tinfo','http://q-zone.qq.com/fcg-bin/cgi_show_userinfo.fcg?uin='+g_iUin); break;
		case 8:
			clean();tall('互　动','thudong','http://q-zone.qq.com/fcg-bin/cgi_alternant.fcg?uin='+g_iUin); break;
	}
}

function changeStyle() {
	showModalDialog("http://q-zone.qq.com/client/module_css_inc.htm", window.top, "status:no;dialogWidth:360px;dialogHeight:270px;");
}

function module_set() {
	showModalDialog("http://q-zone.qq.com/client/module_set_inc.htm", window.top, "scroll:no;status:no;dialogWidth:324px;dialogHeight:275px;");
}
function module_pub(itemno) {
	if(pubid.length==0)
		var msgmix=itemno+"|"+"请您输入文字";
	else{
	for(i=0;i<pubid.length;i++){
		if(itemno==pubid[i])
		var msgmix=itemno+"|"+pubmsg[i].substring(4);
		}
	}
	if(msgmix==undefined) msgmix=itemno+"|"+"请您输入文字";
	showModalDialog("http://q-zone.qq.com/client/module_pubset_inc.htm", msgmix, "scroll:no;status:no;dialogWidth:324px;dialogHeight:240px;");
}

function module_add(wndid) {
	var para= new Array(window.top, wndid);
	showModalDialog("http://q-zone.qq.com/client/module_add_inc.htm", para, "status:no;dialogWidth:324px;dialogHeight:305px;");
}

function module_modify(wndid, wnditemid) {
	var para= new Array(window.top, wndid, wnditemid);
	showModalDialog("http://q-zone.qq.com/client/module_modify_inc.htm", para, "status:no;dialogWidth:324px;dialogHeight:305px;");
}

function module_uphoto(abID){
			showModalDialog("http://q-zone.qq.com/cgi-bin/photo/cgi_show_upload_multi?albumid="+abID, window.top, "scroll:no;status:no;dialogWidth:750px;dialogHeight:600px;");
		}
function module_reload(wndid) {
	var i=findWndElement(99, wndid);
	if (i<0) {
		alert("找不到自定义层"+wndid); return;
	}
	w= g_WndArray[i].div.style.pixelWidth;
	h= g_WndArray[i].div.style.pixelHeight;
	x= g_WndArray[i].div.style.pixelLeft;
	y= g_WndArray[i].div.style.pixelTop;
	top.deleteWindowByTypeAndItemno(99, wndid);RefreshXMLData(wndid);
	top.addWindow(99, wndid, x, y, w, h, 200);
}

function module_del(wndid, itemid) {
	hidentarget.location="http://q-zone.qq.com/cgi-bin/user/cgi_del_diywnd_item?wndid="+wndid+"&itemid="+itemid;
}

function module_new() {
	showModalDialog("http://q-zone.qq.com/client/module_new_inc.htm", window.top, "status:no;dialogWidth:324px;dialogHeight:305px");
}

function myitem(itemtype) {
	var sMyitem;
	sMyitem='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">'
	sMyitem+='<tr align="center">'
	sMyitem+='<td height="32" colspan="2"><table width="100%" height="29"  border="0" cellpadding="0" cellspacing="0"><tr>'
	sMyitem+='<td width="6" height="32" background="http://imgcache.qq.com/qzone/mall/m_t_l.gif"></td>'
	sMyitem+='<td class="mall_m">'
	sMyitem+='<font color="#ffffff"><b>·我的物品</b></font></td>'
	sMyitem+='<td class="mall_m" align="right"><font color="#6B6D6C">'
	var mcn=1,mclass=new Array
	mclass[mcn++]=new Array("道具","http://q-zone.qq.com/cgi-bin/prop/cgi_prop_usermain")
	mclass[mcn++]=new Array("皮肤",1)
	mclass[mcn++]=new Array("小装饰",2)
	mclass[mcn++]=new Array("酷炫DIY",6)
	mclass[mcn++]=new Array("植物","http://q-zone.qq.com/cgi-bin/mall/cgi_show_userflower")
	mclass[mcn++]=new Array("大头贴",'/cgi-bin/mall/cgi_useritem_big')
	mclass[mcn++]=new Array("迷你屋","http://home.qq.com/mall/mall.shtml")
	mclassn=mclass.length-1;
	for (i=1;i<mclass.length;i++) 
	{
		sMyitem+='<span onclick="show('+i+','+mclassn+');'
		if (parseInt(mclass[i][1]) && (mclass[i][0]!="大头贴")) sMyitem+="mallinfo.location='/cgi-bin/mall/cgi_show_useritem?type_id="+mclass[i][1]+"'";
		else if (mclass[i][0]=="大头贴") sMyitem+="mallinfo.location='"+mclass[i][1]+"'";
		else if (mclass[i][0]=="植物" || mclass[i][0]=="道具") sMyitem+="mallinfo.location='"+mclass[i][1]+"'";
		else if (mclass[i][0]=="迷你屋") sMyitem+="window.open('"+mclass[i][1]+"')";
		sMyitem+='" id="b'+i+'" class="hand">'+mclass[i][0]+'</span>';
		if (i<mclass.length-1) sMyitem+='|';
	}
	sMyitem+='<a href="javascript:top.saveScenario()" target="mallinfo">'
	sMyitem+='<img src="http://imgcache.qq.com/qzone/mall/save_bt.gif" width="76" height="19" border="0" align="absmiddle" hspace="6"></a></font></td>'
	sMyitem+='<td width="6" height="32" background="http://imgcache.qq.com/qzone/mall/m_t_r.gif"></td></tr></table></td>'
	sMyitem+='</tr><tr>'
	sMyitem+='<td width="300" height="20" valign="middle">'
	sMyitem+='</td>'
	sMyitem+='<td width="351" height="20" valign="middle">'
	var dn=1,data=new Array
	data[dn++]=new Array("挂件",2,3)
	data[dn++]=new Array("Banner",3,3)
	data[dn++]=new Array("鼠标",4,3)
	data[dn++]=new Array("漂浮物",5,3)
	data[dn++]=new Array("播放器",6,4)
	//data[dn++]=new Array("领养植物",7,3)
	//data[dn++]=new Array("个性logo",8,3)
	data[dn++]=new Array("公告栏",12,4)
	datan=data.length-1;
	for (n=1;n<mclass.length;n++){
		sMyitem+='<div id="i'+n+'" style="display:none">'
		for (i=1;i<data.length;i++) 
		{
			if ((data[i][2]==n) && (data[i][0]!="")){
				sMyitem+='<span class=mallt id="m'+i+'" onclick="'
				if (parseInt(data[i][1])) sMyitem+="showm("+i+","+datan+",'/cgi-bin/mall/cgi_show_useritem?type_id="+data[i][1]+"','')";
				else sMyitem+="showm("+i+","+datan+",'"+data[i][1]+"','')";
				sMyitem+='">·'+data[i][0]+'</span>';
			}else if ((data[i][2]==n) && (data[i][0]=="")) sMyitem+='<span id="m'+i+'"></span>';
		}
		sMyitem+='</div>'
	}
	sMyitem+='</td>'
	sMyitem+='</tr><tr>'
	sMyitem+='<td colspan="2" align="center" valign="top"><iframe name="mallinfo" id="mallinfo" width="643" height="445" allowTransparency="true" scrolling=no border="0" frameborder="0" src="'
	if (itemtype==7)
	{
		sMyitem+='/cgi-bin/mall/cgi_useritem_big';
	}
	else if (!itemtype)
	{
		sMyitem+='/cgi-bin/mall/cgi_show_useritem?type_id=1';
	}
	else
	{
		sMyitem+='/cgi-bin/mall/cgi_show_useritem?type_id='+itemtype;
	}
	sMyitem+='"></iframe></td>'
	sMyitem+='</tr></table>'
	initd.innerHTML=sMyitem;
}

function closeban() {
	for (i=0; i<=5; i++)
	{
		eval("i"+i).style.display="none";
	}
}

function showban(num) {
    closeban();
	eval("i"+num).style.display="";
}


function pdDIYmusic() {
	if (cookie_iuin == top.g_iUin){
	DIYmusic(helpZY);
	}
}
////////////begin/////////////////////支付统一流程(justinyang)/////////////////////////////////////////////
var g_item_bag = new Array();
function add_shopping_bag(itemid)
{
	var i;
	//当已经存在此item时不加入，保证数组值的唯一性
	for(i=0; i<g_item_bag.length; i++)
	{
		if(g_item_bag[i] == itemid)
		{
			return false;
		}
	}
	
	g_item_bag[g_item_bag.length] = itemid;
	return true;
}
//检查itemid是否在数组里
function check_shopping_bag(itemid)
{
	var i;
	
	for(i=0; i<g_item_bag.length; i++)
	{
		if(g_item_bag[i] == itemid)
		{
			return true;
		}
	}
	
	return false;
}

//从数组里移走itemid
function move_shopping_bag(itemid)
{
	var i;
	for(i=0; i<g_item_bag.length; i++)
	{
		if(g_item_bag[i] == itemid)
		{
			g_item_bag.splice(i,1);
			return true;
		}
	}
		
	return false;
}

//全部清除
function clear_shopping_bag()
{
	if(g_item_bag.length == 0)
		return false;
	
	g_item_bag.splice(0, g_item_bag.length);
		
	return true;
}

//组装数组
function get_shopping_bag()
{
	var str = '';
	
	for(i=0; i<g_item_bag.length; i++)
	{
		if(i == 0)
		{
			str = g_item_bag[i];
		}
		else
		{
			str = str+'|'+g_item_bag[i];
		}
	}
	
	return str;
}


//只供购物车点击调用
function create_shopping_bag()
{
	if (g_item_bag.length==0)
	{
		alert("您的购物车没有物品!");
	}
	else
	{
		clsDate = new Date();
		var xDoc= LoadXMLData(0);
		sUrl= "/cgi-bin/mall/cgi_save?item_list="+encodeWindows()+"&bag_list="+get_shopping_bag()+
			"&change_scenario=0"  + "&scenari_no="+ getElementText(xDoc,"/data/scenari_no") +"&styleid="+
				top.g_StyleID + "&PcacheTime="+clsDate.getTime();
		mallinfo.location= sUrl;
		mallFlag=0;
	}
}
/////////end//////////////////////支付统一流程(justinyang)/////////////////////////////////////////////////////////
function shmenu(obj){
	if (eval(obj).style.display){
		eval(obj).style.display=''
		eval(obj+"pic").src="http://imgcache.qq.com/qzone/client/bt_m_on.gif"
	}else{
		eval(obj).style.display='none'
		eval(obj+"pic").src="http://imgcache.qq.com/qzone/client/bt_m_off.gif" 
	}
}
// layers.js
var g_OO = null; // g_OperatingObject
var g_oldX, g_oldY;
var g_OT= 0; // g_OT
var g_Direction = null;
var g_CtrlPressed= false;


/** 鼠标移入层的事件回调
  */
function LayerOnMouseOver(obj) {
	if (g_OT!=0) return;

	g_OO= obj;
	if(g_OO.resiziable==true) {
		g_Direction= getDirection(obj);
		if (g_Direction != "") {
			g_OO.style.cursor= g_Direction + "-resize";
		}
	}
	g_OO.style.cursor="default";
	document.onmousemove= LayerOnMouseMove;
	top.g_type=obj.type;
	top.g_itemno=obj.itemno;
}

/** @note 鼠标移出层的事件回调
  */
function LayerOnMouseOut (obj) {
	if (g_OT!=0) return;
	document.oncontextmenu = function() {return false;}
	g_OO= null;
	document.onmousemove= null;
	document.oncontextmenu = function() {return false;}
	}

/** @note 鼠标在层上移动的事件回调
  */
function LayerOnMouseMove () {
	g_Direction= getDirection(g_OO);
	if (g_Direction != "") {
		g_OO.style.cursor= g_Direction + "-resize";
	}
	else {
		g_OO.style.cursor="default";
	}
}

function getDirection (el) {
	dir = "";
	xPos = event.x; yPos = event.y;
	objPosx = initd.style.pixelLeft - initd.scrollLeft - body.scrollLeft + el.style.pixelLeft + el.style.pixelWidth;
	objPosy = initd.style.pixelTop - initd.scrollTop - body.scrollTop + el.style.pixelTop + el.style.pixelHeight;

	offset = 5; //The distance from the edge in pixels
	if (Math.abs(xPos-objPosx) < offset) {
		dir= "e";
	} else if(Math.abs(yPos-objPosy) < offset) {
		dir= "s";
	}
	return dir;
}

/*  @note 开始对一个层的操作
	@note g_OT   == 1  移动
						    == 2  改变大小
						    == 3  删除 (在按住CTRL时进行)
 */
function LayerStartOperate()
{	if(event.button==1) {
		if (g_OO == null) return;
		g_OO.style.zIndex=100; // 把当前操作的层提到最上层
		/// 判断操作类型
		g_Direction= getDirection(g_OO);
		if (g_Direction != "") {
			g_OT= 2;
			if(g_OO.resiziable==true){
				document.onmousemove= LayerResize;
			}
		}
		else {
			g_OT= 1;
			document.onmousemove= LayerMoving;
			g_OO.style.cursor="move";
		}
		//-

		g_oldX= event.x;
		g_oldY= event.y;
		document.onmouseup= LayerEndOperate;
		// 禁止文字选择
		document.body.onselectstart = new Function("return false");
		return false;
	}
	else if (event.button==2&&g_type==2||event.button==2&&g_type==3||event.button==2&&g_type==12) {
		top.document.oncontextmenu = showmenuie5;
		top.document.onclick = hidemenuie5;
	}else {
		return false;
	}
}

/** @note 停止对一个层的操作
 */
function LayerEndOperate() {
	if (g_OT == 0) return false;
	g_OT= 0;
	document.onmousemove= null;

	g_OO.style.zIndex = 0;
	g_OO.style.cursor= "default";
	document.onmouseup= null;
	g_Direction= null;
	// 恢复文字选择
	document.body.onselectstart = null;
	return false;
}

/* @note 对层的点击
 */
function LayerOnClick() {
	if (g_EditMode !=0) return false;
	if (g_OO == null) return false;
	if (g_CtrlPressed == true) {
		var len= g_WndArray.length;
		for (var i=0; i < len; i++)
		{
			if ((g_WndArray[i].type == 99)&&(g_WndArray[i].div.id == g_OO.id)) {
				g_EditFlag = 1;
				deleteWindowByTypeAndItemno(99, g_WndArray[i].itemno);
				return false;
			}
		}
	}
	return false;
}

/*  @note 一个层的拖动
 */
function LayerMoving()
{
	if (g_OT != 1) return;
	g_OO.style.pixelLeft = g_OO.style.pixelLeft + (event.x- g_oldX);
	g_OO.style.pixelTop = g_OO.style.pixelTop + (event.y- g_oldY);
	g_oldX= event.x;
	g_oldY= event.y;
	top.g_EditFlag= 1;
}

/*  @note 一个层的改变大小
 */

function LayerResize()
{
	if (g_OT != 2) return;
	if (g_Direction == null) {
		window.status= "direction is null";
		return;
	}
	var  el,xPos, yPos, str, xMin, yMin, dir;
	xMin = 80; //The smallest width possible
	yMin = 80; //             height

	if (g_Direction.indexOf("e") != -1) {
		g_OO.style.pixelWidth= Math.max(xMin, g_OO.style.pixelWidth + event.x - g_oldX);
	}
	if (g_Direction.indexOf("s") != -1) {
		g_OO.style.pixelHeight = Math.max(yMin, g_OO.style.pixelHeight + event.y - g_oldY);
	}
	if (g_Direction.indexOf("w") != -1) {
		var temp= g_OO.style.pixelWidth-(event.x - g_oldX);
		if (temp>xMin) {
			g_OO.style.pixelLeft = g_OO.style.pixelLeft+event.x-g_oldX;
			g_OO.style.pixelWidth= Math.max(xMin, g_OO.style.pixelWidth-(event.x - g_oldX));
		}
	}
	if (g_Direction.indexOf("n") != -1) {
		var temp= g_OO.style.pixelHeight-(event.y - g_oldY);

		if (temp>yMin) {
			g_OO.style.pixelTop = g_OO.style.pixelTop+event.y-g_oldY;
			g_OO.style.pixelHeight = Math.max(yMin, g_OO.style.pixelHeight-(event.y - g_oldY));
		}
	}
	g_oldX= event.x;
	g_oldY= event.y;

	window.event.returnValue = false;
	window.event.cancelBubble = true;
	top.g_EditFlag= 1;
}



/** @note 键盘按下的事件
  */
function DocumentOnKeyDown() {
	switch (event.keyCode) {
		case 17: // CTRL
			if (cookie_iuin == top.g_iUin) g_CtrlPressed= true;
		break;
		case 74: // 'J'
			if (g_CtrlPressed) { // 进入编辑模式
				enterEditMode();
			}
		break;
		case 83: // 'S'
			if (g_EditMode==0) saveScenario();
		break;
		case 66: // 'b'
		guideButton(2)
		break;
		default: return true;
	}
	if (g_OO == null) return false;
	switch (event.keyCode) {
		case 39: // right arrow
			if (g_OT == 1)
				g_OO.style.pixelLeft = g_OO.style.pixelLeft + 1;
			else if (g_OT == 2)
				g_OO.style.pixelWidth = g_OO.style.pixelWidth + 1;
		break;
		case 37: // left arrow
			if (g_OT == 1)
				g_OO.style.pixelLeft = g_OO.style.pixelLeft - 1;
			else if (g_OT == 2)
				g_OO.style.pixelWidth = g_OO.style.pixelWidth - 1;
		break;
		case 38: // up arrow
			if (g_OT == 1)
				g_OO.style.pixelTop = g_OO.style.pixelTop - 1;
		break;
		case 40: // down arrow
			if (g_OT == 1)
				g_OO.style.pixelTop = g_OO.style.pixelTop + 1;
		break;
	}
	if (top.g_OT != 0) return false;
}

/** @note 键盘释放事件
  */
function DocumentOnKeyUp() {
	if (event.keyCode == 17) {
		g_CtrlPressed= false;
	}
	if (g_EditMode==0) return false;
}
// main.js
var cookie_iuin = parseInt(getCookie("zzpaneluin"));

/** 调整大小到指定的范围内
*/
function adjustSize(obj,w, h) {
	if ( (obj.width/obj.height) > (w/h) ) {
		if (obj.width>w) obj.style.width=w;
	}
	else {
		if (obj.height>h) obj.style.height=h;
	}
}

function bblog (hId)
{
	var list;
	blogXDoc= LoadXMLData(1);
	sBlog= "";
	sBlog+='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>';
	sBlog+='<td class="tl"></td>';
	sBlog+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(2)" style="cursor:hand">网络日志</span> </td>';
	sBlog+='<td align="right" class="title"><img onclick="guideButton(2)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>';
	sBlog+='<td class="tr"></td>';
	sBlog+='</tr><tr>';
	sBlog+='<td rowspan="6" class="ml"></td>';
	sBlog+='<td class="titleback">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openBlogUrl(\'/fcg-bin/cgi_blog_userlist.fcg?uin='+top.g_iUin+'\')" style="cursor:hand">最近发表</span></td>';
	sBlog+='<td align="right" class="titleback">'
	if (cookie_iuin == top.g_iUin)
	{
		sBlog+='<span onClick="openBlogUrl(\'/client/blog/tcont_edit.htm\')" style="cursor:hand"><img src="http://imgcache.qq.com/qzone/client/zy_rz.gif" align="absmiddle" border="0"></span>'
	}
	sBlog+='</td><td rowspan="6" class="mr"></td>';
	sBlog+='</tr><tr><td colspan="2" class="mm">';
	sBlog+='<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="70" align="center" valign="middle"><img src="http://imgcache.qq.com/qzone/client/b01.gif" width="54" height="48"></td><td><table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	list= blogXDoc.selectNodes("//data/lastadds");
	if(1>list.length)
	{
		if (cookie_iuin == top.g_iUin)
		{
			sBlog+='<tr><td width="100%" height="20" class="text"><span class="classs" onClick="openBlogUrl(\'/client/blog/tcont_edit.htm\')" style="cursor:hand">'
			sBlog+='您还没有网络日志，请点击“写日志”添加网络日志。</span></td></tr>'
			sBlog+='<tr><td class="line"></td></tr>'
			sBlog+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sBlog+='写网络日志，记录您生活的点滴，或发表喜欢的任意事情。</td></tr>'
		}
		else
		{
			sBlog+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sBlog+='此空间暂无网络日志。</td></tr>'
		}
		sBlog+='<tr><td class="line"></td></tr>'
	}
	else
	{
		for (i=0; i<list.length; i++) {
			sTypeName= getDiaryTypeString(htmlReplace(getElementText(list[i], "type")));
			sBlog+='<tr><td height="20"><span class="classs">·['+sTypeName+']</span><span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[i], ("url")))+'\')" '+htmlReplace(getElementText(list[i],"titleclass"))+' style="cursor:hand">'+TruncateStr(htmlReplace(getElementText(list[i], ("title"))),38)+'</span></td>'
			sBlog+='<td width="60" align="right">'+htmlReplace(getElementText(list[i], "visittime"))+'/<font color="#ff0000">'+htmlReplace(getElementText(list[i], "answertime"))+'</font>&nbsp;</td></tr>'
		}
	}
	sBlog+='</table></td></tr></table>'
		sBlog+='</td></tr><tr>'
		sBlog+='<td colspan="2" class="titleback">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openBlogUrl(\'/fcg-bin/cgi_blog_userlist.fcg?sorttype=lastanswer&uin='+top.g_iUin+'\')" style="cursor:hand">最近回复</span></td>'
		sBlog+='</tr><tr><td colspan="2" class="mm">'
		sBlog+='<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="70" align="center" valign="middle"><img src="http://imgcache.qq.com/qzone/client/b02.gif" width="54" height="48"></td><td><table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		list= blogXDoc.selectNodes("//data/lastanswers");
	for (i=0; i<list.length; i++) {
		sTypeName= getDiaryTypeString(htmlReplace(getElementText(list[i], "type")));
		sBlog+='<tr><td height="20"><span class="classs">·['+sTypeName+']</span><span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[i], ("url")))+'\')" '+htmlReplace(getElementText(list[i],"titleclass"))+' style="cursor:hand">'+TruncateStr(htmlReplace(getElementText(list[i], ("title"))),38)+'</span></td>'
			sBlog+='<td width="60" align="right">'+htmlReplace(getElementText(list[i], "visittime"))+'/<font color="#ff0000">'+htmlReplace(getElementText(list[i], "answertime"))+'</font>&nbsp;</td></tr>'
	}
	sBlog+='</table></td></tr></table>'
		sBlog+='</td></tr><tr>'
		sBlog+='<td colspan="2" class="titleback">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openBlogUrl(\'/fcg-bin/cgi_blog_userlist.fcg?sorttype=answer&uin='+top.g_iUin+'\')" style="cursor:hand">最热贴</span></td>'
		sBlog+='</tr><tr><td colspan="2" class="mm">'
		sBlog+='<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="70" align="center" valign="middle"><img src="http://imgcache.qq.com/qzone/client/b03.gif" width="54" height="48"></td><td><table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		list= blogXDoc.selectNodes("//data/hotanswers");
	for (i=0; i<list.length; i++) {
		sTypeName= getDiaryTypeString(htmlReplace(getElementText(list[i], ("type"))));
		sBlog+='<tr><td height="20"><span class="classs">·['+sTypeName+']</span><span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[i], ("url")))+'\')" '+htmlReplace(getElementText(list[i],"titleclass"))+' style="cursor:hand">'+TruncateStr(htmlReplace(getElementText(list[i], ("title"))),38)+'</span></td>'
			sBlog+='<td width="60" align="right">'+htmlReplace(getElementText(list[i], "visittime"))+'/<font color="#ff0000">'+htmlReplace(getElementText(list[i], "answertime"))+'</font>&nbsp;</td></tr>'
	}
	sBlog+='</table></td></tr></table>'
		sBlog+='</td></tr><tr>'
		sBlog+='<td class="dl"></td>'
		sBlog+='<td colspan="2" class="dm"></td>'
		sBlog+='<td class="dr"></td>'
		sBlog+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sBlog;
	sBlog='';
}

function mblog(hId)
{
	var list;
	blogXDoc= LoadXMLData(1);

	sBlog='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sBlog+='<td class="tl"></td>'
		sBlog+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(2)" style="cursor:hand">网络日志</span></td>'
		sBlog+='<td align="right" class="title"><img onclick="guideButton(2)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sBlog+='<td class="tr"></td>'
		sBlog+='</tr><tr>'
		sBlog+='<td class="ml"></td>'
		sBlog+='<td colspan="2" align="center" class="mm">'
		sBlog+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		sBlog+='<tr><td height="1" colspan="2" class="line"></td></tr><tr>'
		sBlog+='<td class="shadows"><span class="classs">&nbsp;·最近发表</span></td>'
	sBlog+='<td align="right" class="shadows">'
	if (cookie_iuin == top.g_iUin)
	{
		sBlog+='<span onClick="openBlogUrl(\'/client/blog/tcont_edit.htm\')" style="cursor:hand"><img src="http://imgcache.qq.com/qzone/client/zy_rz.gif" align="absmiddle" border="0"></span>'
	}
		sBlog+='</td></tr><tr><td colspan="2" class="text">'
		list= blogXDoc.selectNodes("//data/lastadds");
	if (list.length>0) {
		sBlog+='<span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[0], ("url")))+'\')" '+htmlReplace(getElementText(list[0],"titleclass"))+' style="cursor:hand">'
			sBlog+= TruncateStr(htmlReplace(getElementText(list[0], ("title"))),22)+'</span>'
	}
	sBlog+='</td></tr>'
		sBlog+='<tr><td height="1" colspan="2" class="line"></td></tr><tr>'
		sBlog+='<td colspan="2" class="shadows"><span class="classs">&nbsp;·最近回复</span></td>'
		sBlog+='</tr><tr><td colspan="2" class="text">'
		list= blogXDoc.selectNodes("//data/lastanswers");
	if (list.length>0) {
		sBlog+='<span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[0], ("url")))+'\')" '+htmlReplace(getElementText(list[0],"titleclass"))+' style="cursor:hand">'
			sBlog+= TruncateStr(htmlReplace(getElementText(list[0], ("title"))),22)+'</span>'
	}
	sBlog+='</td></tr>'
		sBlog+='<tr><td height="1" colspan="2" class="line"></td></tr><tr>'
		sBlog+='<td colspan="2" class="shadows"><span class="classs">&nbsp;·最热贴</span></td>'
		sBlog+='</tr><tr><td colspan="2" class="text">'
		list= blogXDoc.selectNodes("//data/hotanswers");
	if (list.length>0) {
		sBlog+='<span onclick="openBlogUrl(\''+htmlReplace(getElementText(list[0], ("url")))+'\')" '+htmlReplace(getElementText(list[0],"titleclass"))+' style="cursor:hand">'
			sBlog+= TruncateStr(htmlReplace(getElementText(list[0], ("title"))),22)+'</span>'
	}
	sBlog+='</td></tr>'
		sBlog+='</table></td>'
		sBlog+='<td class="mr"></td>'
		sBlog+='</tr><tr>'
		sBlog+='<td class="dl"></td>'
		sBlog+='<td colspan="2" class="dm"></td>'
		sBlog+='<td class="dr"></td>'
		sBlog+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sBlog;
	sBlog='';
}

function bgb(hId) {
	var list;
	gbXDoc= LoadXMLData(2);
	sGb='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sGb+='<td class="tl"></td>'
		sGb+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(4)" style="cursor:hand">留言板</span></td>'
		sGb+='<td align="right" class="title"><img onClick="guideButton(4)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sGb+='<td class="tr"></td>'
		sGb+='</tr><tr>'
		sGb+='<td class="ml"></td>'
		sGb+='<td colspan="2" valign="top" align="center" class="mm">'
		sGb+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		sGb+='<tr>'
		sGb+='<td  class="titleback"><span class="classs">&nbsp;·主人留言</span></td>'
		sGb+='</tr><tr><td class="text">'
		list= gbXDoc.selectNodes("//data");
	sGb+='<span onclick="guideButton(4)" style="cursor:hand">'+TruncateStr(ubbDel(getElementText(list[0], ("hostmsg"))),70)+'</span>';
	sGb+='</td></tr><tr>'
		sGb+='<td  class="titleback"><span class="classs">&nbsp;·最近回复</span></td>'
		sGb+='</tr><tr><td>'
		sGb+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		list= gbXDoc.selectNodes("//data/visitmsg");
	for (i=0; i<list.length && i<4; i++) {
		sGb+='<tr><td height="1"  class="line"></td></tr><tr>'
			sGb+='<td  class="text2">&nbsp;<b>留言者：</b>'+TruncateStr(getElementText(list[i], ("nick")),70)+'<b>留言时间：</b> '+TruncateStr(getElementText(list[i], ("date")),70)+TruncateStr(getElementText(list[i], ("time")),70)+'</td>'
			sGb+='</tr><tr><td  class="text">'
			sGb+='<span onclick="guideButton(4)" style="cursor:hand">'+TruncateStr(ubbDel(getElementText(list[i], ("msg"))),70);
		sGb+='</span></td></tr>'
	}
	sGb+='</table>'
		sGb+='</td></tr></table>'
		sGb+='</td><td class="mr"></td>'
		sGb+='</tr><tr>'
		sGb+='<td class="dl"></td>'
		sGb+='<td colspan="2" class="dm"></td>'
		sGb+='<td class="dr"></td>'
		sGb+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sGb;
	sGb='';
}

function mgb(hId){
	var list;
	gbXDoc= LoadXMLData(2);
	sGb='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sGb+='<td class="tl"></td>'
		sGb+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(4)" style="cursor:hand">留言板</span></td>'
		sGb+='<td align="right" class="title"><img onClick="guideButton(4)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sGb+='<td class="tr"></td>'
		sGb+='</tr><tr>'
		sGb+='<td class="ml"></td>'
		sGb+='<td colspan="2" valign="top" class="mm">'
		sGb+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">'
		sGb+='<tr><td colspan="2" class="titleback"><span class="classs">&nbsp;·主人留言</span></td>'
		sGb+='</tr><tr><td colspan="2" class="text">'
		list=gbXDoc.selectNodes("//data");
	if (list.length>0)
		sGb+='<span onclick="guideButton(4)" style="cursor:hand">'+TruncateStr(ubbDel(htmlReplace(getElementText(list[0], ("hostmsg")))),20)+'</span>';
	sGb+='</td></tr>'
		sGb+='<tr><td height="1" colspan="2" class="line"></td></tr>'
		sGb+='<tr><td colspan="2" class="titleback"><span class="classs">&nbsp;·最近回复</span></td>'
		sGb+='</tr><tr><td colspan="2" class="text">'
		list= gbXDoc.selectNodes("//data/visitmsg");
	if (list.length>0)
		sGb+='<span onclick="guideButton(4)" style="cursor:hand">'+TruncateStr(ubbDel(htmlReplace(getElementText(list[0], ("msg")))),64)+'</span>';
	sGb+='</td></tr>'
		sGb+='</table></td>'
		sGb+='<td class="mr"></td>'
		sGb+='</tr><tr>'
		sGb+='<td class="dl"></td>'
		sGb+='<td colspan="2" class="dm"></td>'
		sGb+='<td class="dr"></td>'
		sGb+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sGb;
	sGb='';
}

function minfo(hId)
{
	var infoXDoc= LoadXMLData(3);
	document.title= htmlReplace(getElementText(infoXDoc, "/data/spacename"))+"["+window.top.g_iUin+".q-zone.qq.com]";
	document.all.spacename.innerHTML= htmlReplace(getElementText(infoXDoc, "/data/spacename"));

	sInfo='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sInfo+='<td class="tl"></td>'
		sInfo+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(7)" style="cursor:hand">个人资料</span></td>'
		sInfo+='<td align="right" class="title"><img  onClick="guideButton(7)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sInfo+='<td class="tr"></td>'
		sInfo+='</tr><tr>'
		sInfo+='<td rowspan="2" class="ml"></td>'
		sInfo+='<td colspan="2" class="titleback">&nbsp;<span onclick="show(1,3)" id="b1" class="button" style="font-weight: bold">形象</span>|<span onclick="show(2,3)" id="b2" class="button">档案</span>|<span onclick="show(3,3)" id="b3" class="button">统计</span>&nbsp;'
	if (cookie_iuin == top.g_iUin)
	{
		sInfo+='<span onclick="javascript:parent.mall(4);" id="b4" class="button"><img src="http://imgcache.qq.com/qzone/client/zy_da.gif" border="0" alt="点击这里合成大头贴" align="absmiddle"></span>'
	}
	else
	{
		sInfo+='<a href="tencent://Message/?Uin='+top.g_iUin+'&websiteName=q-zone.qq.com&Menu=yes"><img border="0" SRC="http://wpa.qq.com/pa?p=1:'+top.g_iUin+':14" alt="点击这里给我发消息" align="absmiddle" ></a>'
	}
		sInfo+='</td><td rowspan="2" class="mr"></td>'
		sInfo+='</tr><tr>'
		sInfo+='<td colspan="2" align="center" class="mm">'
		sInfo+= '<div id="i1" style=" width:140px; height:226px;  background-image:url(http://imgcache.qq.com/qzone/client/loadgif.gif); display:'
		sInfo+="''"
		var mm=htmlReplace(getElementText(infoXDoc, "/data/avatar"));
	if (mm.substring(mm.length-3,mm.length)=="swf"){
		sInfo+='"><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=140 height=226 ><param name="movie" value="'+htmlReplace(getElementText(infoXDoc, "/data/avatar"))+'" /><param name="wmode" value="transparent" /><embed src="'+htmlReplace(getElementText(infoXDoc, "/data/avatar"))+'" align="middle" width=140 height=226 /></object></div>'
	} else {
		sInfo+='"><img src="'+htmlReplace(getElementText(infoXDoc, "/data/avatar"))+'" onload="adjustSize(this,140,226)"></div>'
	}
	sInfo+='<div id="i2" style="display:'
		sInfo+="'none'"
		sInfo+='"><table height="226" width="135" border="0" valign="top" align="center" cellpadding="0" cellspacing="0">'
		sInfo+='<tr><td height="1" colspan="2" class="line"></td></tr>'
		sInfo+='<tr valign="top"><td class="itext" width="50">ＱＱ号：</td>'
		sInfo+='<td height="18" class="itext">'
		sInfo+=top.g_iUin
		sInfo+='</td>'
		sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
		sInfo+='<tr valign="top"><td class="itext" width="50"> 昵　称：</td>'
		sInfo+='<td height="18" class="itext">'
		sInfo+=TruncateStr(htmlReplace(getElementText(infoXDoc, "/data/nickname")), 22)
		sInfo+='</td>'
		sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
		sInfo+='<tr valign="top"><td class="itext" width="50"> 年　龄：</td>'
		sInfo+='<td height="18" class="itext">'
		ivar = parseInt(htmlReplace(getElementText(infoXDoc, "/data/age")))
		if (ivar)
		{
			if (ivar > -1 && ivar <106)
				sInfo+=htmlReplace(getElementText(infoXDoc, "/data/age"))
		}
		sInfo+='</td>'
			sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
			sInfo+='<tr valign="top"><td class="itext" width="50"> 性　别：</td>'
			sInfo+='<td height="18 class="itext"">'
			if (htmlReplace(getElementText(infoXDoc, "/data/sex")) == "1")
			{
				sInfo+='男</td>'
			}
			else if (htmlReplace(getElementText(infoXDoc, "/data/sex")) == "2")
			{
				sInfo+='女</td>'
			}
			else
			{
				sInfo+='</td>'
			}
			sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr valign="top"><td class="itext" width="50"> 位　置：</td>'
				sInfo+='<td height="18" class="itext">'
				sInfo+=htmlReplace(getElementText(infoXDoc, "/data/province"))+'  '+htmlReplace(getElementText(infoXDoc, "/data/city"))
				sInfo+='</td>'
				sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr valign="top"><td class="itext" width="50"> 说　明：</td>'
				sInfo+='<td class="itext" width="85">'
				sInfo+=TruncateStr(htmlReplace(getElementText(infoXDoc, "/data/desc")), 64)
				sInfo+='</td>'
				sInfo+='</tr><tr valign="top"><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='</table></div>'
				sInfo+= '<div id="i3" style="display:'
				sInfo+="'none'"
				sInfo+='"><table height="226" width="135" border="0" valign="top" align="center" cellpadding="0" cellspacing="0">'
				sInfo+='<tr><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr valign="top"><td class="itext" width="90">历史访问人数：</td>'
				sInfo+='<td height="18" class="itext">'
				sInfo+=htmlReplace(getElementText(infoXDoc, "/data/visitcount"))
				sInfo+='</td>'
				sInfo+='</tr><tr><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr valign="top"><td class="itext" width="90">本空间的排名：</td>'
				sInfo+='<td height="18" class="itext">'
				if("0" == getElementText(infoXDoc, "/data/spacemark")){
					sInfo+="未入榜";
				}
				else{
					sInfo+=htmlReplace(getElementText(infoXDoc, "/data/spacemark"))
				}
				sInfo+='</td>'
				sInfo+='</tr><tr><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr valign="top"><td class="itext" width="90">日排名变化：</td>'
				sInfo+='<td height="18" class="itext">'
				if("0" == getElementText(infoXDoc, "/data/markchange")){
					sInfo+="无";
				}
				else{
					sInfo+=htmlReplace(getElementText(infoXDoc, "/data/markchange"))
				}
				sInfo+='</td>'
				sInfo+='</tr><tr><td height="1" colspan="2" class="line"></td></tr>'
				sInfo+='<tr><td colspan="2" >&nbsp;</td></tr>'
				sInfo+='</table></div>'
				sInfo+='</td></tr><tr>'
				sInfo+='<td class="dl"></td>'
				sInfo+='<td colspan="2" class="dm"></td>'
				sInfo+='<td class="dr"></td>'
				sInfo+='</tr></table>'

				g_WndArray[hId].div.innerHTML=sInfo;
			sInfo='';
}

function malt(hId)
{
	var list;
	var altXDoc= LoadXMLData(4);

	sAlt='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sAlt+='<td class="tl"></td>'
		sAlt+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(8)" style="cursor:hand">互动</span></td>'
		sAlt+='<td align="right" class="title"><img  onClick="guideButton(8)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sAlt+='<td class="tr"></td>'
		sAlt+='</tr><tr>'
		sAlt+='<td rowspan="4" class="ml"></td>'
		sAlt+='<td colspan="2" class="titleback"><span class="classs">&nbsp;[近期访客]</span></td>'
		sAlt+='<td rowspan="4" class="mr"></td>'
		sAlt+='</tr><tr><td colspan="2" class="mm" align="center" valign="top">'
		sAlt+='<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">'
		list= altXDoc.selectNodes("/data/visitorlist");
	for (i=0; i<list.length; i++) {
		sAlt+='<tr><td><a href="javascript:openUserSpace('+htmlReplace(getElementText(list[i], "uin"))+')">'+TruncateStr(htmlReplace(getElementText(list[i], "spacename")),12)+'</a></td>'
			sAlt+='<td width="50" height="18" align="center"><a href="tencent://Message/?websiteName=q-zone.qq.com&Menu=yes&Uin='+htmlReplace(getElementText(list[i], "uin"))+'"><img src="http://imgcache.qq.com/qzone/client/qme.gif" width="45" height="15" border="0" align="absmiddle"></a></td>'
			sAlt+='</tr>'
	}
	sAlt+='</table></td></tr><tr>'
		sAlt+='<td colspan="2" class="titleback"><span class="classs">&nbsp;[主人关注]</span></td>'
		sAlt+='</tr><tr><td colspan="2" class="mm" align="center" valign="top">'
		sAlt+='<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">'
		list= altXDoc.selectNodes("/data/favorlist");
	for (i=0; i<list.length; i++) {
		sAlt+='<tr><td><a href="javascript:openUserSpace('+htmlReplace(getElementText(list[i], "uin"))+')">'+TruncateStr(htmlReplace(getElementText(list[i], "spacename")),12)+'</a></td>'
			sAlt+='<td width="50" height="18" align="center"><a href="tencent://Message/?websiteName=q-zone.qq.com&Menu=yes&Menu=yes&Uin='+htmlReplace(getElementText(list[i], "uin"))+'"><img src="http://imgcache.qq.com/qzone/client/qme.gif" width="45" height="15" border="0" align="absmiddle"></a></td>'
			sAlt+='</tr>'
	}
	sAlt+='</table>'
		sAlt+='</td></tr><tr>'
		sAlt+='<td class="dl"></td>'
		sAlt+='<td colspan="2" class="dm"></td>'
		sAlt+='<td class="dr"></td>'
		sAlt+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sAlt;
	sAlt='';
}

function bphoto (hId)
{
	var photoXDoc= LoadXMLData(5);

	sPhoto='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sPhoto+='<td class="tl"></td>'
		sPhoto+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(5)" style="cursor:hand">相册</span></td>'
		sPhoto+='<td align="right" class="title"><img onclick="guideButton(5)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sPhoto+='<td class="tr"></td>'
		sPhoto+='</tr><tr>'
		sPhoto+='<td class="ml"></td>'
		sPhoto+='<td colspan="2" align="center" class="mm">'
		sPhoto+='<img src="'+htmlReplace(getElementText(photoXDoc, '//data/img'))+'" onload="adjustSize(this,370,280)" border="1" onclick=openAlbum('+htmlReplace(getElementText(photoXDoc, '//data/albumid'))+') style="cursor:hand"><br>'
		//sPhoto+=htmlReplace(getElementText(photoXDoc, '//data/album'))+'个相册</td>'
		sPhoto+='<td class="mr"></td>'
		sPhoto+='</tr><tr>'
		sPhoto+='<td class="dl"></td>'
		sPhoto+='<td colspan="2" class="dm"></td>'
		sPhoto+='<td class="dr"></td>'
		sPhoto+='</tr></table>'
		g_WndArray[hId].div.innerHTML= sPhoto;
	sPhoto='';
}

function mphoto (hId)
{
	var photoXDoc= LoadXMLData(5);

	sPhoto='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sPhoto+='<td class="tl"></td>'
		sPhoto+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(5)" style="cursor:hand">相册</span></td>'
		sPhoto+='<td align="right" class="title"><img onclick="guideButton(5)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sPhoto+='<td class="tr"></td>'
		sPhoto+='</tr><tr>'
		sPhoto+='<td class="ml"></td>'
		sPhoto+='<td colspan="2" align="center" class="mm">'
		sPhoto+='<img src="'+htmlReplace(getElementText(photoXDoc, '//data/smallimg'))+'" onload="adjustSize(this,100,75)" border="1" onclick=openAlbum('+htmlReplace(getElementText(photoXDoc, '//data/albumid'))+') style="cursor:hand"><br>'
		//sPhoto+=htmlReplace(getElementText(photoXDoc, '//data/album'))+'个相册</td>'
		sPhoto+='</td><td class="mr"></td>'
		sPhoto+='</tr><tr>'
		sPhoto+='<td class="dl"></td>'
		sPhoto+='<td colspan="2" class="dm"></td>'
		sPhoto+='<td class="dr"></td>'
		sPhoto+='</tr></table>'
		g_WndArray[hId].div.innerHTML= sPhoto;
	sPhoto='';
}
function mhome(hId)
{
	sHome='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>';
		sHome+='<td class="tl"></td>'
		sHome+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(6)" style="cursor:hand">迷你屋</span></td>'
		sHome+='<td align="right" class="title"><img onclick="guideButton(6)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sHome+='<td class="tr"></td>'
		sHome+='</tr><tr>'
		sHome+='<td class="ml"></td>'
		sHome+='<td colspan="2" align="center" class="mm"><img src="http://imgcache.qq.com/qzone/client/home_simple.gif" width="145" height="80" border="1"></td>'
		sHome+='<td class="mr"></td>'
		sHome+='</tr><tr>'
		sHome+='<td class="dl"></td>'
		sHome+='<td colspan="2" class="dm"></td>'
		sHome+='<td class="dr"></td>'
		sHome+='</tr></table>'

		g_WndArray[hId].div.innerHTML=sHome;
	sHome='';
}
function bhome(hId){
	sHome='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
		sHome+='<td class="tl"></td>'
		sHome+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(6)" style="cursor:hand">迷你屋</span></td>'
		sHome+='<td align="right" class="title"><img onclick="guideButton(6)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>'
		sHome+='<td class="tr"></td>'
		sHome+='</tr><tr>'
		sHome+='<td class="ml"></td>'
		sHome+='<td colspan="2" align="center"class="mm">'
		sHome+='<iframe name="bhome" id= "bhome" width="100%" height="100%" allowTransparency="true" scrolling=no border="0" frameborder="0" src="'
		sHome+='http://home.qq.com/home/initial.shtml?author=tencent&uin='+top.g_iUin
		sHome+='">数据读取中…</iframe></td>'
		sHome+='<td class="mr"></td></tr><tr>'
		sHome+='<td class="dl"></td>'
		sHome+='<td colspan="2" class="dm"></td>'
		sHome+='<td class="dr"></td>'
		sHome+='</tr></table>'
		g_WndArray[hId].div.innerHTML=sHome;
	sHome='';
}

function bmusic(hId) {
	var musicXDoc= LoadXMLData(7);
	var idolinfo=musicXDoc.selectSingleNode("/data/idol");
	var topiclist=musicXDoc.selectNodes("/data/idol/topic");
	var rankinfo=musicXDoc.selectSingleNode("/data/rank");
	var ranklist=musicXDoc.selectNodes("/data/rank/song");
	var albuminfo=musicXDoc.selectSingleNode("/data/album");
	var songlist=musicXDoc.selectNodes("/data/album/song");
	sMusic='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">';
	sMusic+='<tr><td class="tl"></td><td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(3)" style="cursor:hand">音乐盒</span></td>';
	sMusic+='<td align="right" class="title"><img onclick="guideButton(3)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td><td class="tr"></td></tr>';
	sMusic+='<tr><td class="ml"></td><td colspan="2" align="center" class="mm" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	sMusic+='<tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle"> &nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">我的偶像</span></td></tr><tr><td align="center"><img src="';
	if(idolinfo==null)
		sMusic+='http://imgcache.qq.com/qzone/client/nopic.gif';
	else
		sMusic+=mainshowUrl(htmlReplace(idolinfo.getAttributeNode("url").text));
	sMusic+='" onload="adjustSize(this,130,130)" align="absmiddle" class="slp" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand"></td><td width="65%"><table width="100%" height="190"  border="0" align="center" cellpadding="0" cellspacing="0"><tr><td height="20" colspan="2">';
	sMusic+='<table height="3" border="0" cellspacing="0" cellpadding="0"><tr><td></td></tr></table><table width="99%"  border="0" cellspacing="2" cellpadding="0" class="ou">';
	if (idolinfo==null||(htmlReplace(idolinfo.getAttributeNode("id").text) == "" && htmlReplace(idolinfo.getAttributeNode("name").text) == ""))
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td height="20" class="text"><span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">您还没有偶像，请添加偶像。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" class="text">添加偶像，收集您喜爱偶像的各种资讯。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" class="text">此空间暂无偶像。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
	else
	{
		sMusic+='<tr><td height="20">姓名：'+TruncateStr(htmlReplace(idolinfo.getAttributeNode("name").text),10)+'</td>';
		sMusic+='<td>生日：'+displayBirthday(htmlReplace(idolinfo.getAttributeNode("birthday").text))+'</td></tr>';
		sMusic+='<tr><td height="20">星座：'+displayAstro(parseInt(htmlReplace(idolinfo.getAttributeNode("astro").text))-1)+'</td>';
		sMusic+='<td height="20">血型：'+displayBloodType(htmlReplace(idolinfo.getAttributeNode("blood").text))+'</td></tr>';
		sMusic+='<tr><td height="20">身高：'+displayIdolHeight(parseInt(htmlReplace(idolinfo.getAttributeNode("height").text)))+'</td>';
		sMusic+='<td height="20">体重：'+displayIdolWeight(parseInt(htmlReplace(idolinfo.getAttributeNode("weight").text)))+'</td></tr>';
	}
	sMusic+='</table></td></tr>';
	for(i=0;i<topiclist.length&&i<4;i++)
	{
		sMusic+='<tr><td>·'+TruncateStr(htmlReplace(topiclist[i].getAttributeNode("title").text),40)+'</td>';
		sMusic+='<td height="20"><span class="num">('+topiclist[i].getAttributeNode("visit").text+'/<font color=#ff0000>'+topiclist[i].getAttributeNode("answer").text+'</font>)</span></td>';
		sMusic+='</tr><tr><td class="line" colspan="2"></td></tr>';
	}
	if (idolinfo!=null&&(htmlReplace(idolinfo.getAttributeNode("id").text) != "" || htmlReplace(idolinfo.getAttributeNode("name").text) != ""))
	{
		sMusic+='<tr><td height="20" colspan="2" align="right"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=idolinfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+idolinfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
	}
	sMusic+='</table></td></tr><tr><td colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	sMusic+='<tr><td width="50%" class="text" valign="top"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	sMusic+='<tr><td class="titleback">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle"> &nbsp;';
	sMusic+='<span class="classs" onClick="openMusicUrl(\'/client/music/tranklist.shtml?uin='+top.g_iUin+'\')" style="cursor:hand">劲歌榜</span></td></tr>';
    if(ranklist.length<1)
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td width="100%" height="20" class="text"><span class="classs" onClick="openMusicUrl(\'/client/music/tranklist.shtml?uin='+top.g_iUin+'\')" style="cursor:hand">'
			sMusic+='您还没有打榜歌曲，请添加打榜歌曲。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='添加打榜歌曲，推荐您最喜爱的音乐与大家分享。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='此空间暂无打榜歌曲。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
	for(i=1;i<=ranklist.length&&i<=10;i++)
	{
		sMusic+='<tr><td height="20"><span class="numpic">&nbsp;'+i+'&nbsp;</span>&nbsp;'+mainShowSongTrend(parseInt(ranklist[i-1].getAttributeNode("trend").text))+'&nbsp;';
		sMusic+=TruncateStr(htmlReplace(ranklist[i-1].getAttributeNode("name").text),12)+'——'+TruncateStr(htmlReplace(ranklist[i-1].getAttributeNode("singer").text),12)+'</td>';
		sMusic+='</tr><tr><td class="line"></td></tr>';
	}
	if(rankinfo!=null&&htmlReplace(rankinfo.getAttributeNode("name").text)!="")
    {
		sMusic+='<tr><td height="20" align="right"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=rankinfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+rankinfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
	}
	sMusic+='</table></td><td width="50%" class="text" valign="top"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	sMusic+='<tr><td class="titleback">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle"> &nbsp;';
	sMusic+='<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showalbum?uin='+top.g_iUin+'\')" style="cursor:hand">音乐收藏';
	if(albuminfo!=null&&(htmlReplace(albuminfo.getAttributeNode("name").text)!=""&&htmlReplace(albuminfo.getAttributeNode("id").text)!="0"))
	{
		sMusic+='——'+TruncateStr(htmlReplace(albuminfo.getAttributeNode("name").text),20);
	}
	sMusic+='</span></td></tr>';
	if(songlist.length<1)
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td width="100%" height="20" class="text"><span " class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showalbum?uin='+top.g_iUin+'\')" style="cursor:hand">'
			sMusic+='您还没有收藏音乐，请点击添加歌曲。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='添加音乐，您的朋友访问时就可以听到您添加的音乐。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='此专题暂无收藏歌曲。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
    for(i=1;i<=songlist.length&&i<=10;i++)
	{
		sMusic+='<tr><td height="20"><span class="num" style="color:#FF9900;font-weight: bold;">'+i+'</span>&nbsp;';
		sMusic+=TruncateStr(htmlReplace(songlist[i-1].getAttributeNode("name").text),12)+'——'+TruncateStr(htmlReplace(songlist[i-1].getAttributeNode("singer").text),12)+'</td>';
		sMusic+='</tr><tr><td class="line"></td></tr>';
	}
	if(albuminfo!=null&&(htmlReplace(albuminfo.getAttributeNode("name").text)!=""||htmlReplace(albuminfo.getAttributeNode("id").text)!="0"))
	{
		sMusic+='<tr><td height="20" align="right"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=albuminfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+albuminfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
	}
	sMusic+='</table></td></tr></table></td></tr></table></td><td class="mr"></td></tr><tr><td class="dl"></td><td colspan="2" class="dm"></td><td class="dr"></td></tr></table>';
	g_WndArray[hId].div.innerHTML=sMusic;
	sMusic='';
}

function mmusic(hId)
{
	if (!g_XDoc[13])
	  var musicXDoc=LoadXMLData(7);
  	else
  	var musicXDoc= LoadXMLData(13);
	var idolinfo=musicXDoc.selectSingleNode("/data/idol");
	var topiclist=musicXDoc.selectNodes("/data/idol/topic");
	sMusic='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr><td class="tl"></td>';
	sMusic+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(3)" style="cursor:hand">音乐盒</span></td>';
	sMusic+='<td align="right" class="title"><img onclick="guideButton(3)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>';
	sMusic+='<td class="tr"></td></tr><tr><td class="ml"></td><td colspan="2" align="center" class="mm" valign="top">';
	sMusic+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	sMusic+='<tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle"> &nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">我的偶像</span></td></tr><tr><td align="center"><img src="';
	if(idolinfo==null)
		sMusic+='http://imgcache.qq.com/qzone/client/nopic.gif';
	else
		sMusic+=mainshowUrl(htmlReplace(idolinfo.getAttributeNode("url").text))
	sMusic+='" onload="adjustSize(this,100,100)" align="absmiddle" class="slp" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand"></td>';
	sMusic+='<td width="65%"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	if (idolinfo==null||(htmlReplace(idolinfo.getAttributeNode("id").text) == "" && htmlReplace(idolinfo.getAttributeNode("name").text) == ""))
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td height="20" class="text"><span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">您还没有偶像，请添加偶像。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" class="text">添加偶像，收集您喜爱偶像的各种资讯。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" class="text">此空间暂无偶像。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
	else
	{
		sMusic+='<tr><td height="20" class="text">姓名：'+TruncateStr(htmlReplace(idolinfo.getAttributeNode("name").text),10)+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">生日：'+displayBirthday(htmlReplace(idolinfo.getAttributeNode("birthday").text))+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">星座：'+displayAstro(parseInt(htmlReplace(idolinfo.getAttributeNode("astro").text))-1)+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">身高：'+displayIdolHeight(parseInt(htmlReplace(idolinfo.getAttributeNode("height").text)))+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=idolinfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+idolinfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
	}
	sMusic+='</table></td></tr><tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">相关资讯</span></td></tr>';
	sMusic+='<tr><td colspan="2" align="center"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	for(i=0;i<topiclist.length&&i<5;i++)
	{
		sMusic+='<tr><td height="20" class="text">· <span class="button" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')">'+TruncateStr(htmlReplace(topiclist[i].getAttributeNode("title").text),32)+'</span></td></tr>';
		sMusic+='<tr><td class="line"></td></tr>';
	}
	sMusic+='</table></td></tr></table></td><td class="mr"></td></tr><tr><td class="dl"></td><td colspan="2" class="dm"></td><td class="dr"></td></tr></table>';
	g_WndArray[hId].div.innerHTML=sMusic;
	sMusic='';
}

function idol(hId)
{
	if (!g_XDoc[13])
	  var musicXDoc=LoadXMLData(7);
  	else
  	var musicXDoc= LoadXMLData(13);
	var idolinfo=musicXDoc.selectSingleNode("/data/idol");
	var topiclist=musicXDoc.selectNodes("/data/idol/topic");
	sMusic='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr><td class="tl"></td>';
	sMusic+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(3)" style="cursor:hand">音乐盒</span></td>';
	sMusic+='<td align="right" class="title"><img onclick="guideButton(3)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td>';
	sMusic+='<td class="tr"></td></tr><tr><td class="ml"></td><td colspan="2" align="center" class="mm" valign="top">';
	sMusic+='<table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	sMusic+='<tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle"> &nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">我的偶像</span></td></tr><tr><td align="center"><img src="';
	if(idolinfo==null)
		sMusic+='http://imgcache.qq.com/qzone/client/nopic.gif';
	else
		sMusic+=mainshowUrl(htmlReplace(idolinfo.getAttributeNode("url").text))
	sMusic+='" onload="adjustSize(this,100,100)" align="absmiddle" class="slp" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand"></td>';
	sMusic+='<td width="65%"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	if (idolinfo==null||(htmlReplace(idolinfo.getAttributeNode("id").text) == "" && htmlReplace(idolinfo.getAttributeNode("name").text) == ""))
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td height="20" class="text"><span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">您还没有偶像，请添加偶像。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" class="text">添加偶像，收集您喜爱偶像的各种资讯。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" class="text">此空间暂无偶像。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
	else
	{
		sMusic+='<tr><td height="20" class="text">姓名：'+TruncateStr(htmlReplace(idolinfo.getAttributeNode("name").text),10)+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">生日：'+displayBirthday(htmlReplace(idolinfo.getAttributeNode("birthday").text))+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">星座：'+displayAstro(parseInt(htmlReplace(idolinfo.getAttributeNode("astro").text))-1)+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text">身高：'+displayIdolHeight(parseInt(htmlReplace(idolinfo.getAttributeNode("height").text)))+'</td></tr><tr><td class="line"></td></tr>';
		sMusic+='<tr><td height="20" class="text"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=idolinfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+idolinfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
	}
	sMusic+='</table></td></tr><tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')" style="cursor:hand">相关资讯</span></td></tr>';
	sMusic+='<tr><td colspan="2" align="center"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	for(i=0;i<topiclist.length&&i<5;i++)
	{
		sMusic+='<tr><td height="20" class="text">· <span class="button" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showidol?uin='+top.g_iUin+'\')">'+TruncateStr(htmlReplace(topiclist[i].getAttributeNode("title").text),32)+'</span></td></tr>';
		sMusic+='<tr><td class="line"></td></tr>';
	}
	sMusic+='</table></td></tr></table></td><td class="mr"></td></tr><tr><td class="dl"></td><td colspan="2" class="dm"></td><td class="dr"></td></tr></table>';
	g_WndArray[hId].div.innerHTML=sMusic;
	sMusic='';
}

function coll(hId)
{
	if (!g_XDoc[15])
	  var musicXDoc=LoadXMLData(7);
  else
  	var musicXDoc= LoadXMLData(15);
	var albuminfo=musicXDoc.selectSingleNode("/data/album");
	var songlist=musicXDoc.selectNodes("/data/album/song");
	sMusic='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">';
	sMusic+='<tr><td class="tl"></td><td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(3)" style="cursor:hand">音乐盒</span></td>';
	sMusic+='<td align="right" class="title"><img onclick="guideButton(3)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td><td class="tr"></td></tr>';
	sMusic+='<tr><td class="ml"></td><td colspan="2" align="center" class="mm" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr>';
	sMusic+='<td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showalbum?uin='+top.g_iUin+'\')" style="cursor:hand">音乐收藏';
	if(albuminfo==null||(htmlReplace(albuminfo.getAttributeNode("name").text)!=""&&htmlReplace(albuminfo.getAttributeNode("id").text)!="0"))
	{
		sMusic+='——'+TruncateStr(htmlReplace(albuminfo.getAttributeNode("name").text),20);
	}
	sMusic+='</span></td></tr><tr><td colspan="2" align="center"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	if(songlist.length<1)
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td width="100%" height="20" class="text"><span " class="classs" onClick="openMusicUrl(\'/cgi-bin/music/cgi_music_showalbum?uin='+top.g_iUin+'\')" style="cursor:hand">'
			sMusic+='您还没有收藏音乐，请点击添加歌曲。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='添加音乐，您的朋友访问时就可以听到您添加的音乐。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='此专题暂无收藏歌曲。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
    for(i=1;i<=songlist.length&&i<=10;i++)
	{
		sMusic+='<tr><td height="20" class="text"><span class="num" style="color:#FF9900;font-weight: bold;">'+i+'</span>&nbsp;';
		sMusic+=TruncateStr(htmlReplace(songlist[i-1].getAttributeNode("name").text), 20);
		sMusic+='&nbsp;'+TruncateStr(htmlReplace(songlist[i-1].getAttributeNode("singer").text), 16)+'</td>';
		sMusic+='<tr><td colspan="2" class="line"></td></tr>';
	}
	if(albuminfo!=null&&(htmlReplace(albuminfo.getAttributeNode("name").text)!=""||htmlReplace(albuminfo.getAttributeNode("id").text)!="0"))
	{
		sMusic+='<tr><td height="20" colspan="2" class="text" align="right"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=albuminfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+albuminfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr><tr><td colspan="2" class="line"></td></tr>';
	}
	sMusic+='</table></td></tr></table></td><td class="mr"></td></tr><tr><td class="dl"></td><td colspan="2" class="dm"></td><td class="dr"></td></tr></table>';
	g_WndArray[hId].div.innerHTML=sMusic;
	sMusic='';
}

function rank(hId)
{
	if (!g_XDoc[14])
		var musicXDoc=LoadXMLData(7);
	else
  		var musicXDoc= LoadXMLData(14);
	var rankinfo=musicXDoc.selectSingleNode("/data/rank");
	var ranklist=musicXDoc.selectNodes("/data/rank/song");
	sMusic='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">';
	sMusic+='<tr><td class="tl"></td><td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> <span onclick="guideButton(3)" style="cursor:hand">音乐盒</span></td>';
	sMusic+='<td align="right" class="title"><img onclick="guideButton(3)" src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="more"></td><td class="tr"></td></tr>';
	sMusic+='<tr><td class="ml"></td><td colspan="2" align="center" class="mm" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">';
	sMusic+='<tr><td class="titleback" colspan="2">&nbsp;<img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="ltitle">&nbsp;<span class="classs" onClick="openMusicUrl(\'/client/music/tranklist.shtml?uin='+top.g_iUin+'\')" style="cursor:hand">劲歌榜</span></td></tr>';
	sMusic+='<tr><td colspan="2" align="center"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">';
	 if(ranklist.length<1)
	{
		if (cookie_iuin == top.g_iUin)
		{
			sMusic+='<tr><td width="100%" height="20" class="text"><span class="classs" onClick="openMusicUrl(\'/client/music/tranklist.shtml?uin='+top.g_iUin+'\')" style="cursor:hand">'
			sMusic+='您还没有打榜歌曲，请添加打榜歌曲。</span></td></tr>'
			sMusic+='<tr><td class="line"></td></tr>'
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='添加打榜歌曲，推荐您最喜爱的音乐与大家分享。</td></tr>'
		}
		else
		{
			sMusic+='<tr><td height="20" style="height: 21px;padding-top: 3px;">'
			sMusic+='此空间暂无打榜歌曲。</td></tr>'
		}
		sMusic+='<tr><td class="line"></td></tr>'
	}
	for(i=1;i<=ranklist.length&&i<=10;i++)
	{
		sMusic+='<tr><td height="20" class="text"><span class="numpic">&nbsp;'+i+'&nbsp;</span>&nbsp;<img src="http://imgcache.qq.com/qzone/client/icon_u.gif">&nbsp;';
		sMusic+=TruncateStr(htmlReplace(ranklist[i-1].getAttributeNode("name").text),12)+'——'+TruncateStr(htmlReplace(ranklist[i-1].getAttributeNode("singer").text),12)+'</td></tr>';
		sMusic+='<tr><td colspan="2" class="line"></td></tr>';
	}
	if(rankinfo!=null&&htmlReplace(rankinfo.getAttributeNode("name").text)!="")
    {
		sMusic+='<tr><td height="20" colspan="2" class="text" align="right"><img src="http://imgcache.qq.com/qzone/client/vote_u.gif" alt="顶" hspace="3" border="0" align="absmiddle" ><span class="num"><b>';
		sMusic+=rankinfo.getAttributeNode("good").text+'<img src="http://imgcache.qq.com/qzone/client/vote_d.gif" alt="砸" hspace="3" border="0" align="absmiddle" >'+rankinfo.getAttributeNode("bad").text+'</b></span>&nbsp;</td></tr>';
		sMusic+='<tr><td colspan="2" class="line"></td></tr>';
	}
	sMusic+='</table></td></tr></table></td><td class="mr"></td></tr><tr><td class="dl"></td><td colspan="2" class="dm"></td><td class="dr"></td></tr></table>';
	g_WndArray[hId].div.innerHTML=sMusic;
	sMusic='';
}

/** 自定义层
*/
function tSelf(hId, wndid) {
	var wndXDoc= LoadXMLData(11);
	var wndXD= wndXDoc.selectNodes("/data/window");
	for(var i=0;i<wndXD.length;i++){
		var wnd=wndXDoc.selectSingleNode("/data/window[" + i + "]/id").text;
		if(wnd==wndid){
			sSelf='<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>'
				sSelf+='<td class="tl"></td>'
				sSelf+='<td class="title"><img src="http://imgcache.qq.com/qzone/client/b.gif" width="1" height="1" align="absmiddle" class="side"> '+diyWndReplace(getElementText(wndXDoc, "/data/window[" + i + "]/title"))+'</td>'
				sSelf+='<td align="right" class="title">'
				if (g_EditMode==0) {
					sSelf+= '<a href="javascript:module_add('+wndid+')"> <img src="http://imgcache.qq.com/qzone/client/bt_05.gif" align="absmiddle" border="0"></a>&nbsp;'
				}
				sSelf+= '</td>'
					sSelf+='<td class="tr">';
				sSelf+='</td>'
					sSelf+='</tr><tr>'
					sSelf+='<td class="ml"></td>'
					sSelf+='<td colspan="2" align="center" class="mm"><table width="100%"  border="0" cellspacing="0" cellpadding="0">'
					var list = wndXDoc.selectNodes("/data/window[" + i + "]/item");
				for (var j=0; j<list.length; j++) {
					style= parseInt(diyWndReplace(getElementText(list[j], "style")));
					sSelf+='<tr>';
					if (diyWndReplace(getElementText(list[j], "img"))!=""&&diyWndReplace(getElementText(list[j], "img"))!="http://") {
						sSelf+='<td width="100" height="75" align="center" valign="center"><img src="'+scriptFilter(diyWndReplace(getElementText(list[j], "img")))+'" onload="adjustSize(this,100,75)"></td>'
							sSelf+='<td><span class="classs">·'
					}
					else {
						sSelf+='<td colspan="2"><span class="classs">·'
					}
					if (diyWndReplace(getElementText(list[j], "url"))!=""&&diyWndReplace(getElementText(list[j], "url"))!="http://") {
						if (parseInt(style/16)) {
							sSelf+='<a target="_self" href='+diyWndReplace(getElementText(list[j], "url"))+'>'
						}
						else {
							sSelf+='<a target="_blank" href='+diyWndReplace(getElementText(list[j], "url"))+'>'
						}
					}
					sSelf+=diyWndReplace(getElementText(list[j], "title"))
						if (g_EditMode==0) {
							sSelf+='&nbsp;&nbsp;&nbsp;<a href="javascript:module_del('+wndid+','+diyWndReplace(getElementText(list[j], "id"))+')">删除</a>'
								sSelf+='&nbsp;&nbsp;<a href="javascript:module_modify('+wndid+','+diyWndReplace(getElementText(list[j], "id"))+')">修改</a>'
						}
						if (diyWndReplace(getElementText(list[j], "url"))!="")
							sSelf+='</a>'
							sSelf+='</span>'
							sSelf+='<br>'+diyWndReplace(getElementText(list[j], "content"));
						sSelf+='</td></tr>'
							sSelf+='<tr><td height="1" colspan="3" class="line"></td></tr>'
				}
				sSelf+='</table></td>'
					sSelf+='<td class="mr"></td>'
					sSelf+='</tr><tr>'
					sSelf+='<td class="dl"></td>'
					sSelf+='<td colspan="2" class="dm"></td>'
					sSelf+='<td class="dr"></td>'
					sSelf+='</tr></table>'
					g_WndArray[hId].div.innerHTML=sSelf;
				sSelf='';
		}
	}
}

/*
显示偶像照片
*/
function mainshowUrl(photourl)
{
	if (photourl==""||photourl==null)
		return "http://imgcache.qq.com/qzone/client/nopic.gif";
	else
		return photourl;
}

/*
显示歌曲排名变化
*/
function mainShowSongTrend(inum)
{
	var imgUrl = new Array( "http://imgcache.qq.com/qzone/client/icon_d.gif","http://imgcache.qq.com/qzone/client/icon_02.gif", "http://imgcache.qq.com/qzone/client/icon_u.gif");

	if(inum<-1) inum =-1;
	if(inum>1) inum =1;
	inum+=1;
	return ("<img src='"+imgUrl[inum]+"' width='7' height='7' hspace='1'>");
}
function DIYsys(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><p><font class="helptext">个性设置使用说明：</font></p><p>';
		sdiy+='<font class="helptext">·</font>目前您的空间处于<font class="helptext">自定义</font>模式，所有挂件和内容模块可以自由拖拽到适当位置，鼠标选中相应模块后，按住左键可用键盘进行位置的细小调整。<br>';
		sdiy+='<br>';
		sdiy+='<font class="helptext">·</font>点击<font color="0000FF">新建模块</font>，可以自由定义图文并茂的个性模块。';
		sdiy+='<br>';
		sdiy+='<font class="helptext">·</font>点击<font color="0000FF">模块管理</font>，可以选择各部分内容的显示与否和显示方式。';
		sdiy+='<br>';
		sdiy+='<font class="helptext">·</font>点击<font color="0000FF">恢复默认</font>，恢复到原始缺省状态。';
		sdiy+='<br>';
		sdiy+='<font class="helptext">·</font>点击<font color="0000FF">保存</font>，可以保存本次所作的操作。';
		sdiy+='<br>';
		sdiy+='<font class="helptext">·</font>点击<font color="0000FF">取消</font>，自动恢复到上次保存的状态。';
		sdiy+='<br>';
		sdiy+='<table width="95%" border="0" cellspacing="1" cellpadding="0">'
			sdiy+='<tr>';
		sdiy+='<td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td>';
		sdiy+='</tr>';
		sdiy+='</table>';
		sdiy+='</td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function clean(){
	helpZY.innerHTML="";
}

function DIYphoto(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline"><tr>';
		sdiy+='<td class="pback"><font class="helptext">大头贴使用说明：<br>';
		sdiy+='<br></font>从本地选择图片或Q-ZONE相册中选择图片，点击”编辑文字”输入内容后，再点击“确定”后会在预览图上出现文字，鼠标左键可将文字拖拽到图中的任意位置，然后点击保存方案即可合成大头贴。<br>';
		sdiy+='<br><font class="helptext">·</font>合成后的大头贴会保存在您的个人物品中的大头贴专栏。<br>';
		sdiy+='<br><font class="helptext">·</font><font color="#FF3300">个人物品中的大头贴可以直接更换为自己的形象图片</font>。<br>';
		sdiy+='<br><table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td></tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function DIYlogo(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><font class="helptext">个性logo使用说明：<br>';
		sdiy+='<br></font>选择您喜欢的图案，编辑文字内容，最后点击保存方案即可，合成的个性logo会保存在您的个人物品中，并可以在个人物品中选择相应的个性logo进行文字修改和合成。<br>';
		sdiy+='<br><table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td>';
		sdiy+='</tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function DIYflower(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><font class="helptext">植物使用说明：<br>';
		sdiy+='<br></font>所有植物可以免费领养，点击植物图片可以预览效果，确定领养只需要点击“保存方案”。如已有植物，则先前植物被更替为新选择的植物，如先前植物已经结出果实，更换时各项指数会相应减少，植物将被保存到“我的物品”。<br>';
		sdiy+='<br><font class="helptext">·</font>详情请看<br>';
		sdiy+='<a href="http://q-zone.qq.com/web/help/help_18.shtml" target="_blank">（<font color="#0033FF">具体植物养植规则</font>）</a><br>';
		sdiy+='<br><table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td>';
		sdiy+='</tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function DIYplayer(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><font class="helptext">播放器使用说明：<br>';
		sdiy+='<br></font>点击播放器预览图片可以看到使用效果，点击“保存方案”即可应用。<br>';
		sdiy+='<br><font class="helptext">·</font>添加音乐请在<a href="javascript:top.guideButton(3)"><font color="#0000FF">音乐盒</font></a>中音乐库选择歌曲或者在音乐收藏中添加歌曲，然后在编辑播放列表中设置播放曲目及顺序即可。<br>';
		sdiy+='<br><table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td>';
		sdiy+='</tr></tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function DIYmusic(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><p><font class="helptext">添加音乐三步曲：<br>';
		sdiy+='<br>·</font>添加音乐<br>';
		sdiy+='请点击<span class=button onclick="tmusic.mainFrame.location=\'http://q-zone.qq.com/cgi-bin/music/cgi_call_ucsongadd?albumid=0\'"><img src="http://imgcache.qq.com/qzone/client/bt_addmusic.gif" width="83" height="22" hspace="3" border="0"></span>按钮<br>';
		sdiy+='方式一：点击<span class=button onclick="tmusic.mainFrame.location=\'http://shop.qqmusic.qq.com/\'; musicshmline(\'hide\')"><img src="http://imgcache.qq.com/qzone/client/qusicfind.gif" width="110" height="22" border="0" align="absmiddle"></span>，购买歌曲成功后，自动收录在音乐收藏中<br>';
		sdiy+='方式二：直接添加网络歌曲，成功后自动收录在音乐收藏中<br>';
		sdiy+='<br><font class="helptext">·</font>自动播放<br>';
		sdiy+='然后进入<span class=button onclick="tmusic.mainFrame.location=\'/client/music/tplaylist.shtml?uin='+top.g_iUin+'\'"><img src="http://imgcache.qq.com/qzone/client/icon_05.gif" width="16" height="13" hspace="4" border="0" align="absmiddle">播放列表</span>页面，点击<span class=button onclick="tmusic.mainFrame.location=\'/client/music/tplayadd.shtml\'"><img src="http://imgcache.qq.com/qzone/client/bt_06.gif" alt="编辑播放列表" hspace="3" border="0" >编辑播放列表</span>，选择音乐收藏中的歌曲作为背景音乐，背景音乐能自动在Qzone中播放，并可设置歌曲播放顺序。<br>';
		sdiy+='<br><font class="helptext">·</font>选择播放器 <br>';
		sdiy+='点击<span  onclick="mall(2);DIYplayer(helpZY)" class="button"><font color="#0000FF">这里</font></span>进入装扮空间，点击播放器图片可以看到使用效果，点击保存方案即可。<br>';
		
		
		sdiy+='<table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td></tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}

function DIYcopy(obj){
	if(getCookie("notS")!=1){
		sdiy='<table width="165" border="0" cellspacing="1" cellpadding="3" class="helpline">';
		sdiy+='<tr><td class="pback"><p><font class="helptext">地址复制使用说明：</font><br><br>';
		sdiy+='这篇文章的网址已被成功复制，您可以在QQ的聊天窗口中右击鼠标选择粘贴或者按下ctrl+v，然后就可以把这篇文章的网址发给您的qq好友，和大家一起分享了，^_^<br><br>';
		sdiy+='<table width="95%" border="0" cellspacing="1" cellpadding="0">';
		sdiy+='<tr><td align="right"><input type="checkbox" name="checkbox" value="checkbox" onclick="setNS();">下次不显示<br><span onclick="clean();" class="button">关闭</span></td></tr></table></td></tr></table>';
		obj.innerHTML=sdiy;
	}
}
function makeHot(){
	var str="";
	hotB.style.pixelLeft= 683;
	hotB.style.pixelTop= 480;
	hotB.style.width= 194;
	hotB.style.height= 170;
	hotB.style.zindex= 2;
	hotB.innerHTML= str;
}
function setNS(){
	if (getCookie("notS")!=1) setCookie("notS",1);
	else setCookie("notS",0)
}// music.js

function showSongClass(inum)
{
    for(var i=0; i< inum; i++)
    {
        document.write("<img src='http://imgcache.qq.com/qzone/client/icon_star.gif' width='11' height='10' hspace='1' align='absmiddle'>");
    }
}

function showSongTrend(inum)
{
	var imgUrl = new Array( "http://imgcache.qq.com/qzone/client/icon_d.gif","http://imgcache.qq.com/qzone/client/icon_02.gif", "http://imgcache.qq.com/qzone/client/icon_u.gif");

	if(inum<-1) inum =-1;
	if(inum>1) inum =1;
	inum+=1;
	document.write("<img src='"+imgUrl[inum]+"' width='7' height='7' hspace='1'>");
}

function changeURL1(winName, newURL) { 
	win= window.open(newURL, winName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=300"); 
}

function setSorttype(sorttype)
{		
//		 for (len=0; len<form1.sortselect.length; len++) {
   //     if (form1.sortselect[len].value == sorttype) {
  //          form1.sortselect[len].selected= true; 
    //    } 
   // } 			 		 			
}



function changeCollSongDlg(obj_url, operation, uin, songid, song, singer,url, star, trend, desc) 
{ 
	var ret;
	var song_info = new Array(operation, uin,songid, song, singer, url, star, trend, desc);
	ret = showModalDialog(obj_url,song_info,"status:no;dialogHeight:18;dialogWidth:23;help:no"); 

	if(ret==1)
		window.location.href = "/cgi-bin/music/cgi_music_collmain?uin="+uin;	
} 

function showCollAddDlg(obj_url, uin)
{
	changeCollSongDlg(obj_url,1,uin ,0, "", "","",0,0,"");
}

function changeRankSongDlg(obj_url, operation, uin, rankid, songid, song, singer,url, star, trend, desc) 
{ 
	var song_info = new Array(operation, uin, rankid, songid, song, singer, url, star, trend, desc);
	var ret;
	ret = showModalDialog(obj_url,song_info,"status:no;dialogHeight:18;dialogWidth:23;help:no"); 
	if(ret==1)
		window.location.href = "/cgi-bin/music/cgi_music_rankmain?operation=4&uin="+uin+"&rankid="+rankid;
} 




function showRankEditDlg(obj_url, operation, uin, rankid, rankname) 
{ 
	var rank_info = new Array(operation, uin,rankid, rankname);
	var dest_url =  "/cgi-bin/music/cgi_music_rankmain?operation=4&uin="+uin+"&rankid=";
	var ret;
	ret = showModalDialog(obj_url,rank_info,"status:no;dialogHeight:150px;dialogWidth:350px;help:no"); 
	if(operation ==1)
		dest_url += ret;
	else if(operation ==2)
		dest_url += rankid;
	
	if(ret>-1)
		window.location.href = dest_url;
}

function showIdolAddDlg(url_1, url_2, uin) 
{ 
	var idol_info = new Array('1', uin,'');
	var ret;
	idol_info[2] = showModalDialog(url_1,'',"status:no;dialogHeight:150px;dialogWidth:360px;help:no");
	if(idol_info[2])
	{
		ret = showModalDialog(url_2,idol_info,"status:no;dialogHeight:380px;dialogWidth:500px;help:no");	
		if(ret>-1)
		window.location.href = "/cgi-bin/music/cgi_music_idolmain?operation=4&uin="+uin+"&idolid="+ret;
	}
} 

function showIdolEditDlg(url_edit, uin, idolname, idolid, height, weight, birthday, desc, blood, favor, constell, photourl, flag, comment) 
{ 
	var idol_info = new Array('2', uin, idolname, idolid, height, weight, birthday, desc, blood, favor, constell, photourl, flag,comment);
	var ret;
	ret = showModalDialog(url_edit,idol_info,"status:no;dialogHeight:380px;dialogWidth:500px;help:no");	 
	if(ret==1)
		window.location.href = "/cgi-bin/music/cgi_music_idolmain?operation=4&uin="+uin+"&idolid="+idolid;
} 

function chkdate(datestr)
{
 var lthdatestr
 if (datestr != "")
  lthdatestr= datestr.length ;
 else
  lthdatestr=0;
  
 var tmpy="";
 var tmpm="";
 var tmpd="";
 //var datestr;
 var status;
 status=0;
 if ( lthdatestr== 0)
  return 0


 for (i=0;i<lthdatestr;i++)
 { if (datestr.charAt(i)== '-')
  {
   status++;
  }
  if (status>2)
  {
   //alert("Invalid format of date!");
   return 0;
  }
  if ((status==0) && (datestr.charAt(i)!='-'))
  {
   tmpy=tmpy+datestr.charAt(i)
  }
  if ((status==1) && (datestr.charAt(i)!='-'))
  {
   tmpm=tmpm+datestr.charAt(i)
  }
  if ((status==2) && (datestr.charAt(i)!='-'))
  {
   tmpd=tmpd+datestr.charAt(i)
  }

 }
 year=new String (tmpy);
 month=new String (tmpm);
 day=new String (tmpd)
 //tempdate= new String (year+month+day);
 //alert(tempdate);
 if ((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2))
 {
  //alert("Invalid format of date!");
  return 0;
 }
 if (!((1<=month) && (12>=month) && (31>=day) && (1<=day)) )
 {
  //alert ("Invalid month or day!");
  return 0;
 }
 if (!((year % 4)==0) && (month==2) && (day==29))
 {
  //alert ("This is not a leap year!");
  return 0;
 }
 if ((month<=7) && ((month % 2)==0) && (day>=31))
 {
  //alert ("This month is a small month!");
  return 0;
 
 }
 if ((month>=8) && ((month % 2)==1) && (day>=31))
 {
  //alert ("This month is a small month!");
  return 0;
 }
 if ((month==2) && (day==30))
 {
  //alert("The Febryary never has this day!");
  return 0;
 }
 
 return 1;
}

function fucCheckNUM(NUM)
{
 var i,j,strTemp;
 strTemp="0123456789";
 if ( NUM.length== 0)
  return 0
 for (i=0;i<NUM.length;i++)
 {
  j=strTemp.indexOf(NUM.charAt(i)); 
  if (j==-1)
  {
  //说明有字符不是数字
   return 0;
  }
 }
 //说明是数字
 return 1;
} 

function getIdolConstell(id)
{
	var constellType=new Array("","白羊座","金牛座","双子座","巨蟹座","狮子座","处女座","天秤座","天蝎座","射手座","摩羯座","水瓶座", "双鱼座");
	if((id > -1) && (id < 13))
		document.write(constellType[id]);
}

function getIdolBlood(id)
{
	var bloodType=new Array("","O型","A型","B型","AB型","其它");
	if((id > -1) && (id < 6))
		document.write(bloodType[id]);
}

function getIdolHeight(id)
{
	if (id <=0)
		document.write("");
	else
		document.write(id+"厘米");
}

function getIdolWeight(id)
{
	if (id <=0)
		document.write("");
	else
		document.write(id+"公斤");
}

function getSubDate(datestr)
{
 	var lthdatestr;
	var tmpy="";
 	var tmpm="";
 	var tmpd=""; 	
	var status=0;

if (datestr != "")
{  		
	lthdatestr= datestr.length ;
	
  	for (i=0;i<lthdatestr;i++)
 	{ 
 		if (datestr.charAt(i)== '-')
  		{
   			status++;
  		}
  		if (status>2)
  		{
   		//alert("Invalid format of date!");
   			return 0;
  		}
		
  		if ((status==0) && (datestr.charAt(i)!='-'))
  		{
   			tmpy=tmpy+datestr.charAt(i);
  		}
  		if ((status==1) && (datestr.charAt(i)!='-'))
  		{
   			tmpm=tmpm+datestr.charAt(i);
  		}
  		if ((status==2) && (datestr.charAt(i)!='-'))
  		{
 			if(datestr.charAt(i)==' ')
				break; 
  			tmpd=tmpd+datestr.charAt(i);
  		}

 	}	
}

	var subDate=new Array(tmpy,tmpm,tmpd);

	return subDate;
}


function getCnDate(datestr)
{
 	var subDate;

 	subDate = getSubDate(datestr);
	if(subDate[0]=="0000"&&subDate[1]=="00"&&subDate[0]=="00")
	{
		document.write("");
		return 0;
	}
 	document.write(subDate[0]+"年");
	document.write(subDate[1]+"月");
	document.write(subDate[2]+"日");
	return 1;
}
function formatStr(srcString)
{
	var regstr = new RegExp("<", "g");
	srcString=srcString.replace(regstr, "&lt;");

	var regstr = new RegExp(">", "g");
	srcString=srcString.replace(regstr, "&gt;");	
	var regstr = new RegExp("\n", "g");
	srcString=srcString.replace(regstr, "<br>");
	var regstr = new RegExp("\"", "g");
	srcString=srcString.replace(regstr, "&quot");


//	
	return srcString;	
}

function formatShow(str)
{
	var srcString = formatStr(str);		 
	document.write(srcString);	
}

function fmtShowWeb(str)
{	
	var srcString = formatStr(str);		 
	str = ubbReplace(str, "all");
	document.write(srcString);	
	return str;	
}

function fmtShow(str,len)
{
	var subStr = TruncateStr(str,len);
	document.write("<span   title = \"");
	formatShow(str);
	document.write("\">");
	formatShow(subStr);	
	document.write("</span>");
}

function fmtShow1(str,len)
{
	var subStr = "·"+TruncateStr(str,len);
	document.write("<span   title = \"");
	formatShow(str);
	document.write("\">");
	formatShow(subStr);	
	document.write("</span>");
}

function chksafe(a)
{ 
	 fibdn = new Array ("<" ,">");
 	i=fibdn.length;
 	j=a.length;
 	for (ii=0;ii<i;ii++)
 	{ 
 		for (jj=0;jj<j;jj++)
  		{ 
  			temp1=a.charAt(jj);
   			temp2=fibdn[ii];
   			if (temp1==temp2)
   			{ return 0; }
  		}
 	}
 	return 1;
}

function showOpt(value,str)
{
	var strOpt = "<option  value=\"" + value +"\">"+str+"</option>"
	document.write(strOpt );

}
			
			
function showDigitOpt(begin,count,dir)
{
	if(dir)
	{
		for(i=begin;i<begin+count;i++)	showOpt(i,i);
	}
	else
	{	
		for(i=begin+count-1;i>=begin;i--)	showOpt(i,i);					
	}
}
function getOpType(op)
{
	var res = "";
	if(op==1)
		res = "添加";
	else if(op==2)
		res = "编辑";

	document.write(res);
}

 function showOp()
 {
 	var a = window.dialogArguments;
 	getOpType(a[0]); 	
 }

function musicHtmlReplace(srcString){
    var regstr = new RegExp("<", "g");
    srcString=srcString.replace(regstr, "&lt;");
    regstr = new RegExp(">", "g");
    srcString=srcString.replace(regstr, "&gt;");
    regstr = new RegExp("\'", "g");
    srcString=srcString.replace(regstr, "&apos;");
    regstr = new RegExp("\"", "g");
    srcString=srcString.replace(regstr, "&quot;");
    return srcString;
}
function URLencode(srcString){
		if(srcString=="http://" ||(srcString.substring(0,7)!="http://"&&srcString.substring(0,6)!="mms://"))
			srcString="";
	  var regstr = new RegExp("<", "g");
    srcString=srcString.replace(regstr, "&lt;");
    regstr = new RegExp(">", "g");
    srcString=srcString.replace(regstr, "&gt;");
    regstr = new RegExp("\'", "g");
    srcString=srcString.replace(regstr, "&apos;");
    regstr = new RegExp("\"", "g");
    srcString=srcString.replace(regstr, "&quot;");
    //regstr = new RegExp("%", "g");
    //srcString=srcString.replace(regstr, "%25");	
    regstr = new RegExp("&", "g");
    srcString=srcString.replace(regstr, "%26");
    //regstr = new RegExp("=", "g");
    //srcString=srcString.replace(regstr, "%3D");
		//regstr = new RegExp("+", "g");
    //srcString=srcString.replace(regstr, "%2B");	
    //regstr = new RegExp("?", "g");	
    // srcString=srcString.replace(regstr, "%3F");		
		//regstr = new RegExp(" ", "g");
    //srcString=srcString.replace(regstr, "+");					
		//regstr = new RegExp(":", "g");
    //srcString=srcString.replace(regstr, "%3A");								
		//regstr = new RegExp("/", "g");
		//srcString=srcString.replace(regstr, "%2F");
		regstr = new RegExp("\r", "g");
		srcString=srcString.replace(regstr, "%0A");																
		regstr = new RegExp("\n", "g");
		srcString=srcString.replace(regstr, "%0D");																		
		regstr = new RegExp(",", "g");
		srcString=srcString.replace(regstr, "%27");																				
		return srcString;
	}

// musicDemo.js
var tm="";
var bat=0;

function loadPlaylist() {
	Qstop();
	setQQMusicCookie(PANEL_UIN_COOKIE_NAME, PANEL_KEY_COOKIE_NAME);
	if (findWndElementByType(6)==-1) {
		if (cookie_iuin != top.g_iUin){
			alert("对不起，主人并未设置音乐播放器，暂时无法试听");
		}
		else if (confirm("您的Q-ZONE中还没有播放器，是否选择一个？")) {
			mall(2);
		}
	} else {
		addPlayList(top.g_iUin);
		setTimeout("Qnext()",2000);
	}
}

//function playSingleSong(name, url) {
//	if (findWndElementByType(6)==-1) {
//		if (cookie_iuin != top.g_iUin) {
//			alert("对不起，主人并未设置音乐播放器，暂时无法试听");
//		}
//		else if (confirm("您的Q-ZONE中还没有播放器，是否选择一个？")) {
//			mall(2);
//		}
//	}
//    else {
//		var regstr = new RegExp("&apos;", "g");
//		url=url.replace(regstr, "\'");
//		name=name.replace(regstr, "\'");
//		musicDemoPlay.URL= url;
//		tm=name;
//		bat=1;
//    }
//}

function playOneSong(name, url,qusid) {
/*	if(qusid<=0){
		setCookie(MUSIC_UIN_COOKIE_NAME, "");
	  setCookie(MUSIC_KEY_COOKIE_NAME, "");	
	}else{
		setQQMusicCookie(PANEL_UIN_COOKIE_NAME, PANEL_KEY_COOKIE_NAME);
		}
*/
	if (findWndElementByType(6)==-1) {
		if (cookie_iuin != top.g_iUin) {
			alert("对不起，主人并未设置音乐播放器，暂时无法试听");
		}
		else if (confirm("您的Q-ZONE中还没有播放器，是否选择一个？")) {
			mall(2);
		}
	}else {
		var regstr = new RegExp("&apos;", "g");
		url=URLencode(url);
		name=name.replace(regstr, "\'");
		if (bUseVQQPlayer) {
			var sTorrentURL = "";
			if(qusid>0)
		sTorrentURL = "http://219.134.128.55/"+ qusid + ".tpt";
		VQQPlayer.setPlayURL(qusid,url,sTorrentURL,0,"","");
		musicSwf.SetVariable("musicName", name);
		//setTimeout("sendName()",5500);
		}else{ 
		MediaPlayer.runPlayer(url);	
		musicSwf.SetVariable("musicName", name);
		//setTimeout("sendName()",5500);	
	}
		//tm=name;
		//bat=1;
    }
}

function showIT() {return;
	bat= 0;
	getUrl();
}

/////////////播放///////////
function Fplay(){
	  if(musicDemoPlay.currentPlaylist.attributeCount==1)return;
    musicDemoPlay.controls.play();
}
///////////停止/////////////////
function Fstop(){
    musicDemoPlay.controls.stop();
    g_msg="停止    ";
}
////////////暂停///////////////
function Fpause(){
    musicDemoPlay.controls.pause();
    g_msg="暂停    ";
}

////////////下一首///////////////
function Fnext() {
    musicDemoPlay.controls.next();
    Fplay();
    //g_msg="下一首    ";
}

////////////上一首///////////////
function Fprevious() {
    musicDemoPlay.controls.previous();
    Fplay();
   // g_msg="上一首    ";
}

/////////////读取地址////////////////
function getUrl() {
	var sUrl= "http://qzone_d"+getsid(g_iUin)+".qq.com/"+g_iUin+"/10";
	var sUrlBak= "http://q-zone.qq.com/cgi-bin/music/cgi_music_playlist?uin="+g_iUin;

	if ((1<<21)&g_StaticMode) {
		musicDemoPlay.URL= sUrl;
	}
	else {
		musicDemoPlay.URL= sUrlBak;
	}
}

///////////检测歌曲下载////////////////
function load_Music() {
	if (!document.all.musicDemoPlay) return;
	if (!musicDemoPlay.currentMedia) return;
	var cm= musicDemoPlay.currentMedia.name;
	if (bat==1) {
		document.musicSwf.SetVariable("musicName", tm);
	} else {
		document.musicSwf.SetVariable("musicName", cm);
	}
}

// qusic.js
//All Rights Reserved By Micoz.Zhong 
//Tencent.Crop.Limited
var S_UNDEFINE= 0;
var S_STOP = 1;
var S_PAUSE = 2;
var S_PLAYING = 3;
var S_FORWORD = 4;
var S_RESERVSE = 5;
var S_BUFFERING = 6;
var S_WAITING = 7;
var S_MEDIAEND = 8;
var S_TRANSITION = 9;
var S_READY = 10;
var S_RECONNECTION = 11;

//播放列表最大个数
var MAX_PLAYLIST_NUM = 200;

//p2p服务器设置
var P2P_UDP_SVR_IP = "219.134.128.54";
var P2P_UDP_SVR_PORT = 8000;
var P2P_TCP_SVR_IP = "219.134.128.54";
var P2P_TCP_SVR_PORT = 433;
var P2P_STUN_SVR_IP = "202.104.193.7";
var P2P_STUN_SVR_PORT = 8000;
var P2P_TORRENT_URL = "http://219.134.128.55/"
var P2P_CACHE_SPACE = 100;

//上报服务器设置
var STAT_REPORT_SVR_IP = "219.134.128.41";
var STAT_REPORT_SVR_PORT = 17653;

//music听歌设置
var MUSIC_COOKIE_DOMAIN = "qq.com"
var PANEL_UIN_COOKIE_NAME = "zzpaneluin";
var PANEL_KEY_COOKIE_NAME = "zzpanelkey";
var MUSIC_UIN_COOKIE_NAME = "qqmusic_uin";
var MUSIC_KEY_COOKIE_NAME = "qqmusic_key";

//当前播放器版本
var CURRENT_PLAYER_VERSION = "1.2.2.6";
//var CURRENT_PLAYER_VERSION = "1.2.2.3";
function PlayListObject()
{	
	this.mId = -1;
	this.mDuration = 0;
	this.mPlayURL = "";
	this.mTorrentURL = "";
	this.mSongName = "";
	this.mSingerName = "";
}

function PlayerListManager()
{	
	this.mFull  = false;
	this.mPosition = -1;
	this.mpList = new Array();
	
	//获取播放列表的长度
	this.getCount = function()
	{
			return this.mpList.length;
	}
	
	//获取指定下标的播放列表信息
	this.getObject = function(n)
	{
		return this.mpList[n];
	}
	
	//根据播放url查找播放列表的下标
	this.getPos = function(strURL)
	{
		for(var i=0; i<this.getCount(); i++)
		{
			if(this.getObject(i).mPlayURL==strURL) 
				return i ;
		}
		return -1 ;
	}
	
	//根据播放id查找播放列表的下标
	this.getPosById = function(Id)
	{
		for(var i=0; i<this.getCount(); i++)
		{
			if(this.getObject(i).mId==Id) 
				return i ;
		}
		return -1 ;
	}	
	
	//根据播放url查找对应播放列表内容
	this.findObject = function(strURL)
	{	
		var i = this.getPos(strURL) ;
		if(i!=-1)
			return this.getObject(i) ;
		return null;
	}
	
	//根据播放id查找对应播放列表内容
	this.findObjectById = function(iId)
	{
		var i = this.getPosById(iId) ;
		if(i!=-1)
			return this.getObject(i) ;
		return null;	
	}	
	
	//根据播放url查找对应播放列表
	this.findObject = function(strURL)
	{	
		var i = this.getPos(strURL) ;
		if(i!=-1)
			return this.getObject(i) ;
		return null;
	}
	
	//添加指定内容到播放列表
	this.addObject = function(iId, strURL, strTorrentURL, iDuration, strSongName, strSingerName)
	{	
		if (strURL=="")
			return;
		
		var obj, pos;
		if (iId>0)
			pos = this.getPosById(iId);
		else if (strURL!="")
			pos = this.getPos(strURL);

		if(pos!=-1)
		{
			/*
			obj = this.getObject(pos);
			obj.mId = iId;
			obj.mPlayURL = strURL;
			obj.mTorrentURL = strTorrentURL;
			obj.mDuration = iDuration;
			obj.mSongName = strSongName;
			obj.mSingerName = strSingerName;
			*/
		}
		else if (this.getCount()>=MAX_PLAYLIST_NUM)
		{
			this.mFull  = true;
			this.mPosition+=1;
			if (this.mPosition>=MAX_PLAYLIST_NUM)
				this.mPosition = 0;
			
			obj = this.getObject(this.mPosition);
			obj.mId = iId;
			obj.mPlayURL = strURL;
			obj.mTorrentURL = strTorrentURL;
			obj.mDuration = iDuration;
			obj.mSongName = strSongName;
			obj.mSingerName = strSingerName;
		}	
		else
		{	
				obj = new PlayListObject() ;
				obj.mId = iId;
				obj.mPlayURL = strURL;
				obj.mTorrentURL = strTorrentURL;
				obj.mDuration = iDuration;
				obj.mSongName = strSongName;
				obj.mSingerName = strSingerName;
				this.mpList[this.getCount()] = obj ;
		}
		return;			
	}
	
	//根据播放url更新播放列表
	this.updateObject = function(iId, strURL, strTorrentURL, iDuration, strSongName, strSingerName)
	{	
		var n = this.getPos(strURL) ;
		if(n != -1)
		{
			this.mpList[n].mId = iId;
			this.mpList[n].mDuration = iDuration ;
			this.mpList[n].mTorrentURL = strTorrentURL;
			this.mpList[n].mSongName = strSongName;
			this.mapList[n].mSingerName = strSingerName;
			return true;
		}
		return false;
	}
	
	//根据id更新播放列表
	this.updateObjectById = function(iId, strURL, strTorrentURL, iDuration, strSongName, strSingerName)
	{	
		var n = this.getPosById(iId) ;
		if(n != -1)
		{
			this.mpList[n].mPlayURL = strURL;
			this.mpList[n].mTorrentURL = strTorrentURL;
			this.mpList[n].mDuration = iDuration ;
			this.mpList[n].mSongName = strSongName;
			this.mapList[n].mSingerName = strSingerName;
			return true;
		}
		return false;
	}
	
	//根据播放url从播放列表中删除指定内容
	this.deleteObject = function(strURL)
	{	
		var n = this.getPos(strURL) ;
		if(n!=-1)
		{	
			delete this.mpList[n];
			this.mpList.length-- ;
			return true;
		}
		return false;
	}

	//根据播放id从播放列表中删除指定内容
	this.deleteObjectById = function(iId)
	{	
		var n = this.getPosById(iId) ;
		if(n!=-1)
		{	
			delete this.mpList[n];
			this.mpList.length-- ;
			return true;
		}
		return false;
	}
	
	//清空播放列表
	this.clearObject = function()
	{	
		for(var i=0; i<this.getCount(); i++)
			delete this.mpList[i];
		this.mpList.length = 0;
	}
}

function WMPlayer()
{
	this.mPlayerName = "";
	this.mInitializeStatus = false;
	this.mMute = false;
	this.mPlayList = new PlayerListManager();
	this.mPlayingPos = -1;
	this.mVisible = true;
	this.mInstall = true;
	this.mDLLink = "";
	this.mUinCookieName = "";									//uin cookie name
	this.mKeyCookieName = "";									//key cookie name	
	
	this.checkPlayer = function(strDLLink)
	{
		var objPlayer = document.all(this.mPlayerName);
		if (!objPlayer) 
			return false;

		if (!objPlayer.Controls) 
			return false;

		return true;
	}
	
	this.createActiveX = function(bVisible, bInstall, objName, objWidth, objHeight, strUinCookieName, strKeyCookieName, strDLLink)
	{
		if (objName=="")
			objName = "wmplayer";
			
		this.mPlayerName = objName;
		var objStr = "<OBJECT id=\"" + objName + "\" width=\""+ objWidth + "\" height=\"" + objHeight + "\" CLASSID=\"CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\">";
		/*
		document.write(objStr);
  	document.write("<PARAM Name=\"autoStart\" value=\"true\">");
  	if (!bVisible)
  		document.write("<PARAM Name=\"uiMode\" value=\"invisible\">");
  	document.write("</OBJECT>");
		*/
		
		objStr = objStr + "<PARAM Name=\"autoStart\" value=\"true\">";
		if (!bVisible)
			objStr = objStr + "<PARAM Name=\"uiMode\" value=\"invisible\">";
		objStr = objStr + "</OBJECT>";
		
		this.mVisible = bVisible;
		this.mInstall = bInstall;
		this.mUinCookieName = strUinCookieName;
		this.mKeyCookieName = strKeyCookieName;
		this.mDLLink = strDLLink;
		return objStr;
	}

	this.initialize = function()
	{
		if (!this.checkPlayer())
		{
			if (this.mInstall)
			{
				alert("对不起，您现在的媒体播放器版本太低，请升级媒体播放器。");
				window.location = this.mDLLink;
			}
			return false;
		}
		
		if (!setQQMusicCookie(this.mUinCookieName, this.mKeyCookieName))
			return false;

		this.mInitializeStatus = true;
		return true;
	}	
	
	this.isInitialize = function()
	{
		return this.mInitializeStatus;
	}	
	
	this.getStatus = function()
	{
		if (!this.mInitializeStatus)
			return -1;

		return document.all(this.mPlayerName).playState;
	}	

	this.getCurrentMusic = function()
	{
		if (this.mPlayingPos<0)
			return null;
		return this.mPlayList.getObject(this.mPlayingPos);
	}	
	
	this.runPlayer = function(strPlayURL)
	{
		if (!this.mInitializeStatus)
			return;
		
		if (this.isPause())
		{

		}	
		else	if ( (strPlayURL!=null) && (strPlayURL!="") )
		{	
			document.all(this.mPlayerName).URL = strPlayURL;
			this.mPlayList.addObject(-1, strPlayURL, "", 0, "", "");
			this.mPlayingPos = this.mPlayList.getPos(strPlayURL);
		}
		
		if ( (this.mPlayingPos<0) && (this.mPlayList.getCount()>0	) )
		{
			this.mPlayingPos = 0;
			document.all(this.mPlayerName).URL = this.mPlayList.getObject(0).mPlayURL;
		}
		
		var strPatch = /qqmusic.qq.com/i;
		if (document.all(this.mPlayerName).URL.search(strPatch))
			return;
		
		try
		{
		if (document.all(this.mPlayerName).Controls.isAvailable('play')) 
			document.all(this.mPlayerName).Controls.Play();
		}
		catch(e)
		{
			//alert("error");
		}	
		return;		
	}	
	
	this.stopPlayer = function()
	{
		if (!this.mInitializeStatus)
			return false;
		
		if ( (!this.isPlaying()) && (!this.isPause()) )
			return false;
		
		try
		{	
		if (document.all(this.mPlayerName).Controls.isAvailable('stop')) 
			document.all(this.mPlayerName).Controls.Stop();
		}
		catch(e)
		{
			//alert("error");
		}		
		return true;
	}		
	
	this.pausePlayer = function()
	{
		if (!this.mInitializeStatus)
			return false;
		
		if (!this.isPlaying())
			return false;
		
		try
		{	
		if (document.all(this.mPlayerName).Controls.isAvailable('pause')) 
			document.all(this.mPlayerName).Controls.Pause();
		}
		catch(e)
		{
			//alert("error");
		}			
		return true;
	}	
	
	this.isPlaying = function()
	{
		if (!this.mInitializeStatus)
			return false;

		var _status = this.getStatus();
		return ((_status==S_PLAYING) || (_status==S_BUFFERING));
	}
	
	this.isPause = function()
	{
		if (!this.mInitializeStatus)
			return false;

		var _status = this.getStatus();
		return (_status==S_PAUSE);		
	}
	
	this.isStop = function()
	{
		if (!this.mInitializeStatus)
			return false;
		
		var _status = this.getStatus();
		return 	((_status==S_STOP) || (_status==S_MEDIAEND) || (_status==S_UNDEFINE));
	}	
	
	this.setMute = function()
	{
		if (!this.mInitializeStatus)
			return false;

		if (document.all(this.mPlayerName).settings.mute)
			document.all(this.mPlayerName).settings.mute = false;
		else
			document.all(this.mPlayerName).settings.mute = true;		
		
		return true;
	}
		
	this.setVolumn = function(type)
	{
		if (!this.mInitializeStatus)
			return false;
	
		if (document.all(this.mPlayerName).settings.mute)
			return false;
		
		switch(type)
		{
			case "up":
				if (document.all(this.mPlayerName).settings.volume+10<100)
					document.all(this.mPlayerName).settings.volume+=10;
				break;
			case "down":
				if (document.all(this.mPlayerName).settings.volume-10>0)
					document.all(this.mPlayerName).settings.volume-=10;
				break;
			default:
				break;
		}			
		return true;	
	}	
	this.quickPlayer = function(pos)
	{
		if (!this.mInitializeStatus)
			return false;
		if (!this.isPlaying())
			return false;
		if ((document.all(this.mPlayerName).Controls.currentPosition+pos)>=document.all(this.mPlayerName).currentMedia.duration)
			return false;
		if ((document.all(this.mPlayerName).Controls.currentPosition+pos)<=0)
			return false;
			document.all(this.mPlayerName).Controls.currentPosition+=pos;
		//setInterval("forwardPlayer("+pos+")", 1000);
		return true;
	}
	
	this.lastPlayer = function()
	{
		if (this.mPlayList.getCount()==0)
			return;
		
		this.mPlayingPos = this.mPlayingPos - 1;
		if ( (this.mPlayingPos<0) || (this.mPlayingPos>=this.mPlayList.getCount()) )
			this.mPlayingPos = 0;
		
		this.runPlayer(this.mPlayList.getObject(this.mPlayingPos).mPlayURL);
		return this.mPlayingPos;
	}
	
	this.nextPlayer = function()
	{
		if (this.mPlayList.getCount()==0)
			return -1;
		this.mPlayingPos = this.mPlayingPos + 1;
		if ( (this.mPlayingPos>=this.mPlayList.getCount()) || (this.mPlayingPos<0) )
			this.mPlayingPos = 0;
			this.runPlayer(this.mPlayList.getObject(this.mPlayingPos).mPlayURL);
		return this.mPlayingPos;	
	}
			
	this.setBalance = function()
	{
		document.all(this.mPlayerName).settings.balance = document.all(this.mPlayerName).settings.balance=='100'?'-100':'100';
		return (document.all(this.mPlayerName).settings.balance=='100'?'右声道':'左声道');
	}
	
	this.getErrorMsg = function()
	{
		var errorDesc = document.all(this.mPlayerName).error.item(0).errorDescription;
		return errorDesc;
	}	

	this.autoRandomPlay = function(objName, bAutoPlay, bRandom)
	{
		if (!this.isInitialize())
			return;
			
		if (this.mPlayList.getCount()==0)
		{
		}	
		else if (bAutoPlay)
		{
			if (bRandom)
			{
				//随机播放
				try
				{
				if ( this.isStop() || document.all(this.mPlayerName).Controls.isAvailable('play') )
				{
					this.mPlayingPos = Math.floor(Math.random()*this.mPlayList.getCount());
					this.runPlayer(this.mPlayList.getObject(this.mPlayingPos).mPlayURL);
				}
				}
				catch(e)
				{
					//alert("error");
				}			
			}
			else
			{	
				//顺序播放
				try
				{
				if ( this.isStop() || document.all(this.mPlayerName).Controls.isAvailable('play') )
					this.nextPlayer();
				}
				catch(e)
				{
					//alert("error");
				}				
			}
		}
		return;
	}	
	
	this.printPlayList = function()
	{
		var list = "";
		for (var i=this.mPlayList.getCount(); i>0; i--)
		{
			list = list + "第[" + i + "]" + "播放记录:" + this.mPlayList.getObject(i-1).mPlayURL + "\n";  
		}	
		return list;
	}	
}	

function QQPlayer()
{
	this.mPlayerName = "";										//控件id
	this.mInitializeStatus = false;						//控件是否已初始化
	this.mMute = false;												//是否静音
	this.mPlayList = new PlayerListManager();	//播放歌曲列表
	this.mPlayingPos = -1;										//当前播放歌曲列表下标
	this.mUseP2P = false;											//是否使用P2P
	this.mVisible = true;											//控件是否可视
	this.mInstall = false;										//是否跳转到安装下载页面
	this.mDLLink = "";												//安装下载页面跳转链接
	this.mUinCookieName = "";									//uin cookie name
	this.mKeyCookieName = "";									//key cookie name	
	
	this.setPlayParams = function(iMusicId, strURL)
	{
		//设置播放的参数
		var iUin = getCookie(MUSIC_UIN_COOKIE_NAME);
		if ( (iUin=="") || (iUin<0) )
			iUin = 0;
			
		var strKey = getCookie(MUSIC_KEY_COOKIE_NAME);

		document.all(this.mPlayerName).SetValidateDomain(MUSIC_COOKIE_DOMAIN);
		document.all(this.mPlayerName).SetQQNum(iUin);
		document.all(this.mPlayerName).SetValidateMusicID(iMusicId);
		document.all(this.mPlayerName).SetValidateKey(strKey);
		document.all(this.mPlayerName).SetValidateURL(strURL);

		/*
		document.all(this.mPlayerName).SetValidateEndtime((long)pSongData->dbPlayTime);
		document.all(this.mPlayerName).SetValidateIP(pSongData->strIP);
		document.all(this.mPlayerName).SetValidateidiograph(pSongData->strIdiograph);
		document.all(this.mPlayerName).SetValidateFromtag(pSongData->dwFromTag);
		document.all(this.mPlayerName).SetValidateFriendUin(strFUin);
		*/

		return;
	}	
	
	this.checkPlayer = function()
	{
		//检查并初始化控件参数
		var objPlayer = document.all(this.mPlayerName);
		if (!objPlayer) 
			return false;
		
		try
		{
			objPlayer.SetCacheSpace(P2P_CACHE_SPACE);
			if (!objPlayer.InitControl())
				return false;
		}
		catch(e)
		{
			return false;
		}	
		
		if (this.mUseP2P)
		{
			objPlayer.EnableP2P(true);
			objPlayer.SetP2PServerUDPInfo(P2P_UDP_SVR_IP, P2P_UDP_SVR_PORT);
			//objPlayer.SetP2PServerUDPInfo("219.134.128.54", 8000);
			objPlayer.SetP2PServerTCPInfo(P2P_TCP_SVR_IP, P2P_TCP_SVR_PORT);
			objPlayer.SetStunServerInfo(P2P_STUN_SVR_IP, P2P_STUN_SVR_PORT);
			//objPlayer.LaunchP2PShare("QQMusicReport.exe", 60);
			objPlayer.LaunchP2PShare("QzoneSupport.exe", 60);
		}
		else
			objPlayer.EnableP2P(false);
			
		objPlayer.EnableLocalHttpServer();
		objPlayer.LaunchUDPReport(STAT_REPORT_SVR_IP, STAT_REPORT_SVR_PORT, "Qusic-QZone");

		var player_ver = objPlayer.GetVersion();
		var main_ver = player_ver.substr(16, 8);
		//alert(main_ver);
		if (main_ver<CURRENT_PLAYER_VERSION)
			return false;
			
		return true;
	}
	
	this.createActiveX = function(bVisible, bInstall, bUseP2P, objName, objWidth, objHeight, strUinCookieName, strKeyCookieName, strDLLink)
	{ 
		//创建ACTIVEX控件,从创建对象到生成,会有一定的时间间隔
		//调用这个函数，需要间隔一至数秒的时间才能调用初始化函数
		if (objName=="")
			objName = "qqplayer";
		this.mPlayerName = objName;

		//var objStr = "<OBJECT id=\"" + this.mPlayerName + "\" width=\"" + objWidth + "\" height=\"" + objHeight + "\" CLASSID=\"CLSID:AC3A36A8-9BFF-410a-A33D-2279FFEB69D2\" codeBase=\"http://imgcache.qq.com/music/QQMusicSetup.exe#version=1,2,2,6\"></OBJECT>";
		var objStr = "<OBJECT id=\"" + this.mPlayerName + "\" width=\"" + objWidth + "\" height=\"" + objHeight + "\" CLASSID=\"CLSID:AC3A36A8-9BFF-410a-A33D-2279FFEB69D2\"></OBJECT>"; 
		this.mVisible = bVisible;		
		this.mUseP2P = bUseP2P;
		this.mDLLink = strDLLink;
		this.mInstall = bInstall;
		this.mUinCookieName = strUinCookieName;
		this.mKeyCookieName = strKeyCookieName;
		return objStr;
	}
		
	this.initialize = function()
	{
		//初始化播放器
		if (!this.checkPlayer())
		{
			if (this.mInstall)
			{
				alert("对不起，您现在的媒体播放器版本太低，请升级媒体播放器。");
				window.location = this.mDLLink;
			}
			return false;
		}
		
		if (!setQQMusicCookie(this.mUinCookieName, this.mKeyCookieName))
			return false;
		
		this.mInitializeStatus = true;
		return true;
	}
	
	this.unInitialize = function()
	{
		//释放播放器所占用资源
		try
		{
			if (document.all(this.mPlayerName).UninitControl())
				return true;
		}
		catch(e)
		{	
			return false;	
		}
	}	

	this.isInitialize = function()
	{
		//播放器是否被初始化
		return this.mInitializeStatus;
	}	
	
	this.getStatus = function()
	{
		//获取当前播放状态
		if (!this.mInitializeStatus)
			return -1;
		
		var _status = -1;
		_status = document.all(this.mPlayerName).GetPlayState();
		return _status;
	}		
	
	this.setPlayURL = function(iId, strPlayURL, strTorrentURL, iDuration, strSongName, strSingerName)
	{
		//设置播放URL
		if (!this.mInitializeStatus)
			return;
		
		if ( ((strPlayURL==null) || (strPlayURL=="")) && (iId<0) )
			return;
		
		if (iId<0)
		{
			this.mPlayingPos = this.mPlayList.getPos(strPlayURL);
			document.all(this.mPlayerName).SetPlayURL(strPlayURL, 0);
			this.mPlayList.addObject(iId, strPlayURL, strTorrentURL, 0, strSongName, strSingerName);	
		}
		else
		{
			this.setPlayParams(iId, strPlayURL);
			this.mPlayingPos = this.mPlayList.getPosById(iId);
			document.all(this.mPlayerName).SetPlayURL2(strPlayURL, strTorrentURL, iId, this.bUseP2P);
			this.mPlayList.addObject(iId, strPlayURL, strTorrentURL, 0, strSongName, strSingerName);	
		}
		
		return;				
	}	

	this.setPlayList = function()
	{
		//此功能将播放列表保存到播放器,会造成播放器播放列表与js中播放列表不同步的情况
		//慎用之,使用时,建议用setInterval函数，定时设置播放列表
		document.all(this.mPlayerName).SetList(this.mPlayList);
		return;
	}	

	this.resetCache = function()
	{
		//清空p2p cache数据
		document.all(this.mPlayerName).ResetCache();
	}	
	
	this.isPlaying = function()
	{
		//判断播放是否正在进行
		if (!this.mInitializeStatus)
			return false;

		var _status = this.getStatus();
		return ((_status==S_PLAYING) || (_status==S_BUFFERING));
	}
	
	this.isPause = function()
	{
		//判断播放是否被暂停
		if (!this.mInitializeStatus)
			return false;

		var _status = this.getStatus();
		return (_status==S_PAUSE);
	}
	
	this.isStop = function()
	{
		//判断播放是否被中断
		if (!this.mInitializeStatus)
			return false;

		var _status = this.getStatus();
		return ((_status==S_STOP) || (_status==S_MEDIAEND));	
	}	
		
	this.getCurrentMusic = function()
	{
		if (this.mPlayingPos<0)
			return null;
		return this.mPlayList.getObject(this.mPlayingPos);
	}	

	this.runPlayer = function(strPlayURL)
	{
		//开始播放
		if (!this.mInitializeStatus)
			return;
		
		if (this.isPause())
		{
			this.startPlayer();
		}
		else if (this.mPlayingPos<0 && this.mPlayList.getCount()>0)
		{
			this.mPlayingPos = 0;
			this.setPlayURL(this.mPlayList.getObject(0).mId, this.mPlayList.getObject(0).mPlayURL, this.mPlayList.getObject(0).mTorrentURL, this.mPlayList.getObject(0).mDuration, this.mPlayList.getObject(0).mSongName, this.mPlayList.getObject(0).mSingerName);
		}
		else
		{	
			this.startPlayer();
		}
		
		if (this.mPlayingPos>0)
		{
			//使用P2P的方式预先下载下一首歌曲
			var strPatch = /qqmusic.qq.com/i;
			for(var i=this.mPlayingPos; i<this.mPlayList.getCount(); i++)
			{
				if (this.mPlayList.getObject(i).mPlayURL.search(strPatch))
				{
					document.all(this.mPlayerName).SetPrepareSong(this.mPlayList.getObject(i).mPlayURL, this.mPlayList.getObject(i).mTorrentURL);
					break;
				}	 
			}	
		}
			
		return;
	}

	this.startPlayer = function()
	{
		//开始播放
		try
		{
		if (document.all(this.mPlayerName).isAvailable('play'))
		{
			document.all(this.mPlayerName).Play();		
			return true;
		}
		}
		catch(e)
		{
			//alert("error");
		}	
		return false;
	}
	
	this.stopPlayer = function()
	{
		//停止播放
		if (!this.mInitializeStatus)
			return false;
		
		if ( (!this.isPlaying()) && (!this.isPause()) )
			return false;
		
		try
		{
		if (document.all(this.mPlayerName).isAvailable('stop'))
		{
			document.all(this.mPlayerName).Stop();
			return true;
		}
		}
		catch(e)
		{
			//alert("error");
		}
		return false;
	}
	
	this.pausePlayer = function()
	{
		//暂停播放
		if (!this.mInitializeStatus)
			return false;
		
		if (!this.isPlaying())
			return false;
			
		try
		{
		if (document.all(this.mPlayerName).isAvailable('pause'))
			document.all(this.mPlayerName).Pause();		
		}
		catch(e)
		{
			//alert("error");
		}
	}
	
	this.setMute = function()
	{
		//false:未设置静音   true:设置静音
		if (!this.mInitializeStatus)
			return false;

		var bSet = 1 - document.all(this.mPlayerName).GetMute();
		if ( (bSet!=0) && (bSet!=1) )
			return false;
			
		document.all(this.mPlayerName).SetMute(bSet);
		return (bSet==0?false:true);
	}
	
	this.setVolumn = function(type)
	{
		if (!this.mInitializeStatus)
			return false;
	
		if (document.all(this.mPlayerName).GetMute()==1)
			return false;

		var vol = document.all(this.mPlayerName).GetVolume();
		switch(type)
		{
			case "up":
				vol+=10;
				if(vol>100) 
					vol = 100;
				document.all(this.mPlayerName).SetVolume(vol);
				break;
			case "down":
				vol-=10;
				if(vol<0)
					vol = 0;
				document.all(this.mPlayerName).SetVolume(vol);	
				break;
			default:
				break;		
		}	
		return true;
	}
	
	this.quickPlayer = function(pos)
	{
		//快进：pos>0  回退:pos<0
		if (!this.mInitializeStatus)
			return false;
		
		if (!this.isPlaying())
			return false;
		
		var curr = document.all(this.mPlayerName).GetCurrentPos();
		curr = curr + pos;
		
		if (curr<=0)
			return false;
		
		var currDuration = document.all(this.mPlayerName).GetAttributeDuration();
		if ( (currDuration>0) && (curr>currDuration) )
			return false;
			
		document.all(this.mPlayerName).SetCurrentPos(curr);
		return true;
	}

	this.lastPlayer = function()
	{
		//上一首歌
		if (this.mPlayList.getCount()==0)
			return -1;
		
		this.mPlayingPos = this.mPlayingPos - 1;
		if ( (this.mPlayingPos<0) || (this.mPlayingPos>=this.mPlayList.getCount()) )
			this.mPlayingPos = 0;
		
		this.setPlayURL(this.mPlayList.getObject(this.mPlayingPos).mId, this.mPlayList.getObject(this.mPlayingPos).mPlayURL, this.mPlayList.getObject(this.mPlayingPos).mTorrentURL, this.mPlayList.getObject(this.mPlayingPos).mDuration,
		this.mPlayList.getObject(this.mPlayingPos).mSongName, this.mPlayList.getObject(this.mPlayingPos).mSingerName);
		return this.mPlayingPos;
	}
	
	this.nextPlayer = function()
	{
		//下一首歌
		if (this.mPlayList.getCount()==0)
			return -1;
	
		this.mPlayingPos = this.mPlayingPos + 1;
		if ( (this.mPlayingPos>=this.mPlayList.getCount()) || (this.mPlayingPos<0) )
			this.mPlayingPos = 0;
	  this.setPlayURL(this.mPlayList.getObject(this.mPlayingPos).mId, this.mPlayList.getObject(this.mPlayingPos).mPlayURL, this.mPlayList.getObject(this.mPlayingPos).mTorrentURL, this.mPlayList.getObject(this.mPlayingPos).mDuration, this.mPlayList.getObject(this.mPlayingPos).mSongName, this.mPlayList.getObject(this.mPlayingPos).mSingerName);
    return this.mPlayingPos;	
	}

	this.autoRandomPlay = function(objName, bAutoPlay, bRandom)
	{
		if (this.mPlayList.getCount()==0)
		{
		}
		else if (bAutoPlay)
		{
			if (bRandom)
			{
				//随机播放
				try
				{
				if (this.isStop() || document.all(this.mPlayerName).isAvailable('play') )
				{
					this.mPlayingPos = Math.floor(Math.random()*this.mPlayList.getCount());
					this.setPlayURL(this.mPlayList.getObject(this.mPlayingPos).mId, this.mPlayList.getObject(this.mPlayingPos).mPlayURL, this.mPlayList.getObject(this.mPlayingPos).mTorrentURL, this.mPlayList.getObject(this.mPlayingPos).mDuration, this.mPlayList.getObject(this.mPlayingPos).mSongName, this.mPlayList.getObject(this.mPlayingPos).mSingerName);
				}
				}
				catch(e)
				{
					//alert("error");
				}
			}
			else
			{	
				//顺序播放
				try
				{
				if (this.isStop() || document.all(this.mPlayerName).isAvailable('play') )
					this.nextPlayer();
				}
				catch(e)
				{
					//alert("error");
				}	
			}
		}
		return;
	}	
	
	this.printPlayList = function()
	{
		//打印播放列表
		var list = "";
		for (var i=this.mPlayList.getCount(); i>0; i--)
		{
			list = list + "第[" + i + "]" + "播放记录:" + this.mPlayList.getObject(i-1).mPlayURL + "\n";
		}	
		return list;
	}
}

//获取cookie的值
//参数：name - cookie name
//返回：cookie value(若不存在，则返回"")
function getCookie(name)
{
	var search;
	search = name + "=";
	offset = document.cookie.indexOf(search);
	if (offset != -1) {
		offset += search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
	}
	else
		return "";
}

//设置Cookie值
//参数：cookie name - cookie name; value - cookie value
//返回: void
function setCookie (name, value)
{
	document.cookie = name + "=" + value + "; path=/; domain=qq.com";
	return;
}

//设置QQMusic Cookie
//参数: params1 - 用户QQ号码Cookie Name, params2 - 用户校验Key Cookie Name
//返回: void
function setQQMusicCookie(params1, params2)
{
	var mValue;
	mValue = getCookie(params1);
	setCookie(MUSIC_UIN_COOKIE_NAME, mValue);
	
	mValue = getCookie(params2);
	setCookie(MUSIC_KEY_COOKIE_NAME, mValue);	
	return true;
}

//判断是否是不可见字符
function isASCII(character)
{
	if ((character>0)&&(character<=255))
		return true;
	return false;
}

//得到字符串的长度
function getStrLen(str)
{
	var _len = 0;
	for(var i=0; i<str.length; i++)
	{
		if(isASCII(str.charCodeAt(i)))
			_len += 1;
		else
			_len+= 2;
	}
	return _len;
}

//以下实现解析Q-Zone返回的XML格式的播放列表
function analyseXMLURL(sDynamicURL, sStaticURL, bIsStatic, objPlayerName) {
	if ( (sDynamicURL=="") || (sStaticURL=="") || (!objPlayerName) )
		return;
	
	try
	{	
		var xmlDoc = new ActiveXObject("microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function()
		{
			if (xmlDoc.readyState==4)	
			{
				if (xmlDoc.parseError.errorCode != 0) 
				{
					//alert("对不起，您的浏览器不支持Qusic的新特性。");
				}
				else
				{	
					objPlayerName.mPlayList.clearObject();
					var sSongName="", sSingerName="", sPlayURL="", iMusicId=-1, sTorrentURL="";
					var songList = xmlDoc.documentElement.selectNodes("/data/playlist/song");
          if(songList.length==0) {
          clearInterval(qusicName);
         	return;  
          }
					for (var i=0; i<songList.length; i++)
					{
						sSongName = songList[i].getAttributeNode("name").text;//alert(sSongName);
						sSingerName = songList[i].getAttributeNode("singer").text;
						sPlayURL = URLencode(songList[i].getAttributeNode("url").text);//alert(sPlayURL);
						iMusicId = songList[i].getAttributeNode("qusid").text;
						sTorrentURL = "http://219.134.128.55/"+ iMusicId + ".tpt";
						objPlayerName.mPlayList.addObject(iMusicId, sPlayURL, sTorrentURL, 0, sSongName, sSingerName);	
				}
					//objPlayerName.runPlayer("");
					runPlayer();
				}//end else
			}//end if (xmlDoc.readyState==4)	
		}
		
		xmlDoc.async = "true";
		if (bIsStatic)
			xmlDoc.load(sStaticURL);
		else
			xmlDoc.load(sDynamicURL);
	}
	catch(e)
	{
		//alert("对不起，您的浏览器不支持Qusic新特性。");
	}	
	return;
}

function CreatePlayer(){
	if (VQQPlayer.isInitialize()){
	bUseVQQPlayer = true;
			return true;
		}
		VQQPlayer.unInitialize();
		document.all.wm_control.innerHTML = MediaPlayer.createActiveX(true, false, "wmplayer", "0", "0",  PANEL_UIN_COOKIE_NAME, PANEL_KEY_COOKIE_NAME, "http://www.qq.com");
		MediaPlayer.initialize();
		return true;	
			}
function addPlayList(uin){
	if (bMusicLoaded){
		if (bUseVQQPlayer)
			analyseXMLURL("http://q-zone.qq.com/cgi-bin/music/cgi_playlist_xml?uin="+uin, "http://qzone_d1.qq.com/"+uin+"/10", false, VQQPlayer);
		else
			analyseXMLURL("http://q-zone.qq.com/cgi-bin/music/cgi_playlist_xml?uin="+uin, "http://qzone_d1.qq.com/"+uin+"/10", false, MediaPlayer);
		qusicName=setInterval("sendName()",1000);
	}
}
function runPlayer(){
	if(!VQQPlayer) return;
	if(!MediaPlayer) return;
	if (bUseVQQPlayer) 
			VQQPlayer.runPlayer('');
			else 
			MediaPlayer.runPlayer('');
			top.RefreshXMLData(3);
			top.g_FlowerXDoc=top.LoadXMLData(3);
			var Mark=top.g_FlowerXDoc.selectSingleNode("/data/mark").text;
			if ((Mark>>4)%2==1)
				bRandomPlay = true;
			else
				bRandomPlay = false;	
			setAutoPlay(true, bRandomPlay);
			//qusicName=setInterval("sendName()",1000);
	}	
	function pausePlayer(){
	if (bUseVQQPlayer) 
		VQQPlayer.pausePlayer();
	else 
		MediaPlayer.pausePlayer();
}	
	function stopPlayer(){
	if (bUseVQQPlayer) 
		VQQPlayer.stopPlayer();
	else 
		MediaPlayer.stopPlayer();
}	
		function lastPlayer()	{
		if (bUseVQQPlayer) 
			VQQPlayer.lastPlayer();
		else 
			MediaPlayer.lastPlayer();
	}	
	function nextPlayer()	{
			if (bUseVQQPlayer) 
				VQQPlayer.nextPlayer();
			else 
			MediaPlayer.nextPlayer();
						}	
function setAutoPlay(bAutoPlay, bRandomPlay){
	if (bUseVQQPlayer)
		VQQPlayer.autoRandomPlay(VQQPlayer, bAutoPlay, bRandomPlay);
	else
		MediaPlayer.autoRandomPlay(MediaPlayer, bAutoPlay, bRandomPlay);
	idAutoPlay = setTimeout("setAutoPlay("+bAutoPlay+","+bRandomPlay+")", 5000);
}	

function sendName(){
	if(bUseVQQPlayer == true)
	{
	var obj=VQQPlayer.getCurrentMusic();
	if ( !obj || (obj.mSongName=="") ) return;
	if(!document.musicSwf) return;
	document.musicSwf.SetVariable("musicName", obj.mSongName);//alert(obj.mSongName);
  }
else{
	var obj=MediaPlayer.getCurrentMusic();
	if ( !obj || (obj.mSongName=="") ) return;
	if(!document.musicSwf) return;
  document.musicSwf.SetVariable("musicName", obj.mSongName);
  }
	}
	
	function musicSwf_DOFSCommand(command,args){
    if (command=="Play"){
         Qplay();
	}
	  if (command=="Stop"){
         Qstop();
	}
	  if (command=="Pause"){
         Qpause();
	}
		if (command=="next"){
         Qnext();
	}

	if (command=="previous"){
         Qprevious();
	}
	if (command=="gotoMusic") {
		showmusiclist();
		}
}
/////////////播放///////////
function Qplay(){
	  
	  runPlayer();
	  }
///////////停止/////////////////
function Qstop(){
	 clearTimeout(idAutoPlay);
   stopPlayer(); 
}   
////////////暂停///////////////
function Qpause(){
   clearTimeout(idAutoPlay);
   pausePlayer();
 }

////////////下一首///////////////
function Qnext() {
    nextPlayer();
    //g_msg="下一首    ";
}

////////////上一首///////////////
function Qprevious() {
   lastPlayer();
   // g_msg="上一首    ";
}
function showmusiclist(){
	bt(3);
		top.g_aParams["url"]= "http://q-zone.qq.com/cgi-bin/music/cgi_music_collmain?operation=0&uin="+top.g_iUin;
		openMusicUrl('/client/music/tplaylist.shtml?uin=' + top.g_iUin);
	}
	function chechAndListen(listenURL)
{
	if (bUseVQQPlayer)
	{
		return VQQPlayer.setPlayURL(-1, listenURL, '', 0,'','');
	}
	else
	{
		return MediaPlayer.runPlayer(listenURL);
	}
}

// space_scenario.js
var photoItem="";
var flowerDis=0;
var mallFlag=0;
var pubItemId="";
var pubtxtid=0;
var pubX="";
var pubY="";
var GFflag=0;
var pubkey=1;
var pubid=new Array();
var pubmsg=new Array();
var msg=new Array();
var font=new Array();
var fontSize=new Array();
var fontColor=new Array();
var pubItems;
var sendcol="";
var sendtext="";
var giftkey=0;
var pubPrice="";
Number.prototype.toFixed=function(len)
{
    var add = 0;
    var s,temp;
    var s1 = this + "";
    var start = s1.indexOf(".");
    if(s1.substr(start+len+1,1)>=5)add=1;
    var temp = Math.pow(10,len);
    s = Math.floor(this * temp) + add;
    return s/temp;
}
//保证不报js错误
function killErrors() {
  return true;
}
//window.onerror = killErrors;

function nocontextmenu()
{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
}

//更改个人空间的皮肤
function space_changeSkin(type, itemno, sort)
{
	if (findWndElement(type, itemno) >=0) {
		itemno= 1;
	}
    var itemdir= itemno%16;
    if (sort ==0) {
		top.all.style.background= 'url(http://imgcache.qq.com/qzone/item/orig/'+itemdir+'/'+itemno+'.gif)';
	}
	else {
		top.all.style.background= 'url(http://imgcache.qq.com/qzone/item/orig/'+itemdir+'/'+itemno+'.jpg)';
	}
	new CSkin (type,itemno,sort);

}
/*******************************************
单个item移动
********************************************/
function space_moveItem(layerid,flip,pleft,ptop)
{
    eval('var tmpObj = top.document.all.i'+layerid+';');
    tmpObj.style.display="inline";
    tmpObj.style.visibility="";
    tmpObj.style.pixelLeft=pleft;
    tmpObj.style.pixelTop=ptop;
    if(flip)
        tmpObj.style.filter="flipH()";
}
/*******************************************
 某种类别item具体移动的位置定义
********************************************/
function space_moveItemtype(layerid,type)
{
     if(type==2)
        space_moveItem(layerid,0,0,0);
     else if(type==3)
        space_moveItem(layerid,0,725,320);
     else
        return;

}

/*******************************************************************************************
input---类别
output----该类别在方案数组的位置
1----背景   2----挂件  3----banner    4----鼠标方案   5----漂浮物 6----播放器
7----个性花藤  8----个性标志  9----大头贴（小） 11---- 大头贴（大）
********************************************************************************************/
function space_changetype(type)
{
    var suffix=0;
    if(type>0&&type<6)
    {
		   suffix=type-1;
	}
    return suffix;
}

function space_layerToType(layer)
{
    var suffix=0;
	if(layer>=0&&layer<5)
	{
	  suffix=layer+1;
	}
    return suffix;
}

function space_delItem(type, itemno)
{
	deleteWndElement(type, itemno);
}

/** 在我的物品中使用ITEM，因为个性LOGO及大头贴的源文件不一样，所以需要与在商城中使用的代码分开
  */
function myitem_changeItem(type,itemno,posx,posy,width,height,zIndex)
{
	type= parseInt(type);
	itemno= parseInt(itemno);
	posx= parseInt(posx);
	posy= parseInt(posy);
	width= parseInt(width);
	height= parseInt(height);
	zIndex= parseInt(zIndex);

	top.g_EditFlag = 1;
	window.top.space_addItem(type,itemno,posx,posy,width,height,zIndex);
	if (type==4) { // 鼠标方案
		space_inimouse();
	}
	if (type==8) { // 个性LOGO
		if (top.mallinfo.form1 && top.mallinfo.form1.bgid)
			top.mallinfo.form1.bgid.value=itemno;
	}
}

/** 在商城的页面里面改变装扮方案的ITEM
  */
function mall_changeItem(type,itemno,posx,posy,width,height,zIndex)
{
	type= parseInt(type);
	itemno= parseInt(itemno);
	posx= parseInt(posx);
	posy= parseInt(posy);
	width= parseInt(width);
	height= parseInt(height);
	if(type!=12)
	zIndex= parseInt(zIndex);
	top.g_EditFlag= 1;
	if (type==11||type==8) {
    	SetLogoBig(type,itemno,posx,posy,width,height,zIndex);
	}else if(type==12){
		window.top.addPub(type,itemno,posx,posy,zIndex);
	}else {
		window.top.space_addItem(type,itemno,posx,posy,width,height,zIndex);
		if (type==4) { // 鼠标方案
			space_inimouse();
		}
	}
}
//增加item
function mall_changeFlower(type,itemno,posx,posy,width,height,zIndex,level)
{
	type= parseInt(type);
	itemno= parseInt(itemno);
	posx= parseInt(posx);
	posy= parseInt(posy);
	width= parseInt(width);
	height= parseInt(height);
	zIndex= parseInt(zIndex);
	level=parseInt(level)

	top.g_EditFlag= 1;
	if(type==7&&width!=1){
			i=window.top.findWndElementByType(type);
			if(top.g_FlowerXDoc==undefined)
			   top.g_FlowerXDoc= top.LoadXMLData(3);
			if (parseInt(showGardener())<level) 
				{
					alert("对不起，你的花匠等级不够领养该种植物！");
					return;
				}
			i= window.top.findWndElementByType(type,itemno);
			if (i>=0){
				oldItemno= window.top.g_WndArray[i].itemno;
			if (itemno== oldItemno) {
				window.top.deleteWindowByTypeAndItemno(type, oldItemno);
				window.top.deleteWindowByTypeAndItemno(type, oldItemno);
				window.top.deleteWindowByTypeAndItemno(type, oldItemno);
				return;
			}}
		if (confirm("是否确定领养？")) {
			window.top.space_addFlower(type,itemno,posx,posy,width,height,zIndex);
			window.top.document.all["fg"].src="http://q-zone.qq.com/cgi-bin/prop/cgi_prop_pickfruit";
		}else{
			return;
			}
		}else	return;
}
//更换植物
function space_addItem (type,itemno,posx,posy,width,height,zIndex)
{
	if (itemno==0) return;
    switch (type)
    {
    	case 1 :  //皮肤类别
    	space_changeSkin(type,itemno,zIndex);
    	break;

    	case 2 :  //挂件类别
    	space_addGJ(type,itemno,posx,posy,width,height,zIndex);//*************半完成
    	break;

    	case 3 :  //banner类别
    	space_addBanner(type,itemno,posx,posy,width,height,zIndex);//*************半完成
    	break;

    	case 4 :  //鼠标方案
    	space_mouse(type,itemno);//*************等待调试
    	break;

    	case 5 :  //漂浮物
	   	space_addFloatItem(type, itemno, posy, width); //*************等待调试
    	break;

    	case 6 :  //播放器
    	space_addMusic(type,itemno,posx,posy,width,height,zIndex); //*************等待调试
    	break;

    	case 7 :  //个性花藤
    	space_addFlower(type,itemno,posx,posy,width,height,zIndex);//*************等待调试
    	break;

    	case 8 :  //个性标志
    	space_addLogo(type,itemno);//*************等待调试
    	break;

    	case 9 :  //大头贴（小）
    	space_addMPhotoS(type,itemno);//*************等待调试
    	break;

    	case 11 :  //大头贴（大）
    	space_addMPhotoL(type,itemno);//*************等待调试
    	break;
    	case 12 :  //公告栏
    	
    	space_addPub(type,itemno,posx,posy,zIndex);//*************等待调试
    	break;
    	default:
    	alert("error type:"+ type);
    }
}
 ////////////////////////加载挂件///////////////////////////
function space_addGJ(type, itemno, posx, posy, width, height, zIndex) {
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		return;
	}
	var itemdir= itemno%16;
	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".gif";
	if ((posx==0)&&(posy==0)) {
		posx=20; posy= 10;
	}
    var GJ=new CImg(type, itemno, posx, posy, 75, 235, surl, -1);
}


////////////////////////加载banner///////////////////////////
function space_addBanner(type,itemno,posx,posy,width,height,zIndex)
{
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		return;
	}

	var itemdir=itemno%16;
	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".gif";
	if ((posx==0)&&(posy==0)) {
		posx=720; posy= 330;
	}
	var Banner=new CImg(type, itemno, posx, posy, 190, 157, surl, zIndex)
}

////////////////////////加载花藤//////////////////////////
/////////////////////////////////////////////////////////////////////
//SunPot=阳光指数 LovPot=爱心指数 RaiPot=雨露指数 NurPot=营养指数  //
//FloLev=花藤级别 FloSor=花藤类别 FloSce=花藤方案                  //
/////////////////////////////////////////////////////////////////////

//改变分数槽高度
function changeCellHeight(Point){
	var height=200;  //height 为分数槽高度的像素值
	var Height = height/200*Point;
	return Height;
}
function changSrc(Point){
	var srctemp="FloLev"+Point+".gif";
	return srctemp;
}
function showFlowerPot(SunPot,RaiPot,NurPot,LovPot,FloLev,FloSor,FloSce){
	document.all("sunpot").height=changeCellHeight(SunPot);
	document.all("raipot").height=changeCellHeight(RaiPot);
	document.all("nurpot").height=changeCellHeight(NurPot);
	document.all("lovpot").height=changeCellHeight(LovPot);
	document.all("flosho").src=changSrc(FloLev);
}

function space_addFlower(type,itemno,posx,posy,width,height,zIndex){
	var i, oldItemno;
	flowerDis=zIndex;
  do {
		i= findWndElementByType(type);
		if (i<0) break;
		oldItemno= g_WndArray[i].itemno;
		deleteWindowByTypeAndItemno(type, oldItemno);
	} while (i>=0);
	if (itemno== oldItemno) {
		return;
	}
/*if(g_StaticMode)
   g_FlowerXDoc= LoadXMLData(3);//////读取花藤XML
else 
	 g_FlowerXDoc= LoadXMLData(3);*/
    var itemdir= itemno%16;
    var FloLev= showFloLevel();//////////////读取xml中花藤级别
    var SunPot= showFloSun();///////////////读取xml中阳光指数
    var LovPot= showFloLove();///////////////读取xml中爱心指数
    var RaiPot= showFloRain();///////////////读取xml中雨露指数
    var NurPot= showFloNutri();///////////////读取xml中营养指数
    var Gardener=showGardener();
    var Mark=showMark();
    GFflag=height;
    if (height==1){
    	var Turl= "http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_r"+5+".gif";
      var Furl= "http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_f"+5+".gif";
       if (FloLev>=4&&(Mark>>2)==0) Mark=0;
    else Mark=4;
      FloLev=5; 
       
    }else{
    var Turl= "http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_r"+FloLev+".gif";
    var Furl= "http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_f"+FloLev+".gif";
    }
    var Burl= "http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_bg.gif";
    new CImg(type, itemno, 57, 605, 868, 50, Turl, 1001);
    new FWnd(type, itemno, 731, 480, 194, 170, Burl, 1000, SunPot, LovPot, RaiPot, NurPot,Gardener);
    new FImg(type, itemno, 698, 477, 92, 178, Furl, 1002,zIndex,FloLev,height,Mark);
   //document.all.floB.onmousedown=pot.style.visibility=hidden;


}


/*********************************************************************************************
此函数仅供挂件，banner等只能同时存在一件的item使用

*********************************************************************************************/
function space_addlayer(type,itemno)
{
        var change=changScenariolist(type,itemno,0,0,0);
		if(itemno==0)
	    {
			return false;
		}
		var ilayerid;
        ilayerid=space_changetype(type);

        var itemdir=itemno%16;
        //判断层是否存在。不存在则增加层
		var iexit=eval('top.document.all.i'+ilayerid+'?1:0');
		if(iexit==0)
	    {
		    top.document.all.divAzitSpaceBody.innerHTML+='<img src="http://imgcache.qq.com/qzone/item/orig/'+itemdir+'/'+itemno+'.gif"  id="i'+ilayerid+'" style="position:absolute;display=none">';
		    eval('space_moveItemtype("'+ilayerid+'",'+type+');');
		}
        if(change==1)
		{
            eval('top.document.all.i'+ilayerid+'.style.visibility="hidden";');
        }
        else
        {
            eval('top.document.all.i'+ilayerid+'.src="http://imgcache.qq.com/qzone/item/orig/'+itemdir+'/'+itemno+'.gif"');
            eval('top.document.all.i'+ilayerid+'.style.visibility="";');
        }
}


function space_changeFavUrl()
{
    window.location="/cgi-bin/favor/cgi_alternant?uin="+window.top.g_uin;
}
function space_changePhotoUrl()
{
	window.location="/cgi-bin/photo/cgi_list_album_s?uin="+window.top.g_uin;
}

function space_changeBlogUrl()
{
	window.location="/cgi-bin/blog/cgi_blog_main?uin="+window.top.g_uin;
}

function space_changeDiaryUrl()
{
    window.location="/cgi-bin/blog/cgi_blog_diarymain?uin="+window.top.g_uin;
}

/////////////////////////////////////漂浮物的初始化/////////////////////////////
function floatinitial()
{
	Amount=8;
	Ypos_float=new Array();
	Xpos_float=new Array();
	Speed_float=new Array();
	Step_float=new Array();
	CStep_float=new Array();
  var newDiv=document.createElement("<div id='floatlayer'  style='position:absolute;top:0px;left:0px;z-index:300'></div>");
	//漂浮物的层
	var str="<div style='position:relative'>";
	for (i = 0; i < Amount; i++)
	{
	    var P= Math.floor(Math.random()*4);
	    str+='<img id="si" src="about:blank" style="position:absolute;top:0px;left:0px;visibility=hidden">';
	}
	str+='</div>';
  newDiv.innerHTML=str;
  document.all.body.appendChild(newDiv);
	WinHeight=625;
	WinWidth=925;

	for (i=0; i < Amount; i++)
	{
		Ypos_float[i] = Math.round(Math.random()*WinHeight);
		Xpos_float[i] = Math.round(Math.random()*WinWidth);
		Speed_float[i]= Math.random()*1.5+1;
		CStep_float[i]=0;
		Step_float[i]=Math.random()*0.05+0.05;
	}

}

//漂浮物,去掉原始的漂浮物,新增一种类别的漂浮物
function space_addFloatItem(type, itemno, mode, num)
{
	var totalnum=8;
	if (itemno==0) {
		return false;
	}
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
    	return 0;
    }
    var itemdir=itemno%16;

    for(i=0; i<totalnum; i++)
    {
       if (top.si[i])
           top.si[i].style.visibility="hidden";
    }

    //停止层运动,比较笨的方法
    stop_Falling();
	if (mode==0)
	{
        top.document.all.floatlayer.style.pixelLeft=0;
        top.document.all.floatlayer.style.pixelTop=0;
    }
    else if(mode==1)
    {
        top.document.all.floatlayer.style.pixelLeft=0;
        top.document.all.floatlayer.style.pixelTop=625;

    }
    else if(mode==2)
    {
        top.document.all.floatlayer.style.pixelLeft=0;
        top.document.all.floatlayer.style.pixelTop=0;
    }
    else if(mode==3)
    {
        top.document.all.floatlayer.style.pixelLeft=925;
        top.document.all.floatlayer.style.pixelTop=0;

    }

	for(i=0; i<totalnum;i++)
	{
          if(top.si[i]) {
               top.si[i].style.visibility="";
               var P=Math.floor(Math.random()*num);
               top.si[i].src="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+"_"+(P+1)+".gif";
          }
    }
    top.g_FallingMode= mode;
    start_Falling();
    new CFloat (type, itemno, mode, num);
}

/** 开始飘浮物
  */
function start_Falling() {
	falling= setInterval("fall()", 200);
}

function stop_Falling() {
	if (falling) {
		clearTimeout(falling);
		falling= null;
		g_FallingMode= null;
	}
}

//定义轨迹
function fall()
{
	if (top.g_FallingMode == null) {
		return;
	}
	var mode= top.g_FallingMode;
    var totalnum=8;
	var WinHeight=625;
	var WinWidth=925;
    var hscrll=(document.layers)?window.pageYOffset:top.document.body.scrollTop;
    var wscrll=(document.layers)?window.pageXOffset:top.document.body.scrollLeft;
    for (i=0; i <totalnum; i++)
    {
        if(mode==0||mode==1)
        {
            sy = top.Speed_float[i]*Math.sin(90*Math.PI/180);
            sx = top.Speed_float[i]*Math.cos(top.CStep_float[i]);
            top.Ypos_float[i]+=sy;
            top.Xpos_float[i]+=sx;
            if (top.Ypos_float[i] > WinHeight)
            {
                top.Ypos_float[i]=0;
                top.Xpos_float[i]=Math.round(Math.random()*WinWidth);
                top.Speed_float[i]=Math.random()*1+1;
            }
         }
         else
         {
             sx = top.Speed_float[i]*Math.sin(90*Math.PI/180);
             sy = top.Speed_float[i]*Math.cos(top.CStep_float[i]);
             top.Ypos_float[i]+=sy;
             top.Xpos_float[i]+=sx;
             if (top.Xpos_float[i] > WinWidth)
             {
                  top.Xpos_float[i]=0;
                  top.Ypos_float[i]=Math.round(Math.random()*WinHeight);
             }
         }

          //控制方向
          if (mode==0)
          {
               top.si[i].style.pixelLeft=top.Xpos_float[i];
               top.si[i].style.pixelTop=top.Ypos_float[i]+hscrll;
          }
          else if(mode==1)
          {
               top.si[i].style.pixelLeft=top.Xpos_float[i];
               top.si[i].style.pixelTop=-top.Ypos_float[i]+hscrll;
          }
          else if(mode==2)
          {
               top.si[i].style.pixelLeft=top.Xpos_float[i]+wscrll;
               top.si[i].style.pixelTop=top.Ypos_float[i];
          }
          else if(mode==3)
          {
               top.si[i].style.pixelLeft=-top.Xpos_float[i]+wscrll;
               top.si[i].style.pixelTop=top.Ypos_float[i];
          }
     }
}

function space_inimouse() {
	var itemno=null, itemdir;
	var itemurl;
	for (i=0; i<window.top.g_WndArray.length; i++) {
		if (window.top.g_WndArray[i].type == 4) {
			itemno= parseInt(window.top.g_WndArray[i].itemno);
			break;
		}
	}
	if (itemno == null) return;
	itemdir=itemno%16;
	itemurl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".ani";

	var oStyleSheet= document.styleSheets[0];
	oStyleSheet.addRule("body", "cursor:url("+itemurl+");");

	return;
}

/////////////////////////////////////图片代替鼠标///////////////////////////////
function space_mouse(type, itemno) {
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		return 0;
	}
	var itemdir=itemno%16;
	var itemurl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".ani";
	document.all.body.style.cursor= 'url('+itemurl+')';

	for(i=0; i<g_WndArray.length; i++) {
		if (g_WndArray[i].alive && (g_WndArray[i].type==97)) {
			g_WndArray[i].div.style.cursor= 'url('+itemurl+')';
		}
	}

    new CMouseStyle(type, itemno);
}

/////////////////////加载个性标志////////////////////////////////////////////
function space_addLogo(type,itemno) {
   if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		return;
	}
  if (type!=8) return;
  var itemdir=g_iUin%256;
  var surl="http://imgcache.qq.com/qzone/logos/"+itemdir+"/"+g_iUin+"_"+itemno+".gif";

  top.Mlogo.style.background='url('+surl+')';
  new CLogo(type, itemno);
}

/////////////////////加载播放器////////////////////////////////////////////
function space_addMusic(type,itemno,posx,posy,width,height,zIndex) {
	var i= findWndElementByType(type);
	if (i >=0) {
		var oldItemno= g_WndArray[i].itemno;
		deleteWindowByTypeAndItemno(type, oldItemno);
		
		if (itemno== oldItemno) {
			return;
		}
	}
	var itemdir=itemno%16;
	var surl="http://q-zone.qq.com/item/orig/"+itemdir+"/"+itemno+".swf";
	var playMusic=new CSwf(type,itemno,posx,posy,width,height,surl,zIndex);
	bMusicLoaded=true;
	setTimeout("addPlayList("+top.g_iUin+")",5000);
}

/////////////////////加载大头贴(小)////////////////////////////////////////////
function space_addMPhotoS(type,itemno,posx,posy,width,height,zIndex){
	if (type!=9) return;
	var itemdir=itemno%16;
	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".swf";
}
////////////////////////公告栏///////////////////////////////////////////////
function space_addPub(type,itemno,posx,posy,zIndex){
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		//pubItemId="";	
		//pubtxtid=0;
		return;
	}

	var itemdir=itemno%16;
	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".gif";
	if ((posx==0)&&(posy==0)) {
		posx=720; posy= 330;
	}
	var Pub=new PImg(type, itemno, posx, posy,surl,zIndex);
	//pubItemId=itemno;	
	//pubtxtid=zIndex;
}
function addPub(type,itemno,posx,posy,zIndex){
	if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);
		pubItemId="";
		mallFlag=1;	
		return;
	}

	var itemdir=itemno%16;
	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".gif";
	if ((posx==0)&&(posy==0)) {
		posx=720; posy= 330;
	}
	if(pubItemId==""){
	mallFlag=0;	
	pubtxtid=1;
	var Pub=new PImg(type, itemno, posx, posy,surl,zIndex);
  pubItemId=itemno;	
  pubPrice=zIndex;
}else{
	alert("很抱歉公告栏一次只能购买一个")
}
}
////////////////////////////////////////////////////////////////////////////
//modify by justinyang 05-08-15 特供物品
function SetLogoBig(type,itemno,posx,posy,width,height,zIndex)
{
    if (type==11) {
   		var itemdir=itemno%16;
   		var surl="/item/orig/"+itemdir+"/"+itemno+".swf";
    	if(parent.photoArray[zIndex]!=itemno){
    		top.mallinfo.swfMerger.SetVariable("control", "2");
    		top.mallinfo.swfMerger.SetVariable("rigurl",surl);
    		top.mallinfo.swfMerger.SetVariable("rigsort",zIndex);
    		
    		if(zIndex==0) {
    		parent.photoSender[0]=itemno;
    	 	parent.priceArray[0]=parseFloat(parent.price);
		
		parent.vipPriceArray[0] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
	
    	}
    	  if(zIndex==1) {
    		parent.photoSender[1]=itemno;
    	 	parent.priceArray[1]=parseFloat(parent.price);
		parent.vipPriceArray[1] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
    	}
    		if(zIndex==2) {
    		parent.photoSender[2]=itemno;
    	  	parent.priceArray[2]=parseFloat(parent.price);
		parent.vipPriceArray[2] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
		  
    	}
    		if(zIndex==3) {
    		parent.photoSender[3]=itemno;
    	  	parent.priceArray[3]=parseFloat(parent.price);
		parent.vipPriceArray[0] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
    	}
    		if(zIndex==4) {
    		parent.photoSender[4]=itemno;
    	 	parent.priceArray[4]=parseFloat(parent.price);
		parent.vipPriceArray[4] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
    	}
    		if(zIndex==5) {
    		parent.photoSender[5]=itemno;
    		parent.priceArray[5]=parseFloat(parent.price);
		parent.vipPriceArray[5] = (parseFloat(parent.price) > parseFloat(parent.vip_price))?parseFloat(parent.vip_price):0;
    	}
    		var photoS="";
    		var total=0;
		var vipPriceTotal = 0;
    		for (i=0;i<6;i++){
    		if (parent.photoSender[i]!="")	
            photoS+=parent.photoSender[i]+"|";
    	      total+=parent.priceArray[i];
    	      total=total.toFixed(2);
	      parent.calc_price.innerHTML=total;

	      vipPriceTotal+=parent.vipPriceArray[i];
		vipPriceTotal =  vipPriceTotal.toFixed(2);
		parent.vip_calc_price.innerHTML = vipPriceTotal;
		
    	     }
    	   top.mallinfo.form1.frontswf.value =photoS;
    	   	parent.photoArray[zIndex]=itemno;
       		}
		else {
  			top.mallinfo.swfMerger.SetVariable("control", "2");
    		top.mallinfo.swfMerger.SetVariable("rigurl","");
    		top.mallinfo.swfMerger.SetVariable("rigsort",zIndex);
    		if(zIndex==0) {
    		parent.photoSender[0]="";
    	  parent.priceArray[0]=0;
	parent.vipPriceArray[0] = 0;
    	}
    	  if(zIndex==1) {
    		parent.photoSender[1]="";
    	  parent.priceArray[1]=0;
	parent.vipPriceArray[1] = 0;
    	}
    		if(zIndex==2) {
    		parent.photoSender[2]="";
    	  parent.priceArray[2]=0;
	 parent.vipPriceArray[2] = 0;	
    	}
    		if(zIndex==3) {
    		parent.photoSender[3]="";
    	  parent.priceArray[3]=0;
	parent.vipPriceArray[3] = 0;
    	}
    		if(zIndex==4) {
    		parent.photoSender[4]="";
    	  parent.priceArray[4]=0;
	 parent.vipPriceArray[4] = 0;
    	}
    		if(zIndex==5) {
    		parent.photoSender[5]="";
    	  parent.priceArray[5]=0;
	parent.vipPriceArray[5] = 0;
    	} 
    		var photoS="";var total=0; var vipPriceTotal = 0;
    		for (i=0;i<6;i++){
    		if (parent.photoSender[i]!="")	
            photoS+=parent.photoSender[i]+"|";
            total+=parent.priceArray[i]; total=total.toFixed(2);
	     parent.calc_price.innerHTML=total;

            vipPriceTotal+=parent.vipPriceArray[i]; vipPriceTotal=vipPriceTotal.toFixed(2);
		parent.vip_calc_price.innerHTML = vipPriceTotal;
            }
        top.mallinfo.form1.frontswf.value =photoS;
    	  parent.photoArray[zIndex]="";
      }
    }else if (type==8) {
 		if(photoItem!=itemno) {
			var itemdir= itemno%16;
			var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".gif";
			top.Mlogo.style.background='url('+surl+')';
			top.mallinfo.form1.bgid.value=itemno;
			photoItem=itemno;
		}
		else {
			var surl="http://imgcache.qq.com/qzone/1/topb.gif";
			top.Mlogo.style.background='url('+surl+')';
			top.mallinfo.form1.bgid.value="";
			photoItem="";
		}
	}
}
 /////////////////////加载大头贴(大)////////////////////////////////////////////

function space_addMPhotoL(type,itemno,posx,posy,width,height,zIndex){
   if (findWndElement(type, itemno) >=0) {
		deleteWindowByTypeAndItemno(type, itemno);

		return;
	}
   	if (type!=11) return;
   	var itemdir=itemno%16;
   	var surl="http://imgcache.qq.com/qzone/item/orig/"+itemdir+"/"+itemno+".swf";


   	for(i=0; i<g_WndArray.length; i++) {


    new CAddPhoto(type, itemno);
}
}


//打开赠送页面
function space_openGive(itemno,price,type)
{
   var nowdate=new Date();
   window.location="/client/mall/give.htm?itemno="+itemno+"&price="+price+"&type="+type;
}

function space_showGiveUrl()
{
    //获得itemid
	var url=window.location.href;
	var urlbegin=url.indexOf('=')+1;
	var urlend=url.indexOf('&');
	var item_id=url.substr(0,urlend);
	item_id=item_id.substr(urlbegin,item_id.length);

	//获得type
	var surl=window.location.href;
	var give_type=surl.substr(surl.lastIndexOf('=')+1,surl.length);
	var itemdir=item_id%16;
	var itemurl="http://imgcache.qq.com/qzone/item/pre/"+itemdir+"/"+item_id+".gif";
    document.all.itemdir.src=itemurl;
	document.all.item_id.value=item_id;
	document.all.give_type.value=give_type;
}

function space_showGivePrice()
{
    var url=window.location.href;
	var urlbegin=url.indexOf('&')+7;
	var urlend=url.lastIndexOf('&');
	var price=url.substr(0,urlend);
	price=price.substr(urlbegin,price.length);
    document.write(price);
}


function space_delete(itemno,type,pageno)
{
	  if(confirm("您确认要将该物品删除吗？")==true)
	  {
		  var nowdate=new Date();
		  window.location="/cgi-bin/mall/cgi_delete_useritem?item_id="+itemno+"&type="+type+"&pageno="+pageno+"&PcacheTime="+nowdate.getTime();
	  }
}

function space_openMyItem()
{
	top.document.getElementById("info").src="/cgi-bin/user/cgi_show_setting";
	top.document.getElementById("main").src="/cgi-bin/mall/cgi_show_useritem?itemtype=1&page_no=1";
	top.malll.style.visibility='hidden';
}
// style.js
var g_type="";
var g_itemno="";
function setCSS(sID) {
	var sheetName= "http://imgcache.qq.com/qzone/"+sID+"/css.css";
	top.g_StyleID= sID;
	document.createStyleSheet(sheetName);
	//document.onmousedown=wndClick;
	//document.oncontextmenu = function() {return false;}
/*
	tUrl=top.location.href;
	var str = tUrl.split("/client");
	var str1=tUrl.split("cgi_blog_cont");
	var str2=tUrl.split("entrance=web");
	var str3 = tUrl.split("qzone-entry");
	if (this==top) {
		if ((str[1]=="" || str[1]==null)&&(str1[1]=="" || str1[1]==null)&&(str2[1]=="" || str2[1]==null)&&(str3[1]=="" || str3[1]==null)){
			top.location="http://q-zone.qq.com/";
		}
	} */
}
function wndClick(){
if(event.shiftKey && event.button==1){
window.location.reload()
}
}
function showmenuie5() 
{
	var rightedge = document.body.clientWidth - event.clientX;

ie5menu.style.visibility = "visible";

if (rightedge < ie5menu.offsetWidth)
		ie5menu.style.left = document.body.scrollLeft + event.clientX -ie5menu.offsetWidth;
	else
		ie5menu.style.left = document.body.scrollLeft + event.clientX;
		
	if (event.clientY < ie5menu.offsetHeight)
		ie5menu.style.top = document.body.scrollTop + event.clientY;
	else
		ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
 return false;
}
function hidemenuie5() {
	ie5menu.style.visibility = "hidden";
	document.oncontextmenu = function() {return false;}
} 
function delItem(){
	deleteWindowByTypeAndItemno(g_type, g_itemno);
	g_EditFlag=1;
	}
function getFruit(){
	if(GFflag==1) return;
	if(confirm("您确定要采摘吗!")){
	document.all["fg"].src="http://q-zone.qq.com/cgi-bin/prop/cgi_prop_pickfruit";
	GFflag=1;
	}
}
function getGift(){
	if(confirm("您将获得Q-zone送出的神秘礼物!")){
	giftkey=1;	
	document.all["fg"].src="http://q-zone.qq.com/cgi-bin/prop/cgi_prop_send_qzonegift";
	document.all["giftdiv"].innerHTML="";
}
	}
function shmline(sh){
	if (sh=="show"){
		parent.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_on.gif";
		parent.tframe.cols="120,7,*"
	}else if(sh=="hide"){
		parent.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_off.gif";
		parent.tframe.cols="0,7,*"
	}else if(sh=="auto"){
		if (parent.tframe.cols=="0,7,*"){
			parent.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_on.gif";
			parent.tframe.cols="120,7,*"
		}else{
			parent.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_off.gif";
			parent.tframe.cols="0,7,*"
		}
	}
}

function musicshmline(sh){
	if (sh=="show"){
		tmusic.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_on.gif";
		tmusic.tframe.cols="120,7,*"
	}else if(sh=="hide"){
		tmusic.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_off.gif";
		tmusic.tframe.cols="0,7,*"
	}else if(sh=="auto"){
		if (tmusic.tframe.cols=="0,7,*"){
			tmusic.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_on.gif";
			tmusic.tframe.cols="120,7,*"
		}else{
			tmusic.midFrame.mline.src = "http://imgcache.qq.com/qzone/"+window.top.g_StyleID+"/bt_mline_off.gif";
			tmusic.tframe.cols="0,7,*"
		}
	}
}// wnd.js
function findWndElementByType(type) {
	var len= g_WndArray.length;
	for (var i=0; i < len; i++)
	{
		if (g_WndArray[i].type == type) {
			return i;
		}
	}
	return -1;
}

function findWndElement(type, itemno) {
	var len= g_WndArray.length;
	for (var i=0; i < len; i++)
	{
		if ((g_WndArray[i].type == type)&&(g_WndArray[i].itemno == itemno)) {
			return i;
		}
	}
	return -1;
}

/** 恢复缺省
  */
function reset_default() {
	var len= g_WndArray.length;
	for (var i=0; i < len; i++)
	{
		g_WndArray[i].remove();
	}
	g_WndArray.length=0;
	top.g_EditFlag = 1;
	new CSkin (1, 1, 0);
	saveScenario();
}

function addWindow(type, itemno, posx, posy, width, height, zindex)
{
	if ((width==0) || (height==0)) { // 指定缺省位置和大小
		if (type==97) { // 小模块
			switch (itemno) {
				case 1: // 个人资料
					posx=0; posy=0; width=164; height=300; zindex=90;
				break;
				case 2://网络日志
					posx=169; posy=0; width=164; height=148; zindex=91;
				break;
				case 3://互动
				    posx=0; posy=304; width=164; height=300; zindex=92;
				break;
				case 4://相册
				    posx=169; posy=304; width=164; height=148; zindex=93;
				break;
				case 5://音乐盒
				    posx=337; posy=304; width=286; height=300; zindex=94;
				break;
				case 6://迷你屋
				    posx=169; posy=456; width=164; height=148; zindex=95;
				break;
				case 7://留言板
					posx=169; posy=456; width=164; height=148; zindex=95;
				break;
				case 8://偶像
					posx=337; posy=384; width=286; height=300; zindex=94;
				break
				case 9://排行榜
					posx=337; posy=464; width=286; height=300; zindex=94;
				break;
				case 10://音乐收藏
					posx=337; posy=304; width=286; height=300; zindex=94;
				break;
			}
		}
		if (type==98) { // 大模块
			switch (itemno) {
				case 1: // 个人资料
					posx=0; posy=0; width=164; height=300; zindex=90;
				break;
				case 2://网络日志
					posx=169; posy=0; width=454; height=300; zindex=91;
				break;
				case 3://互动
				    posx=0; posy=304; width=164; height=300; zindex=92;
				break;
				case 4://相册
				    posx=169; posy=0; width=454; height=355; zindex=93;
				break;
				case 5://音乐盒
				    posx=169; posy=0; width=454; height=506; zindex=94;
				break;
				case 6://迷你屋
				    posx=169; posy=456; width=454; height=300; zindex=95;
				break;
				case 7://留言板
					posx=169; posy=456; width=454; height=300; zindex=95;
				break;
			}
		}
    	if (type==99) {
    		posx=0; posy=0; width=283; height=300; zindex=90;
    	}
	}
	hWnd= new CWnd( type, itemno, posx, posy, width, height, zindex);
	setWindowContent(hWnd.sid);
}

/** 添加系统窗口
  */
function addSystemWindow(type, itemno, posx, posy, width, height, zindex)
{
	if ((width==0) || (height==0)) { // 指定缺省位置和大小
		if (type==97) { // 小模块
			switch (itemno) {
				case 1: // 个人资料
					posx=0; posy=0; width=164; height=300; zindex=90;
				break;
				case 2://网络日志
					posx=169; posy=0; width=164; height=148; zindex=91;
				break;
				case 3://互动
				    posx=0; posy=304; width=164; height=300; zindex=92;
				break;
				case 4://相册
				    posx=169; posy=304; width=164; height=148; zindex=93;
				break;
				case 5://音乐盒
				    posx=337; posy=304; width=286; height=300; zindex=94;
				break;
				case 6://迷你屋
				    posx=169; posy=456; width=164; height=148; zindex=95;
				break;
				case 7://留言板
					posx=169; posy=456; width=164; height=148; zindex=95;
				break;
				case 8://偶像
					posx=337; posy=384; width=286; height=300; zindex=94;
				break
				case 9://排行榜
					posx=337; posy=464; width=286; height=300; zindex=94;
				break;
				case 10://音乐收藏
					posx=337; posy=304; width=286; height=300; zindex=94;
				break;
			}
		}
		if (type==98) { // 大模块
			switch (itemno) {
				case 1: // 个人资料
					posx=0; posy=0; width=164; height=300; zindex=90;
				break;
				case 2://网络日志
					posx=169; posy=0; width=454; height=300; zindex=91;
				break;
				case 3://互动
				    posx=0; posy=304; width=164; height=300; zindex=92;
				break;
				case 4://相册
				    posx=169; posy=0; width=454; height=355; zindex=93;
				break;
				case 5://音乐盒
				    posx=169; posy=0; width=454; height=506; zindex=94;
				break;
				case 6://迷你屋
				    posx=169; posy=456; width=454; height=300; zindex=95;
				break;
				case 7://留言板
					posx=169; posy=456; width=454; height=300; zindex=95;
				break;
			}
		}
    	if (type==99) {
    		posx=0; posy=0; width=283; height=300; zindex=90;
    	}
	}
	new CWnd(type, itemno, posx, posy, width, height, zindex);
}

function deleteWindowByTypeAndItemno(type, itemno) {
	var i= findWndElement(type, itemno);
	if (i>=0) {
		g_WndArray[i].remove();
		deleteArrayElement(g_WndArray, i);
	};
}

function Insert(objWnd)
{
	var i= g_WndArray.length;
	objWnd.sid= i;
	g_WndArray[i]= objWnd;
}

function InsertUniqueType (objWnd)
{
	var i= findWndElementByType(objWnd.type);
	if (i<0) i= g_WndArray.length;
	objWnd.sid= i;
	g_WndArray[i]= objWnd;
}

function InsertUniqueTypeAndItemno (objWnd)
{
	var i= findWndElement(objWnd.type, objWnd.itemno);
	if (i<0) i= g_WndArray.length;
	objWnd.sid= i;
	g_WndArray[i]= objWnd;
}

function CSkin (type, itemno, imgtype)
{
	this.type= type;
	this.itemno= itemno;
	this.imgtype= imgtype;
	this.alive= true;
	InsertUniqueType (this);
}

CSkin.prototype.remove = function() {
	itemno= 1;
    var itemdir= itemno%16;
	top.all.style.background= 'url(http://q-zone.qq.com/item/orig/'+itemdir+'/'+itemno+'.gif)';
}

function CFloat (type, itemno, mode, num)
{
	this.type= type;
	this.itemno= itemno;
	this.mode= mode;
	this.num= num;
	this.alive= true;
	InsertUniqueType (this);
}

CFloat.prototype.remove = function() {
	if (this.alive) {
		var totalnum= 8;
    	stop_Falling();
		for(i=0; i<totalnum; i++)
		{
    		if(top.si[i]) {
    	        top.si[i].style.visibility="hidden";
    	    }
    	}
	}
}

function CMouseStyle (type, itemno)
{
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	InsertUniqueType (this);
}

CMouseStyle.prototype.remove = function() {
	if (this.alive) {
		document.all.body.style.cursor= 'default';
		for(i=0; i<g_WndArray.length; i++) {
			if (g_WndArray[i].alive && (g_WndArray[i].type>60)) {
				g_WndArray[i].div.style.cursor= 'default';
			}
		}
	}
}

function CLogo(type, itemno){
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	InsertUniqueType (this);
}

CLogo.prototype.remove = function() {
	if (this.alive) {
	top.Mlogo.style.background='url("http://imgcache.qq.com/qzone/1/topb.gif")';
	}
}

/** 自定义层、系统层 的定义函数
  */
function CWnd (type, itemno, x, y, width, height, zIndex)
{
	g_WndID++;
	var sWndID= "layer"+g_WndID;
	var newDiv;
	if (g_EditMode==0)
		var newDiv= document.createElement("<div id='"+sWndID+"' onmouseover='LayerOnMouseOver("+sWndID+")' onmouseout='LayerOnMouseOut("+sWndID+")' onmousedown='LayerStartOperate()' onmouseup='LayerEndOperate()' style='position:absolute; padding:0px; overflow: hidden'></div>");
	else
		var newDiv= document.createElement("<div id='"+sWndID+"' style='position:absolute; padding:0px; overflow: hidden'></div>");
	newDiv.innerHTML= "<table width='100%' height='100%' border='0' cellpadding='3' cellspacing='1' class='helpline'><tr><td align='center' valign='middle' class='pback'>数据加载中。。。</td></tr></table>";
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= width;
	newDiv.style.height= height;
	newDiv.style.zindex=zIndex;
	newDiv.resiziable=false;
	document.all("initd").appendChild(newDiv);
	this.div= newDiv;
	this.alive= true;
	this.type= type;
	this.itemno= itemno;

	if(type==99) {
		newDiv.resiziable=true;
	}
	InsertUniqueTypeAndItemno(this);
}

CWnd.prototype.remove = function() {
	if (this.alive) {
		if (document.getElementById(this.div.id)) {
			document.all("initd").removeChild(this.div);
		}
		this.div= null;
		this.alive= false;
	}
}


////图片类窗口
/////////////////////////////////////////////
function CImg (type, itemno, x, y, width, height, surl, zIndex)
{
	g_WndID++;
	var sWndID= "layer"+g_WndID;
	var sImgID= "img"+g_WndID;
	var str= "<img id='"+sImgID+"' border='0' src='"+surl+"'></img>";
	var newDiv;
	if (g_EditMode==0||mallFlag==1)
		newDiv= document.createElement("<div id='"+sWndID+"' onmouseover='LayerOnMouseOver("+sWndID+")' onmouseout='LayerOnMouseOut("+sWndID+")' onmousedown='LayerStartOperate()' onmouseup='LayerEndOperate()' style='position:absolute; padding:0px; overflow: hidden'>");
	else
		newDiv= document.createElement("<div id='"+sWndID+"' style='position:absolute; padding:0px; overflow: hidden'>");

	newDiv.innerHTML= str;
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= width;
	newDiv.style.height= height;
	newDiv.style.zindex= zIndex;
	newDiv.type=type;
	newDiv.itemno=itemno;
	document.body.appendChild(newDiv);
	this.div= newDiv;
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	Insert(this);
}

CImg.prototype.remove = function() {
	if (this.alive) {
		document.body.removeChild(this.div);
		this.div= null;
		this.alive= false;
	}
}

////////////////////////////////////////////////////////////////////////////


////swf类窗口
/////////////////////////////////////////////
function CSwf (type, itemno, x, y, width, height, surl, zIndex)
{
	g_WndID++;
	var sWndID= "layer"+g_WndID;
	var sImgID= "swf"+g_WndID;
	var str='';
	str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="210" height="120" id="musicSwf">';
  str+='<param name="movie" value="'+surl+'">';
  str+='<param name="quality" value="high">';
  str+='<param name="wmode" value="transparent" />';
  str+='<embed src="'+surl+'" name="musicSwf" swLiveConnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  wmode="transparent" ></embed> ';
  str+='</object>';
  //str+='<object ID=musicDemoPlay CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="0" height="0">';
  //str+=' <PARAM Name="autoStart"  Value="true">';
  //str+='<param name="volume" value="100">';
  //str+='<param name="playCount" value="100">';
  //str+='<param name="loop" value="-1">';
  //str+=' <PARAM Name="uiMode" Value="invisible">';
  //str+='<embed ID=musicDemoPlay hidden="true" width="0" height="0" autostart="true">';
  //str+='</object>';
var newDiv;
	if (g_EditMode==0||mallFlag==1)
		newDiv= document.createElement("<div id='"+sWndID+"' onmouseover='LayerOnMouseOver("+sWndID+")' onmouseout='LayerOnMouseOut("+sWndID+")' onmousedown='LayerStartOperate()' onmouseup='LayerEndOperate()' style='position:absolute; padding:0px; overflow: hidden'>");
	else
		newDiv= document.createElement("<div id='"+sWndID+"' style='position:absolute; padding:0px; overflow: hidden'>");

	newDiv.innerHTML= str;
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= width;
	newDiv.style.height= height;
	newDiv.style.zindex= zIndex;
	document.body.appendChild(newDiv);
	this.div= newDiv;
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	this.sid=g_WndID;
	InsertUniqueType(this);
}

CSwf.prototype.remove = function() {
	if (this.alive) {
		Qstop();
		document.body.removeChild(this.div);
		this.div= null;
		this.alive= false;
	}
}

////////////////////////////////////////////////////////////////////////////
///花类窗口
/////////////////////////////////////////////
function FImg (type, itemno, x, y, width, height, surl, zIndex,visiable,FloLevel,Height,mark)
{
	if (mark!="") mark=mark>>2;
	g_WndID++;
	var sWndID= "layer"+g_WndID;
	var sImgID= "img"+g_WndID;
	var newDiv;
	if (g_EditMode==0){
  var sImg="";
	if (FloLevel==5){
		if(Height!=1)
	sImg='<div style="position:absolute; z-index:1003;Left: 11; Top: -50;"><img  onclick="getFruit();" class="button" src="http://imgcache.qq.com/qzone/mall/guo.gif" width="60" height="100"></div>';
}
	if(mark==0&&FloLevel>=4&&giftkey==0){
	sImg+='<div id="giftdiv" style="position:absolute; z-index:1003;Left: 15; Top: 40;"><img  onclick="getGift();" class="button" src="http://imgcache.qq.com/qzone/mall/gift.gif" width="36" height="51"></div>';
}
  sImg+= "<img id='floB' border='0' src='"+surl+"'style='cursor:hand' onclick='";
	sImg+='pot.style.display=pot.style.display?"":"none";top.flowerDis=pot.style.display?"1":"0";g_EditFlag=1';
	sImg+="'>";
	}else {
	var sImg="";
	if (FloLevel==5){
		if (cookie_iuin == top.g_iUin&&Height!=1)
	sImg='<div style="position:absolute; z-index:1003;Left: 11; Top: -50;"><img  onclick="getFruit();" class="button" src="http://imgcache.qq.com/qzone/mall/guo.gif" width="60" height="100"></div>';
  else sImg='<div style="position:absolute; z-index:1003;Left: 11; Top: -50;"><img src="http://imgcache.qq.com/qzone/mall/guo.gif" width="60" height="100"></div>';
  }
  if(cookie_iuin == top.g_iUin&&mark==0&&FloLevel>=4&&giftkey==0){
	sImg+='<div id="giftdiv" style="position:absolute; z-index:1003;Left: 15; Top: 40;"><img  onclick="getGift();" class="button" src="http://imgcache.qq.com/qzone/mall/gift.gif" width="36" height="51"></div>';
}
  sImg+= "<img id='floB' border='0' src='"+surl+"'style='cursor:hand' onclick='";
	sImg+='pot.style.display=pot.style.display?"":"none";';
	sImg+="'>";
  }
	newDiv= document.createElement("<div id='"+sWndID+"' style='position:absolute; padding:0px;'>");
  newDiv.innerHTML= sImg;
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= width;
	newDiv.style.height= height;
	newDiv.style.zindex= zIndex;

	document.body.appendChild(newDiv);
	this.div= newDiv;
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	this.sid=g_WndID;
if(visiable==0)
	pot.style.display="";
else
	pot.style.display="none";
	Insert(this);


}

FImg.prototype.remove = function() {
	if (this.alive) {
		document.body.removeChild(this.div);
		this.div= null;
		this.alive= false;
	}
}

////////////////////////////////////////////////////////////////////////////
/** 花藤背板窗口类
  */
function FWnd (type, itemno, x, y,width, height, Burl, zIndex , SunPot, LovPot, RaiPot, NurPot,Gardener)
{
	
	g_WndID++;
	var str= '<table width="194" height="170" border="0" cellpadding="0" cellspacing="0" background="'+Burl+'">'
	str+='<tr><td rowspan="3">&nbsp;</td>'
	str+='<td width="27" height="42" align="center" valign="bottom"><img src="http://imgcache.qq.com/qzone/client/icon_ft.gif" width="27" height="5"></td>'
    str+='<td width="6" rowspan="3">&nbsp;</td>'
    str+='<td width="27" align="center" valign="bottom"><img src="http://imgcache.qq.com/qzone/client/icon_ft.gif" width="27" height="5"></td>'
    str+='<td width="6" rowspan="3">&nbsp;</td>'
    str+='<td width="27" align="center" valign="bottom"><img src="http://imgcache.qq.com/qzone/client/icon_ft.gif" width="27" height="5"></td>'
    str+='<td width="6" rowspan="3">&nbsp;</td>'
    str+='<td width="27" align="center" valign="bottom"><img src="http://imgcache.qq.com/qzone/client/icon_ft.gif" width="27" height="5"></td>'
    str+='<td rowspan="3">&nbsp;</td></tr><tr>'
    str+='<td width="27" height="80" align="center" valign="bottom" background="http://imgcache.qq.com/qzone/client/icon_fm.gif" title="阳光：'+SunPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_f1.gif" width="27" height="'+(((SunPot>200)?200:SunPot)/2)*0.8+'"></td>'
    str+='<td width="27" align="center" valign="bottom" background="http://imgcache.qq.com/qzone/client/icon_fm.gif" title="爱心：'+LovPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_f2.gif" width="27" height="'+(((LovPot>200)?200:LovPot)/2)*0.8+'"></td>'
    str+='<td width="27" align="center" valign="bottom" background="http://imgcache.qq.com/qzone/client/icon_fm.gif" title="雨露：'+RaiPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_f3.gif" width="27" height="'+(((RaiPot>200)?200:RaiPot)/2)*0.8+'"></td>'
    str+='<td width="27" align="center" valign="bottom" background="http://imgcache.qq.com/qzone/client/icon_fm.gif" title="营养：'+NurPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_f4.gif" width="27" height="'+(((NurPot>200)?200:NurPot)/2)*0.8+'"></td></tr><tr>'
	str+='<td width="27" height="21" align="center" valign="top" title="阳光：'+SunPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_fd.gif" width="27" height="5"><img src="http://imgcache.qq.com/qzone/client/icon_b1.gif" width="16" height="16"></td>'
    str+='<td width="27" align="center" valign="top" title="爱心：'+LovPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_fd.gif" width="27" height="5"><img src="http://imgcache.qq.com/qzone/client/icon_b2.gif" width="16" height="16"></td>'
    str+='<td width="27" align="center" valign="top" title="雨露：'+RaiPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_fd.gif" width="27" height="5"><img src="http://imgcache.qq.com/qzone/client/icon_b3.gif" width="16" height="16"></td>'
    str+='<td width="27" align="center" valign="top" title="营养：'+NurPot+'"><img src="http://imgcache.qq.com/qzone/client/icon_fd.gif" width="27" height="5"><img src="http://imgcache.qq.com/qzone/client/icon_b4.gif" width="16" height="16"></td>'
	str+='</tr><tr><td width="49">&nbsp;</td>'
	str+='<td colspan="7" align="center" valign="top"><font color="#000000">'
	switch (parseInt(Gardener)){
		case 0:
		str+='花匠学徒';
		break;
		case 1:
		str+='花匠学徒';
		break;
		case 2:
		str+='高级花匠';
		break;
		case 3:
		str+='花匠大师';
		break;
		case 4:
		str+='花之圣手';
		break;
		case 5:
		str+='花之神匠';
		break;
		}
	str+='</font><a href="http://q-zone.qq.com/web/?url=http://q-zone.qq.com/web/help/help_18.shtml#111" target="_blank"><img src="http://imgcache.qq.com/qzone/client/bt_help.gif" hspace="2" alt="帮助" border="0" align="absmiddle"></a></td>'
	str+='<td width="19">&nbsp;</td></tr></table>'
	var newDiv;
	if (g_EditMode==0)
		var newDiv= document.createElement("<div id='pot' style='position:absolute; padding:0px; overflow: hidden'>");
	else
		var newDiv= document.createElement("<div id='pot' style='position:absolute; padding:0px; overflow: hidden'>");
	newDiv.innerHTML= str;
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= width;
	newDiv.style.height= height;
	newDiv.style.zindex=zIndex;
	document.body.appendChild(newDiv);
	this.div= newDiv;
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	this.sid=g_WndID;
	Insert(this);
}

FWnd.prototype.remove = function() {
	if (this.alive) {
		document.body.removeChild(this.div);
		this.div= null;
		this.alive= false;
	}
}
///////////////////////公告栏类/////////////////////////////////
 function PImg (type, itemno, x, y, surl,zIndex){
	g_WndID++;
  var pubb="";
  var sWndID= "layer"+g_WndID;
	var sImgID= "img"+g_WndID;
	var str= '<table background="'+surl+'" width="190" height="90"  border="0" cellpadding="0" cellspacing="0"><tr><td width="54" height="7"></td><td></td><td></td></tr><tr><td></td><td width="124" height="48"><marquee direction=up scrolldelay=1000 height=48 width=124 onMouseOut=start() onMouseOver=stop()><span id='+itemno+' style="word-break:break-all;word-wrap: break-all;TABLE-LAYOUT:fixed"><font color="#ff0000" size="2" family="舒体"></font></span></marquee></td><td>&nbsp;</td></tr><tr><td></td><td align="right" valign="top">';
	if (g_EditMode==0) 
	str+='<img onclick="module_pub('+itemno+');" src="http://imgcache.qq.com/qzone/client/bt_06.gif" width="14" height="14" hspace="2" vspace="2" align="absmiddle" class="button"><font onclick="module_pub('+itemno+');"  color="#003366" >编辑&nbsp</font>;';
	str+='</td><td>&nbsp;</td></tr></table>';
	var newDiv;
	if (g_EditMode==0||mallFlag==1)
		newDiv= document.createElement("<div id='"+sWndID+"' onmouseover='LayerOnMouseOver("+sWndID+")' onmouseout='LayerOnMouseOut("+sWndID+")' onmousedown='LayerStartOperate()' onmouseup='LayerEndOperate()' style='position:absolute; padding:0px; overflow: hidden'>");
	else
		newDiv= document.createElement("<div id='"+sWndID+"' style='position:absolute; padding:0px; overflow: hidden'>");

	newDiv.innerHTML= str;
	newDiv.style.pixelLeft= x;
	newDiv.style.pixelTop= y;
	newDiv.style.width= 190;
	newDiv.style.height= 90;
	newDiv.style.zindex=0;
	newDiv.type=type;
	newDiv.itemno=itemno;
	document.body.appendChild(newDiv);
	this.div= newDiv;
	this.type= type;
	this.itemno= itemno;
	this.alive= true;
	Insert(this);
	//var sUrl="/cgi-bin/user/cgi_pboardxml_showmsg?uin="+g_iUin+"&typeid="+type+"&itemid="+itemno;
	//top.pubtxtid=itemno;alert(itemno);
	if(pubtxtid!=1){
		if(pubItems==undefined){
			var pubDoc= LoadXMLData(12);
	    pubItems= pubDoc.selectNodes("/data/item");
	    for(var j=0; j<pubItems.length; j++){
				pubid[j]=pubDoc.selectSingleNode("/data/item[" + j + "]/id").text;
				pubmsg[j]=pubDoc.selectSingleNode("/data/item[" + j + "]/msg").text;
				}
			}
	for(i=0;i<pubItems.length;i++){
	if(itemno==pubid[i]){
      msg[i]=pubmsg[i].substring(4);
      font[i]=pubmsg[i].substring(1,2);
      fontSize[i]=pubmsg[i].substring(2,3);
      fontColor[i]=pubmsg[i].substring(0,1);
	top.document.all(""+itemno+"").innerHTML="<font color='"+colortrn(fontColor[i])+"' size='"+fontSize[i]+"' face='"+texttrn(font[i])+"'>"+msg[i]+"</font>";
//top.document.all(""+itemno+"").innerHTML="<font color='#ff0000' size='2' family='舒体'>"+pubmsg[i]+"</font>";
}
}
 }else pubtxtid=0;
}


PImg.prototype.remove = function() {
	if (this.alive) {
		document.body.removeChild(this.div);
		this.div= null;
		this.alive= false;
	}
}
function texttrn(sendtext) {
	var Tcolor = "";
	switch (parseInt(sendtext)) {
	case 1 :
		Tcolor = '舒体';
		break;
	case 2 :
		Tcolor = '隶书';
		break;
	case 3 :
		Tcolor = '彩云';
		break;
	case 4 :
		Tcolor = '细黑';
		break;
	case 5 :
		Tcolor = '新魏';
		break;
	case 6 :
		Tcolor = '宋体';
		break;
	case 7 :
		Tcolor = '姚体';
		break;
	case 8:
		Tcolor = '幼圆';
		break;
	case 9 :
		Tcolor = '仿宋';
		break;
	case 0 :
		Tcolor = '行楷';
		break;
}
  return Tcolor;
}
function colortrn(sendcol) {
	var Tcolor = "";
	switch (sendcol) {
	case "a" :
		Tcolor = "#EE1D24";
		break;
	case "b" :
		Tcolor = "#F16522";
		break;
	case "c" :
		Tcolor = "#F7941D";
		break;
	case "d" :
		Tcolor = "#FFF100";
		break;
	case "e" :
		Tcolor = "#8FC63D";
		break;
	case "f" :
		Tcolor = "#37B400";
		break;
	case "g" :
		Tcolor = "#00A650";
		break;
	case "h" :
		Tcolor = "#00A99E";
		break;
	case "i" :
		Tcolor = "#00AEEF";
		break;
	case "j" :
		Tcolor = "#0072BC";
		break;
	case "k" :
		Tcolor = "#0054A5";
		break;
	case "l" :
		Tcolor = "#2F3192";
		break;
	case "m" :
		Tcolor = "#652C91";
		break;
	case "n" :
		Tcolor = "#91278F";
		break;
	case "o" :
		Tcolor = "#ED008C";
		break;
	case "p" :
		Tcolor = "#EE1000";
		break;
	}
  return Tcolor;
}
