/*
var act = 1;	



function chPic()
{

	obr1 = new Image(180,128);
	obr1.src = "webStyles/vivien/design/hlavicka-frame1.jpg";
	obr2 = new Image(180,128);
	obr2.src = "webStyles/vivien/design/hlavicka-frame2.jpg";
	obr3 = new Image(180,128);
	obr3.src = "webStyles/vivien/design/hlavicka-frame3.jpg";
	obr4 = new Image(180,128);
	obr4.src = "webStyles/vivien/design/hlavicka-frame4.jpg";
	obr5 = new Image(180,128);
	obr5.src = "webStyles/vivien/design/hlavicka-frame5.jpg";
	
	if( act < 5 )
		act = act + 1;
	else
		act = 1;

    if( act == 1 )
        document.images['img1'].src = "webStyles/vivien/design/hlavicka-frame1.jpg";
    if( act == 2 )
        document.images['img1'].src = "webStyles/vivien/design/hlavicka-frame2.jpg";
    if( act == 3 )
        document.images['img1'].src = "webStyles/vivien/design/hlavicka-frame3.jpg";
    if( act == 4 )
        document.images['img1'].src = "webStyles/vivien/design/hlavicka-frame4.jpg";
    if( act == 5 )
        document.images['img1'].src = "webStyles/vivien/design/hlavicka-frame5.jpg";
 

    setTimeout("chPic();", 5000);
}
*/

/*
 *
 * Funkce pro horní rolovací menu
 *
 *
 */
 
 	var timeout	= 500;
	var closetimer	= 0;
	var ddmenuitem	= 0;
	
	var topItem = 0;
	var oldStyle = 0;
	
	// open hidden layer
	function mopen(id, topElement, setstyle)
	{	
		// cancel close timer
		mcancelclosetime();

		if( oldStyle ) {
			topItem.className = oldStyle;
			oldStyle = 0;
			//alert("Nast. zpet elementu "+topItem+" na styl "+oldStyle+"*, nast. "+topItem.className );
		}
	
		// close old layer
		if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	
		// get new layer and show it
		ddmenuitem = document.getElementById(id);
		if( ddmenuitem )
		//	alert("Nenalezena polozka ID '"+id+"'");
		//else 
			ddmenuitem.style.visibility = 'visible';
		
		// Nastaví elementu styl
		if( topElement )
		{
			topItem = document.getElementById(topElement);
			oldStyle = topItem.className;
	//		alert("Style je *"+topItem.className+"*");
			topItem.className = setstyle;
			//topItem.className = 'top_menu_item top_menu_item_sel';
	//		alert("Nast. elementu "+topItem+"("+topElement+") na styl "+setstyle+"*, nast. "+topItem.className );
			//alert("Style je 25*"+topItem.className+"*");
		}
	
	}
	// close showed layer
	function mclose()
	{
		if(ddmenuitem) {
			ddmenuitem.style.visibility = 'hidden';
		}
		if( oldStyle ) {
			topItem.className = oldStyle;
			//alert("Nast. zpet elementu "+topItem+" na styl "+oldStyle+"*, nast. "+topItem.className );
		}
		//alert("zaviram");
	}
	
	// go close timer
	function mclosetime()
	{
		closetimer = window.setTimeout(mclose, timeout);
	}
	
	// cancel close timer
	function mcancelclosetime()
	{
		if(closetimer)
		{
			window.clearTimeout(closetimer);
			closetimer = null;
		}
	}
	
	// close layer when click-out
	document.onclick = mclose; 

/*
 * Konec kunkcí pro horní rolovací menu
 *
 *
 */       



function pripominani()
{

	var theSelect = document.getElementById("pripopt");
	
//	alert("The select has been changed to " + theSelect.value);
}

function odeslatDalsi(no, tableName)
{
//	alert("nastavuji stranku: " +no+ ", polozky " +tableName+ "_setpgno");	

	// Nastaví poµadované číslo stránky
	document.getElementById( tableName+"_pgno" ).value = no;
	document.getElementById( tableName+"_setpgno").value = no;

	document.mainform.submit();
}

function buy( prodCode )
{
//	alert("nastavuji stranku: " +no+ ", polozky " +tableName+ "_setpgno");	

	// Nastaví poµadované číslo stránky
	//document.getElementById( "prod_num_"+prodCode ).value = no;
	//document.getElementById( tableName+"_setpgno").value = no;
	document.getElementById( "buyitem" ).value = prodCode;	

	document.insertForm.submit();
}

