function setCookie(NameOfCookie, value, expirehours) {
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expirehours * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) +
((expirehours == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) {
if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

function getCookie(NameOfCookie){
if (document.cookie.length > 0) {
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1) {
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));}}
return null;
}

function hideNotificationBox(){
	setCookie("notificationDiv", 'hide','50000');
	document.getElementById("notification").style.display = 'none';
}

function selectAll(control)
{
	for(var i = 0;i < control.length;i++){
		if (control.options[i].selected == false)
			control.options[i].selected = true;
	}	
	
}

function unSelectAll(control)
{
	for(var i = 0;i < control.length;i++){
		if (control.options[i].selected == true)
			control.options[i].selected = false;
	}	
	
}

/*
function cos(k) {
	//if(pagina_incarcata) alert(pagina_incarcata);
    var deja_ex = 0;
	if (getCookie("cosul"))
	{
		oldValue = getCookie("cosul");
		if (oldValue.indexOf("|"+k+"|") == -1)
		{
			//delCookie("cosul");
			newValue = oldValue + k + "|";
			setCookie("cosul", newValue, 0.1);
		}
		else
		{
	        deja_ex = 1;
		}
	}
	else 
	{
		setCookie("cosul", "||" + k + "|", 0.1);
	}

    s = unescape(document.cookie);
//alert(s);
    var k = -2;
    var ex = s.indexOf('|');
    while (ex > 0)
    {
        k ++;
        ex = s.indexOf('|',ex + 1);
    }



    if (k > 0)
    {
        if (deja_ex)
        {
            alert("Acest anunt este deja selectat.\nAi " + k+ " anunt(uri) selectate.\n\nPoti vedea anunturile selectate \nfacand click pe 'Selectia mea' din meniu.");
        }
        else
        {
            alert("Ai "+k+" anunt(uri) selectate.\n\nPoti vedea anunturile selectate \nfacand click pe 'Selectia mea' din meniu.");
        }
    }
    else
    {
        alert("Eroare\nInregistrarea nu a putut fi introdusa la anunturile selectate.\n\nVerifica daca optiunea 'accept cookies' este activata.");
    }
}
*/
function deschideConvertor() {
newWindow=window.open(root+"general/valuta.php","ConvertorValutar","width=256,height=200,left=400,top=300,alwaysRaised");
newWindow.focus();
}

function Help(daLink) {
    	var helpWnd=window.open(daLink,"help","width=400,height=400,scrollbars=yes,dependent=yes,toolbar=no");
}



function roll(img_name1, img_src1, img_name2, img_src2)
   {
   document[img_name1].src = img_src1;
   //document[img_name2].src = img_src2;
   }

function openW(file,sizex,sizey) { 
	var x = (screen.availWidth / 2) - sizex/2;
	var y = (screen.availHeight / 2) - sizey/2;	
	newWindow=window.open(file, "Logo","scrollbars,resizable,left="+x+",top="+y+",width="+sizex+",height="+sizey+",left=0,top=0,alwaysRaised"); 
	newWindow.focus(); 
}


function opWindow(href,categorie) {		
		var x = (screen.availWidth / 2) - 400;
		var y = (screen.availHeight / 2) - 300;
		var x_pos = (screen.availWidth / 2) - 400;
		var y_pos = (screen.availHeight / 2) - 300;
		//alert (categorie);
		var ref = href+""+categorie;
        window = window.open(""+ref+"", "Search", "toolbar=yes,scrollbars=yes,width=800,height=600,left="+x_pos+",top="+y_pos);
        window.focus();
}
function submitFormAdaugare(){
document.getElementById("corecteaza").value=1;
document.op.submit();
}
