

//var XmlHttp ;
function CreateXmlHttp()	{
	var XmlHttp ;
					try			{
						XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
					}
					catch(e) {
						try		{
							XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
						} 
						catch(oc)	{
							XmlHttp = null;
						}
					}
					if(!XmlHttp && typeof XMLHttpRequest != "undefined") 	{
						XmlHttp = new XMLHttpRequest();
					}
					//alert(XmlHttp);
					return XmlHttp;
			}
			
function StartSlideShow()
{
		

	AjaxCall('../xml/Images.xml','1');
	
}	

function StartSlideShow1()
{
		

	
	AjaxCall('../xml/Images1.xml','2');
}



function AjaxCall(requestUrl,type){
	var XmlHttp=CreateXmlHttp();
	args='AJAX';	
	if(XmlHttp) {
						XmlHttp.onreadystatechange =function (){ HandleResponse(XmlHttp,type);};
						XmlHttp.open("POST", requestUrl,  true);
						XmlHttp.setRequestHeader('Content-Type', "text/xml");
						XmlHttp.setRequestHeader("Content-length", args.length);
						XmlHttp.send(args);	
				}
					
}
var dimages=new Array();
function HandleResponse(XmlHttp,type){
		if(XmlHttp.readyState == 4)	{			
			if(XmlHttp.responseXML.getElementsByTagName('FileName')!=null)	{
				if (!XmlHttp.responseXML.documentElement && XmlHttp.responseStream)
					XmlHttp.responseXML.load(XmlHttp.responseStream);
					if(type=='1')
						PlaySlideShow(XmlHttp);
					else
						PlaySlideShow2(XmlHttp);
						
				}				
			}
		}
		
ImgCount=0;
function PlaySlideShow(ImgObj){
	
	var imgObj=document.getElementById('myImage');
	if (imgObj != null){
	var data=ImgObj.responseXML.documentElement;
	if(ImgCount>=data.getElementsByTagName('FileName').length)
		ImgCount=0	;
	FileName =data.getElementsByTagName('FileName')[ImgCount].lastChild.nodeValue;	
	imgObj.src=	FileName;
	ImgCount +=1;		
	setTimeout(function (){PlaySlideShow(ImgObj)}, 1500);}
}

function PlaySlideShow2(ImgObj){
	var imgObj=document.getElementById('myImage2');
	if (imgObj != null ){
	var data=ImgObj.responseXML.documentElement;
	if(ImgCount>=data.getElementsByTagName('FileName').length)
		ImgCount=0	;
	FileName = data.getElementsByTagName('FileName')[ImgCount].lastChild.nodeValue;	
	imgObj.src=	FileName;
	ImgCount +=1;		
	setTimeout(function (){PlaySlideShow2(ImgObj)}, 1500);}
}
