	// tekstilaatikon t�tt�inen valikosta
    function setValue(userSelection,targetComp)
    {
	    var comp = document.getElementById(targetComp);
	    	comp.value=userSelection;
	        //alert(comp.value);
	}

    function setDateValue(userSelection,targetComp,instruction)
    {
    	var userSelectionLength = userSelection.length;
	if(userSelectionLength>0 && userSelectionLength<11){
		if(userSelection.match(/\b\d{1,2}\.\d{1,2}\.\d{4}\b/)){
			var splitted=userSelection.split(/\./);
			if(splitted.length==3){
				var comp = document.getElementById(targetComp);
				comp.value=splitted[2] + "-" + splitted[1] + "-" + splitted[0];
				//alert(comp.value);
			}else{
				alert(instruction);
			}	
		} else {
			alert(instruction);
		}
	} else {
		alert(instruction);
	}
	       
    }
    
    function siirry(cmp,token)
    {	
    	var componentSlc=document.getElementById(cmp);
	var component=componentSlc.firstChild.nextSibling;
	while(component.value.substring(0,1)!=token && component.nextSibling){
		component = component.nextSibling;
	}
	/*alert(component.value);*/
	component.selected='selected';
	setValue(component.value,'LaivanNimi');
	componentSlc.focus();
    }
    
function submitform(cmpname)
{
 var cmp =document.getElementById(cmpname);
	cmp.submit();
}
