﻿window.vodone_outplayer = false;//针对代码广告 14:33 2009-10-12

function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e)
        {
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
                        }  
                        catch (e) 
                        { 
                                alert("抱歉！您的浏览器不支持直接设为首页。请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为“true”，点击“加入收藏”后忽略安全提示，即可设置成功。");  
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}       
 //设置内容文字的大小
 function SetSize(size)
 {
 
    document.getElementById('Content').style.fontSize=size+'px';
    document.getElementById('Content').style.lineHeight=size+'px';


}

var xmlhttp;
 function createRequest()
  {
    if(window.ActiveXObject)
     {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }else if(window.XMLHttPRequest)
     {
        xmlhttp=new XMLHttpRequest();         
     }
  }
  
    
 //广告流量统计方法,AdNo广告编号,Pos广告位置编号
 function CP(No,Pos)
 {
     createRequest();
     xmlhttp.onreadystatechange=StateDO;
     xmlhttp.open("post","/Ajax/CP.aspx?AdNo="+No+"&Pos="+Pos,true);
     xmlhttp.send(null);
  }
  
function StateDO()
{
    if(xmlhttp.readystate==4)
    {
        if(xmlhttp.status==200)
        {
           //alert("OK,通过了！");
        }
        else
        {
           //alert("统计失败！");
        }
    }
}
//提取资讯的浏览次数及评论次数[新闻内容页][时尚生活]
function ShowBookCount(NewsId,T)
{
     createRequest();
     xmlhttp.onreadystatechange=Action;
     xmlhttp.open("post","/Ajax/ShowBookCount.aspx?NewsId="+NewsId+"&T="+T,true);
     xmlhttp.send(null);
}
function Action()
{
    if(xmlhttp.readystate==4)
    {
        if(xmlhttp.status==200)
        {
           FillData(xmlhttp.ResponseText);
        }
    }
}
function FillData(Str)
{
    var indexofBrowse;
    var indexBookCount;
    var data=Str.split('|')
    if(data.length>0)
    {
   
      document.all("BookCount1").innerText=data[0];
      if(document.all("BookCount3"))
	  {
		 document.all("BookCount3").innerText=data[0];
	  }
	 
      document.all("BookCount2").innerText=data[0];
      document.all("BrowseCount").innerText=data[1];
      document.all("G").innerText=data[2];
      document.all("B").innerText=data[3];
    }
}
//清除会员登录Cookie所保存的信息
function LoginOut()
{
     createRequest();
     xmlhttp.onreadystatechange=IsLoginOut;
     xmlhttp.open("post","/Ajax/DeleteCookies.aspx",true);
     xmlhttp.send(null);
}
function IsLoginOut()
{
    if(xmlhttp.readystate==4)
    {
        if(xmlhttp.status==200)
        {
           alert("您已成功退出系统！");
        }
        else
        {
           alert("退出失败！");
        }
    }
}

function Check(ActiveId,Flag)
{
     createRequest();
     xmlhttp.onreadystatechange=Active;
     xmlhttp.open("post","http://127.0.0.1/Ajax/ValidShop.aspx?Id="+ActiveId+"&Flag="+Flag,true);
     xmlhttp.send(null);
}
function Active()
{
    var flag=xmlhttp.ResponseText;
    if(xmlhttp.readystate==4)
    {
        if(xmlhttp.status==200)
        {
           if(flag==1)
           {
                alert("OK");
           }else
           {
                alert("郁闷啊！");
           }
        }
    }
}







//获取用户ID
function GetUserID(r)
{
	document.getElementById('UserID').value = r.responseText;

}
 function getCookies(name)
{
   var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
   if(arr != null) return unescape(arr[2]); return null;
}
function getArray(key)
{
	var user = getCookies("User");
	if(user==null)
		return 0;	
	var list = user.split("&");
	var str ="";//返回值
	var n = -1;
	if(list.length>0)
	{
		for(var i =0;i<list.length;i++)
		{
			n = list[i].indexOf(key);
			if(n>-1)
			{
				str = list[i].substring(key.length +1 );
				break;
			}
		}
	}
	return str;
//	alert( getCookies("User") + "| ID=" + str);
// 使用例子
}


 
function CheckUserCookie(urlid)
 {
	//Ajax.loadHttp("ASPX/Index_UserID.ASPX", true, GetUserID);
  	var url=document.location.href;
	var userid =parseInt( getArray("ID") );//从Cookie中读取信息
  	if(userid<1)
  	{	
  		var a = confirm("你还没有登陆哟，马上登陆参与活动吧！");
  		if(a)
  		{
  			showLavel(true,0);//登录
  			
  			return ;
  		}

	}
  	else
  	{
  	  	if(urlid==0)document.location.href = "StoryUpdate.aspx";
  		
  		if(urlid==1)
  			document.location.href = "TravelUpdate.aspx";
		return ;
  		
	}
  }
  
  function Vote(Id,Pos)
  {
     createRequest();
     xmlhttp.onreadystatechange=VoteResult;
     xmlhttp.open("post","http://127.0.0.1/Ajax/Vote.aspx?Id="+Id+"&Flag="+Pos,true);
     xmlhttp.send(null);
  }
  function VoteResult()
  {
        var flag=xmlhttp.ResponseText;
        if(xmlhttp.readystate==4)
        {
            if(xmlhttp.status==200)
            {
               if(flag==0)
               {
                     var sum=document.getElementById("s0").innerText;
                     document.getElementById("s0").innerText=parseInt(sum)+1;
                     $("#lbsupport").html("已支持");
               }else if(flag==1)
               {
                     var sum=document.getElementById("s1").innerText;
                     document.getElementById("s1").innerText=parseInt(sum)+1;
               }
            }
        }
  }
  
  function Operate(Id,Flag)
  {
     createRequest();
     xmlhttp.onreadystatechange=OperatorResult;
     xmlhttp.open("post","http://127.0.0.1/Ajax/ActiveOperator.aspx?Id="+Id+"&Flag="+Flag,true);
     xmlhttp.send(null);
  }
  function OperatorResult()
  {
        
        if(xmlhttp.readystate==4)
        {
            if(xmlhttp.status==200)
            { var flag=xmlhttp.ResponseText;
               if(flag==0)
               {
                   alert('操作失败!');
               }else if(flag==1)
               {
                     document.location.reload();
               }
            }
        }
  }
  
