//**********************************************************************//
// Global Function for Show & UnShow object
//**********************************************************************//

var bshow=true;
var bshowes=1;

/*objGet('showextendsearchbox').value = GetbShowes();*/

function SetUnderline(element)
{	
	document.getElementById('searchdate0').className='normal';
	document.getElementById('searchdate1').className='normal';
	document.getElementById('searchdate2').className='normal';
	document.getElementById('searchdate3').className='normal';
	document.getElementById('searchdate4').className='normal';
	document.getElementById('searchdate5').className='normal';

	document.getElementById(element).className="darkblue_underline";
}

function SetbShowes(bshowesa)
{
	bshowes = bshowesa;
}

function GetbShowes()
{
	return bshowes;
}


function objShow (obj,on) 
{
	return objSetStyle(obj,'visibility',(on) ? 'visible':'hidden');
}
function objSetStyle (obj,prop,val) 
{
	var o = objGet(obj);
	if (o && o.style) {
		eval ('o.style.'+prop+'="'+val+'"');
		return true;
		}
	else return false;	
}
function objGet(x) 
{
	if (typeof x != 'string') return x;
	else if (Boolean(document.getElementById)) return document.getElementById(x);
	else if (Boolean(document.all)) return eval('document.all.'+x);
	else return null;
}
function objDisplay (obj,on,type) {
	if (on && !type) type = 'block';
	return objSetStyle(obj,'display',(on) ? type:'none');
	}

function ShowUnShow () {

if(bshow == true)
	{
	objDisplay('nabidkytydne',true,'block')
	bshow = false;
	}
	else
	{
	objDisplay('nabidkytydne',false,'block')
	bshow = true;
	}

	
}

function ShowUnShowExtendSearch () {
 

/*alert(bshowes == 1)*/
/*alert(bshowes);*/


if(bshowes == 1)
	{
	objDisplay('extendsearchbox',true,'block')
	
	objGet('linkextendsearchbox').className = 'bold';
	objGet('showextendsearchbox').value = 1;
/*	alert(objGet('showextendsearchbox').value);*/
	objShow ('searchgoogle1',false);
	objShow ('searchgoogle2',false);
/*	alert(objGet('searchtype').value);*/
	objGet('searchtype1').checked = true;
	objGet('searchtype2').checked = false;
	bshowes = 0;
	}
	else
	{
	objDisplay('extendsearchbox',false,'block')
	bshowes = 1;
/*	document.GetElementById('linkextendsearchbox').className = 'bold';*/
	objGet('linkextendsearchbox').className = 'normal';
	objGet('showextendsearchbox').value = 0;
	objShow ('searchgoogle1',true);
	objShow ('searchgoogle2',true);

	}

	
}

function SetShowUnShowExtendSearch ()
{
/*	alert(objGet('showextendsearchbox').value);*/

	if(objGet('showextendsearchbox').value == 1) 
		{
		objDisplay('extendsearchbox',true,'block')
		bshowes = false;
		objGet('linkextendsearchbox').className = 'bold';
		objGet('showextendsearchbox').value = 1;
		objShow ('searchgoogle1',false);
		objShow ('searchgoogle2',false);
		objGet('searchtype1').checked = true;
		objGet('searchtype2').checked = false;
		}
		else
		{
		objDisplay('extendsearchbox',false,'block')
		bshowes = true;
		objGet('linkextendsearchbox').className = 'normal';
		objGet('showextendsearchbox').value = 0;
		objShow ('searchgoogle1',true);
		objShow ('searchgoogle2',true);
		}

}

//**********************************************************************//



/*
 * Převrácení mailu
 */
function mailReverse(str) {
	if (str.substr(0, 7) != 'mailto:') return str;
	var res = 'mailto:';
	for(var i=1; i<=str.length-7;i++) res+=str.charAt(str.length-i);
	return res;
}



/**
 * Přesouvání položek mezi SELECTy
 * 
 * @param from zdrojový SELECT
 * @param to cílový SELECT
 * @param max maximální počet položek v cílovém SELECTu
 * @param error chybová hláška při překročení maxima
 */
function moveSelectItems(from, to, max) {
	// přesypání vybraných oborů
	if (max != 0 && to.length >= max)
		return;
	
	for (var i = 0; i < from.length; i++) {
		if (from.options[i].selected == true) {
			appendSelectItem(to, from.options[i].value, from.options[i].text);
			from.options[i] = null;
			from.options[i].selected = false;
			break;
		}
	}
}

/**
 * Vložení položky do SELECTu
 */
function appendSelectItem(select, itemID, itemName) {
	select.options[select.length] = new Option(itemName, itemID);
}
