现在的位置: 首页 > 综合 > 正文

Musina 网页音乐盒代码 js

2013年10月14日 ⁄ 综合 ⁄ 共 51555字 ⁄ 字号 评论关闭

/*
Script:importplayer.0.3.js

Author:
Sun Chen sunchen@staff.sina.com.cn2008-4-3
*/

/*adboe begin*/
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
var version;
var axo;
var e;

// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}

if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.

// default to the first public version
version = "WIN 6,0,21,0";

// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";

// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");

} catch (e) {
}
}

if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}

if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}

if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}

return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;

if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];

// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}

function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(//?/, ext+'?');
else
return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
{
str += i + '="' + objAttrs[i] + '" ';
}
str += '>';
for (var i in params)
{
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
}
str += '</object>';
}
else
{
str += '<embed ';
for (var i in embedAttrs)
{
str += i + '="' + embedAttrs[i] + '" ';
}

if (objAttrs.id==MMISINA.g.playlistobject)
str += 'style="width:0px;height:0px;"';

str += '> </embed>';
}
return str;
//document.write(str);
}

function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf?1", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
return AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
var ret =
AC_GetArgs
( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
, null
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();

switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblclick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
case "id":
ret.objAttrs[args[i]] = args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

/*adobe end*/

/*adobeflashwrite*/

function dd_listToPlayer(str){
var oo = (window.ActiveXObject)?(window['mmi_sina_music_player']):(document['mmi_sina_music_player']);
oo.LISTTOPLAYER(str);
}

function dd_playerToList(str){
var oo = (window.ActiveXObject)?(window['mmi_sina_music_playerlist']):(document['mmi_sina_music_playerlist']);
oo.PLAYERTOLIST(str);
}

String.prototype.ctrim=function()
{
return this.replace(/(^[/s/u3000]*)|([/s/u3000]*$)/g, "");
}

/*
jejax:namespace
my ajax
*/
var jejax = {};

/*
jsonp:function
get data from js append
*/
jejax.timer = {};
jejax.jsonp = function(options)
{
var url = options.url || '';
var checker = options.checker || '';
var callback = options.complete || function(){};
var error = options.fail || function(){};
var para = options.postBody || '';
var iTimeout = options.timeout || 30000;
var ScriptID = options.scriptid || 'appandScript';
var oScript = document.getElementById(ScriptID);
var HttpHolder = document.getElementsByTagName("head").item(0);
iTimeout = parseInt(iTimeout/250);
var chkTime = 250;//ms
var check_script_state=function()
{
if((checker)() === false)
{
if(iTimeout<=0)
{
(error)();//连接超时;
}
else
{
jejax.timer = setTimeout(check_script_state,chkTime);
iTimeout--;
}
}
else
{
if((checker)() === true)
{
(callback)();
}
else
{

//返回数据不正确;
(error)();
}
}
}

if(url == '' || checker == '')
{
return true;
}
if(para!='')
{
url += '?' + para;
}
try{
if(oScript)
HttpHolder.removeChild(oScript);
}catch(e){};

oScript = document.createElement("script");
oScript.setAttribute("id",ScriptID);
oScript.setAttribute('defer', true);
oScript.setAttribute("charset",'gb2312');
oScript.setAttribute("src",url);
HttpHolder.appendChild(oScript);
check_script_state();
}

/*
MMISINA:namespace
the mmi player namespace

*/
var MMISINA = {};

/*
把输入的字符串转换为半角
input: Str 任意字符串
output:DBCStr 半角字符串
说明:1、全角空格为12288,半角空格为32
2、其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
*/
MMISINA.toDBC = function(Str) {
var DBCStr = "";
for(var i=0; i<Str.length; i++){
var c = Str.charCodeAt(i);
if(c == 12288) {
DBCStr += String.fromCharCode(32);
continue;
}
if (c > 65280 && c < 65375) {
DBCStr += String.fromCharCode(c - 65248);
continue;
}
DBCStr += String.fromCharCode(c);
}
return DBCStr;
}

/*
把输入的字符串转换为半角,并删除所有空格
input: Str 任意字符串
output:DBCStr 半角字符串
说明:1、全角空格为12288,半角空格为32
2、其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
*/
MMISINA.toTrimDBC = function(Str)
{
var DBCStr = "";
for(var i=0; i<Str.length; i++)
{
var c = Str.charCodeAt(i);
if(c == 12288 ||c == 32) {
continue;
}
if (c > 65280 && c < 65375) {
DBCStr += String.fromCharCode(c - 65248);
continue;
}
DBCStr += String.fromCharCode(c);
}
return DBCStr;
}

/*
$:function
get Elemment By Id

*/
MMISINA.$ = function(_sID)
{
return document.getElementById(_sID);
}

/*
addClass:function
replace the obj's class with className

*/
MMISINA.addClass = function(obj,className){
obj.className = className;
return obj;
}

/*
removeClass:function
remove the obj's class

*/
MMISINA.removeClass = function(obj, className){
obj.className = obj.className.replace(new RegExp('(^|/s)'+className+'(?:/s|$)'), '$1');
return obj;
}
/*
getsize:function
get the dom size
*/
MMISINA.getsize = function(obj){
return {
'scroll' : {'x': obj.scrollLeft, 'y': obj.scrollTop},
'size' : {'x': obj.offsetWidth, 'y': obj.offsetHeight},
'scrollSize': {'x': obj.scrollWidth, 'y': obj.scrollHeight}
};
}

/*
stopevent:function
阻断event传递
*/

MMISINA.stopevent = function(event) {

var stopPropagation = function(e){
event = window.event || e;
if (event.stopPropagation) event.stopPropagation();
else event.cancelBubble = true;
};

var preventDefault = function(e){
event = window.event || e;
if (event.preventDefault) event.preventDefault();
else event.returnValue = false;
};
stopPropagation(event);
preventDefault(event);
};

MMISINA.detectDoctype=function()
{
var re=//s+(X?HTML)/s+([/d/.]+)/s*([^//]+)*///gi;
var res=false;
var errors = 'CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//E';
/*********************************************
Just check for internet explorer.
**********************************************/
if(!window.ActiveXObject)return true;//moz
if(typeof document.namespaces != "undefined")
res=document.all[0].nodeType==8 ?re.test(document.all[0].nodeValue) : false;
else
res=document.doctype != null ? re.test(document.doctype.publicId) : false;
if(res)
{
res=new Object();
res['xhtml']=RegExp.$1;
res['version']=RegExp.$2;
res['importance']=RegExp.$3;

if(res=document.all[0].nodeType==8 && document.all[0].nodeValue.indexOf(errors)>=0)
{
return null;
}
return res;
}
else
{
return null;
}
}
MMISINA.doctype = MMISINA.detectDoctype();
MMISINA.none_doctype_height = null;
MMISINA.none_doctype_width = null;

/*
opacity:function
将某物品透明
obj:目标object
fn:动作结束时执行的function
*/

MMISINA.opacity = function(obj,fn)
{
var makeElement = obj;
var IEcuropa = 100;
var FFcuropa = 1;
var visibilityvisibility = '';
var ibegin = 0.1;
var iend = 1;
var func = fn || function(){};

/*if(makeElement.style.visibility=='hidden')
{
visibility = 'visible';
makeElement.style.visibility = visibility;
}
else
{
visibility = 'hidden';
}*/

var complete = function()
{
//makeElement.style.visibility = visibility;
func.call();
};
var change = function()
{
if(typeof(makeElement.style.filter) == "undefined")//ff
{
//FFcuropa -= ibegin;
//(visibility == 'visible')?(makeElement.style.opacity = (1-FFcuropa)):(makeElement.style.opacity = FFcuropa);
//(FFcuropa > 0)?(setTimeout(change,30)):(complete());

}
else//ie
{
IEcuropa -= (ibegin*100);
(makeElement.style.filter == "Alpha(Opacity=0)")?(makeElement.style.filter="Alpha(Opacity="+(100-IEcuropa)+")"):(makeElement.style.filter="Alpha(Opacity="+IEcuropa+")");
(IEcuropa > 0)?(setTimeout(change,30)):(complete())
}
}
change();

};

/*
Drag:function
Drag the divs
*/
MMISINA.Drag = {

obj : null,

init : function(o,complete,oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{
MMISINA.Drag.go = o;
MMISINA.Drag.complete = complete || function(){};
///////o.onmousedown = MMISINA.Drag.start;

o.hmode = bSwapHorzRef ? false : true ;
o.vmode = bSwapVertRef ? false : true ;

o.root = oRoot && oRoot != null ? oRoot : o ;

if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

o.minX = typeof minX != 'undefined' ? minX : null;
o.minY = typeof minY != 'undefined' ? minY : null;
o.maxX = typeof maxX != 'undefined' ? maxX : null;
o.maxY = typeof maxY != 'undefined' ? maxY : null;

o.xMapper = fXMapper ? fXMapper : null;
o.yMapper = fYMapper ? fYMapper : null;

o.root.onDragStart = new Function();
o.root.onDragEnd = new Function();
o.root.onDrag = new Function();
},
setMin:function(options)
{
/*if(options.y)
MMISINA.Drag.go.minY = options.y;
if(options.x)
MMISINA.Drag.go.minX = options.x;*/
},
setMax:function(options)
{
/*MMISINA.Drag.go.maxX = options.x;
if(options.y)
MMISINA.Drag.go.maxY = options.y;
if(options.x)
MMISINA.Drag.go.maxX = options.x;*/
},
start : function(e)
{
//var o = MMISINA.Drag.obj = this;
var o = MMISINA.Drag.obj = MMISINA.Drag.go;
e = MMISINA.Drag.fixE(e);
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
o.root.onDragStart(x, y);

o.lastMouseX = e.clientX;
o.lastMouseY = e.clientY;

if (o.hmode) {
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
} else {
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
}

if (o.vmode) {
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
} else {
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
}

MMISINA._onmousemove = null;
MMISINA._onmouseup = null;
if(document.onmousemove!=null && document.onmousemove!=MMISINA.Drag.drag)
MMISINA._onmousemove = document.onmousemove;
if(document.onmouseup!=null && document.onmouseup!=MMISINA.Drag.end)
MMISINA._onmouseup = document.onmouseup;

document.onmousemove = MMISINA.Drag.drag;
document.onmouseup = MMISINA.Drag.end;

return false;
},

drag : function(e)
{
e = MMISINA.Drag.fixE(e);
var o = MMISINA.Drag.obj;
var ey = e.clientY;
var ex = e.clientX;
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
var nx, ny;

if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

if (o.xMapper) nx = o.xMapper(y)
else if (o.yMapper) ny = o.yMapper(x)

with(MMISINA.Drag.obj)
{
root.style[o.hmode ? "left" : "right"] = nx + "px";
root.style[o.vmode ? "top" : "bottom"] = ny + "px";
lastMouseX = ex;
lastMouseY = ey;
root.onDrag(nx, ny);
}
return false;
},

end : function()
{
document.onmousemove = MMISINA._onmousemove;
document.onmouseup = MMISINA._onmouseup;
MMISINA.Drag.obj.root.onDragEnd( parseInt(MMISINA.Drag.obj.root.style[MMISINA.Drag.obj.hmode ? "left" : "right"]),
parseInt(MMISINA.Drag.obj.root.style[MMISINA.Drag.obj.vmode ? "top" : "bottom"]));
MMISINA.Drag.obj = null;
MMISINA.Drag.complete.call();
},

fixE : function(e)
{
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
return e;
}
};

MMISINA.add_event = function(type,object,fn)
{
if (window.addEventListener){
return object.addEventListener((type == 'mousewheel' && document.getBoxObjectFor != null) ? 'DOMMouseScroll' : type, fn, false);
} else {
return object.attachEvent('on'+type, fn);
}
}

MMISINA.remove_event = function(type,object,fn)
{
try{
if (window.removeEventListener){
object.removeEventListener((type == 'mousewheel' && document.getBoxObjectFor != null) ? 'DOMMouseScroll' : type, fn, false);
} else {
object.detachEvent('on'+type, fn);
}}catch(e){}
}

/*
escapeHTML: function
parse txt to HTML

Arguments:
str the txt string

Example:
MMISINA.escapeHTML('<a href="#">test</a>');
*/
MMISINA.escapeHTML = function(str)
{
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
};

/*
getCookieVal: function
index the cookie

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

/*
getCookie: function
read cookie with name

Arguments:
name the cookie name

Example:
MMISINA.getCookie('playlist');
*/
MMISINA.getCookie = function( name )
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i,j) == arg)
{
return MMISINA.getCookieVal(j);
}
i = document.cookie.indexOf(" ",i) + 1;
if (i == 0)
{
break;
}
}
return null;
}

