function showWindow(strURL, strNome, intWidth, intHeight, strOptions)
{
	intXPos = (screen.availWidth - intWidth) / 2;
	intYPos = (screen.availHeight - intHeight) / 2;
	window.open(strURL, strNome, 'top=' + intYPos + ',left=' + intXPos + ',width=' + intWidth + ',height=' + intHeight + ',' + strOptions);
}
	

// Mostra una message box
function mp_message(title_msg, text_msg, error_msg, width_msg, height_msg, icon_msg, admin_msg)
{
	//alert('/medianet/media_pro/common/mp_message.asp?title=' + title_msg + '&text=' + text_msg + '&icon=' + icon_msg);
	
	intXPos = (screen.availWidth - width_msg) / 2;
	intYPos = (screen.availHeight - height_msg) / 2;
	window.open('/medianet/media_pro/common/mp_message.asp?title=' + title_msg + '&text=' + text_msg + '&icon=' + icon_msg + '&admin=' + admin_msg + '&error=' + error_msg, 'winMPMsg', 'top=' + intYPos + ',left=' + intXPos + ',width=' + width_msg + ',height=' + height_msg + ',scrollbars=yes,resizable=yes');
}


function closeRefresh()
	{
		self.close();
		window.opener.location.reload();
	}
	
// Chiede conferma prima di chiudere una finestra
function closePopup(strConfirmText)
{
	if(confirm(strConfirmText))
	{
		self.close();
	}
}

// Chiede conferma prima tornare indietro
function confirmBack(strConfirmText)
{
	if(confirm(strConfirmText))
	{
		history.go(-1);
	}
}
	
// Mostra la finestra con il calendario
function CalPop(sInputName)
{
	window.open('common/Calendar.asp?N=' + escape(sInputName) + '&DT=' + escape(window.eval(sInputName).value), 'CalPop', 'toolbar=0,width=378,height=225');
}

// Dialog x inserimento ora
function timePopup(strInput, intWidth, intHeight)
{
	intXPos = (screen.availWidth - intWidth) / 2;
	intYPos = (screen.availHeight - intHeight) / 2;
	window.open('/medianet/media_pro/common/dlg_time.asp?input=' + escape(strInput), 'timePopup', 'top=' + intYPos + ', left=' + intXPos + ', width=' + intWidth + ', height= ' + intHeight + ',toolbar=0');
}

// Hihlight
function Highlight(e)
{
var r = null;
if (e.parentNode && e.parentNode.parentNode) {
	r = e.parentNode.parentNode;
}
else if (e.parentElement && e.parentElement.parentElement) {
	r = e.parentElement.parentElement;
}
if (r) {
	if (r.className == "appuntamento") {
	r.className = "appuntamento";
	}
	else if (r.className == "appuntamento") {
	r.className = "appuntamento";
	}
}
}


// Conferma e procede
function confirmEdit(strURL, strText)
{
	if(confirm(strText))
	{
		window.location = strURL;
	}
}


// ***** Hilite rows *****
function hiliteOn(row,my_color)
{
	var cells = row.cells;
	if (!cells) return;
	oldCellColor = cells[0].style.backgroundColor;
	for (var i=0;i<cells.length;i++)
	{
		cells[i].style.backgroundColor=my_color;
	}
}

function hiliteOff(row,my_color)
{
	var cells = row.cells;
	if (!cells) return;
	for (var i=0;i<cells.length;i++)
	{
		cells[i].style.backgroundColor=my_color;
	}
}
// ***********************


function confirm_exit()
{
	confirm_msg = confirm('Confermi l\'uscita da Media.Pro?');
	if(confirm_msg) {
		showWindow('logout.asp?mode=popup', 'win_logout', 200, 200);
	}
}