//document.domain = "mz99.com";

//取cookie
function getCookie(name){
	var search;
	search = name + "=";
	offset = document.cookie.indexOf(search);
	if (offset != -1) {
		offset += search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
	}
	else return "";
}

//删除cookie
function deleteCookie(name){
  setCookie(name, "");
}

//设置cookie
function setCookie(name,value){
	document.cookie = name + "=" + value + "; ";//domain=
}

function setCSS(CssArrayParam) 
{
  var cssID = getCookie("Mz99Blog_SpaceTemplate");
   for(var i = 0; i<CssArrayParam.length;i++)
   {
      var re = /@/g;
      cssID = (cssID =="")?"1": cssID;            
      var r = CssArrayParam[i].replace(re, cssID); 
      document.createStyleSheet(r);               
   }

}

//加载xml
function  loadXMLCommon(xmlFile)
{
    var xmlDoc;
    if(window.ActiveXObject)
    {
        xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
        xmlDoc.async    = false;
        xmlDoc.load(xmlFile);
        
        if(xmlDoc.parseError.errorCode!=0)//判断加载是否有错
        {
           return null;
        }     
    }
    else if (document.implementation&&document.implementation.createDocument)
    {
        xmlDoc = document.implementation.createDocument('', '', null);
        xmlDoc.load(xmlFile);
    }
    else
    {
        return null;
    }
    
    return xmlDoc;
}



// 首先对xml对象进行判断
function  checkXMLDocObj(xmlFile)
{
    var xmlDoc = loadXMLCommon(xmlFile);
    if(xmlDoc==null)
    {
        alert('您的浏览器不支持xml文件读取,于是本页面禁止您的操作,推荐使用IE5.0以上可以解决此问题!');
        window.location.href='/Index.aspx';
    }
    
    return xmlDoc;
}



//初始化cookie用户

var hostUser = getCookie("Mz99_Blog_HostUserName"); //空间主人
var guestUser = getCookie("Mz99_Blog_LoginUserName"); //浏览人
var MzSpaceTemplate = getCookie("Mz99Blog_SpaceTemplate");//空间模板数
   
//    if(hostUser=="")
//    {
//        alert('您的浏览器不支持cookie模式,推荐使用cookie可以解决此问题!');
//        window.location.href='/Index.aspx';
//    }


//缩小图片
function ZoomPic(obj)
{
	if(obj.width > 550)
	{
		obj.height = obj.height / obj.width * 550
		obj.width = 550;
	}
}


//帮助文件提示
function helpMouseOut(obj)
{
   document.getElementById(obj).style.display = "none";
}
function helpMouseOver(obj)
{
   document.getElementById(obj).style.display = "block";
}



      
