function SureConfirm(url) {
	if(window.confirm('Confirm?')){ window.location=url }
}

// POPBOX start
var timeout;
function showPopBox(e,w,h,code) {
var x = (window.event) ? window.event.x : e.pageX;
var y = (window.event) ? window.event.y : e.pageY;
if (document.all) {
	var scroll = getScroll();
	y = y + scroll.y;
}
document.getElementById('popBox').style.width = w;
document.getElementById('popBox').style.height = h;
document.getElementById('popBox').style.top = y+10;
document.getElementById('popBox').style.left = x;
document.getElementById('popBox').innerHTML = code;
showDiv('popBox');
timeout = setTimeout("hideDiv('popBox');", 4000);
}

function showDiv(id) {
	document.getElementById(id).style.visibility = 'visible';
	document.getElementById(id).style.display = 'inline';
}

function hideDiv(id) {
	document.getElementById(id).style.visibility = 'hidden';
	document.getElementById(id).style.display = 'none';
}

function popBoxOut(){
	timeout = setTimeout("hideDiv('popBox');", 1000);
}

function getCode(Var_1, Var_2, displayBox) {
    var html = document.getElementById(displayBox).innerHTML;
    html = replace(html, '%VARIABLE_1', Var_1);
	html = replace(html, '%VARIABLE_2', Var_2);
	return html;
}

function doNothing() { }

function replace(a,b,c) {
	while (a.indexOf(b)>-1) {
		pos = a.indexOf(b); a = '' + (a.substring(0, pos) + c + a.substring((pos + b.length), a.length));
		}
	return a;
}

function getScroll() {
	if (document.all) {
		var ieBox = document.compatMode != 'CSS1Compat';
		var cont = ieBox ? document.body : document.documentElement;
		return {x:cont.scrollLeft, y:cont.scrollTop};
	} else {
		return {x:window.pageXOffset, y:window.pageYOffset};
	}
}
// POPBOX end

// CALENDAR start
function fAddListItem(strDate) {
	var dl=document.form.dateList;
	dl.options[dl.options.length]=new Option(strDate,strDate);
}

function fRemoveListItem(strDate) {
	var dl=document.form.dateList;
	for (var i=0;i<dl.options.length;i++)
		if (strDate==dl.options[i].value) break;
	dl.options[i]=null;
}

function submitByDates(fm) {	// construct the selected dates in the hidden form field allSelected
	fm.allSelected.value='';
	for (var i=0; i<fm.dateList.length; i++) {
		if (i>0) fm.allSelected.value+=',';
		fm.allSelected.value+=fm.dateList.options[i].value;
	}
	// fm.action='ByDate.php';
	//alert(fm.allSelected.value); // in your app you should call fm.submit() instead so that the allSelected.value can be submitted.
	fm.submit();
}

function fInitAgenda(y, m, d) {
	with (gfFlat_1) {
		fAddRange(y, m, d, false);
	}
	gfFlat_1.fRepaint();
	gfFlat_2.fRepaint();
}
// CALENDAR end