var isWorking = false;

function updateContentArea(divName, varsPassed, url, fName) {
  	if(!fName){
		var fName = '';
		}

	function handleHttpResponse() {
	  if (http.readyState == 4) {
		if (http.responseText.indexOf('invalid') == -1) {
	    	if(divName.length>0){
				if(document.getElementById(divName)){
					document.getElementById(divName).innerHTML =  http.responseText; 
					if(fName.length>2){
						eval(fName);
						}
					}
				}
		  isWorking = false;
		}
	  }
	}	

	var http = '';
	if (window.XMLHttpRequest){
		// If IE7, Mozilla, Safari, etc: Use native object
		var http = new XMLHttpRequest();
		}else{
		if (window.ActiveXObject){
			// ...otherwise, use the ActiveX control for IE5.x and IE6
			var http = new ActiveXObject("Microsoft.XMLHTTP"); 
			}
		}


  if (http) {	  
    http.open("GET", url + "?" + varsPassed, true);
    http.onreadystatechange = handleHttpResponse;

    isWorking = true;
    http.send(null);
  }
}
function getHTTPObject() {
  var xmlhttp = '';
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

//var http = getHTTPObject(); // We create the HTTP Object

function addBlock(ID){
	url = "tigeradmin/modules/edit_content.php";
	varsPassed = "action=add&Group_ID="+ID;
	divName = "pointAndEdit_"+ID;
	updateContentArea(divName, varsPassed, url);
	}
	
function deleteBlock(Group, ID){
	if(confirm('Are you sure you want to delete this block?')){
		url = "tigeradmin/modules/edit_content.php";
		varsPassed = "action=delete&Group_ID="+Group+"&ID="+ID;
		divName = "pointAndEdit_"+Group;
		updateContentArea(divName, varsPassed, url);
		}else{
		}
	}

function open_edit_window(ID, format, bgColor){
//	window.name = "window"+ID;
	window.open("tigeradmin/modules/edit_content.php?bgColor="+bgColor+"&location=$location&format="+format+"&ID="+ID,"","toolbar=no,scrollbars=no,resizable=no,width=600,height=400")
	}			
