// JavaScript Document
function createRequestObject() {

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }
   return req;
   

}

// Make the XMLHttpRequest object
var http = createRequestObject();
var div = "main";
function sendRequest(method, address, vars, div_name) {
   // Open PHP script for requests
   div=div_name;
   if (method=='get')
   {   var forceGET = "&ceva="+ parseInt(Math.random()*999999999);
       http.open(method, address+'?'+vars+forceGET);
       http.onreadystatechange = function () {return false;};
       http.send(null);
    }
    else
    {   var forceGET = "&ceva="+ parseInt(Math.random()*999999999);
        http.open(method, address);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = function () {return false;};
        http.send(vars+forceGET);
    }
}

function show(id)
{
if (document.getElementById(id))
{
if (document.getElementById(id).style.display == 'none')
{
document.getElementById(id).style.display = '';
}
}
}

function hide(id)
{
if (document.getElementById(id))
{
if (document.getElementById(id).style.display != 'none')
{
document.getElementById(id).style.display = 'none';
}
}
}

function switch_visible(id)
  {
  if (document.getElementById(id).style.display == 'none')
    {
    document.getElementById(id).style.display = '';
    }
  else
    {
	document.getElementById(id).style.display = 'none';
	}
  }
function blah(obj) {
   var rowObj = obj.parentNode;
   for (i = 0; i < rowObj.childNodes.length; i++) {
      //this line prevents firefox from treating whitespace as a childNode
      if (rowObj.childNodes[i].style) {
         rowObj.childNodes[i].className = (rowObj.childNodes[i] == obj) ? "sel" : "";
      }
   }
}

function show_sec(sec) { // pentru consumabile
  if (sec=='kituritbl') {document.cons_inkjet.src='/fp/nav_bar/cons_inkjet1.gif';}
  if (sec=='tonertbl') {document.cons_laser.src='/fp/nav_bar/cons_laser1.gif';}
  if (sec=='riboanetbl') {document.cons_matriceale.src='/fp/nav_bar/cons_matriceale1.gif';}
  if (sec=='termictbl') {document.cons_termice.src='/fp/nav_bar/cons_termice1.gif';}
}
function show_sec1(grupa, seria) {// pentru restul lumii
  if (grupa=='Medii de imprimare' && seria=='a3') {document.format_a3.src='/fp/nav_bar/format_a31.gif';}
  if (grupa=='Medii de imprimare' && seria=='a4') {document.format_a4.src='/fp/nav_bar/format_a41.gif';}
  if (grupa=='Medii de imprimare' && seria=='a6') {document.format_a6.src='/fp/nav_bar/format_a61.gif';}
  if (grupa=='Medii de imprimare' && seria=='etc') {document.etichete_etc.src='/fp/nav_bar/etichete_etc1.gif';}
  if (grupa=='cd') {document.cd.src='/fp/nav_bar/cd1.gif';}
  if (grupa=='dvd') {document.dvd.src='/fp/nav_bar/dvd1.gif';}
  if (grupa=='Dischete') {document.dischete.src='/fp/nav_bar/dischete1.gif';}
  if (grupa=='Memorii USB') {document.memorii_usb.src='/fp/nav_bar/memorii_usb1.gif';}
  if (grupa=='Imprimante') {document.imprimante_si_multifunctionale.src='/fp/nav_bar/imprimante_si_multifunctionale1.gif';}
}
//
function switch_view()
  {
	  op=document.getElementById('ceeste').selectedIndex;
	  if (op==0)
	    {// Persoana
		document.getElementById('persoanaSec').style.display = '';
		document.getElementById('firmaSec').style.display = 'none';
		}
	  if (op==1)
	    {// Firma
		document.getElementById('persoanaSec').style.display = 'none';
		document.getElementById('firmaSec').style.display = '';
		}
  }