// JavaScript Document

function submitForm( formular, additionalGETdata, actionSrc )
{
//		window.alert(actionSrc );
	if ( actionSrc != null ) formular.action = actionSrc;
	if ( additionalGETdata != "" ) formular.action = formular.action + "?" + additionalGETdata;
	formular.submit();
}

function bt( n, c){         
  //this.document.form_book.text.value = this.document.form_book.text.value + \"\" + n + \"\";
  document.getElementById(c).value = document.getElementById(c).value + n ;
  document.getElementById(c).focus();
} 

// JScript source code
function setRowCellsColor( row, color )
{
	for( i=0; i<row.cells.length; i++ )
	{
		row.cells.item(i).bgColor=color;
	}
}

// Create a cookie with the specified name and value.
// The cookie expires at the end of the 20th century.
function SetCookie(sName, sValue)
{
  date = new Date();
  document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();
}


function rowClicked( row ){
	if( document.m_selected_row != null ){
		setRowCellsColor( document.m_selected_row, document.m_selected_row.bgColor );
		document.m_selected_row.style.color="#595959";
	}
	setRowCellsColor( row, "#3BBBE4" );
	row.style.color="#FFFFFF";
	
	document.m_selected_row = row;
	SetCookie("ID_sel",document.m_selected_row.ID);
}

function cellClicked( cell ){
	if( m_selected_row != null ){
		m_selected_row.bgColor = null;
		m_selected_row.style.color="#595959";
	}
	cell.bgColor = "#ca4212";
	cell.style.color="#ffff00";
	
	m_selected_row = cell;
	SetCookie("ID_sel",m_selected_row.ID);
}


//-- validate 
function validate(formular)
{
ktu=formular.ktu.value;

    if (formular.kategorie.value=="")
    {
        alert("Nevyplnili ste kategóriu.");
        formular.kategorie.focus();
        return false;
    }
    else if (formular.typ.value=="")
    {
        alert("Nevyplnili ste typ.");
        formular.typ.focus();
        return false;
    }
    else if (formular.nazov.value=="")
    {
        alert("Nevyplnili ste názov.");
        formular.title.focus();
        return false;
    }
    else if (formular.popis.value=="")
    {
        alert("Nevyplnili ste popis.");
        formular.popis.focus();
        return false;
    }
    else if (formular.cena.value=="")
    {
        alert("Nevyplnili ste cenu.");
        formular.cena.focus();
        return false;
    }
}


function print_list(path) 
{
	window.open(path,'print','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,width=680,height=545,left=50,top=50');
}

function print_inz(path) 
{
	window.open(path,'print','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,width=560,height=400,left=50,top=50');
}

function send_email(path) 
{
	window.open(path,'email','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,width=400,height=200,left=50,top=50');
}

function write_date()
{
var thetime=new Date(); 
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";

if (nday==0)
nday="Nedeľa";
if (nday==1)
nday="Pondelok";
if (nday==2)
nday="Utorok";
if (nday==3)
nday="Streda";
if (nday==4)
nday="Štvrtok";
if (nday==5)
nday="Piatok";
if (nday==6)
nday="Sobota";

nmonth+=1;

if (nyear<=99)
nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
nyear+=1900;

document.write("je "+nday+", "+ntoday+"."+nmonth+"."+nyear);

}