/**
 * Viemero Project Oct 2004
 * @author Xuan, Zhiyi <zxuan@cc.hut.fi>
 * @copyright Copyright &copy; 2004, Xuan, Zhiyi
 */
// JavaScript Document, display date and time

var timer = null

function stop()
{
clearTimeout(timer)
}

function start()
{
var time = new Date();

var weekday=new Array("su","ma","ti","ke","to","pe","la");
//var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

var day = weekday[time.getDay()];
var date = time.getDate();
var month = time.getMonth() + 1;
var year = time.getYear().toString();
var hours = time.getHours();
var minutes = time.getMinutes();

minutes=((minutes < 10) ? "0" : "") + minutes;
//var seconds = time.getSeconds();
//seconds=((seconds < 10) ? "0" : "") + seconds;
//var clock =  hours + ":" + minutes + ":" + seconds + "  " + day + " " + date + " " + month + "  " + year;

var clock = day + " " + date + "." + month  + "." + year.substr(2,2) + "  " + hours  + ":" + minutes;

document.forms["frmTime"].userTime.value = clock
timer = setTimeout("start()",1000)
}

function enabletab(tabid)
{
document.forms.enabletabs.enabletabid.value = tabid;
document.forms.enabletabs.submit();
//window.location.reload();
}

function relink(id, parentid)
{
document.forms.autopost.id.value = id;
document.forms.autopost.parentid.value = parentid;
document.forms.autopost.submit();
}

function commitRm()
{
var name=confirm("Are you sure to remove the tab? ");
if (name==true)
{
document.forms.removetabs.submit();
}
}

function commitLogRm(){
var name=confirm("Are you sure to clean the log file? ");
if (name==true)
{
document.forms.cleanup.submit();
}
}

// Used for upload files (error) messages
function OpenMessages() {
	var row = document.getElementById('uploadMsg');
	if (row.style.display == 'none')
		row.style.display = '';
	else
		row.style.display = 'none';
}


function LoadAjaxContent(id, uri, method){
<!-- // Required to be compliant with XHTML-->
 var xmlHttp=null; // Defines that xmlHttp is a new variable.
 // Try to get the right object for different browser
 try {
    // Firefox, Opera 8.0+, Safari, IE7+
    xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
 } catch (e) {
    // Internet Explorer
    try {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
 }
 xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4)
       try { // In some instances, status cannot be retrieved and will produce 
             // an error (e.g. Port is not responsive)
          if (xmlHttp.status == 200) {
             // Set the main HTML of the body to the info provided by the 
             // Ajax Request
             document.getElementById(id).innerHTML 
                = xmlHttp.responseText;
          }
       } catch (e) {
          document.getElementById(id).innerHTML 
             = "Error on Ajax return call : " + e.description;
       }
 
 }
 xmlHttp.open(method,noCache(uri), true); // .open(RequestType, Source);
 xmlHttp.send(null); // Since there is no supplied form, null takes its place 
                     // as a new form.

}

function LoadAjaxContent(uri, method){
<!-- // Required to be compliant with XHTML-->
 var xmlHttp=null; // Defines that xmlHttp is a new variable.
 // Try to get the right object for different browser
 try {
    // Firefox, Opera 8.0+, Safari, IE7+
    xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
 } catch (e) {
    // Internet Explorer
    try {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
 }
 xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4)
       try { // In some instances, status cannot be retrieved and will produce 
             // an error (e.g. Port is not responsive)
          if (xmlHttp.status == 200) {
             // Set the main HTML of the body to the info provided by the 
             // Ajax Request
             //document.getElementById(id).innerHTML 
             //   = xmlHttp.responseText;
          }
       } catch (e) {
          //document.getElementById(id).innerHTML 
          //   = "Error on Ajax return call : " + e.description;
       }
 
 }
 xmlHttp.open(method,noCache(uri), true); // .open(RequestType, Source);
 xmlHttp.send(null); // Since there is no supplied form, null takes its place 
                     // as a new form.

}
