

 function toprefswitch(pole,target,topref_current) {               
    var delka = pole.length;           
    if (topref_current[0] < (delka-1)) {
      topref_current[0]++;
    }
    else {
      topref_current[0] = 0;
    }
    //var nahodny = Math.ceil(Math.random()*delka)-1;
    document.getElementById(target).src = pole[topref_current[0]];
    return true;
 }




// z(ne)viditelneni prvku
function showElement(name1, fields, focus) {
	var obj1 = document.getElementById(name1);
	obj1.style.display = 'block';

	name1=name1+'-tb';
	var obj1 = document.getElementById(name1);
	obj1.className='tab-sel';

	// projdeme vsechny zalozky v poli ktere se maji schovat
	for (var i=0; i<fields.length; i++) {
		field_name=fields[i];
		obj=document.getElementById(field_name);

		if (obj!=null) {
			obj.style.display = 'none';

			name2=field_name+'-tb';
			var obj2 = document.getElementById(name2);
			if (obj2!=null) {
				obj2.className='';
			}
		}
	}

}





	var click_dis = false;

	function roll(item) {
		var pom;
		if (item.classNameRoll) {
			pom = item.classNameRoll;
			item.classNameRoll = item.className;
			item.className = pom;
		} else {
			item.classNameRoll = item.className;
			item.className = 'activ';
		}
	}

	function clickme(item) {
		var pom;
		if (click_dis)
		{
			click_dis = false;
			return;
		}
		if (item.className == item.classNameRoll) {
			item.classNameRoll = item.classNameClick;
			item.className = 'activ';
		} else {
			item.classNameClick = item.classNameRoll
			item.className = 'click';
			item.classNameRoll = 'click';
		}
	}

	function openPage(url, target, width, height) {
		lefti = (window.screen.width / 2) - (width / 2);
		topi = (window.screen.height / 2) - (height / 2);

		options = 'margin=5,scrollbars=yes,toolbar=0,resizable=yes,menubar=0'+(width>0&&height>0?',top=' + topi + ',left=' + lefti + ',width=' + width + ',height=' + height:'');
		win = window.open(url, target, options);
		win.focus();

		//zastaveni pripadneho probublavani
		click_dis = true;

		return (typeof(win) != 'object');
	}



/*
	function openImage(imgSrc) {
	    var img = new Image();
	    img.src = imgSrc;
	    width = img.width+40;
	    height = img.height+40;
	
		lefti = (window.screen.width / 2) - (width / 2);
		topi = (window.screen.height / 2) - (height / 2);

		options = 'margin=0,scrollbars=yes,toolbar=0,resizable=yes,menubar=0'+(width>0&&height>0?',top=' + topi + ',left=' + lefti + ',width=' + width + ',height=' + height:'');
		win = window.open(imgSrc, '', options);
		win.focus();

		//zastaveni pripadneho probublavani
		click_dis = true;

		return (typeof(win) != 'object');
	}
*/





	function openImage2()
	{
		var img = this;
		var width  = img.width  + 10;
		var height = img.height + 10;

		var lefti = (window.screen.width / 2) - (width / 2);
		var topi = (window.screen.height / 2) - (height / 2);


		options = 'margin=0,scrollbars=auto,toolbar=0,resizable=yes,menubar=0'+(width>0&&height>0?',top=' + topi + ',left=' + lefti + ',width=' + width + ',height=' + height:'');

		html = '<html><body style="margin:0;padding:0;text-align:center;"><a href="javascript:window.close();"><img src="' + img.src + '" width="'+width+'" height="'+height+'" border="0"></a></body></html>';

		win = window.open('', '', options);
		win.document.write(html);
		win.focus();

		//zastaveni pripadneho probublavani
		click_dis = true;

	}


	function openImage(imgSrc) {
	    var img = new Image();
		img.onload = openImage2;
	    img.src = imgSrc;

		return false;
	}


	function validate(prvek,validate)
	{
		var errorName = 'error';
		var className = '';

		value = prvek.value;
		if (validate == 'not-empty')
		{
			if (value=='')
				className = errorName;
		}

		if (validate == 'email')
		{
			var regular = new RegExp("^[a-zA-Z][a-zA-Z0-9\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][a-zA-Z0-9\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
			if (!regular.test(value)) className = errorName;

		}

		if (validate.substring(0,4)=='reg:')
		{
			if (value.ereg(validate.substring(4,value.length-4))) className = errorName;
		}

		prvek.className = className;
	}




/* form pro IE */
	var itemfocus = new Array();

	function ramecek(id)
	{
		element = document.getElementById(id);
		
		element.style.borderWidth = '1px';
		element.style.borderStyle = 'solid';
		element.style.borderColor = '#0E5A9F';
		element.style.backgroundColor = '#C1D8EA';
		element.style.margin = '0px';

		itemfocus[id] = true;
	}
	
	function ramecekblur(id)
	{
		itemfocus[id] = false;
		ramecekout(id);	
		
	}

	function ramecekover(id)
	{
		if(!itemfocus[id])
		{
			element = document.getElementById(id);
			
			element.style.borderWidth = '1px';
			element.style.borderStyle = 'solid';
			element.style.borderColor = '#0E5A9F';
			element.style.backgroundColor = '#FFFFFF';
			element.style.margin = '0px';
		}
	}
	
	function ramecekout(id)
	{
		if(!itemfocus[id])
		{
			element = document.getElementById(id);
			
      element.style.borderWidth = '1px';
		  element.style.borderStyle = 'solid';
		  element.style.borderColor = '#AAD1E8';
		  element.style.backgroundColor = '#FFFFFF';
		  element.style.margin = '0px';
		}
	}
	
	
		

