
function NewWin(Location, Width, Height) {
	var leftprop, topprop, screenX, screenY;
	if(navigator.appName == "Microsoft Internet Explorer") {
		screenY = document.body.offsetHeight;
		screenX = window.screen.availWidth;
	} else {
		screenY = window.outerHeight
		screenX = window.outerWidth
	}

	leftvar = (screenX - Width) / 2;
	rightvar = (screenY - Height) / 2;
	if(navigator.appName == "Microsoft Internet Explorer") {
		leftprop = leftvar;
		topprop = rightvar;
	} else {
		leftprop = (leftvar - pageXOffset);
		topprop = (rightvar - pageYOffset);
	}
	VP=window.open(Location,'NewWin','menubar=no,titlebar=no,toolbar=no,scrollbars=yes,status=no,width=' + Width + ',height=' + Height + ',left=' + leftprop + ',top=' + topprop + ',resizable=yes');
	VP.focus();
}


function UnloadCheck(){
	confirm("Are you sure you want to leave this page without saving?");
}

function Go(link) {
	location.href = link;
}

function colorCell(el, checkbox){

	if(checkbox){
		document.getElementById(el).style.backgroundColor = '#00BF1A';
	} else {
		document.getElementById(el).style.backgroundColor = '#FFFFFF';
	}
}

//alert('HERE');

function AddToList(el, div, hidden){

	// get current list
	var list = document.getElementById(div).innerHTML;
	var new_list =  list + '<br><a href="' + el.value + '">' + el.value + '</a>';
	document.getElementById(div).innerHTML = new_list;

	// update hidden
	document.getElementById(hidden).value = new_list;

	//alert(document.getElementById(hidden).value);
}

function DeleteLink(id){
	var url = document.getElementById(id).innerHTML;

}

function ShowElement(el){
	document.getElementById(el).style.display = 'block';
	document.getElementById('blockUI').style.display = 'block';

}

function HideElement(el){
	document.getElementById(el).style.display = 'none';
	document.getElementById('blockUI').style.display = 'none';
}

function toggleTable(id, state){
	var el = document.getElementById('table_' + id);
	if(el.style.display == 'block'){
		el.style.display = 'none';
	} else {
		el.style.display = 'block';
	}
}
