function Ip2Long(ip){
    try{
      var sip = ip.split(\'.\');
      var lRet = parseFloat(sip[0] * 256 * 256 * 256)
            + parseFloat(sip[1] * 256 * 256)
            + parseFloat(sip[2] * 256)
             + parseFloat(sip[3])
      return lRet;
    }
    catch(err){
      return 0;
    }
}