﻿function  HideStatusBar()   
{   
    return window.status="mm62.com";   
}   

String.prototype.trim=function()
{
        return this.replace(/(^\s*)|(\s*$)/g, "");
}

function PictureError(img)
{
   var id = img.getAttribute("id");
   var action = 3; //具体含义看后台代码
   var success = 0; 
   PostAction(action,id,success); 
}

function ArticlesLoad()
{
    var tbp = window.document.getElementById("Artilces");
    if(tbp==null)
    {
        var current =  window.document.getElementById("AspNetPager1");
        var parent= current.parentNode;
        var newNode= document.createElement('div');
        newNode.style.marginTop='20px';
        newNode.style.marginBottom='20px';
        newNode.innerHTML='<iframe scrolling="no" width="608" height="120" src="http://w4.bafang.cc/link/e.html?u=mm62&type=0&w=4&h=1&fc=0066FF&bgc=ffffff&bdc=ffffff&al=center&tw=608&th=120&style=1" frameborder="0"></iframe>';
        parent.insertBefore(newNode,current);
    }  
}

function PostAction(action,id,success)
{
    try
    {
        var xmlhttp = new GetXmlHttp(); 
        var request_Page="/tool/Action.ashx?action="+action+"&id="+id+"&success="+success;
        xmlhttp.open("POST", request_Page, false);
 		xmlhttp.send();   
    }
    catch(e)
    {
    }	
}

function GetXmlHttp()
{
    var http_request;
    if (window.XMLHttpRequest)
    {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType)
        {
            http_request.overrideMimeType("text/xml");
        }
    }
    else if (window.ActiveXObject)
    {
        try
        {
            http_request = new ActiveXObject("Mscml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(ex)
            {}
        }
    }
    return http_request;
}


function AddLoadEvent(func)
{
    var oldonload=window.onload;
    if(typeof window.onload!= 'function')
    {
        window.onload=func;
    }
    else
    {
        window.onload=function()
        {
            oldonload();
            func();
        }
    }
}

function ClickCounter()
{

    if(typeof(kid)!='undefined') 
    {
        PostAction(2,kid,-1);  
      
    }
}
AddLoadEvent(ArticlesLoad);
AddLoadEvent(ClickCounter);



 
