function getCookie(name) 
{
  var prefix = name + "=";
  var cookieStartIndex = document.cookie.indexOf(prefix);

  if (cookieStartIndex == -1)
    return null

  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)

  if (cookieEndIndex == -1)
    cookieEndIndex = document.cookie.length

  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}


function deleteCookieAndRefresh(name)
{
  alert(name+"= "+getCookie(name));

  if (getCookie(name)) 
  {
    var path = "/";
    var domain = ".smartphoneware.com";
    document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";

    window.location.href = window.location.href;
  }
}


function GetElement(id)
{
  if(document.getElementById)
    GetElement = function(id){ return document.getElementById(id); };
  else if(document.all)
    GetElement = function(id){ return document.all[id]; };
  else if(document.layers)
    GetElement = function(id){ return document.layers[id]; };
  else
    GetElement = function() { return null; }
  
  return GetElement(id);
}
  

function switchHighlight(id1,id2)
{
  GetElement("highlight"+id1).style.display = "";
  GetElement("highlight"+id2).style.display = "none";
}

function Download(p)
{
    document.getElementById('download_'+p).submit();
}

function Buy(p)
{
    document.getElementById('buy_'+p).submit();
}
