function pop_win(url)
{
	window.open(url,'','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
}


function ajaxObject()
{
	if (document.all && !window.opera)
	    obj = new ActiveXObject("Microsoft.XMLHTTP");
	else
	    obj = new XMLHttpRequest();

	return obj;
}



function warn(url,type)
{
	
	var conf = "";
  
	switch(type)
	{
		case 'modules':
			var conf = confirm("Are tou sure you want to remove this module?");
		break;
		
		case 'rule':
			var conf = confirm("Are you sure you want to remove this rule?");
		break;		
				
		case 'def':
			var conf = confirm("Are you sure you want to remove this?");
		break;		
		
		case '':
			var conf = confirm("Are you sure you want to remove this?");
		break;	
	}
	
	
	if(conf == true)
		window.location=url;
	else
		return false;
}


function goto(url)
{
	window.location=url;
}


function ajax(ajaxMethod, ajaxUrl, ajaxDiv, ajaxOutput,par1)
{ 
    var ajaxHttp = ajaxObject();
    url=ajaxUrl+"?sid="+Math.random()+"&"+par1;
	ajaxHttp.open(ajaxMethod, url); 
    ajaxHttp.onreadystatechange = function()
    {
		if(ajaxHttp.readyState == 4)
		{
		    var ajaxResponse = ajaxHttp.responseText;
		    
		   // alert(ajaxResponse);
		    if (ajaxOutput == "innerHTML")
				document.getElementById(ajaxDiv).innerHTML = ajaxResponse;
		    else if (ajaxOutput == "value")
		    {
				document.getElementById(ajaxDiv).value = ajaxResponse;									
		    }
		}
		else
		    document.getElementById(ajaxDiv).innerHTML = "<div align='center' width='100%'><img src='../images/load.gif'></div>"
		
    }
    ajaxHttp.send(null);
}

function show_div(id)
{
	/**
	 * face toggle la starea unui div al carui nume vine prin param id, cele 2 stari sunt: vizibil, invizibil
	 * @param int id - id-ul divului a cui stare vreau sa o schimb
	 */
	
	var divName = 'mess_'+id;
	var btnName = 'btn_'+id;
	if (document.getElementById(divName).style.display == 'none')
	{
		document.getElementById(divName).style.display = '';
		document.getElementById(btnName).value = 'Ascunde';
	}
	else
	{
		document.getElementById(divName).style.display = 'none';
		document.getElementById(btnName).value = 'Detalii';
	}		
}

