﻿// wrt by keric 2010 04 22

function showvip(){
	var vip=getCookie('Cookvip');if(vip) document.write("<a href='vip.php' class='urlimg'><img src='img/vip.gif' title='您是Vip成员'/></a> ");
}

function wrtheadex1(){
	var username=getCookie('Cookname');
	var uid=getCookie('Cookuid');
	var lastplay=getCookie('lastplay');
	document.write("<div id='topnaver'><div id='head'><div id='headex1'>");
	if(uid){
		document.write("<div id='issignin'>正在以 ");
		showvip();
		document.write("<a href='home.php'>"+urldecode(username)+"</a> 登录 / <a href='home.php?do=message' class='urlimg'><img src='img/mail.png' title='消息中心' style='cursor:pointer'/></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/red-heart.gif' title='我的喜爱' style='cursor:pointer'></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/set.gif' title='设置，使Solowave更加符合你的使用习惯' style='cursor:pointer'></a> / <a href='addsong.php'>投递音乐</a> <a href='operator.php?action=signout&relink="+encodeURI(window.location.href)+"'>离开</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:4px' id='key' name='key'/> <input type='submit' class='button2' value='搜寻'/></form></div></div>");
	} else {
		document.write("<div id='issignin'><a href='addsong.php'>投递音乐</a> <a href='signin.php?relink="+encodeURI(window.location.href)+"'>登录</a> or  <a href='signup.php?relink="+encodeURI(window.location.href)+"'>注册</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:10px' id='key' name='key'/> <input type='submit' class='button3' value='搜寻'/></form></div></div>");
	}
	if(lastplay) var fix="<a href='play.php?s='"+lastplay+"  title='返回上次正在播放的内容'>正在播放</a> "; else fix="";
	if(uid) var fix2="<a href='collection.php' title='查看你收藏的内容'>我的曲库</a> "; else fix2="";
	document.write("<img src='img/logo.png' style='cursor:pointer' onclick='window.location=\"index.php\"' title='返回首页'/><br/><div id='tabs'>"+fix+"<a href='index.php'  title='看看其他人都有什么新发现'>音乐</a> <a href='explore.php'  title='使用各种有趣的工具发掘音乐'>发掘</a> <a href='social.php'  title=''>会员</a> <a href='fm.php'  title=''浏览圈子和发起讨论>音乐集</a> <a href='tag.php?do=list'  title=''>标签云</a> <a href='quanzi.php'  title=''浏览圈子和发起讨论>圈子</a> "+fix2+"<a href='on-the-go.php'  title='随时随地临时将的曲目放入On-the-go列表并集中管理'>ON-THE-GO</a></div></div><div class='dotline'></div></div></div>");
}
function wrtheadex2(){
	var username=getCookie('Cookname');
	var uid=getCookie('Cookuid');
	var lastplay=getCookie('lastplay');
	document.write("<div id='topnaver'><div id='head'><div id='headex2'>");
	if(uid){
		document.write("<div id='issignin'>正在以 ");
		showvip();
		document.write("<a href='home.php'>"+urldecode(username)+"</a> 登录 / <a href='home.php?do=message' class='urlimg'><img src='img/mail.png' title='消息中心' style='cursor:pointer'/></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/red-heart.gif' title='我的喜爱' style='cursor:pointer'></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/set.gif' title='设置，使Solowave更加符合你的使用习惯' style='cursor:pointer'></a> / <a href='addsong.php'>投递音乐</a> <a href='operator.php?action=signout&relink="+encodeURI(window.location.href)+"'>离开</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:4px' id='key' name='key'/> <input type='submit' class='button2' value='搜寻'/></form></div></div>");
	} else {
		document.write("<div id='issignin'><a href='addsong.php'>投递音乐</a> <a href='signin.php?relink="+encodeURI(window.location.href)+"'>登录</a> or  <a href='signup.php?relink="+encodeURI(window.location.href)+"'>注册</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:10px' id='key' name='key'/> <input type='submit' class='button3' value='搜寻'/></form></div></div>");
	}
	if(lastplay) var fix="<a href='play.php?s='"+lastplay+"  title='返回上次正在播放的内容'>正在播放</a> "; else fix="";
	if(uid) var fix2="<a href='collection.php' title='查看你收藏的内容'>我的曲库</a> "; else fix2="";
	document.write("<img src='img/logo.png' style='cursor:pointer' onclick='window.location=\"index.php\"' title='返回首页'/><br/><div id='tabs'>"+fix+"<a href='index.php'  title='看看其他人都有什么新发现'>音乐</a> <a href='explore.php'  title='使用各种有趣的工具发掘音乐'>发掘</a> <a href='social.php'  title=''>会员</a> <a href='fm.php'  title=''浏览圈子和发起讨论>音乐集</a> <a href='tag.php?do=list'  title=''>标签云</a> <a href='quanzi.php'  title=''浏览圈子和发起讨论>圈子</a> "+fix2+"<a href='on-the-go.php'  title='随时随地临时将的曲目放入On-the-go列表并集中管理'>ON-THE-GO</a></div></div><div class='dotline'></div></div></div>");
}
function wrtheadex2_play(s){
	var username=getCookie('Cookname');
	var uid=getCookie('Cookuid');
	var lastplay=getCookie('lastplay');
	document.write("<div id='topnaver'><div id='head'><div id='headex2'>");
	if(uid){
		document.write("<div id='issignin'>正在以 ");
		showvip();
		document.write("<a href='home.php'>"+urldecode(username)+"</a> 登录 / <a href='home.php?do=message' class='urlimg'><img src='img/mail.png' title='消息中心' style='cursor:pointer'/></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/red-heart.gif' title='我的喜爱' style='cursor:pointer'></a> / <a href='home.php?do=favor' class='urlimg'><img src='img/set.gif' title='设置，使Solowave更加符合你的使用习惯' style='cursor:pointer'></a> / <a href='addsong.php'>投递音乐</a> <a href='operator.php?action=signout&relink="+encodeURI(window.location.href)+"'>离开</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:4px' id='key' name='key'/> <input type='submit' class='button2' value='搜寻'/></form></div></div>");
	} else {
		document.write("<div id='issignin'><a href='addsong.php'>投递音乐</a> <a href='signin.php?relink="+encodeURI(window.location.href)+"'>登录</a> or  <a href='signup.php?relink="+encodeURI(window.location.href)+"'>注册</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:10px' id='key' name='key'/> <input type='submit' class='button3' value='搜寻'/></form></div></div>");
	}
	if(lastplay) var fix="<a href='play.php?s='"+lastplay+"  title='返回上次正在播放的内容'>正在播放</a> "; else fix="";
	if(uid) var fix2="<a href='collection.php' title='查看你收藏的内容'>我的曲库</a> "; else fix2="";
	document.write("<img src='img/logo.png' style='cursor:pointer' onclick='window.location=\"index.php\"' title='返回首页'/><br/><div id='tabs'>"+fix+"<a href='index.php'  title='看看其他人都有什么新发现'>音乐</a> <a href='explore.php'  title='使用各种有趣的工具发掘音乐'>发掘</a> <a href='social.php'  title=''>会员</a> <a href='fm.php'  title=''浏览圈子和发起讨论>音乐集</a> <a href='tag.php?do=list'  title=''>标签云</a> <a href='quanzi.php'  title=''浏览圈子和发起讨论>圈子</a> "+fix2+"<a href='on-the-go.php'  title='随时随地临时将的曲目放入On-the-go列表并集中管理'>ON-THE-GO</a>　<a href='javascript:void(0)' title='将此歌曲添加到on-the-go列表' onclick=\"addtoonthego("+s+")\" style='background:blue;color:white;height:14px'>+</a></div></div><div class='dotline'></div></div></div>");
}
function wrtheadext(){
	var username=getCookie('Cookname');
	var uid=getCookie('Cookuid');
	var lastplay=getCookie('lastplay');
	document.write("<div id='topnaver'><div id='head'><div id='headex2'>");
	if(uid){
		document.write("<div id='issignin'>正在以 ");
		showvip();
		document.write("<a href='../home.php'>"+urldecode(username)+"</a> 登录 / <a href='../home.php?do=message' class='urlimg'><img src='img/mail.png' title='消息中心' style='cursor:pointer'/></a> / <a href='../home.php?do=favor' class='urlimg'><img src='img/red-heart.gif' title='我的喜爱' style='cursor:pointer'></a> / <a href='../home.php?do=favor' class='urlimg'><img src='img/set.gif' title='设置，使Solowave更加符合你的使用习惯' style='cursor:pointer'></a> / <a href='../addsong.php'>投递音乐</a> <a href='operator.php?action=signout&relink="+encodeURI(window.location.href)+"'>离开</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:4px' id='key' name='key'/> <input type='submit' class='button2' value='搜寻'/></form></div></div>");
	} else {
		document.write("<div id='issignin'><a href='../addsong.php'>投递音乐</a> <a href='signin.php?relink="+encodeURI(window.location.href)+"'>登录</a> or  <a href='signup.php?relink="+encodeURI(window.location.href)+"'>注册</a><br/><div style='margin-top:5px'><form action='operator.php?action=musicpacersearch' method='post'><input style='margin-top:4px' id='key' name='key'/> <input type='submit' class='button3' value='搜寻'/></form></div></div>");
	}
	if(lastplay) var fix="<a href='../play.php?s='"+lastplay+"  title='返回上次正在播放的内容'>正在播放</a> "; else fix="";
	if(uid) var fix2="<a href='../collection.php' title='查看你收藏的内容'>我的曲库</a> "; else fix2="";
	document.write("<img src='../img/logo.png' style='cursor:pointer' onclick='window.location=\"index.php\"' title='首页'/><br/><div id='tabs'>"+fix+"<a href='../index.php'  title='看看其他人都有什么新发现'>音乐</a> <a href='../explore.php'  title='使用各种有趣的工具发掘音乐'>发掘</a> <a href='../social.php'  title=''>会员</a> <a href='fm.php'  title=''浏览圈子和发起讨论>音乐集</a> <a href='../tag.php?do=list'  title=''>标签云</a> <a href='../quanzi.php'  title=''浏览圈子和发起讨论>圈子</a> "+fix2+"<a href='../on-the-go.php'  title='随时随地临时将的曲目放入On-the-go列表并集中管理'>ON-THE-GO</a></div></div><div class='dotline'></div></div></div>");
}