function showKey(e) { 
	var key; 
	var code; 
	var e;
	
	if (!e) 
		e = window.event; // set var e for ie 
		
	if (e.keycode) 
		code = e.keycode; // ie and mozilla/gecko 
	else 
		if (e.which) 
			code = e.which; // ns4 and opera 
			
	//code = e.charCode;
	
	if( typeof( e.keyCode ) == 'number'  ) {
		//DOM
		code = e.keyCode;
	} else if( typeof( e.which ) == 'number' ) {
		//NS 4 compatible
		code = e.which;
	} else if( typeof( e.charCode ) == 'number'  ) {
		//also NS 6+, Mozilla 0.9+
		code = e.charCode;
	} else {
		//total failure, we have no way of obtaining the key code
		alert("key fail");
		return;
	}	
	
	if( code == 0 )
		if (e.which) 
			code = e.which; // ns4 and opera 
		
	//var key = String.fromCharCode(code);
	
	//window.status = "Key=" + key; 
//	alert("klavesa: "+code);
	
	return code; 
}

function nastavHodnotu(id, hodnota)
{
//	alert("Nastavuji: " +id+ " na "+hodnota+" aktualne "+document.getElementById( id ).value);	
	
	document.getElementById( id ).value = hodnota;
}

function ukazHodnotu(id)
{
	alert("Hodnota: " +document.getElementById( id ).value);	
}

function onlyNumbers(evt)
{
	var charCode = showKey(evt);
	//alert("klavesa: "+charCode);
	
//	if( charCode == 13 )
//		return false;
		 
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
	    return false;
	
	 return true;
}

function onlyNumbersSetValue(evt, valueID, valueSet )
{
	var charCode = showKey(evt);
	//alert("klavesa: "+charCode);
	
	if( ! onlyNumbers(evt) )
		return false;		
	
	if( charCode == 13 ) 
	{
		// Nastavení hodnoty
	//	alert("Stisk ENTER: " +valueID+" = "+valueSet);
		
		document.getElementById( valueID ).value = valueSet;
		//return false;
	}
		 	
	 return true;
}

function setValueOnSend(evt, valueID, valueSet )
{
	var charCode = showKey(evt);
	//alert("klavesa: "+charCode);
	
//	if( ! onlyNumbers(evt) )
//		return false;		
	
	if( charCode == 13 ) 
	{
		// Nastavení hodnoty
	//	alert("Stisk ENTER: " +valueID+" = "+valueSet);
		
		document.getElementById( valueID ).value = valueSet;
		//return false;
	}
		 	
	 return true;
}


function sendOnEnter(e, valueID, valueSet)  
{      
//	var c=allEve(e).key;
 	var c=showKey(e);  
 	
//	if (window.event.keyCode == 13) 
	if (c == 13) 
	{
	//	alert("HOdnota pred: " + document.getElementById( valueID ).value );			
	
	//	document.getElementById( valueID ).value = valueSet;          
	//	alert("Stisk ENTER: " +valueName+" = "+valueSet + " - po nastaveni "+document.getElementById( valueID ).value );	
		alert("Stisk ENTER " );	
		//document.getElementById("but_update").focus(); 
		return true;        
	}//else   
	//	alert("klavesa: " + c );			
//		alert("klavesa: " + window.event.keyCode + ", " + c );			
	
	return true;
}



function hide_or_show_thread(id) 
{
    if (document.getElementById('div'+id).style.display == 'none') {
        document.getElementById('div'+id).style.display = 'block';
        document.getElementById('a'+id).innerHTML = 'Sbalit';
    }
    else {
        document.getElementById('div'+id).style.display = 'none';
        document.getElementById('a'+id).innerHTML = 'Rozbalit';
    }
}

function selectit(id) 
{
	//if( document.getElementById(id).checked='checked' )
	if( document.getElementById(id).checked == true)
		document.getElementById(id).checked = false;
	else
		document.getElementById(id).checked='checked';
/*
	for (j = 0; j < 8; j++) 
	{
		if (eval("document.myform.ckbox[" + j + "].checked") == true) {
			document.myform.ckbox[j].checked = false;
			if (j == cb) {
		document.myform.ckbox[j].checked = true;
*/
}

var marked_row = new Array;

