var articles_temporary=new Object;
function putValue(sel,to) {
	var opts=sel.getElementsByTagName('option');
	for (i=0;i<opts.length;i++)
	    {
	    if (sel.value==opts[i].value)
		   {
		   document.getElementById(to).innerHTML=opts[i].innerHTML;
		   }
	    }
	}
function addFile(id) {
	var p=document.createElement('p');
	document.getElementById(id).appendChild(p);
	p.innerHTML="<input class='text-input medium-input' type='text' id='medium-input' name='desc[]' /> <input type='file' name='file[]' onchange=\"addFile('files_holder');\">";
	}
function addAnswer(id) {
	var newdiv=document.createElement('p');
	document.getElementById(id).appendChild(newdiv);
	newdiv.innerHTML='<input class="text-input large-input" type="text" id="large-input" name="answer[]" />';
	}
function ucfirst(str) {
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}
function setMenu(id,status,type)
        {
        var xmlHttp;
        try
          {
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
              }
            }
          xmlHttp.open("GET","articles.php?action=menu&id="+id+"&status="+status+"&type="+type,true);
          xmlHttp.send(null);
          }
function putInitiale(judet)
        {
        var xmlHttp;
        try
          {
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
			  document.getElementById('initiala').options.length=0;
			  eval(xmlHttp.responseText);
			  //document.getElementById('initiala').innerHTML=xmlHttp.responseText;
              }
            }
          xmlHttp.open("GET","declaratii.php?action=getInitiale&judet="+judet,true);
          xmlHttp.send(null);
          }
function gotoUrl(judet) {
	var judete=new Object();
	judete['TM']='http://www.cjastm.ro/';
	judete['AR']='http://www.casar.ro/';
	judete['BH']='http://www.casbh.rdsor.ro/';
	judete['SM']='http://www.cassam.ro/';
	judete['MM']='http://www.casmm.ro/';
	judete['CS']='http://www.cjas-cs.ro/';
	judete['MH']='http://www.cjasmh.ro/';
	judete['HD']='http://www.cjashd.ro/';
	judete['GJ']='http://www.casgorj.ro/';
	judete['CJ']='http://www.cascluj.ro/';
	judete['SJ']='http://www.cassalaj.ro/';
	judete['AB']='http://www.casalba.ro/';
	judete['DJ']='http://www.casdj.ro/';
	judete['BN']='http://www.casbn.ro/';
	judete['MS']='http://www.casmures.ro/';
	judete['SB']='http://www.cassb.ro/';
	judete['VL']='http://www.casvl.ro/';
	judete['OT']='http://www.casot.ro/';
	judete['AG']='http://www.casag.ro/';
	judete['BV']='http://www.casbv.ro/';
	judete['HR']='http://cashr.topnet.ro/';
	judete['CV']='http://www.cascov.ro/';
	judete['TR']='http://www.castr.ro/';
	judete['DB']='http://www.casdb.ro/';
	judete['PH']='http://casph.mmc.ro/';
	judete['SV']='http://www.cassv.ro/';
	judete['NT']='http://www.casnt.ro/';
	judete['BC']='http://www.casbc.ro/';
	judete['B']='http://www.casmb.ro/';
	judete['IF']='http://www.casailfov.ro/';
	judete['BT']='http://www.casbt.ro/';
	judete['IS']='http://www.hih.ro/';
	judete['VS']='http://www.cjasvs.ro/';
	judete['VN']='http://www.casvn.ro/';
	judete['BZ']='http://www.casbz.ro/';
	judete['GL']='http://www.casgl.ro/';
	judete['BR']='http://www.casbr.ro/';
	judete['IL']='http://www.casil.ro/';
	judete['CL']='http://www.casacl.ro/';
	judete['GR']='http://www.casgr.ro/';
	judete['TL']='http://www.castl.x3m.ro/';
	judete['CT']='http://www.casct.ro/';
	window.open(judete[judet],'cnas_'+judet);
	}
function gotoDav(judet) {
	   $.prettyPhoto.open('declaratii.php?judet='+judet+'&iframe=true', 'Declaratii avere', '');
	}
function gotoDavP(judet) {
	   $.prettyPhoto.open('declaratii_p.php?judet='+judet+'&iframe=true', 'Declaratii avere', '');
	}
function openList(judet) {
        var xmlHttp;
        try
          {
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
			  document.getElementById('judet_container').innerHTML=xmlHttp.responseText;
              }
            }
          xmlHttp.open("GET","library/get_judet.php?action=list&judet="+judet,true);
          xmlHttp.send(null);
	}
function showLinks(judet,initiala) {
        var xmlHttp;
        try
          {
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
			  document.getElementById('judet_container').innerHTML=xmlHttp.responseText;
              }
            }
          xmlHttp.open("GET","library/get_judet.php?action=links&judet="+judet+"&initiala="+initiala,true);
          xmlHttp.send(null);
	}
document.getElementsByClassName = function(class_name) {
    var docList = this.all || this.getElementsByTagName('*');
    var matchArray = new Array();

    /*Create a regular expression object for class*/
    var re = new RegExp("(?:^|\\s)"+class_name+"(?:\\s|$)");
    for (var i = 0; i < docList.length; i++) {
        if (re.test(docList[i].className) ) {
            matchArray[matchArray.length] = docList[i];
        }
    }

	return matchArray;
}