function wrtfoot(){
	document.write("<div style='height:50px'></div><div id='footer'><a href='intro.php' class='foot'>了解Solowave</a> | <a href='help.php' class='foot'>使用帮助</a> | <a href='developer.php' class='foot'>开发团队</a> | <a href='faye.php' class='foot'>艺术家和专辑检索系统</a> | <a href='servicepolicy.php' class='foot'>服务条款</a> | <a href='ad&co.php' class='foot'>广告合作&建议反馈</a><br/>Copyright © 2010 Solowave.cn.All Rights Reserved.<br/>developed by keric.w</div>");
}

function wrtfootex2(){
	document.write("<div style='height:50px'></div><div class='dotline'></div><br/><table><tr><td width='130'>活动</td><td><a href='addsong.php' class='footex2'>推荐歌曲</a> | <a href='' class='footex2'>新建电台</a> | <a href='faye.php' class='footex2' title='基于百科形式建立的艺术家和专辑数据检索系统'>The faye</a></td></tr><tr><td>你的内容</td><td><a href='' class='footex2'>你的所有推荐</a> | <a href='' class='footex2'>电台</a> | <a href='' class='footex2'>通知</a> | <a href='' class='footex2'>我的页面</a></td></tr><tr><td>发掘器</td><td><a href='' class='footex2'>最近7天</a> | <a href='' class='footex2'>风格</a> | <a href='' class='footex2'>新鲜货</a> | <a href='' class='footex2'>Music pacer</a> | <a href='' class='footex2'>热门标签</a> | <a href='' class='footex2'>趋势</a> | <a href='' class='footex2'>音乐杂志</a> | <a href='' class='footex2'>电台</a> | <a href='' class='footex2'>实验室</a></td></tr></table><br/><a href='' class='footex2a'>Solowave Blog！</a>| <a href='t/intro.php' class='footex2a'>关于Solowave</a> | <a href='t/servicepolicy.php' class='footex2a'>服务条款</a> | <a href='t/developer.php' class='footex2a'>开发团队</a> | <a href='' class='footex2a'>反馈&举报</a> | <a href='http://www.miibeian.gov.cn/' class='footex2a'>皖ICP备10015892号</a><br/><br/><br/>");
}
function wrtfootext(){
	document.write("<div style='height:50px'></div><div class='dotline'></div><br/><table><tr><td width='130'>活动</td><td><a href='../addsong.php' class='footex2'>推荐歌曲</a> | <a href='../' class='footex2'>新建电台</a> | <a href='../faye.php' class='footex2' title='基于百科形式建立的艺术家和专辑数据检索系统'>The faye</a></td></tr><tr><td>你的内容</td><td><a href='../' class='footex2'>你的所有推荐</a> | <a href='../' class='footex2'>电台</a> | <a href='../' class='footex2'>通知</a> | <a href='../' class='footex2'>我的页面</a></td></tr><tr><td>发掘器</td><td><a href='../' class='footex2'>最近7天</a> | <a href='../' class='footex2'>风格</a> | <a href='../' class='footex2'>新鲜货</a> | <a href='../' class='footex2'>Music pacer</a> | <a href='../' class='footex2'>热门标签</a> | <a href='../' class='footex2'>趋势</a> | <a href='../' class='footex2'>音乐杂志</a> | <a href='../' class='footex2'>电台</a> | <a href='../' class='footex2'>实验室</a></td></tr></table><a href='' class='footex2a'>Solowave Blog！</a>| <a href='intro.php' class='footex2a'>关于Solowave</a> | <a href='servicepolicy.php' class='footex2a'>服务条款</a> | <a href='developer.php' class='footex2a'>开发团队</a> | <a href='' class='footex2a'>反馈&举报</a><br/><br/><br/>");
}

