<!--
function confirmDelete(msg){
if(msg==undefined){
        msg="Oletko varma?";
}
var con=confirm(msg);
if (con)
        return true ;
else
        return false ;
}

function setCurDate(elm_day,elm_month,elm_year)
{
        var dCurDate = new Date();
        var dCurMonth = dCurDate.getMonth()+1;
        var dCurDayOfMonth = dCurDate.getDate();
        var dCurYear = dCurDate.getFullYear();

		if(dCurMonth < 10) dCurMonth="0" + dCurMonth;
		if(dCurDayOfMonth < 10) dCurDayOfMonth="0" + dCurDayOfMonth;
		
		elm_day.value=dCurDayOfMonth;
		elm_month.value=dCurMonth;
		elm_year.value=dCurYear;

}

function unsetCurDate(elm_day,elm_month,elm_year){
		elm_day.value="";
		elm_month.value="";
		elm_year.value="";
}

function setCurDateTime(elm_day,elm_month,elm_year, elm_hour, elm_minute, elm_second)
{
        var dCurDate = new Date();
        var dCurMonth = dCurDate.getMonth()+1;
        var dCurDayOfMonth = dCurDate.getDate();
        var dCurYear = dCurDate.getFullYear();
		var dCurHour = dCurDate.getHours();
		var dCurMinute = dCurDate.getMinutes();
		var dCurSecond = dCurDate.getSeconds();
		
		if(dCurMonth < 10) dCurMonth="0" + dCurMonth;
		if(dCurDayOfMonth < 10) dCurDayOfMonth="0" + dCurDayOfMonth;

		elm_day.value=dCurDayOfMonth;
		elm_month.value=dCurMonth;
		elm_year.value=dCurYear;
		if(dCurHour < 10) dCurHour="0" + dCurHour;
		if(dCurMinute < 10) dCurMinute="0" + dCurMinute;
		if(dCurSecond < 10) dCurSecond="0" + dCurSecond;
		elm_hour.value=dCurHour;
		elm_minute.value=dCurMinute;
		elm_second.value=dCurSecond;

}

function unsetCurDateTime(elm_day,elm_month,elm_year, elm_hour, elm_minute, elm_second){
		elm_day.value="";
		elm_month.value="";
		elm_year.value="";
		elm_hour.value="";
		elm_minute.value="";
		elm_second.value="";
}


var timerID = null;
var timerRunning = false;
function stopclock (){
	if(timerRunning){
		clearTimeout(timerID);
		timerRunning = false;
	}
}
function showtime () {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	if(minutes < 10) minutes="0" + minutes;
	if(seconds < 10) seconds="0" + seconds;
	var timeValue = hours + ":" + minutes + ":" + seconds;

	document.getElementById('clock').innerHTML = timeValue;

	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}
function startclock() {
	stopclock();
	showtime();
}

/* miserable attempt at changing preview href to real image, how to get file extension? */
function setHref(element, href, val)	{
	var new_href;
	var ext;
	new_href=href + val;
	document.getElementById(element).href = new_href;
}


function toggleDisplay(elem){
	var disp;
	elemObj=document.getElementById(elem);
	if(elemObj.style.display=='none'){
		disp='';
		elemObj.style.display='';
	}else{
		disp='none';
		elemObj.style.display='none';
	}
}







//http://gethelp.devx.com/techtips/js_pro/10min/10min0499/10min0499.asp => Boris Feldman


function makeStringFromSelect(selectCtrl) {
	var i;
	var j = 0;
	var outlist = "";

	for (i = 0; i < selectCtrl.options.length; i++) {
		if (j > 0) {
			outlist = outlist + ", ";
		}
		outlist = outlist + selectCtrl.options[i].value;
		j++;
	}
	return outlist;
}

function addItems(fromCtrl, toCtrl) {
	var i;
	var j;
	var itemexists;
	var nextitem;

	// step through all items in fromCtrl
	for (i = 0; i < fromCtrl.options.length; i++) {
		if (fromCtrl.options[i].selected) {
			// search toCtrl to see if duplicate
			j = 0;
			itemexists = false;
			while ((j < toCtrl.options.length) && (!(itemexists))) {
				if (toCtrl.options[j].value == fromCtrl.options[i].value) {
					itemexists = true;
					alert(fromCtrl.options[i].value + " found!");
				}
				j++;
			}
			if (!(itemexists)) {
				// add the item
				nextitem = toCtrl.options.length;
				toCtrl.options[nextitem] = new Option(fromCtrl.options[i].text);
				toCtrl.options[nextitem].value = fromCtrl.options[i].value;
			}
		}
	}
}

function removeItems(fromCtrl) {
	var i = 0;
	var j;
	var k = 0;

	while (i < (fromCtrl.options.length - k)) {
		if (fromCtrl.options[i].selected) {
			// remove the item
			for (j = i; j < (fromCtrl.options.length - 1); j++) {
				fromCtrl.options[j].text = fromCtrl.options[j+1].text;
				fromCtrl.options[j].value = fromCtrl.options[j+1].value;
				fromCtrl.options[j].selected = fromCtrl.options[j+1].selected;
			}
			k++;
		} else {
			i++;
		}
	}
	for (i = 0; i < k; i++) {
		fromCtrl.options[fromCtrl.options.length - 1] = null;
	}
}
//-->
