function Confirm(URL, TXT) {
  	if (!confirm(TXT))
	{return} else {self.location=URL;}
}
function getNewSubmitForm(){
	var submitForm = document.createElement("form");
	document.body.appendChild(submitForm);
	submitForm.method = "post";
	return submitForm;
}
function createNewFormElement(inputForm, elementName, elementValue){
	var newdiv = document.createElement('input');
	newdiv.setAttribute("type", "hidden");
	newdiv.setAttribute("name", elementName);
	newdiv.setAttribute("value", elementValue);
	inputForm.appendChild(newdiv);
}
function addEvent(AddToDiv, NewDivId, code) {
	var ni = document.getElementById(AddToDiv);
	newdiv = document.createElement('div');
	newdiv.setAttribute("id", NewDivId);
	newdiv.innerHTML = code;
	ni.appendChild(newdiv);
}
function removeEvent(ToDiv, DivName) {
  	dre = document.getElementById(ToDiv);
  	RemoveDiv = document.getElementById(DivName);
	dre.removeChild(RemoveDiv);
}
function ButOverStyle(cell, cell_class) {       
	if (cell) {
		cell.oldclass = cell.className;   // save colour
		cell.className=cell_class;// change
	} 
}

function ButOutStyle(cell) {
	if (cell) {
		cell.className = cell.oldclass;
	}
}
function selected_option(form, obj, sel) {
	obj1=document[form][obj];
	for (isp=0; isp < obj1.options.length; isp++) {
		if (obj1.options[isp].value==sel) { obj1.options[isp].selected=true;}
	} 
}
function openPop(url, width, height, name, scroll) {
	var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
	var x = parseInt(screen.width / 2.0) - (width / 2.0);
	var y = parseInt(screen.height / 2.0) - (height / 2.0);
	if (typeof(scroll) == "undefined")
		scroll = "no";
	if (isMSIE) {
		width += 15;
		height += 35;
	}
	var win = window.open(url, name, "top=" + y + ",left=" + x + ",scrollbars="+ scroll +",modal=yes,width=" + width + ",height=" + height + ",resizable=yes");
	win.focus();
}
function insertURL(input, url) {
	
	var win, close = false;
	if (window.opener) {
		win = window.opener;
		close = true;
	} else
		win = parent;
	if ((pos = url.indexOf('?')) != -1)
		url = url.substring(0, url.indexOf('?'));
	if (win && js != "") {
		eval("win." + js + ";");
		if (close)
			top.close();
		return;
	}
	if (win && formname != "") {
		var elements = elementnames.split(',');

		for (var i=0; i<elements.length; i++) {
			var elm = win.document.forms[formname].elements[elements[i]];
			if (elm && typeof elm != "undefined")
				elm.value = url;
		}
		if (close)
			top.close();
	}
	if (close)
		top.close();
} 