var xmlHttp;

function cercaImatgesAjax(idAlbum){
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){
      alert ("El navegador no soporta AJAX!");
      return;
    }
    //document.getElementById("dadesImatges").style.display="block";
    document.getElementById("noti_destacada").innerHTML="<table valign=\"center\" cellpadding=\"3\" width=\"848\" cellspacing=\"3\" height=\"510\" class=\"taulaCos\"><tr><td colspan=\"3\"  align=\"center\" ><font class=\"gris\" >Carregant...</font>&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"imatge/carregant.gif\" ></td></tr></table>";

    var url="PortadaAlbumAjax.do?idAlbum="+idAlbum;

    url=url+"&sid="+Math.random();

    //alert(url);

    xmlHttp.onreadystatechange=stateChanged;

    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function stateChanged() { 
    if (xmlHttp.readyState==4){ 
        result = xmlHttp.responseText;
        document.getElementById("noti_destacada").innerHTML = result;
        evalScripts( result );
    }
    portadaTop();
}

function GetXmlHttpObject()
{
var xmlHttp=null;

http://www.w3schools.com/Ajax/ajax_example_suggest.asp

try
  {
  // Firefox, Opera 8.0+, Safari

  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

    }
  }
return xmlHttp;
}

function evalScripts(scripts)
{	try
	{	if(scripts != '')	
		{	var script = "";
			scripts = scripts.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
	       	                         if (scripts !== null) script += arguments[1] + '\n';
 	        	                        return '';});
			if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
		}
		return false;
	}
	catch(e)
	{	alert(e)
	}
}