/*
getSinaCookie: function
read cookie with name from the cookie set "mmisinacookie"

Arguments:
name the cookie name

Example:
MMISINA.getSinaCookie('voice');
*/
MMISINA.getSinaCookie = function(name)
{
var sMucookie = MMISINA.getCookie('mmisinacookie');
if(sMucookie==null || sMucookie=="")
return "";
else
{
if(sMucookie.indexOf(name)<0)
return "";
else
{
sMucookie=sMucookie.substr(sMucookie.indexOf(name)+name.length+1,sMucookie.length);
return sMucookie.substr(0,sMucookie.indexOf('////'));
}
}
}

/*
SetCookie: function
write the "name:value" to cookie

Arguments:
name the cookie name
value the cookie value

Example:
MMISINA.SetCookie('playlist','100,101,102,103');
*/
MMISINA.SetCookie = function(name, value)
{
var argv = MMISINA.SetCookie.arguments;
var argc = MMISINA.SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
// try{domain = (window.location+'').replace('http://').split('/')[0];}catch(e){};

var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value)+
((expires == null || expires =="") ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "; path=/" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

/*
SetSinaCookie: function
save cookie to the cookie set "mmisinacookie" in 299 years

Arguments:
name the cookie name
value the cookie value

Example:
MMISINA.SetSinaCookie('voice',100);
*/
MMISINA.SetSinaCookie = function(name, value)
{

var str = MMISINA.getCookie('mmisinacookie');
var str1="";
var str2="";
if(str=="" || str==null)
{
str=name+"/"+value+"////";
}
else
{
if(str.indexOf(name)<0)
{
str+=name+"/"+value+"////";
}
else
{

str1 = str.substr(0,str.indexOf(name)+name.length+1);
str2= str.substr(str.indexOf(name)+name.length+1,str.length);
str2=str2.substr(str2.indexOf('////'),str2.length);
str=str1+value+str2;
}
}
//document.title = document.cookie.length;
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear()+2);
MMISINA.SetCookie('mmisinacookie',str,nextyear);
//document.title += ';after:'+document.cookie.length;
}

