/* Uudelleenkäytettävä Ajax-alustus */
function ajaxInit() 
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Selaimesi ei tue Ajaxia!");
        return false;
        }
      }
    }
    return xmlHttp;
  }

function haeUutiset(sivu, lahtoid)
  {
    xmlHttp = ajaxInit();
    xmlHttp.onreadystatechange=function()
	  {
	  if(xmlHttp.readyState==4)
	    {
	    kohde = document.getElementById("nosto_uutiset");
	    kohde.innerHTML=xmlHttp.responseText;
	    }
    }
	
	
	/*
    document.getElementById("u1").style.background = "transparent";
    document.getElementById("u2").style.background = "transparent";
    document.getElementById("u3").style.background = "transparent";
    document.getElementById("u1").style.borderBottom = "2px solid transparent";
    document.getElementById("u2").style.borderBottom = "2px solid transparent";
    document.getElementById("u3").style.borderBottom = "2px solid transparent";	
    lahtoid.style.background = "#ffffff";
    lahtoid.style.borderBottom = "2px solid white";
*/


    document.getElementById("u1").style.background = "transparent";
    document.getElementById("u2").style.background = "transparent";
    document.getElementById("u3").style.background = "transparent";
    lahtoid.style.background = "#ffffff";
	lahtoid.style.paddingTop = "5px";
	lahtoid.style.paddingRight = "10px";	
	lahtoid.style.paddingBottom = "8px";
	lahtoid.style.paddingLeft = "10px";		
	lahtoid.style.marginTop = "-5px";
	lahtoid.style.marginRight = "0";
	lahtoid.style.marginBottom = "0";
	lahtoid.style.marginLeft = "0";			
	lahtoid.style.display = "block";	
	lahtoid.blur();

    xmlHttp.open("GET",sivu,true);
    xmlHttp.send(null);
  return false;
  }


function haeUutiset2(sivu, lahtoid)
  {
    xmlHttp = ajaxInit();
    xmlHttp.onreadystatechange=function()
	  {
	  if(xmlHttp.readyState==4)
	    {
	    kohde = document.getElementById("nosto_uutiset2");
	    kohde.innerHTML=xmlHttp.responseText;
	    }
    }

	jQuery(".uudet_tabit a").removeClass("active");
	
	if ( typeof(lahtoid) == 'string' ) {
		jQuery("#" + lahtoid).addClass("active");
	} else {
		jQuery(lahtoid).addClass("active");
	}
	/*
	
    document.getElementById("b1").style.background = "transparent";
    document.getElementById("b2").style.background = "transparent";
    if(document.getElementById("b3")) { document.getElementById("b3").style.background = "transparent"; }
	
    lahtoid.style.background = "#ffffff";
	lahtoid.style.paddingTop = "5px";
	lahtoid.style.paddingRight = "10px";	
	lahtoid.style.paddingBottom = "8px";
	lahtoid.style.paddingLeft = "10px";		
	lahtoid.style.marginTop = "-5px";
	lahtoid.style.marginRight = "0";
	lahtoid.style.marginBottom = "0";
	lahtoid.style.marginLeft = "0";			
	lahtoid.style.display = "block";	
	lahtoid.blur();
	*/

    xmlHttp.open("GET",sivu,true);
    xmlHttp.send(null);
  return false;
  }

