﻿// JavaScript Document
/*
	if (top.location !== self.location && document.location.indexOf('piekee')==-1) {
		alert("派派提示：你现在正在收听由“派派网”提供的音频作品！\n\n更多精彩作品，请访问我们的网址：http://www.piekee.com");
		top.location=self.location;
	}
*/

var PAIAlert = "■派派提示：";
var FSCAlert = "请先选择你要告知的对象哦:)";
var SelectAlert = "请选择要操作的记录！成灰色的复选框为不可选！";
var COMMURL = "";

function initInfo(){
	initBrow();
//	doBtnAll();
}

function VerifyInput()
{
strTitle=document.getElementById("KeyWords");
if(strTitle.value=="")
{
alert(PAIAlert + "请输入您要搜索的关键字！")
strTitle.focus();
return false;
}
return 1;
}

function getIdNum(obj,id){
	var objvalue = document.getElementById(obj).value;
	var objArray = objvalue.split(id);
	return objArray.length;
}

/*
function login(){
	dialogWindow('/web2/pai_login.pai','login','630','250');
}
*/

function viewUser(id){
	dialogToolWindow('/user/user.pai?id='+encodeURI(id),'user','980','500');
}

/*
function noteTimer(){

	if(readCookie('noTimer')=='' || readCookie('noTimer')!=1){
	　var url = COMMURL + "note.pai";
	  //window.location.href = url;
	  
	  var result = unescape(doXmlHttp(url,"check"));
	  if(result.indexOf('短信')!=-1){	
		if(confirm(result)){
			dialogWindow('/web2/mypai/myInbox.pai','note','780','350');
		}else{
			var expires = new Date();
			expires.setTime(expires.getTime() + 30 * 60 * 1000);
			document.cookie = 'noTimer = 1;expires=' + expires.toGMTString();
		}
	  }
	  setTimeout("noteTimer()", 1000*180);
	}
}
*/