//定义获取Cookies值的函数
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return urldecode(unescape(arr[2])); return null;

}

//写cookie函数
function makeCookie(name,value){
	expireDate=new   Date; 
    expireDate.setYear(expireDate.getYear()+1); 
    document.cookie=name+"="+value;
}

function urldecode(str) {
    var ret = "";
    for(var i=0;i<str.length;i++) {
        var chr = str.charAt(i);
        if(chr == "+") {
            ret += " ";
        }else if(chr=="%") {
            var asc = str.substring(i+1,i+3);
            if(parseInt("0x"+asc)>0x7f) {
                ret += decodeURI("%"+ str.substring(i+1,i+9));
                i += 8;
            }else {
                ret += String.fromCharCode(parseInt("0x"+asc));
                i += 2;
            }
        }else {
            ret += chr;
        }
    }
    return ret;
}

function getCookieVal(offset){
	var endstr=document.cookie.indexOf(";",offset);
	if(endstr==-1){
		endstr=document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr));
}



function timetransfer(postdate) 
{ 
var second = 1000; 
var minutes = second*60; 
var hours = minutes*60; 
var days = hours*24; 
var months = days*30; 
var twomonths = days*365; 
var myDate = new Date(Date.parse(postdate)); 
if (isNaN(myDate)) 
{ 
myDate =new Date(postdate.replace(/-/g, "/")); 
} 
var nowtime = new Date(); 
var longtime =nowtime.getTime()- myDate.getTime(); 
var showtime = 0; 
if( longtime > months*2 ) 
{ 
document.write (postdate); 
} 
else if (longtime > months) 
{ 
document.write ("1个月前"); 
} 
else if (longtime > days*7) 
{ 
document.write ("1周前"); 
} 
else if (longtime > days) 
{ 
document.write(Math.floor(longtime/days)+"天前"); 
} 
else if ( longtime > hours) 
{ 
document.write(Math.floor(longtime/hours)+"小时前"); 
} 
else if (longtime > minutes) 
{ 
document.write(Math.floor(longtime/minutes)+"分钟前"); 
} 
else if (longtime > second) 
{ 
document.write(Math.floor(longtime/second)+"秒前"); 
}else 
{ 
document.write(longtime+" error "); 
} 
}

function isEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
alert("邮箱地址不正确");
}


function blog_addimg(){
	alert("请不要在同一乐博中插入2张以上的图片");
	var str=prompt("请输入你要插入的图片地址","http://");
	document.getElementById("blogcont").value=document.getElementById("blogcont").value+"<img>"+"</img>";
	document.getElementById("btitle").value=document.getElementById("btitle").value+"<img>";
	
}

function blog_addsong(){
	alert("请不要在同一乐博中插入2张以上的图片");
	var str=prompt("请输入你要插入的音乐文件地址,你也可以使用上床传音乐文件之后我们提供给你的地址","http://");
	document.getElementById("blogcont").value=document.getElementById("blogcont").value+"<song>"+"</song>";
	
}

function delblog(bid,pageref){
	if(confirm("确实要删除此乐博吗?该操作不可恢复!"))
	{
		window.location="operator.php?action=delblog&bid="+bid+"&pageref="+pageref;
	}
	
}

function blogtext(cont){
	return cont;
}
//全选反选,s 1全选,s 0反选
var chkArray=document.getElementsByName("songselect");
function selAll(s){
	if(chkArray.length){
		var sel=true;
		switch(s){
			case 1:
				for(i=0;i<chkArray.length;i++){
					if(!chkArray[i].checked){
						sel=false;
						break;
					}
				}
				for(i=0;i<chkArray.length;i++){
				   chkArray[i].checked=sel?false:true; 
				}
				break;
			case 0:
				for(i=0;i<chkArray.length;i++){
				   chkArray[i].checked=chkArray[i].checked?false:true; 
				}
				break;	
		}
	}

}