/*
vars: Object
The base object of flash init

Arguments:

Example:

*/
MMISINA.vars = {
officalid:0,
corprateid:0,
ad_audio_url:0,
ad_url:0,
ad_pic:0,
big_ad_url:0,
big_ad_pic:0,
ad_isopen:0,
player_position:0,
player_position_fix:0,
load_official_album:0,
all_load_official_album:0,
autoplay:0,
skin:0,
skinurl:0,
tmpl_albumid:0,
tmpl_songid:0,
tmpl_scroll:0,
tmpl_isopen:0,
relative_php_address:0,
browsertype:0,
uniqueflashid:0,
mod:0,
voice_ad_playatone:true,
voice_ad_count: 0,//2
voice_ad_period:600000,//10mins
mpwask:'',
matchswitch:'',
location:'',
end:true
};

/*
g: Object
The base object of mmi

Arguments:

Example:

*/
MMISINA.g = {
//swf_player:'http://vika.sina.com.cn/vika/MMI/MiniPlayer',
//swf_playlist:'http://vika.sina.com.cn/vika/MMI/playList',
swf_player:'http://music.sina.com.cn/yueku/js/mmi090106/MiniPlayer',
swf_playlist:'http://music.sina.com.cn/yueku/js/mmi090106/playList',
mmi:'mmisina',
mini:'mmimini',
player:'mmiplayer2',
playersize:{width:207,height:87},
playerbg:'mmiplayerbackground',
playlist:'mmiplaylist',
playlistheight:77,
playlist_ad_height:120,
playlist_adclose:40,
playlistbody:'mmilistbody',
miniplayer:'mmimnplayer',
miniplayermax:'mmimnplayermax',
miniplayerbg:'mmimnbg',
ad_none:{klass:'mminonebag',height:'235px'},
ad_small:{klass:'mminbag',height:'295px'},
ad_large:{klass:'mmibbag',height:'415px'},
playlistobject:'mmi_sina_music_playerlist',
flashobject:'mmi_sina_music_player',
keywords:'',
event_added:false,
player_width:0,
player_height:0,
search_url : "http://music.sina.com.cn/yueku/port/s_js_adds.php",//需要上传
end:true
};

var vars_reconfig = function(str,type){
str = MMISINA.toTrimDBC(str+'');
var qunt = parseInt(str);
if(type=='number')
{
if(isNaN(qunt))
return false;
else
return qunt;
}
return str;
};

MMISINA.g.skindata ={};
MMISINA.g.skindata.choosen = (typeof miniplayer_skin !='undefined')?vars_reconfig(miniplayer_skin,''):'black';
MMISINA.g.skindata.gray = ['http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/top_a.png',
'http://i2.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_0b.png',
'http://i3.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_60a.png',
'http://i2.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_180a.png',
'http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_0a.png'];
MMISINA.g.skindata.black = ['http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/top.png',
'http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/copy.png',
'http://i2.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_60.png',
'http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_180.png',
'http://i0.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_0.png'];
MMISINA.g.skindata.blue = ['http://i0.sinaimg.cn/sms/smc_pic/images/mmi/images/top_blue.png',
'http://i0.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_0blue.png',
'http://i2.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_60blue.png',
'http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_180blue.png',
'http://i0.sinaimg.cn/sms/smc_pic/images/mmi/images/copy_00blue.png'];//where?

MMISINA.g.styleArray = ['<style>',
'#mmisina *{font-size:0px;line-height:0px;margin:0px; padding:0px;}',
'#mmisina{position:fixed;#position:fixed;_position:absolute;width:208px;overflow-x:hidden;height:auto;margin:0px;padding:0px;text-align:left;z-index:65536;}',
'#mmisina #mmiplaylist {position:relative;width:208px;bottom:-10px;z-index:10000;overflow:hidden;}',
'#mmisina #mmilisthead{height:18px;width:208px;background-image:url('+MMISINA.g.skindata[MMISINA.g.skindata.choosen][0]+');#background-image:url('+MMISINA.g.skindata[MMISINA.g.skindata.choosen][0]+');background-repeat:no-repeat;_FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src=/''+MMISINA.g.skindata[MMISINA.g.skindata.choosen][0]+'/');_background-image: none;}',
'#mmisina #mmilistbody{text-align:center; padding-bottom:12px;width:208px; overflow:hidden;}',
'#mmisina .mminonebag{height:235px;*height:327px;background:url('+MMISINA.g.skindata[MMISINA.g.skindata.choosen][1]+');background-position:bottom;background-repeat:no-repeat;*FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src=/''+MMISINA.g.skindata[MMISINA.g.skindata.choosen][4]+'/')!important;*background-image:none;}',
'#mmisina .mminbag{height:295px;*height:327px;background:url('+MMISINA.g.skindata[MMISINA.g.skindata.choosen][1]+');background-position:bottom;background-repeat:no-repeat;*FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src=/''+MMISINA.g.skindata[MMISINA.g.skindata.choosen][2]+'/')!important;*background-image:none;}',
'#mmisina .mmibbag{height:415px;*height:427px;background:url('+MMISINA.g.skindata[MMISINA.g.skindata.choosen][1]+');background-position:bottom;background-repeat:no-repeat;*FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src=/''+MMISINA.g.skindata[MMISINA.g.skindata.choosen][3]+'/')!important;*background-image:none;}',
'#mmisina #mmiflash{display:block;margin-left:auto;margin-right:auto;background-color:white;}',
'#mmisina #mmiflashholder{width:180px;margin-left:auto;margin-right:auto;background-color:white;}',
'#mmisina #mmiplayer2{width:208px;height:87px;margin-top:0px;bottom:0px;overflow:hidden;position:relative;z-index:20000;}',
'#mmisina #mmimini {display:none;}</style>'];

MMISINA.g.style = MMISINA.g.styleArray.join('');

MMISINA.g.html = ['',
' <div id="mmiplaylist" onmousedown="MMISINA.stopevent(event)" $_style1_$>',
' <div id="mmilisthead" ></div>',
' <div id="mmilistbody" class="mminbag"><div id="mmiflashholder" style="background:none;"><div id="mmiflash">$_mmiflash_$</div></div></div>',
' </div>',
' <div id="mmiplayer2">$_mmiplayer2_$</div>',
' <div id="mmimini">',
' <div id="mmimnbg" class="mmimnbg"></div>',
' <div id="mmimnplayer" class="mmimnplayer"></div>',
' <div id="mmimnplayermax" class="mmimnplayermax" onclick="MMISINA.min.hidden()"></div>',
' </div>',
''].join('');

/*
isplay: Object
是否正在播放

Arguments:

Example:

*/
MMISINA.isplay = {
cookiename:'isplaying',
syscookiename:'sysisplay',
sysget:function(){
return MMISINA.getSinaCookie(this.syscookiename);
},
sysset:function(ip){
MMISINA.SetSinaCookie(this.syscookiename,ip);
},
get:function(){
return MMISINA.getSinaCookie(this.cookiename);
},
set:function(ip){
MMISINA.SetSinaCookie(this.cookiename,ip);
}
}

/*
voice: Object
读写播放声音

Arguments:

Example:

*/

