
function avaaSuljeOsio(osio,id,toiminto,txt1,txt2){
  	var oo = document.getElementById('otteluohjelma');
  	var tr = oo.getElementsByTagName('tr');
  	
  	for(i=0; i<tr.length; i++){
  	  	eID=tr[i].getAttribute('id').substring(0,11);

  	  	if(eID==osio){
	  	  	if(toiminto==1){			
				tr[i].style.display='';
			}else{
				tr[i].style.display='none';
			}//end if
		}//end if	    
	}//end for
	
	if(document.getElementById(id)){ 
	  	if(toiminto==1){
		  	txt=txt2; 
		}else{
		  	txt=txt1;
		}//end if

		document.getElementById(id).setAttribute('href',"javascript:avaaSuljeOsio('" + osio + "','" + id + "',"+ ((toiminto+1)%2) +",'"+txt1+"','"+txt2+"');") 
	  	
	  	asetaTeksti(document.getElementById(id),txt);
	}//end if
}//end function


function lueLisaa(id,toiminto){
	var ing,txt;
	
  	if(arguments.length==2){
	  	ing = 'ingressi';
		txt = 'teksti';  
	}else{
	  	ing = arguments[2];
		txt = arguments[3];  	  	
	}//end if
  
  	if(document.getElementById(txt+id)){
  	  	if(toiminto==1){
  	  	  	if(document.getElementById(ing+id)){
			    document.getElementById(ing+id).style.display='none';
			}//end if
			
		    document.getElementById(txt+id).style.display='';
		}else{
  	  	  	if(document.getElementById(ing+id)){
			    document.getElementById(ing+id).style.display='';
			}//end if

		    document.getElementById(txt+id).style.display='none';		  
		}//end if
	}//end if
}//end function


function teeAjaxKutsu(url,parameters,funktio){
	document.body.style.cursor='wait';
 	
	if (xmlhttp!=null && xmlhttp.readyState !=0 && xmlhttp.readyState !=4) {
	 	//alert("edellinen menossa");
	}else{	
	    xmlhttp.open("POST", url, true);  
	    //xmlhttp.onreadystatechange = handleResponseVarauslomake_paiva;
	    xmlhttp.onreadystatechange = funktio;
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.send(parameters);
  	} //end if	
}//end function


function asetaTeksti(otus,arvo){
    if(IEselain){
        otus.innerText=arvo;
    }else{
        otus.textContent=arvo;
    }//end if
}//end if
