
	var http = createRequestObject();

	function createRequestObject()  {
		var ro; var browser = navigator.appName;
		if(browser == "Microsoft Internet Explorer") { ro = new ActiveXObject("Microsoft.XMLHTTP");}
		else { ro = new XMLHttpRequest(); } return ro;
	}
	
	function digResponse() {
		
		if(http.readyState == 4) {
		var response = http.responseText;
		returned = response.split('|');
		
		if(response.indexOf('|' != -1)) {
			var type=returned[0];
			var id=returned[1];
			var numdigs=returned[2];
			
			if ( type == 'names' ) {
			
				document.getElementById('vnames' + id).innerHTML = numdigs;
				document.getElementById('dnames' + id).className = 'entree_voting_voted';
				document.getElementById('unames' + id).className = 'entree_voting_voted';
			}
			
			if ( type == 'entrees' ) {
			
				document.getElementById('votes' + id).innerHTML = numdigs + ' votes';
				document.getElementById('ul_votes' + id).className = 'vote_inactive';
				
			}
			
			if ( type == 'comentarii' ) {
				document.getElementById('comd'+id).innerHTML = numdigs+' voturi';
				document.getElementById('cup'+id).className = 'opacityit';
				document.getElementById('cdown'+id).className = 'opacityit';
				document.getElementById('crow' + id).className = 'header_comentariu_inactive';
				
				if ( numdigs <= -9 ) {
					document.getElementById('commdesc'+ id).style.display = 'none';
					document.getElementById('commbut'+ id).innerHTML = 
					'[ <a href="javascript:dispcomment('+id+',true,0);">arata comentariu</a> ]';
				}
				
			}
			
		}}
	}
	
	function dig(type, id, dir) {
		http.open('get', 'http://www.afaceriagricole.net/classes/Comments_extra.php?type='+type+'&id='+id+'&dir='+dir);
		http.onreadystatechange = digResponse;
		http.send(null);
		
	}
	
	function dispcomment(id,show,ctype) {	
		var text = ''; var display = '';
		if ( show ) { text = '[ <a href="javascript:dispcomment('+id+',false,0);">ascunde comentariul</a> ]'; display = ''; }
		else { text = '[ <a href="javascript:dispcomment('+id+',true,0);">arata comentariul</a> ]'; display = 'none'; }
		
		document.getElementById('commdesc'+id).style.display = display;
		document.getElementById('commbut'+id).innerHTML = text;	
	}
	
	function comreply(id,reply){
		if ( id == 0 ) {
			document.getElementById('tr-reply').innerHTML = '<b>Adauga mesaj:</b>';
		} else {
			document.getElementById('tr-reply').innerHTML = '<b style="color: #FF8E08;">Raspuns comentariului scris de <span style="color: #000;">' + reply + '</span>:</b>';
		}
		document.getElementById('id_parinte').value = id;
	}
	
	function loginMsg( id, mesaj, arata ) {
		if ( arata == 1 ) {
			document.getElementById('mesaj' + id).innerHTML = mesaj;
		} else {
			document.getElementById('mesaj' + id).innerHTML = '';
		}
	}
	
	
	
	
	function Domsg(flag) {
		
		hidebox();
		
		if(flag=="intra") {
			window.location = "http://www.afaceriagricole.net/register.php";
		} else {
			if ( flag == "creeaza" ) {
				window.location = "http://www.afaceriagricole.net/register.php?action=register";
			}
		}
		
	}

	function DoFormbox( msgtext ) {
		var answer = confirm("Pentru a putea vota trebuie sa aveti cont.\r\n \r\n OK pentru a intra in cont sau a va inregistra \r\n Cancel pentru a renunta la vot");
		if (answer){
			window.location = "http://www.afaceriagricole.net/register.php";
		}
		else{
			false;
		}
	}
		function doSel(obj) {
		for (i = 1; i < obj.length; i++) {
			if (obj[i].selected == true) {
				location.href = obj[i].value;
			}
		}
	}