MMISINA.voice = {

cookiename:'voice',
get:function(){
return MMISINA.getSinaCookie(this.cookiename);
},
set:function(ip){
MMISINA.SetSinaCookie(this.cookiename,ip);
}
};

/*
temp_songlist: Object
读写临时播放列表

Arguments:

Example:

*/

MMISINA.temp_songlist = {

cookiename:'mmisinaplaylist',
get:function(){
return MMISINA.getCookie(this.cookiename);
},
set:function(str){
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear()+299);
MMISINA.SetCookie(this.cookiename,str,nextyear);
}
};

/*
current_position: Object
读写当前播放位置

Arguments:

Example:

*/

MMISINA.current_position = {

cookiename:'current_pos',
get:function(){
return MMISINA.getSinaCookie(this.cookiename);
},
set:function(ip){
MMISINA.SetSinaCookie(this.cookiename,ip);
}
};

/*
current_playstate: Object
读写当前播放器状态

Arguments:

Example:

*/

MMISINA.current_playstate = {

get:function(){
return {
albumid:MMISINA.getSinaCookie('albumid'),
songid:MMISINA.getSinaCookie('songid')}
},
set:function(albumid,songid,scroll){
MMISINA.SetSinaCookie('albumid',albumid);
MMISINA.SetSinaCookie('songid',songid);
}
};

MMISINA.current_playlist = {

get:function(){
return {
albumid:MMISINA.getSinaCookie('albumid'),
songid:MMISINA.getSinaCookie('songid'),
scroll:MMISINA.getSinaCookie('scrollid')}
},
set:function(albumid,songid,scroll){
MMISINA.SetSinaCookie('albumid',albumid);
MMISINA.SetSinaCookie('songid',songid);
MMISINA.SetSinaCookie('scrollid',scroll);
}
};

/*
check_login: Object
读写登录状态

Arguments:

Example:

*/

MMISINA.check_login = function(){

var sinapro=MMISINA.getCookie("SINAPRO");
var sina_nu=MMISINA.getCookie("SINA_NU");

if (sinapro && sina_nu)
{
var nick=sina_nu.split(':')[1]
return nick;
}
else
{
return false;
};
};

/*
playlist: Object
播放列表操作Class

show:渐变的显示列表;
toggle:根据状态打开或关闭列表;
hidden:渐变的列表消失;
destory:快速的列表消失;

Example:

*/

MMISINA.playlist = (function(){

var getobjects = function(){
return MMISINA.$(MMISINA.g.playlist);
};

var isopen ={
set:function(isopen)//can be true/false/ ''
{
MMISINA.vars.tmpl_isopen = isopen;
MMISINA.SetSinaCookie('tmpl_isopen',isopen);
},
get:function()
{
return MMISINA.vars.tmpl_isopen;
}
};
var ismoving = false;
var setFlashVars = function(key,value){};

var closelist = function(){
MMISINA.$('mmiplaylist').style.height='0px';
if(!window.ActiveXObject)
{
document['mmi_sina_music_playerlist'].style.height = '0px';
document['mmi_sina_music_playerlist'].style.width = '0px';
}
else {
if(MMISINA.doctype==null)
{
MMISINA.$('mmiflash').style.height = '0px';
MMISINA.$('mmiflashholder').style.height = '0px';
MMISINA.$('mmilistbody').style.height = '0px';
MMISINA.$('mmiplaylist').style.height = '18px';
MMISINA.$('mmisina').style.height = '105px';
}

}

};

var showlist = function(){
MMISINA.$('mmiplaylist').style.height='';
if(!window.ActiveXObject)
{
document['mmi_sina_music_playerlist'].style.height = '';
document['mmi_sina_music_playerlist'].style.width = '';
}else {
if(MMISINA.doctype==null)
{
MMISINA.$('mmisina').style.height = null;
MMISINA.$('mmiplaylist').style.height = null;
MMISINA.$('mmilistbody').style.height = null;
MMISINA.$('mmiflashholder').style.height = null;
MMISINA.$('mmiflash').style.height = null;

}

}

};

return {
moving:function(){
},
moved:function(){
},
show:function(){
var obj = getobjects();

if(obj.style.left == '-1000px' || obj.style.height=='0px' || obj.style.height=='18px')
{
showlist();
if(window.ActiveXObject)
{
MMISINA.opacity(obj,function(){
obj.style.filter='';

if(MMISINA.doctype==null)
{
MMISINA.$('mmisina').style.height = null;
MMISINA.$('mmiplaylist').style.height = null;
MMISINA.$('mmilistbody').style.height = null;
MMISINA.$('mmiflashholder').style.height = null;
MMISINA.$('mmiflash').style.height = null;
}

document['mmi_sina_music_playerlist'].style.height = '';
document['mmi_sina_music_playerlist'].style.width = '';
});
}
MMISINA.outscreenfixer();
isopen.set(true);
}

},
toggle:function(){
if( MMISINA.vars.tmpl_isopen === false)//to open
{
//getdata
//setFlashVars
MMISINA.playlist.show();
isopen.set(true);
}
else if(MMISINA.vars.tmpl_isopen === true)//to close
{
//save data
MMISINA.playlist.destory();
isopen.set(false);
}

},
hidden:function(){
var obj = getobjects();
if(window.ActiveXObject)
{
document['mmi_sina_music_playerlist'].style.height = '0px';
document['mmi_sina_music_playerlist'].style.width = '0px';
MMISINA.opacity(obj,MMISINA.playlist.destory);}
else MMISINA.playlist.destory();
isopen.set('');
},
destory:function(){
MMISINA.playlist.finaldestory();
isopen.set('');
},
finaldestory:function(){
closelist();
}

}
})();

/*
ad: Object
广告操作Class

show:变为大尺寸广告;
hidden:变为小尺寸广告;

Example:

*/
MMISINA.ad = (function(){

var flashobj = '';
var player ='';
var playlistbody = '';
var maxheight = MMISINA.g.playlist_ad_height;//the big ad - smaill ad height, IE and FF shit
var height_smallad = 0;
var height_largead = 0;
var height_close = MMISINA.g.playlist_adclose;
var getobjects = function(){
flashobj = MMISINA.$(MMISINA.g.playlistobject) || document[MMISINA.g.playlistobject];
playlistbody = MMISINA.$(MMISINA.g.playlistbody);
player = MMISINA.$(MMISINA.g.player) || document[MMISINA.g.player];
return MMISINA.$(MMISINA.g.mmi);
}
var flashresize = function(type)
{
if(type=='large')
{
flashobj.style.height = MMISINA.g.ad_large.height;
flashobj.height = MMISINA.g.ad_large.height;
}
else if(type=='small')
{
flashobj.style.height = MMISINA.g.ad_small.height;
flashobj.height = MMISINA.g.ad_small.height;
}
else if(type=='none')
{

flashobj.style.height = MMISINA.g.ad_none.height;
flashobj.height = MMISINA.g.ad_none.height;
}
if(window.ActiveXObject)//fix ie bug
{
player.style.posBottom++;
player.style.posBottom--;
}
}

return{
show_big:function(){//打开大广告
var obj = getobjects();
if(playlistbody.className.indexOf(MMISINA.g.ad_small.klass)<0)return false;
MMISINA.changeposition();
MMISINA.addClass(playlistbody,MMISINA.g.ad_large.klass);
flashresize('large');
MMISINA.outscreenfixer();
},
hidden_big:function(){//关闭大广告,显示正常广告
var obj = getobjects();
if(playlistbody.className.indexOf(MMISINA.g.ad_large.klass)<0)return false;
MMISINA.addClass(playlistbody,MMISINA.g.ad_small.klass);
flashresize('small');
},
hidden:function(){
var obj = getobjects();
MMISINA.addClass(playlistbody,MMISINA.g.ad_none.klass);
flashresize('none');
},//完全关闭广告
voice_ad_count:function(count){
MMISINA.SetSinaCookie('sinamu_voice_ad_count',count);
}
}

})();

