var xmlHttp = null;

function createXMLHttpRequest(){
    if(typeof XMLHttpRequest != "undefined"){
        xmlHttp = new XMLHttpRequest();
    }
    else if(typeof window.ActiveXObject != "undefined"){
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
        }
        catch(e){
            try {
                xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
            }
            catch(e){
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e){
                    xmlHttp = null;
                }
            }
        }
    }
    return xmlHttp;
}

var Ajax = {
	GetImages : function(URL){
		var strYear;
	    if(xmlHttp){
	        xmlHttp.abort();
	    }
	    if(createXMLHttpRequest()){
			xmlHttp.onreadystatechange = Ajax.contentImages;
			xmlHttp.open("GET", URL, true);
			xmlHttp.send(null);	
	    }
	},
	contentImages : function (){
		if(xmlHttp && xmlHttp.readyState == 4){
			Ajax.ShowImages();
	        xmlHttp = null;
	    }
	},
	ShowImages : function(){
		var targetDiv = $(General.imageElm);
		this.response = xmlHttp.responseText;	
		targetDiv.innerHTML = "";
		targetDiv.innerHTML = this.response;
		General.imageOpen = true;
		Images.ShowImage();
	},
	
	GetImage : function(URL){
		var strYear;
	    if(xmlHttp){
	        xmlHttp.abort();
	    }
	    if(createXMLHttpRequest()){
			xmlHttp.onreadystatechange = Ajax.contentImage;
			xmlHttp.open("GET", URL, true);
			xmlHttp.send(null);	
	    }
	},
	contentImage : function (){
		if(xmlHttp && xmlHttp.readyState == 4){
			Ajax.ShowImage();
	        xmlHttp = null;
	    }
	},
	ShowImage : function(){
		var targetDiv = document.getElementById("view-image");
		this.response = xmlHttp.responseText;	
		targetDiv.innerHTML = "";
		targetDiv.innerHTML = this.response;
	},
	
	GetThumbNails : function(URL){
		var strYear;
	    if(xmlHttp){
	        xmlHttp.abort();
	    }
	    if(createXMLHttpRequest()){
			xmlHttp.onreadystatechange = Ajax.contentThumbNails;
			xmlHttp.open("GET", URL, true);
			xmlHttp.send(null);	
	    }
	},
	contentThumbNails : function (){
		if(xmlHttp && xmlHttp.readyState == 4){
			Ajax.ShowThumbNails();
	        xmlHttp = null;
	    }
	},
	ShowThumbNails : function(){
		var targetDiv = $(General.imageElm);
		this.response = xmlHttp.responseText;	
		targetDiv.innerHTML = "";
		targetDiv.innerHTML = this.response;
		General.imageOpen = true;
		Images.Fill();
	},
	
	GetMovie : function(URL){
		var strYear;
	    if(xmlHttp){
	        xmlHttp.abort();
	    }
	    if(createXMLHttpRequest()){
			xmlHttp.onreadystatechange = Ajax.contentMovie;
			xmlHttp.open("GET", URL, true);
			xmlHttp.send(null);	
	    }
	},
	contentMovie : function (){
		if(xmlHttp && xmlHttp.readyState == 4){
			Ajax.ShowMovie();
	        xmlHttp = null;
	    }
	},
	ShowMovie : function(){
		var targetDiv = document.getElementById("view-movie-content");
		this.response = xmlHttp.responseText;	
		targetDiv.innerHTML = "";
		targetDiv.innerHTML = this.response;
	}
}

















