JavaScriptDocument
广告代码静态化js通用函数
原则上每个页面不应该出现域名的固定指向
*/
/*
Config
*/
varsSiteUrl="http://www.spvjoy.com";
//varsSiteUrl="http://192.168.1.30:82";
varsSendSite="http://send.mmstoon.com";
varsMp3Url="http://r01.mmstoon.com/mp3/";
varsRingUrl="http://r01.mmstoon.com/ring/";
varsSpUrl="http://r01.mmstoon.com";
varsMmfUrl="http://r01.mmstoon.com/MmfRing/";
varsPhotoUrl="http://p01.mmstoon.com/mmsimg/comm/";
varsVideoPicUrl="http://r01.mmstoon.com/video/";
//varServerUrl="http://search.mmstoon.com/netServer/";
//varServerUrl="http://192.168.1.30/netServer/";
varServerUrl="http://221.238.249.17/netServer/";
/*
函数功能:从URL得到指定参数的值
*/
functionGetUrlArg(strArg,strUrl){
var_url;
if(typeof(strUrl)=="undefined")
_url=location.href+"&";
else
_url=strUrl+"&";
varregex=newRegExp("(?|&)"+strArg+"=([^&?]*)&","gi");
if(!regex.test(_url))return"";
vararr=regex.exec(_url);
return(RegExp.$2);
}
functionurlQuery(){
varsq="";
for(i=0;i
sq+=arguments[i]+"="+GetUrlArg(arguments[i]);
}
returnsq;
}
/*
全局变量
*/
varf=GetUrlArg("f");
varlower_cooid=GetUrlArg("lower_cooid");
varadfcid=GetUrlArg("adfcid");//老二线lower_cooid参数转义
varad_id=GetUrlArg("ad_id");
vars=GetUrlArg("s");
varnum=GetUrlArg("num");
varty=GetUrlArg("ty");
vard=GetUrlArg("d");
if(ty=="")
{
ty="mp3";
}
if(lower_cooid==""&&adfcid!="")lower_cooid=adfcid;
/*
打开链接通用函数,不需要带参数,特殊情况,正常情况下不建议使用
*/
functionopenCommonWin(url){
//主要参数整理
varsf=GetUrlArg("f",url)
varslower_cooid=GetUrlArg("lower_cooid",url)
varsad_id=GetUrlArg("ad_id",url)
if(sf=="")sf=f;
if(slower_cooid=="")slower_cooid=lower_cooid;
if(sad_id=="")sad_id=ad_id;
if(url.substring(0,"http://un.mmstoon.com".length)=="http://un.mmstoon.com"){
openUn();
}else{
varsUrl=url.split("?")[0]+"?f="+sf+"&lower_cooid="+slower_cooid+"&ad_id="+sad_id+"&d="+d;
if(url.split("?")[1]!=null)sUrl=sUrl+"&"+url.split("?")[1]
/*例外处理*/
if(window.location.href.indexOf("/MSNcode/")>0){
window.open(sUrl,"_self");
}else{
window.open(sUrl,"_blank");
}
}
}
/*
打开首页
*/
functionopenHome(){
if(window.location.href.indexOf("/blue/")>0){
window.open("http://www.spjoy.com/AdFiles/blue/blue.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&d="+d,'_blank');
}else{
window.open(sSiteUrl+"?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&d="+d,'_blank');
}
}
/*
打开联盟
*/
functionopenUn(){
//联盟转向,照顾二级联盟
if(f=="98213")
{
window.open("http://union.00yes.com/",'_blank');
}
else
{
window.open("http://un.mmstoon.com/?f="+f,'_blank');
}
}
/*
打开专题页汇总
*/
functionopenSpecial(){
varips=36;
window.open(sSiteUrl+"/ncList.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty=special&ps="+ips+"&d="+d,'_blank');
//window.location.href=sSiteUrl+"/ncList.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty=special&ps="+ips;
}
/*
打开搜索页
*/
functionopenSearch(){
window.open(sSiteUrl+"/search.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&d="+d,'_blank');
//window.location.href=sSiteUrl+"/search.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id;
}
/*
打开彩信diy页
*/
functionopenDiy(){
window.open(sSiteUrl+"/zyzse.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&d="+d,'_blank');
}
/*
在新窗口打开链接
*/
functionopenSendWin(ty,num){
if(ty=="")ty="mp3";
//window.open(sSendSite+"/Send/SendRedirect.asp?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&num="+num+"&ty="+ty,'_blank','left=100,top=0,width=100,height=100,status=yes,resizable=yes');
window.open(sSendSite+"/Send/SendRedirect.asp?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&num="+num+"&ty="+ty+"&d="+d,'_blank');
//window.showModalDialog(sSendSite+"/Send/SendRedirect.asp?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&num="+num+"&ty="+ty,'_blank','dialogWidth:432px;dialogHeight:400px;center:yes;status:0;help:0;edge:raised;resizable:1;scroll:1');
}
/*
在iframe中打开链接
*/
functionopenSendWinInIfr(ty,num,sSubject,sReviewFile){
window.open(sSendSite+"/Send/SendFalse.asp?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&num="+num+"&ty="+ty+"&subject="+sSubject+"&u="+sReviewFile+"&d="+d,'winSend');
}
/*
打开歌手专辑页通用函数,这里可以改变默认资源类型
*/
functionopenSongerWin(strSonger,ty){
varsty="mp3";
if(typeof(ty)!="undefined")sty=ty
window.open(sSiteUrl+"/searchResult.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&search="+strSonger+"&ty="+sty+"&d="+d,'_spvsearch');
}
/*
打开和弦栏目列表
*/
functionopenChnChordWin(chn){
openChnList("ring",chn);
}
/*
打开Mp3栏目列表
*/
functionopenChnMp3Win(chn){
//openChnList("mp3",chn);
openChnList("spring",chn);
}
/*
打开特效栏目列表
*/
functionopenChnSpWin(chn){
openChnList("spring",chn);
}
/*
打开MMF特效栏目列表
*/
functionopenChnMmfWin(chn){
openChnList("mmf",chn);
}
/*
打开彩信栏目列表
*/
functionopenPicWin(chn){
openChnList("photo",chn);
}
/*
打开精美彩图栏目列表
*/
functionopenPicsWin(chn){
openChnList("photo",chn);
}
/*
在框架中打开栏目列表
*/
functionopenListWin(chn){
varsCurUrl=window.location.href;
varsQuery="f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty="+ty+"&chn="+chn+"&ps="+ps+"&d="+d;
/*网页模版分流*/
if(sCurUrl.indexOf("/blue/")>0){
switch(ty){
case"photo":
window.open(sSiteUrl+"/blue/plist.htm?"+sQuery,'ifrList');
break;
case"video":
window.open(sSiteUrl+"/blue/vlist.htm?"+sQuery,'ifrList');
break;
case"ivr":
window.open(sSiteUrl+"/blue/ilist.htm?"+sQuery,'ifrList');
break;
default:
window.open(sSiteUrl+"/blue/mlist.htm?"+sQuery,'ifrList');
break;
}
}else{
window.open(sSiteUrl+"/list.htm?"+sQuery,'ifrList');
}
}
functionopenChnList(ty,chn){
varschn="";
varips=92;
if(ty=="photo"||ty=="video")ips=16;
if(typeof(chn)!="undefined")schn=chn;
varsCurUrl=window.location.href;
/*网页模版分流*/
if(sCurUrl.indexOf("/blue/")>0){
ips=36;
if(ty=="photo"||ty=="video")ips=16;
//location.replace(sSiteUrl+"/blue/"+ty+".htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty="+ty+"&chn="+schn+"&ps="+ips);
window.open(sSiteUrl+"/blue/"+ty+".htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty="+ty+"&chn="+schn+"&ps="+ips+"&d="+d,'_spvchn');
}
else
window.open(sSiteUrl+"/cList.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&ty="+ty+"&chn="+schn+"&ps="+ips+"&d="+d,'_spvchn');
}
/*
搜索窗体提交
*/
vardes="请输入歌手或歌名";
functioncf(e){if(e.value==des){e.value="";e.select();}}
functioncl(e){if(e.value.replace(//g,"").replace(//g,"")==''){e.value=des;}}
functionsearchSubmit(e){
try{
if(e.nodeName.toLowerCase()=="input")
e=e.parentElement.previousSibling.firstChild;
if(e.value==des||e.value.replace(//g,"")==''){
e.select();
returnfalse;
}
else
window.open(sSiteUrl+"/searchResult.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&search="+e.value+"&d="+d,'_spvsearch');
//window.location.href=sSiteUrl+"/searchResult.htm?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&search="+e.value;
}catch(ee)
{
//alert(ee);
}
}
/*
当页面加载完成之后事件处理
*/
functionfuncOnload(){
varoIfr=document.all("winSend");
if(oIfr!=null){
oIfr.src=sSendSite+"/send/SendSearchM.asp?f="+f+"&lower_cooid="+lower_cooid+"&ad_id="+ad_id+"&l=1&s="+s+"&num="+num+"&d="+d
}
/*
使XX得到焦点
*/
//varoTxtSearch=document.all("search");
//if(oTxtSearch!=null){
//oTxtSearch.focus();
//}else{
//varoLink=document.getElementsByTagName("a");
//if(oLink.length>0){
//oLink[0].focus();
//}
//}
}
window.attachEvent("onload",funcOnload);
/*
页面统计写入
*/
functionPvStat(){
varty=GetUrlArg("ty");
document.write("
}
/*
搜索关键字统计写入
*/
functionSearchKeyStat(strKey){
varty=GetUrlArg("ty");
varsKey;
if(typeof(strKey)!="undefined"){
sKey=strKey;
}
else{
sKey=GetUrlArg("search");
}
document.write("
}
functionwrLoading(){
try{
varoBody=window.document.body;
variTop=250;
variLeft=400;
if(oBody!=null){
iTop=oBody.clientHeight/2-20;
iLeft=oBody.clientWidth/2-75;
}
/*
varstrDiv="
strDiv+="";
strDiv+="
strDiv+="
strDiv+="
strDiv+="";
strDiv+="