/*
min: Object
最小化操作Class

show:变为迷你播放器;
hidden:变为标准尺寸播放器;

Example:

*/
MMISINA.min = {
parentname:MMISINA.g.mmi,
objname:MMISINA.g.player,
mined:false,
show:function(){

if(parseInt(MMISINA.$(MMISINA.min.objname).style.width.split('px')[0])==(MMISINA.g.playersize.height))return true;
MMISINA.playlist.toggle();
MMISINA.$(MMISINA.min.objname).style.width = MMISINA.g.playersize.height+'px';

if(!window.ActiveXObject)
{
MMISINA.$(MMISINA.min.parentname).style.width = MMISINA.$(MMISINA.min.objname).style.width;
var right = parseInt(MMISINA.$(MMISINA.min.parentname).style.right.split('px')[0]);
right +=MMISINA.g.playersize.width - MMISINA.g.playersize.height;
MMISINA.$(MMISINA.min.parentname).style.right = right+'px';
}

MMISINA.min.mined = true;
MMISINA.SetSinaCookie('mined',MMISINA.min.mined);
},
hidden:function(){
if(parseInt(MMISINA.$(MMISINA.min.objname).style.width.split('px')[0])==MMISINA.g.playersize.width)return true;
MMISINA.playlist.toggle();
MMISINA.$(MMISINA.min.objname).width = MMISINA.$(MMISINA.min.objname).style.width = MMISINA.g.playersize.width+'px';
if(!window.ActiveXObject)
{
MMISINA.$(MMISINA.min.parentname).style.width = MMISINA.$(MMISINA.min.objname).style.width;
var right = parseInt(MMISINA.$(MMISINA.min.parentname).style.right.split('px')[0]);
right -=MMISINA.g.playersize.width - MMISINA.g.playersize.height;
MMISINA.$(MMISINA.min.parentname).style.right = right+'px';
}
MMISINA.min.mined = false;
MMISINA.SetSinaCookie('mined',MMISINA.min.mined);
MMISINA.changeposition();
}
}

/*
close: function
关闭播放器
Example:

*/

MMISINA.close = function(){
var closeflash = function(){

};
closeflash();
MMISINA.remove_event('resize',window,MMISINA.changeposition);
MMISINA.remove_event('scroll',window,MMISINA.changeposition);
MMISINA.remove_event('scroll',window,MMISINA.setDrag);
MMISINA.$(MMISINA.g.mmi).parentNode.removeChild(MMISINA.$(MMISINA.g.mmi));
MMISINA.g.event_added = false;
}
if(MMISINA.$(MMISINA.g.mmi)!=null)//clear the prev player
{
MMISINA.close();
}

/*
move: function
移动播放器开始
Example:

*/
MMISINA.move = function(obj){
MMISINA.playlist.destory();
obj.style.display ='block';
}

/*
match: Object
移动播放器开始
show:提取绝配数据,cb为需要回调的方法
Example:

*/
var testarr = [];
MMISINA.matchcore = (function(){
//MMISINA.g.search_url
var callback = '';
var ctrim=function(s)
{
return s.replace(/(^[/s/u3000]*)|([/s/u3000]*$)/g, "");
};

var get_meta_keywords =function(){var metas = document.getElementsByTagName("meta");for(var i=0; i<metas.length; i++){if((metas[i].name+'').toLowerCase()=='keywords')return metas[i].getAttribute('content') || '';}return '';};

var init = function(){
var arr = [];
top['MMISINA_keywords'] = get_meta_keywords();
arr.push((MMISINA.g.keywords || ''));
arr.push(document.title);
arr.push(top['MMISINA_keywords']);
arr[0] = ctrim(arr[0]);
if (arr[0].length>0)arr = arr[0];//如果参数有数值,则只匹配参数,否则取更多.
else arr = arr.join('_');
if(MMISINA.g.keywords===false)arr = '';//不匹配
return arr;
}

return {
data:'',
show:function(cb){
var str = init();
str = str.substr(0, 100);
callback = cb || function(){};
if(str===''){

result_s_js_adds = '';
this.receive();
}
else
jejax.jsonp({
url:MMISINA.g.search_url+"?overide=1&key="+encodeURIComponent(str)+'&e=utf8',
checker:this.jsonp_check,
complete:this.receive
});
//top['shea'] = str.replace(/&/g,'_');
},
jsonp_check:function()
{
if(typeof(result_s_js_adds)==='undefined' || result_s_js_adds==='')
return false;
else if(result_s_js_adds!=='')
return true;
},
receive:function(){
var result = result_s_js_adds || '';
result_s_js_adds ='';
var arr = [];
var atemp = 0;
var oo = (window.ActiveXObject)?(window['mmi_sina_music_playerlist']):(document['mmi_sina_music_playerlist']);
if(result==null || result=='')
{
try{oo[callback]('')}catch(e){}
}
else
{
for(var i = 0; i<result.length;i++)
{
for(var j = 0;j<arr.length;j++)
{
if(result[i].name==arr[j].name && result[i].singer_id==arr[j].singer_id)
{
atemp++;
}
}
if(i==0)arr.push(result[i]);
else if(atemp===0)arr.push(result[i]);
atemp=0;
}
var arr=[];
for(var i=0;i<result.length;i++)
arr.push(result[i].id);
MMISINA.matchcore.data = arr.join(',');
try{
if(window.unloading === false)
oo[callback](MMISINA.matchcore.data);
}catch(e){}

}
window.status = ('matched');
}
};

})();

MMISINA.match = function(func){

MMISINA.matchcore.show(func);
};