function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') 
	{
		//alert("DOM");
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3
    
  //  if( domDetect )
  //  	currentColor = "#D1D1D1";

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0) 
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) 
	{
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
           // 	if( newColor == "#DDDDDD" )
          //      	theCells[c].style.backgroundColor = "blank";
                	theCells[c].style.backgroundColor = newColor;
          //      else
          //      	theCells[c].style.backgroundColor = "#CCFFCC";

//                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

function hide_elemets_by_name(t, id) {

	var tags = document.getElementsByTagName(t);
	var no = 0;
	var hide = 0;

	for (var i = 0; i < tags.length; i++) {
		if (tags[i].id == id) {
			if( tags[i].style.display == 'none' ) {
				// Ukáµe
				tags[i].style.display = 'block';
			//	document.getElementById('name'+id).innerHTML = 'Sbalit';
				no++;
				
			}else {
				// Sková
				tags[i].style.display = 'none';
			//	document.getElementById('name'+id).innerHTML = 'Rozbalit';
				no++;
			}
		}
	}
	
	//alert("done tags "+tags.length+" id "+id+" hided tags "+no);
}

function hide_elemets_by_name2(t, id, itemName) {

	var tags = document.getElementsByTagName(t);
	var no = 0;
	var hide = 0;

	for (var i = 0; i < tags.length; i++) {
		if (tags[i].id == id) {
			if( tags[i].style.display == 'none' ) {
				// Ukáµe
				tags[i].style.display = 'block';
				document.getElementById('name'+id).innerHTML = 'Sbalit '+itemName;
				no++;
				
			}else {
				// Sková
				tags[i].style.display = 'none';
				document.getElementById('name'+id).innerHTML = 'Rozbalit '+itemName;
				no++;
			}
		}
	}
	
	//alert("done tags "+tags.length+" id "+id+" hided tags "+no);
}

function hide_elemets_by_name3(t, id, itemName) {

	var tags = document.getElementsByTagName(t);
	var no = 0;
	var hide = 0;

	for (var i = 0; i < tags.length; i++) {
		if (tags[i].id == id) {
			if( tags[i].style.display == 'none' ) {
				// Ukáµe
				tags[i].style.display = 'block';
				document.getElementById('name'+id).value = 'Sbalit '+itemName;
				no++;
				
			}else {
				// Sková
				tags[i].style.display = 'none';
				document.getElementById('name'+id).value = 'Rozbalit '+itemName;
				no++;
			}
		}
	}
	
	//alert("done tags "+tags.length+" id "+id+" hided tags "+no);
}


function setf()
{
	document.getElementById('shd_content').style.height = 2000;

	alert("vyska "+document.body.offsetWidth);	
//document.body.clientHeight;
}

function checkNewsletterReg(form)
{

 //   inpmail = document.getElementById('mailtonews');
    var inpmail = document.forms['mform'].elements['mailtonews'];
    alert("run "+inpmail.value);
 //   return false;
        
    if (inpmail.value == "")
    {
        alert("Musíte vyplnit údaj \„e-mail\“!");
        form.mailtonews.focus();
        return false;
    }

    re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
    if (!re.test(inpmail.value))
    {
        alert("Uvedený e-mail není korektní!");
        form.mailtonews.focus();
        return false;
    }
    
    alert("ok");
    return true;      
}

function checkForm(form)
{
	
	if (form.jmeno.value=="")
    {
        alert("Musíte vyplnit údaj \„Jméno, příjmení, popř. přezdívka\“!");
        form.jmeno.focus();
        return false;
    }
    else if (form.email.value=="")
    {
        alert("Musíte vyplnit údaj \„e-mail\“!");
        form.email.focus();
        return false;
    }

         re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
        if (!re.test(form.email.value))
        {
            alert("Uvedený e-mail není korektní!");
            form.email.focus();
            return false;
        }

   else if (form.obor.value=="")
    {
        alert("Musíte vyplnit údaj \„Obor působnosti. např. 2D nebo 3D grafika...\“!");
        form.obor.focus();
        return false;
    }
	

    return true;
}

var day;
var month;
var year;
var hour;
var minute;
var second;
var clock_set = 0;

/**
 * Opens calendar window.
 *
 * @param   string      calendar.php parameters
 * @param   string      form name
 * @param   string      field name
 * @param   string      edit type - date/timestamp
 */
function openCalendar(params, form, field, type, isClock) 
{

 //   clock_set = isClock;
 //   alert("clock "+clock_set);


    window.open("./shd_libs/calender/calendar.php?" + params, "calendar", "width=400,height=200,status=yes");
    dateField = eval("document." + form + "." + field);
    dateType = type;
}

/**
 * Formats number to two digits.
 *
 * @param   int number to format.
 */
function formatNum2(i, valtype) {
    f = (i < 10 ? '0' : '') + i;
    if (valtype && valtype != '') {
        switch(valtype) {
            case 'month':
                f = (f > 12 ? 12 : f);
                break;

            case 'day':
                f = (f > 31 ? 31 : f);
                break;

            case 'hour':
                f = (f > 24 ? 24 : f);
                break;

            default:
            case 'second':
            case 'minute':
                f = (f > 59 ? 59 : f);
                break;
        }
    }

    return f;
}

/**
 * Formats number to four digits.
 *
 * @param   int number to format.
 */
function formatNum4(i) {
    return (i < 1000 ? i < 100 ? i < 10 ? '000' : '00' : '0' : '') + i;
}

/**
 * Initializes calendar window.
 */
function initCalendar(yearMin, yearMax, clock_set) 
{
 //   alert("clock2 "+clock_set);

    if (!year && !month && !day) 
	{
        /* Called for first time */
        if( window.opener.dateField.value )
		{
            value = window.opener.dateField.value;
      //      alert(yearMin+" "+yearMax);
            
            if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') 
			{
                if (window.opener.dateType == 'datetime') 
				{
                    parts   = value.split(' ');
                    value   = parts[0];

                    if (parts[1]) {
                        time    = parts[1].split(':');
                        hour    = parseInt(time[0],10);
                        minute  = parseInt(time[1],10);
                        second  = parseInt(time[2],10);
                    }
            /*        
                    if (parts[0]) {
		                date        = parts[0].split(".");
		                day         = parseInt(date[0],10);
		                month       = parseInt(date[1],10) - 1;
		                year        = parseInt(date[2],10);
                    }
*/

                }
				
				{
					// Pouze datum   
				//	alert("value "+ value);
					           
	                date        = value.split(".");
	
	                day         = parseInt(date[0],10);
	                month       = parseInt(date[1],10) - 1;
	                year        = parseInt(date[2],10);
	
	          //      alert("datum2 d"+day+" mes"+month+" rok"+year);
				}
				
/*
                date        = value.split("-");
                day         = parseInt(date[2],10);
                month       = parseInt(date[1],10) - 1;
                year        = parseInt(date[0],10);
*/                
            } else {
                day         = parseInt(value.substr(0,2),10);
                month       = parseInt(value.substr(3,2),10) - 1;
                year        = parseInt(value.substr(5,4),10);
                hour        = parseInt(value.substr(8,2),10);
                minute      = parseInt(value.substr(10,2),10);
                second      = parseInt(value.substr(12,2),10);
                
                alert("datum d"+day+" mes"+month+" rok"+year);
/*
                year        = parseInt(value.substr(0,4),10);
                month       = parseInt(value.substr(4,2),10) - 1;
                day         = parseInt(value.substr(6,2),10);
                hour        = parseInt(value.substr(8,2),10);
                minute      = parseInt(value.substr(10,2),10);
                second      = parseInt(value.substr(12,2),10);
*/
            }
        }
        
        if (isNaN(year) || isNaN(month) || isNaN(day) || day == 0) {
            dt      = new Date();
            year    = dt.getFullYear();
            month   = dt.getMonth();
            day     = dt.getDate();
        }
        if (isNaN(hour) || isNaN(minute) || isNaN(second)) {
            dt      = new Date();
            hour    = dt.getHours();
            minute  = dt.getMinutes();
            second  = dt.getSeconds();
        }
    } else {
        /* Moving in calendar */
        if (month > 11) {
            month = 0;
            year++;
        }
        if (month < 0) {
            month = 11;
            year--;
        }
    }

    if (document.getElementById) {
        cnt = document.getElementById("calendar_data");
    } else if (document.all) {
        cnt = document.all["calendar_data"];
    }

    cnt.innerHTML = "";

    str = ""

    //heading table
    str += '<br><table class="calendar" width="100%"><tr><th width="50%">';
    str += '<form method="NONE" onsubmit="return 0">';
    str += '<a href="javascript:month--; initCalendar('+yearMin+', '+yearMax+');">&laquo;</a> ';
    str += '<select id="select_month" name="monthsel" onchange="month = parseInt(document.getElementById(\'select_month\').value); initCalendar('+yearMin+', '+yearMax+');">';
    for (i =0; i < 12; i++) {
        if (i == month) selected = ' selected="selected"';
        else selected = '';
        str += '<option value="' + i + '" ' + selected + '>' + month_names[i] + '</option>';
    }
    str += '</select>';
    str += ' <a href="javascript:month++; initCalendar('+yearMin+', '+yearMax+');">&raquo;</a>';
    str += '</form>';
    str += '</th><th width="50%">';
    str += '<form method="NONE" onsubmit="return 0">';
    str += '<a href="javascript:year--; initCalendar('+yearMin+', '+yearMax+');">&laquo;</a> ';
    str += '<select id="select_year" name="yearsel" onchange="year = parseInt(document.getElementById(\'select_year\').value); initCalendar('+yearMin+', '+yearMax+');">';
//    for (i = year - 25; i < year + 25; i++) {
    for (i = yearMin; i <= yearMax; i++) {
        if (i == year) selected = ' selected="selected"';
        else selected = '';
        str += '<option value="' + i + '" ' + selected + '>' + i + '</option>';
    }
    str += '</select>';
    str += ' <a href="javascript:year++; initCalendar('+yearMin+', '+yearMax+');">&raquo;</a>';
    str += '</form>';
    str += '</th></tr></table>';

    str += '<br><center><table class="calendar" width="90%" border=1><tr>';
    for (i = 0; i < 7; i++) {
        str += "<th>" + day_names[i] + "</th>";
    }
    str += "</tr>";

    var firstDay = new Date(year, month, 1).getDay();
    var lastDay = new Date(year, month + 1, 0).getDate();

    str += "<tr>";

    dayInWeek = 0;
    for (i = 0; i < firstDay; i++) {
        str += "<td>&nbsp;</td>";
        dayInWeek++;
    }
    for (i = 1; i <= lastDay; i++) {
        if (dayInWeek == 7) {
            str += "</tr><tr>";
            dayInWeek = 0;
        }

        dispmonth = 1 + month;

        if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
//            actVal = formatNum4(year) + "-" + formatNum2(dispmonth, 'month') + "-" + formatNum2(i, 'day');
            actVal = formatNum2(i, 'day') + "." + formatNum2(dispmonth, 'month') + "." + formatNum4(year);
        } else {
            actVal = "" + formatNum4(year) + formatNum2(dispmonth, 'month') + formatNum2(i, 'day');
        }
        if (i == day) {
            style = ' class="selected"';
        } else {
            style = '';
        }
        str += "<td" + style + " align=center class=\"den\" style=\"cursor:pointer;\" onClick=\"javascript:returnDate('" + actVal + "');\"><a href=\"javascript:returnDate('" + actVal + "');\">" + i + "</a></td>"
        dayInWeek++;
    }
    for (i = dayInWeek; i < 7; i++) {
        str += "<td>&nbsp;</td>";
    }

    str += "</tr></table>";

    cnt.innerHTML = str;

    // Should we handle time also?
    if (window.opener.dateType != 'date' && !clock_set) {
//    if (clock_set == '1') {

        if (document.getElementById) {
            cnt = document.getElementById("clock_data");
        } else if (document.all) {
            cnt = document.all["clock_data"];
        }

        str = '';
        str += '</br><form class="clock">Čas ';
        str += '<input id="hour"    type="text" size="2" maxlength="2" onblur="this.value=formatNum2(this.value, \'hour\')" value="' + formatNum2(hour, 'hour') + '" />:';
        str += '<input id="minute"  type="text" size="2" maxlength="2" onblur="this.value=formatNum2(this.value, \'minute\')" value="' + formatNum2(minute, 'minute') + '" />:';
        str += '<input id="second"  type="text" size="2" maxlength="2" onblur="this.value=formatNum2(this.value, \'second\')" value="' + formatNum2(second, 'second') + '" />';
        str += '</form>';

        cnt.innerHTML = str;
        clock_set = 1;
    }

}

/**
 * Returns date from calendar.
 *
 * @param   string     date text
 */
function returnDate(d) {
    txt = d;
    if (window.opener.dateType != 'date') {
        // need to get time
        h = parseInt(document.getElementById('hour').value,10);
        m = parseInt(document.getElementById('minute').value,10);
        s = parseInt(document.getElementById('second').value,10);
        if (window.opener.dateType == 'datetime') {
            txt += ' ' + formatNum2(h, 'hour') + ':' + formatNum2(m, 'minute') + ':' + formatNum2(s, 'second');
        } else {
            // timestamp
            txt += formatNum2(h, 'hour') + formatNum2(m, 'minute') + formatNum2(s, 'second');
        }
    }

    window.opener.dateField.value = txt;
    window.close();
}