function doXmlHttp(url,data){

	var xmlHttp = XMLHttpRequestObject();
	xmlHttp.open("POST", url, false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.send(data);
	return xmlHttp.responseText;

}

function doTempXmlHttp(url){

	var xmlHttp = XMLHttpRequestObject();
	xmlHttp.open("GET", url, false);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.send(null);

}

/*
function doMediaSearch(){
	var url= "/"
	if(TrimAll(document.getElementById('keyword').value)==""){
		alert(PAIAlert + "请先输入你要查找的字符！");
		document.getElementById('keyword').focus();
		return false;
	}

	window.document.fmSearch.action="/channel/search.html";
    window.document.fmSearch.submit();

}
*/

function doMediaSearch(){

		var keyword= TrimAll(document.getElementById('keyword').value);
		
		if(keyword==""){
			alert(PAIAlert + "请先输入你要查找的字符！");
			document.getElementById('keyword').focus();
			return false;
		}else{		
			if(keyword.indexOf('%')!=-1){
				alert(PAIAlert + "搜索关键字中不能包含%字符，请更改后再搜索。");
				return false;
			}else{
				window.document.fmSearch.action="/channel/search.html";
				window.document.fmSearch.submit();
			}
		}
}

function doFastSearch(keyword){

		document.getElementById('keyword').value = keyword;
		doMediaSearch();

}





function copyToClicp(id){
	window.clipboardData.setData('text',document.getElementById(id).value);
	alert(PAIAlert + "地址已经复制到剪贴板中了！\n\n现在随你贴在任意的地方了，快试试吧:)");
}

function copyRSSToPlay(URL){
	window.clipboardData.setData('text',URL);
	alert(PAIAlert + "订阅节目的地址已经复制到剪贴板中了！\n\n现在你可以打开任意订阅该地址的播放器吧，比如ITunes。\n\n如果不知道如何使用，派派首页上方有一个叫“订阅”链接，点进去了解下:)");
}

/*
function openAudioInfo(id){

		location.href ="/audio/"+id+".html";

}

function openVideoInfo(id){

		location.href ="/video/"+id+".html";

}

function openGameInfo(id){

		location.href ="/video/"+id+".html";

}
*/

function PStart(url){
	var url = mediaURL(url);
	if(parent.document.getElementById("mplayer")!=null){
		parent.document.getElementById("mplayer").Pause();
	}
	if(parent.document.getElementById("PPMlayer")==null){
		creatPlay(url);
	}else{
		parent.document.getElementById("PPMlayer").FileName = url;
	}
}

function PStop(){
	if(parent.document.getElementById("mplayer")!=null){
		parent.document.getElementById("mplayer").Play();
	}
	parent.document.getElementById("PPMlayer").Pause();

}

function creatPlay(url){
var objHTML1 = ("	<OBJECT ID='PPMlayer' width='280' height='25' CLASSID='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' STANDBY='Loading Windows Media Player components...' TYPE='application/x-oleobject' VIEWASTEXT>");
objHTML1 += ("	<PARAM NAME='FileName' VALUE='"+ url);
objHTML1 += ("'>");
objHTML1 += ("	<PARAM NAME='AutoStart' VALUE='True'>");
objHTML1 += ("	<PARAM NAME='ShowStatusBar' VALUE='True'>");
objHTML1 += ("	<PARAM NAME='ShowControls' VALUE='False'>");
objHTML1 += ("	<PARAM NAME='ShowTracker' VALUE='False'>");
objHTML1 += ("	<PARAM NAME='EnableTracker' VALUE='False'>");
objHTML1 += ("	<PARAM NAME='ShowPositionControls' VALUE='False'>");
objHTML1 += ("	<PARAM NAME='EnablePositionControls' VALUE='False'>");
objHTML1 += ("	</OBJECT>");

parent.document.getElementById("play").innerHTML = objHTML1;
//alert(parent.document.getElementById("play").innerHTML);
//alert(PAIAlert + "正在缓冲中，请等候播放...");

}


function OMOT(obj,id){
	
	openMediaOfType(obj,id);
	
}

function openMediaOfType(obj,id){
	if(obj=="a"){
		location.href ="/web2/club/pai_sort_audio.pai?id="+id;
	}else{
		location.href ="/web2/club/pai_sort_video.pai?id="+id;
	}

}

function OZ(url){

location.href = "http://my.piekee.com/"+url;

}

function OURL(url){

location.href = url;

}

function playIntr(playcode){
	
	var url =domain+ "/home/audio/paipai_intr_";
	var mp3 = ".mp3";
	PStart(url+playcode+mp3);	

}

function adnon(){
	dialogWindow('/web2/non/non.pai','non','980','550');
}

function doTutoDemo(filename){
	dialogWindow('http://pai112.piekee.com:33/tool/demo/paipai_tutorial_'+filename+'.swf','non','980','950');
}


function doSetMC(){
	if(document.getElementById("searchObj").value=="class"){
		document.getElementById("wordobj").innerHTML = doGetClass();
	}
}

function doGetClass(){
var ClassHTML = "<select name='keyword' id='keyword'>"
				+"<option value='1'>◇┬选择频道</option>"
				+"<option value='1'>◇├娱乐</option>"
				+"<option value='2'>◇├时尚</option>"
				+"<option value='3'>◇├音乐</option>"						
				+"<option value='4'>◇├电影</option>"
				+"<option value='5'>◇├评书</option>"
				+"<option value='6'>◇├情感</option>"
				+"<option value='7'>◇├旅游</option>"
				+"<option value='8'>◇├自拍</option>"
				+"<option value='9'>◇├交友</option>"
				+"<option value='10'>◇├美食</option>"
				+"<option value='11'>◇├校园</option>"
				+"<option value='12'>◇├搞笑</option>"						
				+"<option value='13'>◇├购物</option>"
				+"<option value='14'>◇├生活</option>"
				+"<option value='15'>◇├工作</option>"
				+"<option value='16'>◇├跳蚤</option>"
				+"<option value='17'>◇├宠物</option>"
				+"<option value='18'>◇├玩车</option>"	
				+"<option value='19'>◇├短剧</option>"
				+"<option value='20'>◇├动漫</option>"
				+"<option value='21'>◇├体育</option>"						
				+"<option value='22'>◇├游戏</option>"
				+"<option value='23'>◇├人物</option>"
				+"<option value='24'>◇├广告</option>"
				+"<option value='25'>◇├科技</option>"
				+"<option value='26'>◇├教育</option>"
				+"<option value='27'>◇├文艺</option>"
				+"<option value='28'>◇├戏曲</option>"
				+"<option value='29'>◇├新闻</option>"
				+"<option value='30'>◇├其他</option>"
				+"<option value='31'>◇├恐怖</option>"
				+"<option value='32'>◇├财经</option>"
				+"<option value='33'>◇├商业</option>"
				+"<option value='34'>◇├祝福</option>"	
				+"</select>"
				
return ClassHTML;

}

function doSetCS(id,cn){

		var ct = document.getElementById("SetCS").value;

		doFastAddCS(id,cn,ct);

}

function doFastAddCS(id,cn,ct){
		var url="/app/as/mypai/pai_CSInsPres.pai";
		var data = "cn="+escape(cn)+"&ct="+ct   
   
   		//document.location.href = url+data;   
		var result =unescape(doXmlHttp(url,data));	
		/*
		if(result.indexOf("登录")==-1){

			document.getElementById(id).onclick = "";
			document.getElementById(id).title = "派派提示：此用户已添加过，不必重复哦:0";
		}
		*/
		doCSReturn(result,ct,'add');	
}

function doFastAddBK(objid){
		var url="/app/as/mypai/pai_BKInsPres.pai";
		var id = document.getElementById("id").value;
		var mediaTitle = escape(document.getElementById("mediaTitle").value);		
		var obj = document.getElementById("module").value;
		var data = "id="+id+"&mediaTitle="+mediaTitle+"&obj="+obj;
   
   		//document.location.href = url+data;   
  		
		var result =unescape(doXmlHttp(url,data));	
		
		if(result.indexOf("成功")!=-1){
			document.getElementById(objid).onclick = "";
			document.getElementById(objid).className = "pp_online";
			document.getElementById(objid).title = "派派提示：宝贝已收藏，不必重复哦:0";
		}
		alert(result);
		
}

function doCSReturn(rsReturn,ct,act,url){

	var sReturn = rsReturn;
	
	var alertCT = "好友";
	
	if(ct==1){		
		alertCT = "普通朋友";		
	}else if(ct==3){
		alertCT = "黑名单";
	}	

if(sReturn == "undefined" || sReturn == "0"){
		sReturn = "6";
	}

	switch (sReturn){
	   case "1":
			alert(PAIAlert + "此用户已添加过了哦:)");
			if(document.getElementById("add")!=null){
				document.getElementById("add").disabled = false;
				document.getElementById("add").value = "派派提示：一个用户不能在多个好友组类别中存在。";
			}
			break;
	   case "2":	   
	   		alert(PAIAlert + "你取名的用户昵称已存在于你的"+alertCT+"中，请换一个哦:)");
			if(document.getElementById("add")!=null){			
				document.getElementById("add").disabled = false;
				document.getElementById("add").value = "派派提示：用户昵称已存在于你的"+alertCT+"中，请换一个哦:)";
			}
			break;
	   case "3":	   
	   		alert(PAIAlert + "你添加的用户名还没有在派派中注册，要通知对方注册后才能添加哦:)");
			if(document.getElementById("add")!=null){			
				document.getElementById("add").disabled = false;
				document.getElementById("add").value = "派派提示：你添加的用户名还没有在派派中注册...";
			}
			break;				
	   case "6":
			if(act=="add"){
				
				if(ct=='1'){
					alert(PAIAlert + "此用户已成功添加进入你的普通朋友组中！");
				}else if(ct=='2'){
					alert(PAIAlert + "好友已添加成功，记得去好友地盘踩一踩哦:)");
				}else if(ct=='3'){
					alert(PAIAlert + "此用户已成功添加进入你的黑名单组中！\n\n你以后将不会再收到黑名单组中用户发来的短消息！");
				}
				if(document.getElementById("add")!=null){				
					document.getElementById("add").disabled = false;
					document.getElementById("add").value = "派派提示：你的"+alertCT+"已添加成功，请继续添加...";
				}
			}else if(act="up"){
				alert(PAIAlert + "此"+alertCT+"的信息已更新完毕！");
				if(document.getElementById("add")!=null){				
					document.getElementById("add").disabled = false;
					document.getElementById("add").value = "派派提示：你的"+alertCT+"信息已更新完毕。";
				}
				document.location.href = url;

			}
			break;

	   default:alert(sReturn);showBoxs('loginBox');login('logins');
	   

	}	
}


function doSendMMS(){

	var to = TrimAll(document.getElementById("mmsTo").value);
	var content = Trim(document.getElementById("mmsContent").value);

	if(to==""){
		alert(PAIAlert + "短信收件人别忘了填，对方可收不到哦！");
		document.getElementById("mmsTo").focus();
		return false;
	}

	if(String(content)=="undefined" || String(content)=="" || content.length<3)
	{
		alert(PAIAlert + "你的短信息还没填，不能太短哦！")
		document.getElementById("mmsContent").focus();
		return false;
	}
	
	if(content.length>1000){
		alert(PAIAlert + "短信内容不要太长哦，不然对方看这短信会比较累了，1000字以内即可。");
		document.getElementById("mmsContent").focus();
		return false;
	}
	
	if((content.indexOf('电台',0)!=-1 && content.indexOf('派派',0)==-1) || (content.indexOf('播客网',0)!=-1 && content.indexOf('派派',0)==-1) || ((content.indexOf('www.',0)!=-1 || content.indexOf('.com',0)!=-1) && content.indexOf('piekee.com',0)==-1)){
		window.alert(PAIAlert + "短信内容中含有非法内容，请更改。");
		document.getElementById("mmsContent").focus();
		return false;
	}	

	//to = escape(to);
	//content = escape(content);

	var url="/app/as/mms/pai_MMSOfFastAddPres.pai";
	var data = "mmsTo="+escape(to)+"&Content="+escape(content);
	document.getElementById("btnSend").disabled = true;
	document.getElementById("btnSend").value = "正在发送，请稍等...";
	if(document.getElementById("btnClose")!=null){
		document.getElementById("btnClose").disabled = true;
	}
	var result = unescape(doXmlHttp(url,data));

	if(result.indexOf('登录')!=-1){
		alert(result);
		document.getElementById("btnSend").value = " 发送 ";
	}else{
		document.getElementById("mmsContent").value = "";
		document.getElementById("btnSend").value = "短信已发送成功";	
	}
	document.getElementById("btnSend").disabled = false;
}


//var DOMAIN = "http://www.piekee.com";
var DOMAIN = "";
var CODE = "pp1000200020100001";

function mediaURL(fileName){
	
	 var url = "";
	 var path = "";		 

		switch(fileName.substring(8,10)){

			case "sa"	: url = DOMAIN + '/paipai/sa'+CODE; break;
			case "la"	: url = DOMAIN + '/paipai/la'+CODE; break;
			case "pl"	: url = 'http://pai106.piekee.com/paipai/pl'+CODE; break;
			case "zl"	: url = 'http://pai106.piekee.com/paipai/zl'+CODE; break;			
			case "pk"	: url = 'http://pai18.piekee.com/paipai/pk'+CODE; break;
			case "zk"	: url = 'http://pai18.piekee.com/paipai/zk'+CODE; break;
			case "pj"	: url = 'http://pai18.piekee.com/paipai/pj'+CODE; break;
			case "zj"	: url = 'http://pai18.piekee.com/paipai/zj'+CODE; break;	
			case "pi"	: url = 'http://pai18.piekee.com/paipai/pi'+CODE; break;
			case "zi"	: url = 'http://pai18.piekee.com/paipai/zi'+CODE; break;		
			case "ph"	: url = 'http://pai106.piekee.com/paipai/ph'+CODE; break;
			case "zh"	: url = 'http://pai106.piekee.com/paipai/zh'+CODE; break;		
			case "pg"	: url = 'http://pai106.piekee.com/paipai/pg'+CODE; break;
			case "zg"	: url = 'http://pai106.piekee.com/paipai/zg'+CODE; break;		
			case "pf"	: url = 'http://pai106.piekee.com/paipai/pf'+CODE; break;
			case "zf"	: url = 'http://pai106.piekee.com/paipai/zf'+CODE; break;		
			case "pe"	: url = 'http://pai106.piekee.com/paipai/pe'+CODE; break;
			case "ze"	: url = 'http://pai106.piekee.com/paipai/ze'+CODE; break;		
			case "pd"	: url = 'http://pai106.piekee.com/paipai/pd'+CODE; break;
			case "zd"	: url = 'http://pai106.piekee.com/paipai/zd'+CODE; break;		
			case "on"	: url = 'http://pai7.piekee.com/paipai/on'+CODE; break;
			case "zc"	: url = 'http://pai7.piekee.com/paipai/zc'+CODE; break;		
			case "zb"	: url = 'http://pai7.piekee.com/paipai/zb'+CODE; break;
			case "di"	: url = 'http://pai7.piekee.com/paipai/di'+CODE; break;		
			case "dg"	: url = 'http://pai7.piekee.com/paipai/dg'+CODE; break;
			case "ga"	: url = 'http://pai7.piekee.com/paipai/ga'+CODE; break;
			case "ba"	: url = 'http://pai112.piekee.com/paipai/ba'+CODE; break;
			case "bi"	: url = 'http://www.piekee.cn/paipai/bi'+CODE; break;			
			case "db"	: url = 'http://pai112.piekee.com/paipai/db'+CODE; break;
			case "da"	: url = 'http://pai112.piekee.com/paipai/da'+CODE; break;
			case "ds"	: url = 'http://pai112.piekee.com/paipai/ds'+CODE; break;
			default  	: url = "";
		}		
		

	if(url!=""){
		
		path = url+fileName.substring(28,fileName.length);
	
	}else{
		path = fileName;
	}

	return path
}


function openPiekee(){
	
	 if(verifyUser()){
		dialogWindow('/web2/piekee/record/piekee_zone.pai','paike','748','528');
	 }else{
	  login();
  	  return false;
  	}
}

function openRecord(){

		window.location.href = "/web2/mypai/myRecord.pai";

}

function openreg(){
	dialogToolWindow('/user/reg.pai','reg','800','528');
	window.close();

}


function doOnlineMessage(){
	/*
	var url = "/app/as/user/pai_onLinePres.pai";

	var result = unescape(doXmlHttp(url,"checkonline"));		

 	if(result.indexOf(':)')!=-1){	
		alert(result);
	}
	setTimeout("doOnlineMessage()", 1000*600);	
	*/
}

function doColl(){
	
	if(confirm(PAIAlert + "是否确定要收藏派派并设置为主页？")){
		window.external.addFavorite('http://www.piekee.com','我的派派(www.piekee.com)');
		document.getElementById("coll").style.behavior='url(#default#homepage)';
		document.getElementById("coll").setHomePage('http://www.piekee.com');
	}
}

function getoffset()
{
	var tempoffset=(document.getElementById("Num").value-1)*20;
	if (tempoffset<0)
	tempoffset=0;
	document.getElementById("offset").value=tempoffset;
	return true;
}

function setOffset(num)
{
	var tempoffset=(document.getElementById("Num").value-1)*num;
	if (tempoffset<0)
	tempoffset=0;
	document.getElementById("offset").value=tempoffset;
	return true;
}

function openChannel(id){

		location.href ="/web2/piekee/pai_channel_list.pai?id="+id;

}



function doSetClass(a){
	$$(a).className = "hovr";
}

function doResetClass(a)
{
	$$(a).className="";
}

function doSetRadio(obj,value) {

		document.getElementById(obj).value = value;

 }

function doSearch(obj){

	var keyword = document.getElementById(obj);
	if(TrimAll(keyword.value)==""){
		alert(PAIAlert + "请先输入你要查找的字符！");
		document.getElementById(obj).focus();
		return false;
	}

	window.document.getElementById("fmSearch").action=document.location.href;
    window.document.getElementById("fmSearch").submit();

}

function isCheckSelected()
{

	if(document.getElementById("ids").value!=""){
		return true;
	}else{
		var itemlength=document.getElementById("relist").elements.length;
		  for(var i=0;i<parseInt(itemlength);i++)
		  {
			if (document.getElementById("relist").elements[i].type=="checkbox")
			{
			  if(document.getElementById("relist").elements[i].checked && document.getElementById("relist").elements[i].disabled!=true && document.getElementById("relist").elements[i].value!="btnAll")
			  {
				return true;
			  }
			}
		  }
	}
  return false;
}

function doAll(){
  var itemlength=document.getElementById("relist").elements.length;
  for(var i=0;i<parseInt(itemlength);i++){
    if (document.getElementById("relist").elements[i].type=="checkbox" && document.getElementById("relist").elements[i].disabled!=true){
      document.getElementById("relist").elements[i].checked=document.getElementById("btnAll").checked;
    }
  }
  doSRS();
}

function doBtnAll(){

	if(document.getElementById("relist")!=null){
		
		  var itemlength=document.getElementById("relist").elements.length;
		  for(var i=0;i<parseInt(itemlength);i++){
			if (document.getElementById("relist").elements[i].type=="checkbox" && document.getElementById("relist").elements[i].disabled!=true){
			  document.getElementById("relist").elements[i].checked = true;
			}
		  }
		   doSRS();
	}
}


function doBtnUnAll(){
	
	if(document.getElementById("relist")!=null){

		  var itemlength=document.getElementById("relist").elements.length;
		  for(var i=0;i<parseInt(itemlength);i++){
			if (document.getElementById("relist").elements[i].type=="checkbox"){
			  document.getElementById("relist").elements[i].checked = false;
			}
		  }
		  doSRS();
	}
}



function doBtnContrary(){
	if(isCheckSelected()){
		  var itemlength=document.getElementById("relist").elements.length;
		  for(var i=0;i<parseInt(itemlength);i++){
			if (document.getElementById("relist").elements[i].type=="checkbox"){
			  if(document.getElementById("relist").elements[i].checked){
				  document.getElementById("relist").elements[i].checked = false;
			  }else{
				  document.getElementById("relist").elements[i].checked = true;	
			  }
			}
		  }
		  doSRS();
	}else{
		alert(PAIAlert + FSCAlert);
	}	  
}

function doSRS() {

	document.getElementById("ids").value = "";

	 var itemlength= document.getElementById("relist").elements.length;	 
	 
	  for(var i=0;i<parseInt(itemlength);i++){
		if (document.getElementById("relist").elements[i].type=="checkbox" && document.getElementById("relist").elements[i].checked==true && document.getElementById("relist").elements[i].disabled!=true && document.getElementById("relist").elements[i].value!="btnAll"){
		  document.getElementById("ids").value += document.getElementById("relist").elements[i].value+",";
		}
	  }

	document.getElementById("ids").value=doSubstr("ids");

	if(document.getElementById("mmsNotify")!=null){
		if(document.getElementById("ids").value == ""){
			document.getElementById("mmsNotify").checked = false;
			document.getElementById("mailNotify").checked = false;
		}else{
			document.getElementById("mmsNotify").checked = true;
			document.getElementById("mailNotify").checked = true;
		}
		
	}

 }
 
  
function PP_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

var DIR_COMM = "/_comm/";
var DIR_ZONE = "/zone/";

/*
function NewYearRed(){
	
	var RanNum = parseInt(Math.random() * 10 + 1);
	
	if(RanNum == 8){
		if(confirm("※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※\n\n※   派派给你拜年来了，恭喜恭喜！你得到了一次抽奖的机会，派派即将为你送出☆新年大红包☆       ※\n\n※   点【确定】按钮进行抽奖，经系统确认后就可以立即得到，同时请查看短信中收到的中奖提示哦:)   ※\n\n※   小提示：登录10次就会有一次中奖（3小时内不同IP计一次），智买点、鲜花、派币等你来拿哦。    ※\n\n※   派派新春活动“猜猜猜、玩玩玩”中令人眼红的派金也正在大派送中，赶快参与并行动起来吧:)     ※\n\n※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")){
		
			
			var url = COMMURL + "NewYearOf2007Pres.pai";
	  //window.location.href = url;
	  
	  		var result = unescape(doXmlHttp(url,"red"));
			alert(result);
		}
	}

}
*/

function logout(){

document.location.href = "/app/as/user/logout.pai";

}

function bxs(abox){

boxSlide(abox);
}

/*
var gOverPPScroller = false;

function PPScroller(ulId, scrollPixel, speed) {

	this.container = document.getElementById(ulId);
	this.container.Scroller = this;
	this.speed = speed;
	this.scrollpx = scrollPixel;

	this.container.onmouseover = function(e) {
		gOverPPScroller = true;
	}

	this.container.onmouseout = function(e) {
		gOverPPScroller = false;
	}

	this.scroll = function() {
		if (gOverPPScroller == false) {
			var c = this.container.firstChild;
			var first = null;
			while (c) {
				if (c.tagName == 'LI') {
					first = c;
					break;
				}
				c = c.nextSibling;
			}
			var nodeSize = 78;	
			var px = 0;
			nodeSize = first.clientWidth;

			if (first.style.marginLeft != '') {
				px = parseInt(first.style.marginLeft);
			}
			first.style.marginLeft = ( px - this.scrollpx ) + 'px';
			if ( parseInt(first.style.marginLeft) <= -(nodeSize) ) {
				first.style.marginLeft = '0px';
				this.container.removeChild(first);
				this.container.appendChild(first);
			}
		}
		setTimeout('document.getElementById(\'' + this.container.id + '\').Scroller.scroll()', this.speed);
	}

	setTimeout('document.getElementById(\'' + ulId + '\').Scroller.scroll()', this.speed);

}
*/
var boxShowing = true;

function boxSlide(abox) {
  if ( boxShowing )
	 { hideBox(abox); boxShowing = false; }
  else
	 { showBox(abox); boxShowing = true; }
}

var divShowing = false;

function divSlide(abox) {
  if ( divShowing )
	 { hideBox(abox); divShowing = false; }
  else
	 { showBox(abox); divShowing = true; }
}


function hideBox( abox ) {
  if(document.getElementById(abox)!=null){
	  var boxobj = document.getElementById(abox).id;
		hidBoxs(boxobj);
	if(document.getElementById("i_"+boxobj)!=null){
	  	document.getElementById("i_"+boxobj).className = "maxbox";
	  }
  }
}

function showBox( abox ) {
  if(document.getElementById(abox)!=null){
	  var boxobj = document.getElementById(abox).id;
	showBoxs(boxobj);
	if(document.getElementById("i_"+boxobj)!=null){
   	  	document.getElementById("i_"+boxobj).className = "minbox";
	  }
	}
}
/*
function initBrow(){

	var browContent = "";
	document.getElementById("ppBrow").innerHTML = "";
	
	var browArray=new Array("01","05","07","08","11","12","13","15");
     
     for(i=0;i<browArray.length;i++){	

		
		browContent += "<img src=/_imgs/pai_clover/cvr"+browArray[i]+".gif onClick=setBrow('"+browArray[i]+"') class=hand>";
	
	}
	
	document.getElementById("ppBrow").innerHTML = browContent;
}
*/

function initBrow(){

	var browContent = "";
	document.getElementById("ppBrow").innerHTML = "";

	for(i=1;i<=18;i++){
	
		browContent += "<img src=/pels/brow/ppb"+i+".gif width=50 height=50 onClick=setBrow('"+i+"') class=hand>";
	
	}
	
	document.getElementById("ppBrow").innerHTML = browContent;
}

/*
function SoundSearch(){

	if(TrimAll(document.getElementById('keyword_s').value)==""){
		alert(PAIAlert + "请先输入你要查找的字符！");
		document.getElementById('keyword_s').focus();
		return false;
	}
	
   document.getElementById("fmSearch").action="/channel/sound_s.html";
   document.getElementById("fmSearch").submit();
}*/

function SoundSearch(){

	var keyword = TrimAll(document.getElementById('keyword_s').value);
	if(keyword==""){
		alert(PAIAlert + "请先输入你要查找的字符！");
		document.getElementById('keyword_s').focus();
		return false;
	}else{
		if(keyword.indexOf('%')!=-1){
			alert(PAIAlert + "搜索关键字中不能包含%字符，请更改后再搜索。");
				return false;
		}else{
			document.getElementById("fmSearch").action="/channel/sound_s.html";
			document.getElementById("fmSearch").submit();
		}
	}
}

function SoundFastSearch(){

	var keyword = TrimAll(document.getElementById('keyword_fs').value);
	if(keyword==""){
		alert(PAIAlert + "请先输入你要查找的字符！");
		document.getElementById('keyword_fs').focus();
		return false;
	}else{
		if(keyword.indexOf('%')!=-1){
			alert(PAIAlert + "搜索关键字中不能包含%字符，请更改后再搜索。");
				return false;
		}else{
			document.getElementById("fmSearch").action="/channel/sound_s.html";
			document.getElementById("fmSearch").submit();
		}
	}
}

function setBocShare(){
	var shareContent = "给你推荐一个有意思的" + document.title + "，地址：" + document.location.href;
	window.clipboardData.setData('text',shareContent);
	alert("分享的小广播地址已复制，现在你可以粘贴到QQ或MSN好友中哦:)");
}

