/* ODSTRANENI MEZER ZE ZACATKU A KONCE RETEZCE */
function trim(str)
{
	return str.replace(/^\s+/, '').replace(/\s+$/, '');
}



/* Ext WINDOW */
function ExtWnd(name, url, x, y,mode){
	if (mode==1){
		scrh = screen.height/2-100;
		scrw = screen.width/2-150;
		windowprops = ' scrollbars=no, resizable=no,';
		windowprops += ",top="+scrh+",left="+scrw;
	}else{
		windowprops	= " "+mode;
	}
	okno = window.open( url , name, 'toobar=no, location=no, directories=no, status=no, , copyhistory=no, width='+x+',height='+y+windowprops+'');
	okno.focus();
}



/* 	FUNKCE ZKONTROLUJE, ZDA UZIVATEL NEODESILA PRAZDNY FORMULAR S ODPOVEDI NA ULOHU */
function CheckAnswerForm()
{
	var showmode=document.getElementById('show_mode').value;
	var pocet=document.forms[0].length;
	var formOK=false;

	switch(showmode)
	{
		/* VYBER Z MOZNYCH ODPOVEDI */
		case 'RADIO_BUTTONS':
			for(index=0; index<pocet; index++)
			{
				var type=document.forms.main[index].type;
				var value=document.forms.main[index].checked;
				
				/* vyberu pouze radio buttony */
				if(type=='radio')
				{
					if(value==true)
					{
						formOK=true;
						break;
					}
					else
					{
						formOK=false;
					}
				}
			}
			break;
	
		/* VPISUJE DO TEXTOVEHO POLE */
		case 'INPUT_BOX':
			for(index=0; index<pocet; index++)
			{
				var type=document.forms[0][index].type;
				var value=document.forms[0][index].value;
				
				/* prochazim pouze input boxy */
				if(type=='text')
				{
					if(trim(value)=='')
					{
						formOK=false;
						break;
					}
					else
					{
						formOK=true;
					}
				}
			}
			break;

		/* TEXTOVE POLE PREDVYPLNENE */
		case 'INPUT_BOX_FILLED':
			var value=document.getElementById('odpoved1').value;
			
			if(trim(value)=='')
			{
				formOK=false;
			}
			else
			{
				formOK=true;
			}
			break;
			
	}
	
	
	return formOK;
}
