function setIsdCode(id)
{
  var selectBox = $(id+"Cntry");
  var isdCode = selectBox.options[selectBox.selectedIndex].value.substr(3);
  $(id+"IsdCode").value = "+" + isdCode;
  //alert(isdCode);
}

function random_int()
{
 return Math.floor(Math.random()*100000);
}

function softReload()
{
  var param = "&random="+random_int();
  if(window.location.href.indexOf("?") < 0)
  {
    param = "?"+param;
  }
  window.location = window.location.href + param;
}

function formatPhone(ph, cc)
{
  if(cc == undefined)
  {
    cc = 'US';
  }
  if(cc == 'US')
  {
    ph = ph.substr(0,3)+' '+ ph.substr(3,3)+' '+ph.substr(6);
  }
  return ph;
}

function expandObj(obj, fromLen, toLen, delta, speed)
{
  var elm = null;
  if(typeof(obj) == "object")
  {
    elm = obj;
  }
  else
  {
    elm = document.getElementById(obj);
  }

  if((elm != null) && (elm.style != null))
  {
    elm = elm.style;
    var temp = toLen + "px";
    if(elm['height'] != temp)
    {
      elm['height'] = fromLen+"px";

      if(fromLen < toLen)
      {
        fromLen += delta;
        setTimeout("expandObj('"+ obj + "'," + fromLen + "," + toLen + "," + delta + "," + speed + ")", speed);
      }
    }
  }
}

function collapseObj(obj, fromLen, toLen, delta, speed)
{
  var elm = null;
  if(typeof(obj) == "object")
  {
    elm = obj;
  }
  else
  {
    elm = document.getElementById(obj);
  }

  if((elm != null) && (elm.style != null))
  {
    elm = elm.style;
    var temp = toLen + "px";
    if(elm['height'] != temp)
    {
      elm['height'] = fromLen+"px";

      if(fromLen > toLen)
      {
        fromLen -= delta;
        setTimeout("expandObj('"+ obj + "'," + fromLen + "," + toLen + "," + delta + "," + speed + ")", speed);
      }
    }
  }
}