﻿/*
var xmlHttp;

try{
  xmlHttp=new XMLHttpRequest();
}catch (e){
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }catch (e){
  	try{
    	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }catch (e){
    	//alert("Your browser does not support AJAX!");
    	return false;
    }
  }
}
*/

diGetContentAsync = function(urlToGet,destinationDiv,itemsClassToHide, functionToRun, sourceDiv,tempDiv){

	var xmlHttp;
	try{xmlHttp=new XMLHttpRequest();}
	catch (e){
		try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e){
	  	try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	  	catch (e){return false;}
	  }
	}

	if(typeof itemsClassToHide!='undefined') $('.'+itemsClassToHide).hide();
	$('#'+destinationDiv).show();
  xmlHttp.open("GET",urlToGet,true);
	xmlHttp.onreadystatechange=function(){
	  if(xmlHttp.readyState==4){
	    var destinationDivRef;

//			$('#'+destinationDiv).InnerHTML = xmlHttp.responseText;

			if(document.getElementById){
	    	destinationDivRef = document.getElementById(destinationDiv);
	 	 	}else{
	      destinationDivRef = document.all[destinationDiv];
	  	}
	  	if(destinationDivRef!=null){
	        var tempDiv = document.createElement('div');
	        tempDiv.id=tempDiv;
	        tempDiv.innerHTML = xmlHttp.responseText;
            destinationDivRef.appendChild(tempDiv);
            
            var contentDiv = null;
		    if(document.getElementById){
    	    contentDiv = document.getElementById(sourceDiv);
 	 	    }
 	 	    else contentDiv = document.all[sourceDiv];	
            if (contentDiv!=null)
            {
            
                var strContent = contentDiv.innerHTML;
                destinationDivRef.innerHTML = strContent;
                
            }
	    }
       if(typeof functionToRun != 'undefined') functionToRun(); 
	  }
	}
  xmlHttp.send(null);
  return false;
}