/*
mpw: Object
与mpw交互的操作
max:最大化并播放
collect:最大化不播放,但是收藏歌曲
save:
Example:

*/
MMISINA.mpw = {
connect:function(current,str)
{
var arr = (str!=null)?((current+','+str).split(',')):[current];
for(var i = 0; i<arr.length;i++)
{
if(i==0 || (i>0 && arr[i]!=arr[0]))
arr[i] = '<input type=hidden name="SONGID[]" value="'+arr[i]+'">';
}
return arr.join("");
},
post:function(templist,current,osid,method)
{

var str='';var m='';var u='';//the songlist, the match, the useralbum
var oScript = MMISINA.$('sinamusicpost');
var getdata = function(){
if(templist=='null')templist = '';
str = MMISINA.mpw.connect(current,templist);
m = MMISINA.matchcore.data;
u = MMISINA.vars.corprateid;
};
//alert('str:'+str+';m:'+m+';u:'+u+';osid:'+osid+';method:'+method);
getdata();
var HttpHolder = document.getElementsByTagName("body").item(0);
try{if(oScript)HttpHolder.removeChild(oScript);}catch(e){};
oScript = document.createElement("div");
oScript.setAttribute("id","sinamusicpost");
oScript.setAttribute('style', "display:none");
HttpHolder.appendChild(oScript);

MMISINA.$('sinamusicpost').innerHTML = ['<form name="sinamusicpostform" action="http://music.sina.com.cn/yueku/m.php" method="post" target="w_yuekuplayer">',
str,
'<input type=hidden name="MATCHSONGID" value="'+m+'">',
'<input type=hidden name="USERALBUM" value="'+u+'">',
'<input type=hidden name="OPERATIONSONGID" value="'+osid+'">',
'<input type=hidden name="FLAG_ADDLIST" value="'+method+'"></form>'].join('');
document['sinamusicpostform'].submit();

//window.open("http://music.sina.com.cn/yueku/m.php?"+Math.random(), "one","fullscreen=yes,location=no, menubar=no, resizable=yes,scrollbars=yes, status=no, titlebar=no, toolbar=no");

},
max:function(sids,cid){

MMISINA.mpw.post(sids,cid,'',0);
},
collect:function(sids,cid,osid){
//alert(sids+';'+cid+';'+osid);
MMISINA.mpw.post(sids,cid,osid,2);
},
save:function(sids,cid,osid){
//alert(sids+';'+cid+';'+osid);
MMISINA.mpw.post(sids,cid,osid,3);
},
ask:function(v){
MMISINA.SetSinaCookie('sinamu_mpwask',v);
}
}

MMISINA.outscreenfixer = function(){

var heightr = (MMISINA.none_doctype_height)?parseInt(MMISINA.none_doctype_height.split('px')[0]):MMISINA.getsize(MMISINA.$(MMISINA.g.mmi)).size.y;
var widthr = (MMISINA.none_doctype_width)?parseInt(MMISINA.none_doctype_width.split('px')[0]):MMISINA.getsize(MMISINA.$(MMISINA.g.mmi)).size.x;
var screensize = {x:0,y:0};
screensize.x = ( typeof( window.innerWidth ) == 'number')?window.innerWidth:document.documentElement.clientWidth;
screensize.y = ( typeof( window.innerHeight ) == 'number')?window.innerHeight:document.documentElement.clientHeight;

if((window.ActiveXObject && MMISINA.doctype==null) || screensize.x==0 || screensize.y==0)
{
screensize.x = document.body.clientWidth;
screensize.y = document.body.clientHeight;
}

var posfix = 0;
if(!window.ActiveXObject)posfix = 10;
var save_fix = function()
{
MMISINA.saveposition();
MMISINA.SetSinaCookie('right',MMISINA.g.player_position_current.x+'px');
MMISINA.SetSinaCookie('bottom',MMISINA.g.player_position_current.y+'px');
if (screensize.y < heightr)
MMISINA.$(MMISINA.g.mmi).style.bottom = (screensize.y-heightr)+'px';
if (screensize.x < widthr)
MMISINA.$(MMISINA.g.mmi).style.right = (screensize.x-widthr)+'px';
};
if(heightr+parseInt(MMISINA.$(MMISINA.g.mmi).style.bottom.split('px')[0])>screensize.y)
{
MMISINA.$(MMISINA.g.mmi).style.bottom = (screensize.y-heightr)+'px';
save_fix();
}
if(widthr+parseInt(MMISINA.$(MMISINA.g.mmi).style.right.split('px')[0])>screensize.x)
{
MMISINA.$(MMISINA.g.mmi).style.right = (screensize.x-widthr-posfix)+'px';
save_fix();
}
};

/*
changeposition: function
改变播放器位置
Example:

*/

MMISINA.orangescreen = {width:0,height:0,init:0};
MMISINA.changeposition = function()
{
var obj = MMISINA.$(MMISINA.g.mmi);

with(document)
{
MMISINA.g.winw = ( typeof( window.innerWidth ) == 'number')?window.innerWidth:documentElement.clientWidth;
MMISINA.g.winh = ( typeof( window.innerHeight ) == 'number')?window.innerHeight:documentElement.clientHeight;

if(window.ActiveXObject && MMISINA.doctype==null)
{
if(MMISINA.g.winw==0)MMISINA.g.winw = document.body.clientWidth;
if(MMISINA.g.winh==0)MMISINA.g.winh = document.body.clientHeight;
}
MMISINA.g.winT = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
MMISINA.g.winWT = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
if(MMISINA.orangescreen.init==0){MMISINA.orangescreen.width = MMISINA.g.winw;MMISINA.orangescreen.height=MMISINA.g.winh;MMISINA.orangescreen.init++};
}

with (MMISINA)
{
var pos = vars.player_position || 4;
var fix = vars.player_position_fix;
var width = g.player_width || 0;
var height = g.extraheight || g.player_height || 0;
var screensize = {x:(g.winw || 0),y:(g.winh || 0)};
var currentpos = currentposition();
if(MMISINA.none_doctype_height)height = g.player_height;
if(MMISINA.none_doctype_width)width = g.player_width;

}

if(window.ActiveXObject)
{
if(MMISINA.doctype!=null && window.XMLHttpRequest)
MMISINA.g.winT = 0;
}
else {
MMISINA.g.winT = 0;
}

if(currentpos===false)
{
obj.style.left ='';obj.style.top ='';
//if(MMISINA.vars.ad_isopen===true )height+=60;
if(window.ActiveXObject && MMISINA.doctype==null)
height = MMISINA.g.playersize.height;
switch(pos)
{
case 1: obj.style.right = (screensize.x-width-2 + fix.right) +'px';
obj.style.bottom = (MMISINA.g.winT + screensize.y-height-2 + fix.bottom) +'px';
break;
case 2: obj.style.right = (0 + fix.right) +'px';
obj.style.bottom = (MMISINA.g.winT + screensize.y-height-2 + fix.bottom) +'px';
break;
case 3: obj.style.right = (screensize.x-width-2 + fix.right) +'px';
obj.style.bottom = (2 + fix.bottom) +'px';
break;
case 4: obj.style.right = (0 + fix.right) +'px';
obj.style.bottom = (2 + fix.bottom)+'px';
break;
}
top['ops'] = pos+'MMISINA.g.winT:'+MMISINA.g.winT+ ';;+screensize.y:'+ screensize.y +';;-height:'+ height + ';;+fix.bottom:'+fix.bottom;

}
else
{

if(window.ActiveXObject && MMISINA.doctype==null && typeof(top['fixbottom'])=='undefined')
{

//IE7 with no doctype with cookieset
if(window.XMLHttpRequest && MMISINA.getSinaCookie('fixbottom') && MMISINA.getSinaCookie('fixbottom').length>0)
{
top['fixbottom'] = parseInt(MMISINA.getSinaCookie('fixbottom'));
top['fixright'] = parseInt(MMISINA.getSinaCookie('fixright'));
}
else {//IE6 with no doctype
top['fixbottom'] = top['fixbottom'] || parseInt(obj.style.bottom.split('px')[0]);
top['fixright'] = top['fixbottom'] || parseInt(obj.style.right.split('px')[0]);
MMISINA.SetSinaCookie('fixbottom',top['fixbottom']);
MMISINA.SetSinaCookie('fixright',top['fixright']);
}
}

//alert('cookieright:'+MMISINA.getSinaCookie('right')+';cookbottom:'+MMISINA.getSinaCookie('bottom')+top['fixbottom'] +';;'+top['fixright']);

if(MMISINA.orangescreen.width!=MMISINA.g.winw)
{
//if(MMISINA.g.winw>MMISINA.orangescreen.width)
obj.style.right = (MMISINA.g.winw - MMISINA.orangescreen.width + parseInt(obj.style.right.split('px')[0]))+'px';
MMISINA.orangescreen.width = MMISINA.g.winw;
}
if(MMISINA.orangescreen.height!=MMISINA.g.winh)
{
//if(MMISINA.g.winh>MMISINA.orangescreen.height)
obj.style.bottom = (MMISINA.g.winh-MMISINA.orangescreen.height + parseInt(obj.style.bottom.split('px')[0]))+'px';
MMISINA.orangescreen.height = MMISINA.g.winh;

}
//scrolling in ie7 with no doctype
if (window.ActiveXObject && window.XMLHttpRequest && MMISINA.doctype==null) {
if(document.body.scrollTop!=0)
{
obj.style.top ='';
obj.style.bottom = (top['fixbottom'] - document.body.scrollTop)+'px';
}
if(document.body.scrollLeft!=0)
{
obj.style.left ='';
obj.style.right = (top['fixright'] - document.body.scrollLeft)+'px';
}
}
else if(MMISINA.g.winoffet!=MMISINA.g.winT)//scrolling in ie6
{
obj.style.top ='';
obj.style.bottom = Math.abs(parseInt(obj.style.bottom.split('px')[0]))+((parseInt(Math.random()*2)==0)?(1):(-1))+'px';
MMISINA.g.winoffet = MMISINA.g.winT;
}
else if( MMISINA.g.winoffetw != MMISINA.g.winWT)//scrolling in ie6
{
obj.style.left ='';
obj.style.right = Math.abs(parseInt(obj.style.right.split('px')[0]))+((parseInt(Math.random()*2)==0)?(1):(-1))+'px';
MMISINA.g.winoffetw = MMISINA.g.winWT;
}
else{}

}
MMISINA.outscreenfixer();
//if(parseInt(obj.style.bottom.split('px')[0])<0)obj.style.bottom='2px';
MMISINA.saveposition();

};

