﻿ function doHits(id){
  if(event.button!=1 && event.button!=2) return;
    var url=window.location.href.toLowerCase();
    var serverPath=url.substr(0,url.indexOf("/finance/"));
    var xHttp=getXMLRequester();
    ajaxGet(xHttp,serverPath +"/webServer/xsMain.asmx/ShareFileDownSumAdd?id="+id);
}
var brow="";
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
    brow = "ie"+navigator.appVersion.match(/MSIE (.)/)[1];
}
function oWin(u,s,w,h){
    return window.open(u,'',(brow=="ie6"?"menubar=1,toolbar=0":"menubar=0,toolbar=1")+",scrollbars="+
        s+",resizable=1,status=1,location=0"+ (w>0?(",width="+w):"")+(h>0?( ", height="+ h):""));
}
function  trim(s){return  s.replace(/(^\s*)|(\s*$)/g, "");}
function getXMLRequester(){
   var xmlHttp;
   if (window.XMLHttpRequest){
       xmlHttp = new XMLHttpRequest();
       if (xmlHttp.overrideMimeType) {
         xmlHttp.overrideMimeType('text/xml');   }
   }else if (window.ActiveXObject){
       try{
              xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
       } 
       catch (e){
                try{
                     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                     alert('对不起您的浏览器版本太低，请更新后使用。');
                     setTimeout("window.close();",100);}
          }   
   }
   return xmlHttp;
}
//get发送xmlHttp 
function ajaxGet(xmlHttp,p){
    xmlHttp.open("GET",p,true);ajaxSend(xmlHttp,null)
};
//post 发送xmlHttp
function ajaxPost(xmlHttp,path,parm,raluFunc){xmlHttp.onreadystatechange=raluFunc;
    xmlHttp.open("POST",path,true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-Length",parm.length);ajaxSend(xmlHttp,parm)
};
//发送xmlHttp
function ajaxSend(xmlHttp,parm){try{xmlHttp.send(parm)}catch(c){throw c;}};

function $get(id) {
     if(document.getElementById && document.getElementById(id)) 
     {
       return document.getElementById(id);
     } 
     else if (document.all && document.all(id)) 
     {
       return document.all(id);
     } 
     else if (document.layers && document.layers[id]) 
     {
       return document.layers[id];
     } 
     else 
     {
       return false;
     }
}  
function mailtj()
    {
        var url = "mailto:?subject="+gb2312("给你推荐一个好用的家庭记账软件")
        +"&body="+gb2312("省时省钱，免费试用45天 28元永久使用，水滴家庭记账软件\r\n下载地址：http://www.tanzhen.net/finance/download.shtml ");
        window.navigate(url);
    }

function gb2312(key)
{
    var r = "";
    for(var i=0;i<key.length;i++)
    {
        var t = key.charCodeAt(i);
        if(t>=0x4e00 || t==0x300A || t==0x300B)
        {
            try
            {
            execScript("ascCode=hex(asc(\""+key.charAt(i)+"\"))", "vbscript"); r += ascCode.replace(/(.{2})/g, "%$1"); }
            catch(e){}
         }
        else{r += escape(key.charAt(i))}
   }
    return r;
}