function goBack() { history.go(-1); }

function goTo(url) { window.location.href = url; }

function waitThenGoTo(url,time)
{
	if(time < 100) time = time * 1000;
	setTimeout("goTo('"+url+"')",time);
}

function waitThenGoBack(time)
{
	if(time < 1000) time = time * 1000;
	setTimeout('goBack()',time);
}

function reload() { window.reload(); }

function isInt(sText)
{
	var ValidChars = "0123456789";
	var isInt=true;
	var Char;

	for (i = 0; i < sText.length && isInt == true; i++)
	{
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1) isInt = false;
 	}
	return isInt;
}

function noLeadingZero(input)
{
	if((input.length > 1) && (input.substr(0,1) == "0")) return input.substr(1);
	else return input;
}

function datetounixtime(hour, minute, second, month, day, year)
{
	var humDate = new Date(Date.UTC(year, (noLeadingZero(month)-1),
         noLeadingZero(day), noLeadingZero(hour), noLeadingZero(minute), noLeadingZero(second)));
	return (humDate.getTime()/1000.0);
}

function convertAddr(sDom, sUser){
  return("mail"+"to:"+sUser.replace(/%23/g,".").replace(/%24/g,"-")+"@"+sDom.replace(/%23/g,".").replace(/%24/g,"-"));
}

/* ----------------- MENU ----------------- */
var menu = new function()
{
    this.tabid = '#menutab';

    this.select = function(num)
    {
        var img = $(this.tabid+num+' img');
        var imgsrc = img.attr('src');
        var newsrc = imgsrc.replace('.png','_a.png');
        img.attr('src',newsrc);
    }
}