function redirect_confirm(message,url) {
	if (confirm(message)) {
		window.location.href=url;
	}
}

function redirect(url) {
	window.location.href=url;
}

function message(message) {
	alert(message);
}

function select_checkbox(field_id,spanId)
{
	if(document.getElementById(spanId).getAttribute('checked'))
	{
		var previouse_value=document.getElementById(field_id).value;
		document.getElementById(field_id).value=previouse_value+spanId+'=add&';
	}
	else
	{
		var previouse_value=document.getElementById(field_id).value;
		document.getElementById(field_id).value=previouse_value+spanId+'=rm&';
	}
}

function PMA_markRowsInit() {
	// for every table row ...
	var rows = document.getElementsByTagName('tr');
	for ( var i = 0; i < rows.length; i++ ) {
		// ... with the class 'odd' or 'even' ...
		if ( 'odd' != rows[i].className.substr(0,3) && 'even' != rows[i].className.substr(0,4) ) {
			continue;
		}
		// ... add event listeners ...
		// ... to highlight the row on mouseover ...

		rows[i].onmouseover = function() {
			this.className = 'hover';
		}

		if('odd' != rows[i].className.substr(0,3))
		{
			rows[i].onmouseout =  function()
			{
				this.className = 'odd';
			}
		}

		if('even' != rows[i].className.substr(0,4))
		{
			rows[i].onmouseout =  function()
			{
				this.className = 'even';
			}
		}
		// Do not set click events if not wanted
		if (rows[i].className.search(/noclick/) != -1) {
			continue;
		}
		// ... and to mark the row on click ...
		rows[i].onmousedown = function() {
			var unique_id;
			var checkbox;

			checkbox = this.getElementsByTagName( 'input' )[0];
			if ( checkbox && checkbox.type == 'checkbox' ) {
				unique_id = checkbox.name + checkbox.value;
			} else if ( this.id.length > 0 ) {
				unique_id = this.id;
			} else {
				return;
			}

			if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
				marked_row[unique_id] = true;
			} else {
				marked_row[unique_id] = false;
			}

			if ( marked_row[unique_id] ) {
				this.className += ' marked';
			} else {
				this.className = this.className.replace(' marked', '');
			}

			if ( checkbox && checkbox.disabled == false ) {
				checkbox.checked = marked_row[unique_id];
			}
		}

		// ... and disable label ...
		var labeltag = rows[i].getElementsByTagName('label')[0];
		if ( labeltag ) {
			labeltag.onclick = function() {
				return false;
			}
		}
		// .. and checkbox clicks
		var checkbox = rows[i].getElementsByTagName('input')[0];
		if ( checkbox ) {
			checkbox.onclick = function() {
				// opera does not recognize return false;
				this.checked = ! this.checked;
			}
		}
	}
}


function init_load()
{
	PMA_markRowsInit();
}

window.onload=init_load;

function popUp(URL) 
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('" + URL + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=600,left = 0,top = 0');");
}