function downloader(s){
	window.open("download.php?s="+s,"newwindow","height=200,width=600,toolbar=no,meunbar=no,scrollbar=no,statu=no,location=no,resizable=no");
}

function set_ringtone(){
	alert('即将推出');
}

function url_cutex1(url){
	if(url.length<71) return url;
	urlcut=url.substr(0,70);
	return urlcut+"...";
}

function cont_trans(cont){
	var reg=new RegExp("\r\n","g"); 
	return cont.replace(reg,"<br/>");
}

function signin(){
	makeCookie("Cookrelink",window.location.href);
	window.location="signin.php";
}
function signup(){
	makeCookie("Cookrelink",window.location.href);
	window.location="signup.php";
}
function signout(){
	makeCookie("Cookrelink",window.location.href);
	window.location="operator.php?action=signout";
}

function destorycookie(name){
	makeCookie(name);
}

function wordsfilter(cont){
	if(cont.indexOf("共产党")!=-1||cont.indexOf("中国")!=-1||cont.indexOf("社会主义")!=-1||cont.indexOf("妈的")!=-1||cont.indexOf("操你妈")!=-1||cont.indexOf("狗屎")!=-1||cont.indexOf("shit")!=-1||cont.indexOf("爆你菊花")!=-1||cont.indexOf("傻逼")!=-1||cont.indexOf("东突")!=-1||cont.indexOf("达赖")!=-1) return false;
	return true;
	//别忘了结合服务器断进行验证
}

function imfeelinglucky(){
	window.location="operator.php?action=imfeelinglucky";
}

function _play_cmt_litup(prefix,no,ex){
	document.getElementById("ex"+ex+prefix+"span"+no).style.display="inline-block";
}
function _play_cmt_litoff(prefix,no,ex){
	document.getElementById("ex"+ex+prefix+"span"+no).style.display="none";
}
function li_litup(no){
	document.getElementById("li"+no).style.background="#FFFFB5";
}
function li_litoff(no){
	document.getElementById("li"+no).style.background="none";
}
function tr_litup(no){
	document.getElementById("tr"+no).style.background="#FFFFB5";
}
function tr_litoff(no){
	document.getElementById("tr"+no).style.background="none";
}
function music_maylike_litup(no){
	document.getElementById("may_like"+no).style.background="#eee";
}
function music_maylike_litoff(no){
	document.getElementById("may_like"+no).style.background="none";
}
function lit_up1(key,no){
	if(key) document.getElementById(no).style.color="#333"; else document.getElementById(no).style.color="#999";
}
function lit_up2(key,no){
	if(key) document.getElementById("nd"+no).style.color="#333"; else document.getElementById("nd"+no).style.color="#999";
}
function lit_up3(key,no){
	if(key) document.getElementById("nd"+no).style.background="#EEE"; else document.getElementById("nd"+no).style.background="white";
}

function reg_avalible(s){
	if(!s){document.getElementById("signup_btn").disabled=true;document.getElementById("signup_btn").title="您必须同意我们的服务条款方能注册";document.getElementById("agree").onclick=function onclick(){reg_avalible(1);}} else
	{document.getElementById("signup_btn").disabled=false;document.getElementById("signup_btn").title="轻松注册!";document.getElementById("agree").onclick=function onclick(){reg_avalible(0);}}
}

