var DHTML = (document.getElementById || document.all || document.layers);
var flag = 1;
var flag2 = 1;

//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

function makevisible(cur,which){
	strength = (which==0) ? 1 : 0.7;
	
	if (cur.style.MozOpacity)
		cur.style.MozOpacity=strength
	else if (cur.filters)
		cur.filters.alpha.opacity=strength*100
}


function highlight(points){
 var mapa;
 mapa = document.getElementById('points');

 switch(points){

   case('points_0')			:  mapa.style.backgroundPosition = '0px 0px'; break;
   case('points_1')			:  mapa.style.backgroundPosition = '0px -23px'; break;
   case('points_2')			:  mapa.style.backgroundPosition = '0px -46px'; break;
   case('points_3')			:  mapa.style.backgroundPosition = '0px -69px'; break;
   case('points_4')			:  mapa.style.backgroundPosition = '0px -92px'; break;
   case('points_5')			:  mapa.style.backgroundPosition = '0px -115px'; break;
   case('points_6')			:  mapa.style.backgroundPosition = '0px -138px'; break;
   case('points_7')			:  mapa.style.backgroundPosition = '0px -161px'; break;
   case('points_8')			:  mapa.style.backgroundPosition = '0px -184px'; break;
   case('points_9')			:  mapa.style.backgroundPosition = '0px -207px'; break;
   case('points_10')			:  mapa.style.backgroundPosition = '0px -230px'; break;


   case('none')			:  mapa.style.backgroundPosition = '0 0'; break;
   case('')				:  mapa.style.backgroundPosition = '0 0'; break;
 }

}

function mailThisUrl(user,pass) {
	u = window.location;
	m = "ROBOTA";
	
	// the following expression must be all on one line...
	// window.location = "mailto:"+document.selected.address.value+"?subject="+m+"&body="+document.title+" "+u;
	base_url = 'http://www.robota.cz';
	if(typeof(url) == 'object'){
		for(i=0;i<url.length;i++){
    		final_url += base_url + url[i] + "\n";// něco se dělá s promenna[i]
		}
	} else {
		final_url = base_url;
		final_url += "<br><br>";
		final_url += " user: "+user+"<br>";
		final_url += " password: "+pass;
	}
	window.location = "mailto:?subject="+m+"&body="+final_url;
}

// Return a boolean value telling whether // the first argument is an Array object. 
function isArray() {if (typeof arguments[0] == 'object') {  var 
	criterion = arguments[0].constructor.toString().match(/array/i); 
	return (criterion != null);  }return false;
}

function openPopup(sirka, vyska){
    availHeight = screen.height;
    availWidth = screen.width;

    if (availHeight < 342) {posTop = 0;}
    else {posTop = (availHeight - vyska)/2;}

    if (availWidth < 320) {posLeft = 0;}
    else {posLeft = (availWidth - sirka)/2;}

    atts = "width=" + sirka + ",height=" + vyska + ",toolbar=no,scrollbars=no,resizable=0,status=no,top=" + posTop + ",left=" + posLeft;
    window.open("files/popup", "_blank", atts);
}

function changev(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (x.style.display == "none") {
		flag=0;
		}
	else {
		flag=1;
	}
	x.style.display = (flag) ? "none" : "inline";
}

function changed(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	x.style.display = "none";
}

function change(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (x.className == "dir_link") {
		flag=1;
		}
	else {
		flag=0;
	}
	x.className = (flag) ? "dir_link_open" : "dir_link";
}

function changebg(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (x.style.background == "") {
		x.style.background = "#DDE8A5";
		}
	else {
		x.style.background = "";
	}
}


function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name); /*document.getElementById(name).style*/
	}
	else if (document.all)
	{
		return document.all[name]; /*document.all[name].style*/
	}
	else if (document.layers)
	{
		return document.layers[name];
	}
}


function gogogo() 
{
    var a = link+'/'+alloweduser+"/"+path;
    window.location = a;
}

/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;

/**
 * enables highlight and marking of rows in data tables
 *
 */
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 ...
        if ( navigator.appName == 'Microsoft Internet Explorer' ) {
            // but only for IE, other browsers are handled by :hover in css
            rows[i].onmouseover = function() {
                this.className += ' hover';
            }
            rows[i].onmouseout = function() {
                this.className = this.className.replace( ' hover', '' );
            }
        }
        // Do not set click events if not wanted
        if (rows[i].className.search(/noclick/) != -1) {
            continue;
        }

        // ... and disable label ...
        var labeltag = rows[i].getElementsByTagName('label')[0];
        if ( labeltag ) {
            labeltag.onclick = function() {
                return false;
            }
        }

    }
}
window.onload=PMA_markRowsInit;