/*
fixposition: function
初始化播放器位置
Example:

*/
MMISINA.setDrag = function(){MMISINA.g.isDrag = false;};
MMISINA.fixposition=function()
{

if(MMISINA.$(MMISINA.g.mmi))
{
var TOTAL_HEIGHT = MMISINA.g.player_height;
var TOTAL_WIDTH = MMISINA.g.player_width;

with(document)
{
MMISINA.g.winw = ( typeof( window.innerWidth ) == 'number')?window.innerWidth:documentElement.clientWidth;
MMISINA.g.winh = ( typeof( window.innerHeight ) == 'number')?window.innerHeight:documentElement.clientHeight;
MMISINA.g.winoffet = MMISINA.g.winT = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
MMISINA.g.winoffetw = MMISINA.g.winWT = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;
}

if(window.ActiveXObject && MMISINA.doctype==null)
{
if(MMISINA.g.winw==0)MMISINA.g.winw = document.body.clientWidth;
if(MMISINA.g.winh==0)MMISINA.g.winh = document.body.clientHeight;
}

if(window.XMLHttpRequest && MMISINA.doctype!=null)//IE7 FF
MMISINA.g.winT = 0;
if(typeof(MMISINA.Drag)!='undefined')
MMISINA.Drag.setMax({x:(MMISINA.g.winw-MMISINA.g.player_width-2),y:(MMISINA.g.winT + MMISINA.g.winh-MMISINA.g.player_height-2)});//通知drag 改变size了.

if(MMISINA.g.event_added===false)
{
MMISINA.add_event('resize',window,MMISINA.changeposition)
if(window.ActiveXObject && !window.XMLHttpRequest || (window.ActiveXObject && MMISINA.doctype==null) )//ie6
{
MMISINA.add_event('scroll', window,MMISINA.changeposition);
}
else
{
MMISINA.add_event('scroll', window,MMISINA.setDrag);
}
}
MMISINA.g.event_added = true;

}

}

/*
currentposition: function
返回播放器位置
Example:

*/
MMISINA.currentposition = function()
{
return (MMISINA.g.player_position_current || false);
}

/*
saveposition: function
存储播放器位置
Example:

*/
MMISINA.saveposition = function()
{

var right = parseInt(MMISINA.$(MMISINA.g.mmi).style.right.split('px')[0]);
var bottom = parseInt(MMISINA.$(MMISINA.g.mmi).style.bottom.split('px')[0]);

MMISINA.g.player_position_current = {x:right,y:bottom};
};

/*
startDarg: function
flash拖动开始
Example:

*/
var startDrag=function(x,y){
MMISINA.g.flashX=x;
MMISINA.g.flashY=y;
MMISINA.playlist.moving();
MMISINA.g.isDrag=true;
}

/*
stopDrag: function
flash拖动结束
Example:

*/
var stopDrag=function(){
MMISINA.saveposition();
MMISINA.SetSinaCookie('right',MMISINA.g.player_position_current.x+'px');
MMISINA.SetSinaCookie('bottom',MMISINA.g.player_position_current.y+'px');

MMISINA.playlist.moved();
MMISINA.g.isDrag=false;
if(window.ActiveXObject && window.XMLHttpRequest && MMISINA.doctype==null)
{
MMISINA.SetSinaCookie('fixbottom',top['fixbottom']);
MMISINA.SetSinaCookie('fixright',top['fixright']);
}
}

/*
init: function
初始化Class
Example:

*/

