function togle(obj1) {
	//var obj=obj1.parentNode.nextSibling;
	var obj=obj1.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.firstChild;
	
	if(obj.style.display=='none')
	{
		obj.style.display='block';
		obj1.firstChild.src='images/but-green.gif';
		
	}
	else {
		obj.style.display='none';
		obj1.firstChild.src='images/but-red.gif';
	}
	return;
}
function togle_new(obj1) {
	//var obj=obj1.parentNode.nextSibling;
	var obj=obj1.parentNode.parentNode.parentNode.nextSibling.firstChild;
	if(obj.style.display=='none') {
		obj.style.display='block';
		obj1.firstChild.src=DOMAIN+'/images/cont/but-green.gif';
	}
	else {
		obj.style.display='none';
		obj1.firstChild.src=DOMAIN+'/images/cont/but-red.gif';
	}
	return;
}
function togle_special(obj1) {
	//var obj=obj1.parentNode.nextSibling;
	var obj=obj1.parentNode.parentNode.parentNode.nextSibling.firstChild;
	if(obj.style.display=='none') {
		obj.style.display='block';
		obj1.firstChild.src=DOMAIN+'/images/cont/s_but-green.gif';
	}
	else {
		obj.style.display='none';
		obj1.firstChild.src=DOMAIN+'/images/cont/s_but-red.gif';
	}
	return;
}
function rload(val) {
	if(!val) {
		val="0";
	}
	document.location.href=DM+"/index.php?m=boxes&gi="+val;
	return;
}
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function validates() {
	var txt=document.getElementById("search_text").value;
	txt=txt.trim();
	if(txt.length<4) {
		alert("Textul cautat trebuie sa aiba minim 4 caractere.");
		return false;
	}
	else {
		return true;
	}
}
var Request = new Object();
Request.send = function(url, method, callback, data) {
	var req;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	 else
	 {
			return;
	}
	req.onreadystatechange = function() {
		if (req.readyState == 4) {// only if req shows "loaded"
			if (req.status < 400) {// only if "OK"
				(method=="POST") ? callback(req) : callback(req,data);
			} else {
				//alert("There was a problem saving your changes :\n" + req.status+ "/" + req.statusText);
			}
		}
	}
	if (method=="POST") {
		req.open("POST", url, true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(data);
	} else {
		req.open("GET", url, true);
		req.send(null);
	}
	return req;
}

Request.sendGET = function(url, callback, args) {
	return Request.send(url, "GET", callback, args);
}
Request.sendPOST = function(url, data, callback) {
	Request.send(url, "POST", callback, data);
}
function saveRes(response) {
	return;
}
function saveStat(obj) {
	var idnew=obj.getAttribute("id");
	var tmp=idnew.split('_');
	if(tmp[1]) {
		Request.sendGET(DM+'/stat.php?idnew='+tmp[1],saveRes,true);
	}
}
function descdisplay(obj) {
	//alert(obj.parentNode.className);
	//alert(obj.parentNode.lastChild.style.display);
	if(obj.parentNode.lastChild.style.display=="none") {
		obj.parentNode.lastChild.style.display="block";
		obj.innerHTML=" - ";
	}
	else {
		obj.parentNode.lastChild.style.display="none";
		obj.innerHTML=" + ";
	}
}