// JavaScript Document


function schimba_banner(url, nume){
   box = document.getElementById('banner_box');	
   //box.innerHTML = ajaxRequest.responseText;
   document['banner'].src=url+nume;
   //alert (document['banner'].height);
   //navigator.userAgent.toLowerCase().indexOf('chrome')   
   if (navigator.userAgent.toLowerCase().indexOf('msie')>-1){
      document['banner'].style.marginTop=(240-document['banner'].height)/2+'px';
   }
   textarea = document.getElementById('cod_banner')
   textarea.value = ante_value + url + nume + post_value;
   textarea = document.getElementById('cod_votat')
   textarea.value = ante_value_vot + url + nume + post_value;
}

//pentru cautarea de pe prima pagina
function change_box (c, tip){
   var box = document.getElementById("box");
   box.className = c;
   document.s_form.tip.value=tip
	//return false;
}


//arata  adaugarea de ID
function open_id (radio, nume){
   open_div (nume);  
   var obj = document.getElementById('tip_'+radio);
   obj.checked="checked";
   return false;
}

//arata  adaugarea de ID
function open_div (nume){
   var box = document.getElementById(nume);
   box.style.display='block';   
   return false;
}

//arata  adaugarea de ID
function close_div (nume){
   var box = document.getElementById(nume);
   if (box != null){
      box.style.display='none';   
   }
   return false;
}

//initiaza ajax
function ajax_request(){
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	return ajaxRequest;
}

function ajaxPropune(){
var ajaxRequest;  // The variable that makes Ajax possible!
	ajaxRequest = ajax_request();
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById ('form_propune');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;

		}
	}
	id_parinte = document.propune_subcat.id_parinte.value;
	titlu = document.propune_subcat.titlu.value;
	queryString = "&id_parinte="+id_parinte+"&titlu="+titlu;
	ajaxRequest.open("GET", "ajax/site.php?do=propune_subcat"+queryString, true);
	ajaxRequest.send(null); 
	return false;	
}

function selecteaza(){
   document.getElementById("cod").select();
}