//var pp_currentTab="pp_overview"; 
var pp_divs= ["pp_overview", "pp_screenshots", "pp_manual", "pp_download"]; 
var pp_tabs= ["pp_tab_overview", "pp_tab_screenshots", "pp_tab_manual", "pp_tab_download"]; 


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 pp_ShowTab(tabName)
{
  var x;

  for(x in pp_divs)
  {
    var div = GetElement(pp_divs[x]);
    var tab = GetElement(pp_tabs[x]);

    if (div.id==tabName)
    {
      div.style.display = "block";
          tab.className="hover";
        }
    else
    {
      div.style.display = "none";
          tab.className="";
    }
  }
}



function GetXMLHTTPRequest()
{
  // массив функций
  var XMLHttpFactories = [
    function () {return new XMLHttpRequest()},
    function () {return new ActiveXObject("Microsoft.XMLHTTP")},
    function () {return new ActiveXObject("Msxml2.XMLHTTP")},
    function () {return new ActiveXObject("Msxml3.XMLHTTP")}
  ];

  var xmlhttp = null;
  for (var i=XMLHttpFactories.length-1; i>=0; i--) 
  {
    try 
    {
      xmlhttp = XMLHttpFactories[i]();
    }
    catch (e) 
    {
      continue;
    }

    return XMLHttpFactories[i]();
  }
}

var req = GetXMLHTTPRequest();

function OnSE()
{
  if (req.readyState != 4) return;

  if (req.status == 200) 
  {
      alert(req.responseText);
  } 
  else 
  {
      alert(req.statusText);
  }   
}

// usage: SendEmail("menu60_3",1);

function SE(productid,id)
{
  SE_Show(0,id);

  req.open("POST", "/include/_se.php", true);
  req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  req.onreadystatechange = OnSE;
  req.send("productid="+productid+"&id="+id+"&e="+GetElement("e"+id).value);
}

function SE_Show(show,id)
{
/*alert(GetElement("download_card_footer"+id).style.display);
alert(GetElement("download_card_footer_se"+id).style.display);*/
  if (show==1)
  {
    GetElement("download_card_footer"+id).style.display = "none";
    GetElement("download_card_footer_se"+id).style.display = "";
  }
  else
  {
    GetElement("download_card_footer_se"+id).style.display = "none";
    GetElement("download_card_footer"+id).style.display = "";
  }

}

function Buy(p)
{
    document.getElementById('buy_'+p).submit();
}
