var detail=null;
var bgcolor=null;
function open_details(id){
	if(!document.getElementById("cu_detalii_header_" + id)) return false;
	//inchid daca era ceva deschis
	if(detail != null || detail==id){
		//document.getElementById("cu_detalii_" + detail).style.display="none";
		document.getElementById("cu_detalii_butoane_" + detail).style.display="none";
		document.getElementById("cu_detalii_header_" + detail).style.display="none";
		document.getElementById("fara_detalii_" + detail).style.display="";
	}
	//deschid
	if(detail != id){
		detail=id;
		document.getElementById("fara_detalii_" + id).style.display="none";
		//document.getElementById("cu_detalii_" + id).style.display="";
		document.getElementById("cu_detalii_butoane_" + id).style.display="";
		document.getElementById("cu_detalii_header_" + id).style.display="";
	}
	else detail=null;
}
function add_cos(url){
	window.location.href=url;
}
function onmouseover_select(src){
	if(src.checked) src.title="Deselecteaza acest anunt";
	else src.title="Selecteaza acest anunt";
	return;
}
$(document).ready(
    function(){
    	$("span[id^='convertor_']").one("click", function(){
    		//popUp(event,'tooltip_pret');
    		alert("test");
		});
		$("span[@AnuntID]").hover(
		  function () {
		  	$("#tooltip_pret").attr('innerHTML', '<b>Conversie</b><br/><font color=red>' + $(this).attr('eur') + '</font> EUR<br/>' + '<font color=red>' + $(this).attr('usd') + '</font> USD<br/>' + '<font color=red>' + $(this).attr('ron') + '</font> RON<br/>');
		  	//$("#tooltip_pret").load(ajax_path + "ajax_convertor.php?AnuntID="+ $(this).attr('AnuntID'));
		  	popUp(event,'tooltip_pret');
		    //$(this).append($("<span> ***</span>"));
		  }, 
		  function () {
		  	$("#tooltip_pret").attr('innerHTML', '');
		    popUp(event,'tooltip_pret')
		  }
		);
    	$("input:checkbox").click(function(){
			$("#cos_count").load(ajax_path + "ajax_cos.php?Add=" + this.checked + "&AnuntID="+ $(this).attr("AnuntID"));
			if(cos==1 && !this.checked) {
				document.getElementById("anunturi_body").deleteRow(document.getElementById("fara_detalii_" + $(this).attr("AnuntID")).sectionRowIndex);
				if(document.getElementById("cu_detalii_header_" + $(this).attr("AnuntID")))
					document.getElementById("anunturi_body").deleteRow(document.getElementById("cu_detalii_header_" + $(this).attr("AnuntID")).sectionRowIndex);
				if(document.getElementById("cu_detalii_butoane_" + $(this).attr("AnuntID")))
					document.getElementById("anunturi_body").deleteRow(document.getElementById("cu_detalii_butoane_" + $(this).attr("AnuntID")).sectionRowIndex);
			}
			if(document.getElementById("chk_cd_" + $(this).attr("AnuntID"))) document.getElementById("chk_cd_" + $(this).attr("AnuntID")).checked=this.checked;
			if(document.getElementById("chk_fd_" + $(this).attr("AnuntID"))) document.getElementById("chk_fd_" + $(this).attr("AnuntID")).checked=this.checked;
		});


	}
);

