/*              script creare fereastra pentru harta mare            */
function harta(mypage, img) {

w=636;//poza 600px
h=430;//poza 400px
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings ='height='+h+',';

settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no,';
settings +='status='+1+',';

settings +='resizable=no';
win=window.open(mypage,'',settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
/*                       script pentru meniu                         */
function toggleC(id){
	hideC();
	var doc = document.getElementById(id);
	doc.style.display = 'block';
}
function hideC(){
	var divs = document.getElementsByTagName('div');
	for (var i=0; i<divs.length; i++) {
		if(divs[i].className == 'infoBoxC') {
			divs[i].style.display = 'none';
		}
	}
}
function toggleVv(id){
	hideVv();
	var doc = document.getElementById(id);
	doc.style.display = 'block';
}
function hideVv(){
	var divs = document.getElementsByTagName('p');	
	for (var i=0; i<divs.length; i++) {
		if(divs[i].className == 'infoboxV') {
			divs[i].style.display = 'none';
		}
	}
}

function toggleDd(id){
	hideDd();
	var doc = document.getElementById(id);	
	doc.style.display = 'block';
}
function hideDd(){
	var divs = document.getElementsByTagName('p');
	
	for (var i=0; i<divs.length; i++) {
		if(divs[i].className == 'infoboxDd') {
			divs[i].style.display = 'none';
		}
	}
}




function toggleIi(id){
	hideIi();
	var doc = document.getElementById(id);
	doc.style.display = 'block';
}
function hideIi(){
	var divs = document.getElementsByTagName('p');
	for (var i=0; i<divs.length; i++) {
		if(divs[i].className == 'infoboxI') {
			divs[i].style.display = 'none';
		}
	}
}
function toggleCc(id){
	hideCc();
	var doc = document.getElementById(id);
	doc.style.display = 'block';
}
function hideCc(){
	var divs = document.getElementsByTagName('p');
	for (var i=0; i<divs.length; i++) {
		if(divs[i].className == 'infoboxCc') {
			divs[i].style.display = 'none';
		}
	}
}
/* scriptul pentru afisare produse */
 function changeStyle(objectON,modON,objectOFF,modOFF)
{
   document.getElementById(objectON).style.display = modON;
   document.getElementById(objectOFF).style.display = modOFF;
}
function changeImage(filename)
{
   document.mainimage.src = filename;
}
function changeImage1(id,block,none,rows)
{
for(i=0;i<rows;i++){
	if(id=='mari'+i){
	   document.getElementById('mari'+i).style.display = block;
	}
	if(id!='mari'+i){
	   document.getElementById('mari'+i).style.display = none;
	}
}
}
/*              scriptul pentru creare modul cautare                      */
function GetXmlHttpObject(handler)
{
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
}

function stateChangedLocalitate()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
            document.getElementById("txtResult1").innerHTML= xmlHttp.responseText;
    }
    else {
            //alert(xmlHttp.status);
    }
}
function stateChangedZona()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
            document.getElementById("txtResult2").innerHTML= xmlHttp.responseText;
    }
    else {
            //alert(xmlHttp.status);
    }
}

function htmlCautaLocalitate(url, qStr)
{
    if (url.length==0)
    {
        document.getElementById("txtResult1").innerHTML="";
        return;
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }

    url=url+"?"+qStr;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChangedLocalitate;
    xmlHttp.open("GET",url,true) ;
    xmlHttp.send(null);
}
function htmlCautaZona(url, qStr)
{
    if (url.length==0)
    {
        document.getElementById("txtResult2").innerHTML="";
        return;
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }

    url=url+"?"+qStr;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChangedZona;
    xmlHttp.open("GET",url,true) ;
    xmlHttp.send(null);
}
/*             functia de adaugare inca un camp pentru poze                */
var upload_number = 1;
function addFileInput() {
 	var d = document.createElement("p");
 	var file = document.createElement("input");

	file.setAttribute("type", "file");
 	file.setAttribute("name", "poza"+upload_number);
      d.appendChild(file);
 	document.getElementById("moreUploads").appendChild(d);
 	upload_number++;
}
/*                functia pentru adaugare localitate si zona               */
function stateChangeZona()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
            document.getElementById("txtResult4").innerHTML= xmlHttp.responseText;
    }
    else {
            //alert(xmlHttp.status);
    }
}
function stateChangedSpecial()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
            document.getElementById("txtResult").innerHTML= xmlHttp.responseText;
    }
    else {
            //alert(xmlHttp.status);
    }
}
function htmlAddZona(url, qStr)
{
    if (url.length==0)
    {
        document.getElementById("txtResult4").innerHTML="";
        return;
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }

    url=url+"?"+qStr;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChangeZona;
    xmlHttp.open("GET",url,true) ;
    xmlHttp.send(null);
}
function htmlDataSpecial(url, qStr)
{
    if (url.length==0)
    {
        document.getElementById("txtResult").innerHTML="";
        return;
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }

    url=url+"?"+qStr;
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChangedSpecial;
    xmlHttp.open("GET",url,true) ;
    xmlHttp.send(null);
}

/* begin custom functions */

  var doTheMathLink="/favorites_math.php";
  function doFavoriteMath (command, id, imgSRC, detailsURL, title, price){
  $j.post(doTheMathLink, { 
        command: command,
        id: id,
        imgSRC: imgSRC,
        detailsURL: detailsURL,
        title: title,
        price: price

  },
   function(data) {
     $j("#favoriteContentArticle").html(data);  
     //alert("Data Loaded: " + data);
   });
   
   
}


