﻿// JScript File
function blank(){}


function wo(sWords)
{
	window.open('http://www.shangwusousuo.com/s.php?q=' + sWords);	
}

function killErrors()   {     
  return   true;     
}     
    
window.onerror = killErrors;   

function SetMenu(iType)
{
//内容页传值到母版页 不方便，故改为js设置当前栏目。适用于信息页，评论页.
    var oMenu = document.getElementById("ml_" + iType);
    var oMenuIndex = document.getElementById("ml_0");
    if(oMenu == null)
    {
        //设置当前栏目为首页.
       if(oMenuIndex.getAttribute("class") != "menu2")
       {
            ResetMenu(); //重置栏目
            oMenuIndex.className = "menu2";
       }
    }
    else
    {
        //设置当前栏目为该类.
       if(oMenu.getAttribute("class") != "menu2")
       {
            ResetMenu(); //重置栏目
            oMenu.className = "menu2";
       }
    }
}

function ResetMenu()
{
    var menus = document.getElementById("sitemenu").getElementsByTagName("li");
    //ie 7
    document.getElementById("ml_0").className = "menu1";
    for (var i = 0; i < menus.length; i++)
    {
        if (menus[i].getAttribute("class") == "menu2") 
        {
            menus[i].className = "menu1";
        }
    }
}

//增加踩或顶.
function AddRank(iId, iType)
{
    var sRankUrl;
    var oRankId;
    var myDate = new Date(); 
    sRankUrl = "/work/addRank.aspx?id=" + infoId + "&t=" + iType + "&c=" + checkCode + "&s=" + myDate.getMilliseconds();
    //document.write(sRankUrl); 加秒防止ie7缓存.
	if(clicks == 0) 
	{
        document.getElementById('oAddRank').src = sRankUrl;
		clicks ++;
		if(0 == iType)
		{
		    oRankId = document.getElementById("spanUp");
		}
		else
		{
		    oRankId = document.getElementById("spanDown");
		}
		oRankId.innerHTML = parseInt(oRankId.innerHTML, 10) + 1;
		
	} 
	else 
	{
		alert("您今天评论过该网站了");
	}
}

function LoadAds(loader, ad)
{
	var ad = $(ad);
	loader = $(loader);
	if (ad && loader)
	{
		ad.appendChild(loader);
		loader.style.display='block';
		ad.style.display='block';
	}
}

function $(sId)
{
  var d = document;
  var oObj = d.getElementById?d.getElementById(sId):d.all?d.all[sId]:d.divs[sId];
  return oObj;
}

function GetCookieVal(offset)
{
//获得Cookie解码后的值
    var allcookies = document.cookie;
    var begin = document.cookie.indexOf(offset);    //出现的起始位置
    if(-1 == begin)
    {
        return "";      //不存在该cookie，返回空.
    }
    else
    {
        var end = document.cookie.indexOf (";", begin);
        if (end == -1)
        {
            end = document.cookie.length;
        }
        return unescape(document.cookie.substring(begin, end).replace(offset + "=", ""));
    }
}

function setlogin(spanbox)
{
    var user = GetCookieVal('0460webuser');
    if("" != user)
    {
        $(spanbox).innerHTML  = "<a class=\"b red\" href=\"http://www.0460.com/member/login.aspx\">欢迎您," + user + "! 每个人都有自己喜欢的一些网站,点此即可提交</a>";
    }
}