MMISINA.init = (function(){

/*init_g:private function*/
var init_g = function()
{
with(MMISINA.g){
var size = MMISINA.getsize(MMISINA.$(MMISINA.g.mmi)).size;
player_width = size.x;
player_height = size.y;
keywords = (typeof(miniplayer_keywords)!='undefined')?miniplayer_keywords:'';
}

with(document)
{
MMISINA.g.winw = ( typeof( window.innerWidth ) == 'number')?window.innerWidth:documentElement.clientWidth;
MMISINA.g.winh = ( typeof( window.innerHeight ) == 'number')?window.innerHeight:documentElement.clientHeight;
}

if(window.ActiveXObject && MMISINA.doctype==null)
{
if(MMISINA.g.winw==0)MMISINA.g.winw = document.body.clientWidth;
if(MMISINA.g.winh==0)MMISINA.g.winh = document.body.clientHeight;
}

};
var init_templete = function()
{

var flashvar = '';
var fav = (typeof(miniplayer_is_favorites)!='undefined' && miniplayer_is_favorites==true)?true:false;
var addv = function(){
var ktr = '';
var arr = [];
for(var k in MMISINA.vars)
{
ktr = MMISINA.vars[k+'']+'';
arr.push(k+'='+ktr);
}
flashvar = arr.join('&');
};
addv();
with(MMISINA.g){
var pl = AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '180px',
'height', '295px',
'src', swf_playlist,
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', playlistobject,
'bgcolor', '#ffffff',
'name', playlistobject,
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', swf_playlist,
'salign', '',
'FlashVars',flashvar
);

var so = AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', playersize.width,
'height', playersize.height,
'src', swf_player,
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'transparent',
'devicefont', 'false',
'id', flashobject,
'bgcolor', '#ffffff',
'name', flashobject,
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', swf_player,
'salign', '',
'FlashVars',flashvar
);
html = html.replace('$_mmiflash_$',pl).replace('$_mmiplayer2_$',so);
if(fav===true)
{
var httpholder = document.getElementsByTagName("body").item(0);
var oScript = '';

if(window.ActiveXObject && window.XMLHttpRequest)//IE7
{
var stylez = document.createStyleSheet();
var rule = '';
var sname = '';
var arr = '';
for(var i=1;i<MMISINA.g.styleArray.length;i++)
{
arr = MMISINA.g.styleArray[i].split(/[{}]/g);
sname = arr[0];
rule = arr[1].split(';');
for(var j=0;j<rule.length;j++)
{
if(sname!='' && rule[j]!='' && rule[j]!=null)
stylez.addRule(sname,rule[j]);
}
}
}
else if(window.ActiveXObject)//IE6
{
window.style=style+'';
document.createStyleSheet("javascript:window.style");
}else //moz
{
oScript = document.createElement("style");
oScript.innerHTML = style.replace('</style>','').replace('<style>','');
document.getElementsByTagName("head").item(0).appendChild(oScript);
}

oScript = document.createElement("div");
oScript.setAttribute("id",mmi);
oScript.innerHTML = style+html;
httpholder.appendChild(oScript);
oScript.style.position = (window.XMLHttpRequest)?'fixed':'absolute';
if(MMISINA.doctype==null)oScript.style.position = 'absolute';
oScript.style.width = '208px';
oScript.style.height = 'auto';
oScript.style.margin = '0px';
oScript.style.padding = '0px';
oScript.style.zIndex = '65536';
}
else
{
document.write(style+'<div id="mmisina">'+html+'</div>');
}
}

/*fix firefox plist hack*/
if(MMISINA.vars.tmpl_isopen!='true')
{
if(typeof(document['mmi_sina_music_playerlist']) == 'object')
document['mmi_sina_music_playerlist'].style.height = '0px';
if(typeof(MMISINA.$('mmiplaylist')) == 'object')
{
MMISINA.$('mmiplaylist').style.height = '0px';
MMISINA.$('mmiplaylist').style.filter = 'Alpha(Opacity=0)';//filter:Alpha(Opacity=0)
}

if(MMISINA.doctype==null)
{
MMISINA.$('mmiflash').style.height = '0px';
MMISINA.$('mmiflashholder').style.height = '0px';
MMISINA.$('mmilistbody').style.height = '0px';
MMISINA.$('mmiplaylist').style.height = '18px';
MMISINA.$('mmisina').style.height = '105px';
}

}
if(MMISINA.vars.mod === 'small'){
if(!window.ActiveXObject)
{
MMISINA.$(MMISINA.g.player).style.width = MMISINA.$(MMISINA.g.mmi).style.width = MMISINA.g.playersize.height+'px';
}
MMISINA.min.mined = true;
MMISINA.playlist.destory();
}
if(MMISINA.doctype==null)
{
MMISINA.none_doctype_width = MMISINA.g.playersize.width+'px';
MMISINA.none_doctype_height = MMISINA.g.playersize.height+'px';
}

if (MMISINA.vars.tmpl_isopen)
{
MMISINA.$('mmiplaylist').style.height='';
if(!window.ActiveXObject)
{
document['mmi_sina_music_playerlist'].style.height = '';
document['mmi_sina_music_playerlist'].style.width = '';
}else {
if(MMISINA.doctype==null)
{
MMISINA.$('mmisina').style.height = null;
MMISINA.$('mmiplaylist').style.height = null;
MMISINA.$('mmilistbody').style.height = null;
MMISINA.$('mmiflashholder').style.height = null;
MMISINA.$('mmiflash').style.height = null;

}

}
}

};

/*initposition:private function*/
var initposition = function()
{
var init = function(){
var right = MMISINA.getSinaCookie('right')+'';
var bottom = MMISINA.getSinaCookie('bottom')+'';
if(right.indexOf('px')>0 && bottom.indexOf('px')>0)//拖动记录优先
{
MMISINA.$(MMISINA.g.mmi).style.right = right;
MMISINA.$(MMISINA.g.mmi).style.bottom = bottom;
MMISINA.g.player_position_current = {x:parseInt(right.split('px')[0]),y:parseInt(bottom.split('px')[0])};
}
}
init();

MMISINA.changeposition();
};

/*initdrag:private function*/
var initdrag = function()
{
MMISINA.Drag.init(MMISINA.$(MMISINA.g.mmi),MMISINA.saveposition,null,5,MMISINA.g.winw-MMISINA.g.player_width-2,5,MMISINA.g.winh-MMISINA.g.player_height-2,true,true);
MMISINA.fixposition();
};

var initads = function()
{
MMISINA.g.addarr = [];
MMISINA.g.addarr.push(
{
location:'music.sina.com.cn',
ad_url:'http://sms.sina.com.cn/mobiledo/theme/index.php',
ad_pic:'http://d4.sina.com.cn/200911/27/200292_180x60-1.jpg',

big_ad_url:'',

big_ad_pic:'',

ad_audio_url:''

}
);
MMISINA.g.addarr.push(
{
ad_url:'http://sms.sina.com.cn/mobiledo/theme/index.php',
ad_pic:'http://d4.sina.com.cn/200911/27/200292_180x60-1.jpg',

ad_pic:'http://i1.sinaimg.cn/sms/smc_pic/images/mmi/images/180x60.jpg',

big_ad_url:'http://news.sina.com.cn',

big_ad_pic:'',

ad_audio_url:'http://vika.sina.com.cn/vika/MMI/logo4.mp3'
}
);

};

var getads = function(location){
for(var i = 0; i<MMISINA.g.addarr.length;i++)
{
if(location.indexOf(MMISINA.g.addarr[i].location)>=0)
{
return MMISINA.g.addarr[i];
}
}
return MMISINA.g.addarr[0];
}

/*initvars:private function*/
var initvars = function()
{
(function(){//get vars from cookie;
var adsadd = getads(window.location.href+'');
var c_playstate = MMISINA.current_playlist.get();
MMISINA.vars.mpwask = MMISINA.getSinaCookie('sinamu_mpwask');
MMISINA.vars.tmpl_albumid = c_playstate.albumid;
MMISINA.vars.tmpl_songid = c_playstate.songid;
MMISINA.vars.tmpl_scroll = c_playstate.scroll;
MMISINA.vars.tmpl_isopen = MMISINA.getSinaCookie('tmpl_isopen');
MMISINA.vars.ad_audio_url = adsadd.ad_audio_url;
MMISINA.vars.ad_url = adsadd.ad_url; //小广告链接 http://..
MMISINA.vars.ad_pic = adsadd.ad_pic; //小广告图片地址 http://..
MMISINA.vars.big_ad_url = adsadd.big_ad_url; //大广告链接 http://..
MMISINA.vars.big_ad_pic = adsadd.big_ad_pic ; //大广告图片地址 http://..
MMISINA.vars.voice_ad_count = (MMISINA.getSinaCookie('sinamu_voice_ad_count')=='')?0:MMISINA.getSinaCookie('sinamu_voice_ad_count');
})();

with (MMISINA.vars){
ad_isopen =true;
all_load_official_album = true;
officalid = 1317593267;
corprateid = (typeof miniplayer_userid !='undefined')?(vars_reconfig(miniplayer_userid,'number') || 1317593267):1317593267;
//

抱歉!评论已关闭.