
function delDDPI(id)
{
	if (confirm("Are you sure you want to delete this item?")) 
	{
   		var status = getXMLHTTPResponse("ajax_ncf.php", "m=delddpi&ddpi_id="+id );
		location.reload();
		if (status=="")
		{
			alert("Deleted!");
		} else {
			alert("An error occured: "+status);
		}
	}
	return false;
}



function popupChart(id)
{
	if(!!document.getElementById(id+"_popup"))
	{ 
		return false;
	}
	
	var posx = 0;
	var posy = 0;

	if (window.innerHeight) //ff 
	{
		var theHeight = window.innerHeight;
		var theWidth = window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientHeight)
	{
		var theHeight = document.documentElement.clientHeight;
		var theWidth = document.documentElement.clientWidth;
	} else if (document.body) //ie
	{
		var theHeight = document.body.clientHeight;
		var theWidth = document.body.clientWidth;
	}

	var w = theWidth-40;
	var h = theHeight-40;
	posx = Math.round((theWidth-w-20)/2); 
	posy = Math.round((theHeight-h-20)/2); 

    var div = document.createElement("div");
    div.id = id+"_popup";

    div.style.position = "absolute";
    div.style.left = posx+"px";
    div.style.top = posy+"px";
	
	div.style.height = h+"px";
	div.style.width = w+"px";

	div.style.background = "white";
	div.style.border = "solid black 1px";
	div.style.padding = "10px";

	//div.style.display = "none";

    div.innerHTML = "<b class='text' valign='top' style='float:right; margin-bottom: 3px;'><a href='#' onclick='return expandChart();'>Close</a></b>";
    div.innerHTML += "<div id='chart2div'></div>";
    document.body.appendChild(div);

	var chart2 = new FusionCharts('lib/charts/flash/MSCombiDY2D.swf', 'ecxChart2', (w-20), (h-20), '0', '1');
	chart2.setDataURL('ncf_xml/data/data_full.xml');
	chart2.render('chart2div');
	
    return false;
}


var FC_expanded = false;
function expandChart(){
	if (FC_expanded){
		var d = document.getElementById("chart_popup");
		d.parentNode.removeChild(d);
		document.getElementById("chart_container").style.display="";
		//document.getElementById("chart_popup").style.display="none";
	} else {
		document.getElementById("chart_container").style.display="none";
		popupChart("chart");
		//document.getElementById("chart_popup").style.display="";
	}
	FC_expanded = !FC_expanded;
	return false;
}

function changeNewsDate(date)
{
	location = "?p=news&d="+date;
}
	