//弹出气泡提示集
function ShowAlert0(){
	var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
	pop.setContent("title","很抱歉");
	pop.setContent("alertCon","但是你似乎定义了一个错误的参数,或者只是我们出了点错误.注意,你的行为可能是危险的");
	pop.build();
	pop.show();
}
function ShowAlert1(){
	var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
	pop.setContent("title","很抱歉");
	pop.setContent("alertCon","您尚未登录，暂时无法收藏曲目");
	pop.build();
	pop.show();
}
function ShowAlert2(){
	//由播放界面添加的onthego成功
	var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
	pop.setContent("title","成功");
	pop.setContent("alertCon","曲目已成功添加到您的On-the-go列表");
	pop.build();
	pop.show();
}
function ShowAlert3(){
	//由播放界面添加的onthego失败:已存在
	var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
	pop.setContent("title","抱歉");
	pop.setContent("alertCon","此曲目已存在于您的On-the-go列表");
	pop.build();
	pop.show();
}
function ShowIframe1(){
	//推荐歌曲时发现曲目已推荐过，添加评论
	var pop=new Popup({ contentType:1,scrollType:'yes',isReloadOnClose:false,width:500,height:400});
	pop.setContent("contentUrl","plugin/leavecomment.php");
	pop.setContent("title","评论此曲目");
	pop.build();
	pop.show();
}
function ShowIframe2(s){
	//分享和下载歌曲
	var pop=new Popup({ contentType:1,scrollType:'yes',isReloadOnClose:false,width:700,height:300});
	pop.setContent("contentUrl","download.php?s="+s);
	pop.setContent("title","分享和下载此歌曲");
	pop.build();
	pop.show();
}
function rebug(s){
	//提交报告和举报
	var pop=new Popup({ contentType:1,scrollType:'yes',isReloadOnClose:false,width:450,height:200});
	pop.setContent("contentUrl","plugin/rebug.php");
	pop.setContent("title","请告诉我们你要回馈的原因");
	pop.build();
	pop.show();
}
//通用弹出框架
if(!Array.prototype.push){Array.prototype.push=function(){var startLength=this.length;for(var j=0;j<arguments.length;j++){this[startLength+j]=arguments[j];}return this.length;}};function G(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')element=document.getElementById(element);if(arguments.length==1)return element;elements.push(element)};return elements};function getValue(str){var nResult=0;switch(str){case "scrollTop":if(typeof(window.pageYOffset)!='undefined'){nResult=window.pageYOffset;}else if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollTop;}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollTop;}break;case "clientWidth":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.clientWidth;}else if(typeof(document.body)!='undefined'){nResult=document.body.clientWidth;}break;case "clientHeight":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.clientHeight;}else if(typeof(document.body)!='undefined'){nResult=document.body.clientHeight;}break;case "clientHeight":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.clientHeight;}else if(typeof(document.body)!='undefined'){nResult=document.body.clientHeight;}break;case "scrollWidth":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollWidth;}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollWidth;}break;case "scrollHeight":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollHeight;}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollHeight;}break;default:break;}return nResult;};Function.prototype.bind=function(object){var __method=this;return function(){__method.apply(object,arguments)}};Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){__method.call(object,event||window.event)}};Object.extend=function(destination,source){for(property in source){destination[property]=source[property]};return destination};if(!window.Event){var Event=new Object();};Object.extend(Event,{observers:false,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;};},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))element=element.parentNode;return element;},_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);};},unloadCache:function(){if(!Event.observers)return;for(var j=0;j<Event.observers.length;j++){Event.stopObserving.apply(this,Event.observers[j]);Event.observers[j][0]=null;};Event.observers=false;},observe:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);};}});Event.observe(window,'unload',Event.unloadCache,false);var Class=function(){var _class=function(){this.initialize.apply(this,arguments);};for(j=0;j<arguments.length;j++){superClass=arguments[j];for(member in superClass.prototype){_class.prototype[member]=superClass.prototype[member];};};_class.child=function(){return new Class(this);};_class.extend=function(f){for(property in f){_class.prototype[property]=f[property];};};return _class;};function space(flag){if(flag=="begin"){var ele=document.getElementById("ft");if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft_popup";ele=document.getElementById("usrbar");if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar_popup";}else if(flag=="end"){var ele=document.getElementById("ft_popup");if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft";ele=document.getElementById("usrbar_popup");if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar";};};var Popup=new Class();Popup.prototype={iframeIdName:'ifr_popup',initialize:function(config){this.config=Object.extend({contentType:1,isHaveTitle:true,scrollType:'no',isBackgroundCanClick:false,isSupportDraging:true,isShowShadow:true,isReloadOnClose:true,width:400,height:300},config||{});this.info={shadowWidth:4,title:"",contentUrl:"",contentHtml:"",callBack:null,parameter:null,confirmCon:"",alertCon:"",someHiddenTag:"select,object,embed",someHiddenEle:"",overlay:0,coverOpacity:40};this.color={cColor:"#000000",bColor:"#FFFFFF",tColor:"#B4D333",wColor:"#FFFFFF"};this.dropClass=null;this.someToHidden=[];if(!this.config.isHaveTitle){this.config.isSupportDraging=false;}this.iniBuild();},setContent:function(arrt,val){if(val!=''){switch(arrt){case 'width':this.config.width=val;break;case 'height':this.config.height=val;break;case 'title':this.info.title=val;break;case 'contentUrl':this.info.contentUrl=val;break;case 'contentHtml':this.info.contentHtml=val;break;case 'callBack':this.info.callBack=val;break;case 'parameter':this.info.parameter=val;break;case 'confirmCon':this.info.confirmCon=val;break;case 'alertCon':this.info.alertCon=val;break;case 'someHiddenTag':this.info.someHiddenTag=val;break;case 'someHiddenEle':this.info.someHiddenEle=val;break;case 'overlay':this.info.overlay=val;};};},iniBuild:function(){G('dialogCase')?G('dialogCase').parentNode.removeChild(G('dialogCase')):function(){};var oDiv=document.createElement('span');oDiv.id='dialogCase';document.body.appendChild(oDiv);},build:function(){var baseZIndex=10001+this.info.overlay*10;var showZIndex=baseZIndex+2;this.iframeIdName='ifr_popup'+this.info.overlay;var path="dialogclose.gif";var close='<input type="image" id="dialogBoxClose" src="'+path+'" border="0" width="16" height="16" align="absmiddle" title="关闭"/>';var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';var cover='<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;"></div>';var mainBox='<div id="dialogBox" style="border:1px solid '+this.color.tColor+';display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="'+this.color.bColor+'">';if(this.config.isHaveTitle){mainBox+='<tr height="24" bgcolor="'+this.color.tColor+'"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>'+'<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:'+this.color.wColor+';font-size:14px;font-weight:bold;">'+this.info.title+'&nbsp;</td>'+'<td id="dialogClose" width="20" align="right" valign="middle">'+close+'</td><td width="6"></td></tr></table></td></tr>'}else{mainBox+='<tr height="10"><td align="right">'+close+'</td></tr>'};mainBox+='<tr style="height:'+this.config.height+'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>'+'<div id="dialogBoxShadow" style="display:none;z-index:'+baseZIndex+';"></div>';if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;this.setBackgroundSize();window.onresize=this.setBackgroundSize;}else{G('dialogCase').innerHTML=mainBox;}Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move"};this.lastBuild()},setBackgroundSize:function(){var getValueWidth;var getMaxValueWidth=[getValue("clientWidth"),getValue("scrollWidth")];getValueWidth=eval("Math.max("+getMaxValueWidth.toString()+")");G('dialogBoxBG').style.width=getValueWidth;var getValueHeight;var getMaxValueHeight=[getValue("clientHeight"),getValue("scrollHeight")];getValueHeight=eval("Math.max("+getMaxValueHeight.toString()+")");G('dialogBoxBG').style.height=getValueHeight+ "px";},lastBuild:function(){var confirm='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.confirmCon+'</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确定 "/>&nbsp;<input id="dialogCancel" type="button" value=" 取消 "/></div></div>';var alert='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.alertCon+'</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确定 "/></div></div>';var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;if(this.config.contentType==1){var openIframe="<iframe width='100%' style='height:"+this.config.height+"px' name='"+this.iframeIdName+"' id='"+this.iframeIdName+"' src='"+this.info.contentUrl+"' frameborder='0' scrolling='"+this.config.scrollType+"'></iframe>";var coverIframe="<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:"+coverIfZIndex+";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";G("dialogBody").innerHTML=openIframe+coverIframe;}else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml;}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false);}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false);};},reBuild:function(){G('dialogBody').height=G('dialogBody').clientHeight;this.lastBuild()},show:function(){this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow()},forCallback:function(){return this.info.callBack(this.info.parameter)},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth+"px";oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth+"px";oShadow['style']['width']=oDialog.offsetWidth+"px";oShadow['style']['height']=oDialog.offsetHeight+"px";},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';var oDialog=G('dialogBox');oDialog['style']['position']="absolute";oDialog['style']['display']='';var sClientWidth=getValue("clientWidth");var sClientHeight=getValue("clientHeight");var sScrollTop=getValue("scrollTop");var sleft=(sClientWidth/2)-(oDialog.offsetWidth/2);var iTop=(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);if(sTop<1)sTop="20";if(sleft<1)sleft="20";oDialog['style']['left']=sleft+"px";oDialog['style']['top']=sTop+"px";},reset:function(){if(this.config.isReloadOnClose){top.location.reload();};this.close();},close:function(){G('dialogBox').style.display='none';if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='none';if(this.config.isShowShadow)G('dialogBoxShadow').style.display='none';G('dialogBody').innerHTML='';this.showSome();},hiddenSome:function(){var tag=this.info.someHiddenTag.split(",");if(tag.length==1&&tag[0]==""){tag.length=0;}for(var j=0;j<tag.length;j++){this.hiddenTag(tag[j]);};var ids=this.info.someHiddenEle.split(",");if(ids.length==1&&ids[0]=="")ids.length=0;for(var j=0;j<ids.length;j++){this.hiddenEle(ids[j]);};space("begin");},hiddenTag:function(tagName){var ele=document.getElementsByTagName(tagName);if(ele!=null){for(var j=0;j<ele.length;j++){if(ele[j].style.display!="none"&&ele[j].style.visibility!='hidden'){ele[j].style.visibility='hidden';this.someToHidden.push(ele[j]);};};};},hiddenEle:function(id){var ele=document.getElementById(id);if(typeof(ele)!="undefined"&&ele!=null){ele.style.visibility='hidden';this.someToHidden.push(ele);}},showSome:function(){for(var j=0;j<this.someToHidden.length;j++){this.someToHidden[j].style.visibility='visible';};space("end");}};var Dragdrop=new Class();Dragdrop.prototype={initialize:function(width,height,shadowWidth,showShadow,contentType){this.dragData=null;this.dragDataIn=null;this.backData=null;this.width=width;this.height=height;this.shadowWidth=shadowWidth;this.showShadow=showShadow;this.contentType=contentType;this.IsDraging=false;this.oObj=G('dialogBox');Event.observe(G('dialogBoxTitle'),"mousedown",this.moveStart.bindAsEventListener(this),false);},moveStart:function(event){this.IsDraging=true;if(this.contentType==1){G("iframeBG").style.display="";G("iframeBG").style.width=this.width;G("iframeBG").style.height=this.height;};Event.observe(document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(document,"mouseup",this.mouseup.bindAsEventListener(this),false);Event.observe(document,"selectstart",this.returnFalse,false);this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};this.backData={x:parseInt(this.oObj.style.left),y:parseInt(this.oObj.style.top)};},mousemove:function(event){if(!this.IsDraging)return;var iLeft=Event.pointerX(event)-this.dragData["x"]+parseInt(this.oObj.style.left);var iTop=Event.pointerY(event)-this.dragData["y"]+parseInt(this.oObj.style.top);if(this.dragData["y"]<parseInt(this.oObj.style.top))iTop=iTop-12;else if(this.dragData["y"]>parseInt(this.oObj.style.top)+25)iTop=iTop+12;this.oObj.style.left=iLeft+"px";this.oObj.style.top=iTop+"px";;if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth+"px";G('dialogBoxShadow').style.top=iTop+this.shadowWidth+"px";};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move";},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop||document.body.scrollTop);var oObjBottom;var oObjRight;if(this.showShadow){oObjBottom=parseInt(this.oObj.style.top)+this.height+this.shadowWidth;oObjRight=parseInt(this.oObj.style.left)+this.width+this.shadowWidth;}else{oObjBottom=parseInt(this.oObj.style.top)+this.height;oObjRight=parseInt(this.oObj.style.left)+this.width;};if(mousX<1||mousY<1||mousX>document.body.clientWidth||mousY>document.body.clientHeight||parseInt(this.oObj.style.left)<0||parseInt(this.oObj.style.top)<0||oObjRight>document.body.clientWidth||oObjBottom>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth;};};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false);},returnFalse:function(){return false;}};function openshow(url,title,w,h,stype){g_pop=new Popup({contentType:stype,isReloadOnClose:false,width:w,height:h});g_pop.setContent("title",title);g_pop.setContent("contentUrl",url);g_pop.build();g_pop.show();}function g_close_pop_re(){g_pop.close();location.reload();}function Comment(url,w,h){g_pop=new Popup({contentType:1,isReloadOnClose:false,width:w,height:h});g_pop.setContent("title","登陆");g_pop.setContent("scrollType","no");g_pop.setContent("contentUrl",url);g_pop.build();g_pop.show();}function g_close_pop(){g_pop.close();g_pop=null;}function ShowAlert(title,content,w,h){var pop=new Popup({contentType:4,isReloadOnClose:false,width:w,height:h});pop.setContent("title",title);pop.setContent("alertCon",content);pop.build();pop.show();}function Wclose(){g_pop.close();g_pop=null;}
