

function naytaIkkuna(taso)
		{
		if (document.getElementById)
		{
		
		var style2 = document.getElementById(taso).style;
		style2.display = style2.display? "":"block";
		}
		else if (document.all)
		{
		
		var style2 = document.all[taso].style;
		style2.display = style2.display? "":"block";
		}
		else if (document.layers)
		{
		
		var style2 = document.layers[taso].style;
		style2.display = style2.display? "":"block";
		}
		}

	function avaaIkkuna(file,window) {
	    ikkuna=open(file,window,'resizable=no,width=500,height=500, menu=no, toolbar=no, status=no');
		ikkkuna.focus();
    }


function TestFileType( fileName, fileTypes ) {
if (!fileName) return;

dots = fileName.split(".")
//get the part AFTER the LAST period.
fileType = "." + dots[dots.length-1];

if(fileTypes.join(".").indexOf(fileType) == -1){
alert("Vain seuraavat tiedosto päätteet sallitaan: \n\n" + (fileTypes.join(" .")) + "\n\n Valitse  uusi kuva jollakin ed. mainituista tiedosto päätteistä.");
document.getElementById('lataaNappi').disabled=true;
}else if(fileTypes.join(".").indexOf(fileType) != -1){
document.getElementById('lataaNappi').disabled=false;
};
}



function openChild(file,window) {
    childWindow=open(file,window,'resizable=no,width=100,height=150, menu=no, toolbar=no, status=no');
    if (childWindow.opener == null) childWindow.opener = self;
	childWindow.focus();
    }
	
function reloadParentClose(){
	
	opener.location.reload();
	this.window.close();

}

function textCounter(field,cntfield,maxlimit) {
				if (field.value.length > maxlimit) // if too long...trim it!
				field.value = field.value.substring(0, maxlimit);
				// otherwise, update 'characters left' counter
				else
				cntfield.value = maxlimit - field.value.length;
				}
				
				function lataaTeksti(){
				
							var taso='lataaNappi';
							if (document.getElementById)
							{
							var style2 = document.getElementById(taso).style;
							style2.display ="none";
							}
							else if (document.all)
							{
							
							var style2 = document.all[taso].style;
							style2.display ="none";
							}
							else if (document.layers)
							{
							
							var style2 = document.layers[taso].style;
							style2.display = "none";
							}
							document.getElementById('lataaBoxi').innerHTML='Lataan ...';
				}

