﻿var PageUrl = "http://www.61g.com/";
/*
==================================================================  
Trim(string):去除两边的空格 
==================================================================  
*/
String.prototype.trim = function()
{	
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

/*
==================================================================  
获取对象的X与Y坐标
==================================================================  
*/
function getOffsetTop(el, p) {
    var _t = el.offsetTop;
    while (el = el.offsetParent) {
        if (el == p) break;
        _t += el.offsetTop;
    }

    return _t;
};
function getOffsetLeft(el, p) {
    var _l = el.offsetLeft;
    while (el = el.offsetParent) {
        if (el == p) break;
        _l += el.offsetLeft;
    }

    return _l;
};

/*
==================================================================  
获取浏览器的类型
==================================================================  
*/
function getOs() 
{ 
    var OsObject = ""; 
    if(navigator.userAgent.indexOf("MSIE")>0) 
    { 
         return "MSIE"; 
    } 
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)
    { 
         return "Firefox"; 
    } 
    if(isSafari=navigator.userAgent.indexOf("Safari")>0)
    { 
         return "Safari"; 
    } 
    if(isCamino=navigator.userAgent.indexOf("Camino")>0)
    { 
         return "Camino"; 
    } 
    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)
    { 
         return "Gecko"; 
    } 
}

function GetXMLHTTP() 
{ 
    var A=null; 
    try 
    { 
        A=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    catch(e) 
    { 
        try 
        { 
            A=new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        catch(oc)
        { 
            A=null; 
        } 
    } 
    if ( !A && typeof XMLHttpRequest != "undefined" ) 
    { 
        A=new XMLHttpRequest(); //ff只支持这个
    } 
    return A; 
}
