DOM=(document.getElementById)?1:0;
NS4=(document.layers)?1:0;
IE4=(document.all)?1:0;
DHTML = (DOM || NS4 || IE4);
Op5=(navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1)?1:0;

function getObj(name) {
	if (DOM) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else
	if (IE4) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else
	if (NS4) {
		this.obj = getObjNN4(document.name);
		this.style = this.obj;
	}
	return this;
}

function getObjNN4(obj,name) {
	var x = obj.layers;
	var thereturn;
	for (var i=0;i<x.length;i++) {
		if(x[i].id == name) thereturn = x[i];
		else if (x[i].layers.length) var tmp = getObjNN4(x[i],name);
		if (tmp) thereturn = tmp;
	}
	return thereturn;
}

function sGetObj(name) {
	if (DOM) return document.getElementById(name);
	else if (IE4) return document.all[name];
	else if (NS4) return getObjNN4(document,name);
}
 
 
function getWidth(obj) { return obj.offsetWidth; }
function getHeight(obj) { return obj.offsetHeight; }
 

 function change_on(styl){
	it = sGetObj('vyskoc');
	it.className = styl;
 }
 function change_off(){
	it = sGetObj('vyskoc');
	it.className = "vyskoc";
 }




/* FIX */

function fix_div_columns_height(cols) {
	var hmax = 0;
    for(var idx=0; cols[idx]; idx++) {
		h = getHeight(sGetObj(cols[idx]));
        if(h > hmax) hmax = h;
    }
	for(var idx=0; cols[idx]; idx++) {
		document.getElementById(cols[idx]).style.height = hmax+'px';
    }
}


/* FORM FUNCTIONS */



function Form() {
    this.name = '';
}

Form.prototype.init = function(name) {
    this.name = name;
}

Form.prototype.set = function(variable, value) {
    eval("document."+this.name+"."+variable+".value='"+value+"';");
}

Form.prototype.submit = function() {
    eval("document."+this.name+".submit()");
}

Form.prototype.get = function(name) {
    return eval("document."+this.name+"."+name+".value");
}

Form.prototype.change = function(name, value) {
    eval("document."+this.name+"."+name+"='"+value+"';");
}

/* COOKIE FUNCTIONS */



function createCookie(name,value,sec) {
	if (sec) {
		var date = new Date();
		date.setTime(date.getTime()+(sec*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


/* QUEUE FUNCTIONS */



function Queue() {
	this.queue = new Array();
}

Queue.prototype.add = function(name) {
	this.queue.push(name);
}

Queue.prototype.process = function() {
	var func = '';
	while(this.queue.length > 0) {
		func = this.queue.shift();
		eval(func);
	}
}



/* QUEUE */



init_queue = new Queue();                                                                     
dest_queue = new Queue();                                                                     
form = new Form(); form.init('main');       



/*vyskakovani obrazku*/

function cms_picture(file) {
		 okno = window.open('', '', 'fullscreen=0,titlebar=0,locationbar=0,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,hotkeys=0,width=200,height=200');
		okno.document.open("text/html", "replace");
		okno.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
		okno.document.write('<HTML>');
		if (title == null) {
			title = 'Picture';
		}
		okno.document.write('<HEAD><title>picture</title></HEAD>');
		okno.document.write('<BODY BOTTOMMARGIN="0" TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" BGCOLOR="#FFFFFF" onload="resizeTo((document.images.picture.width+15),(document.images.picture.height+35))">');
		okno.document.write('<img src="'+file+'" border=0 name="picture" onclick="window.close(self)">');			
		okno.document.write('<SCRIPT language=\"Javascript\">');
		okno.document.write('moveTo(0,0);');
		okno.document.write('<\/SCRIPT>');
		okno.document.write('</body></html>');		
		okno.document.close();
		okno.focus();
	}	

