/**
 * @author martin.dilg
 */
 function Slides(callback){
 	
	slidesCallback = callback;
	
	this.loadSlides = function(path){
		
		var subpath = path;
		
		var xmlHttp = null;
		// Mozilla, Opera, Safari sowie Internet Explorer 7
		if (typeof XMLHttpRequest != 'undefined') {
    		xmlHttp = new XMLHttpRequest();
		}
		if (!xmlHttp) {
   			 // Internet Explorer 6 und älter
    		try {
        		xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    		} catch(e) {
        		try {
           	 		xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
        		} catch(e) {
            		xmlHttp  = null;
        		}
    		}
		}
		if (xmlHttp) {
    		xmlHttp.open('GET', xmlBasePath + subpath + 'slides.xml', true);
    		xmlHttp.onreadystatechange = function () {
        		if (xmlHttp.readyState == 4) {
           	 		processXML(xmlHttp.responseXML);
        		}
   		 	};
    		xmlHttp.send(null);
		}
		
	}
	
	function processXML(xml){
				
		var elements = new Array();
		elements = xml.getElementsByTagName("slide");
				
		timesArray = new Array();
		slidesArray = new Array();
				
		for(var i=0;i < elements.length; i++){
					
			if( elements[i].getAttribute("time") != null && elements[i].getAttribute("slide") != null){
				timesArray[i] = elements[i].getAttribute("time");
				slidesArray[i] = elements[i].getAttribute("slide");
			}
		}	
		
		callback();

	}
	
	this.getArrays = function(){
		return({"slides":slidesArray, "times":timesArray});
	}
	
	this.callback  = callback; 
	
}
	

	
 
