
function insertMyRotatorData(){
	// The page is designated in the URL-- parse the page


	MyObject= new getPageObj('php/listRotatorImages.php','get','null','null');


	MyObject.requestInfo();

	

}


var cubeimage=new Array();
var delay=15000;
var count =1;
function loadMainRotator(results){

	///image list is returned in results

	var imageArray=Array();

	var switchImage=Array();
	imageArray=results.split(',');

	/// include the path in the array
	for(ima=0;ima < imageArray.length;ima++){
		switchImage[ima]="../NewFrontPage/Rotator/"+imageArray[ima];
	}
	

	
	for (i=0;i<imageArray.length;i++){
		cubeimage[i]=new Image()
		cubeimage[i].src=switchImage[i]
	}



	d=document.getElementById("pageContent");

	d.innerHTML="<img onLoad=setTimeout('movecube()',delay) src=\""+switchImage[0]+"\" name=\"cube\""+ 				 "height=\"265\" width=\"420\" >";

	
}


function movecube(){


	d=document.getElementsByTagName("img");

	delay=15000;

	if(count == cubeimage.length) {
		count =0;
	}

	if (window.open){
		
		d[1].src=cubeimage[count++].src;
	}


}


function getPageObj(myURL,reqType,myData,pgType){

	this.myURL=myURL;
	this.reqType=reqType;
	this.myData=myData;
	this.pgType=pgType;

	this.getHTTPObject=function(){ 
  		var xmlhttp; 

  		if(window.XMLHttpRequest){ 
   		 	xmlhttp = new XMLHttpRequest(); 
 		} 
 		else if (window.ActiveXObject){ 
    			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    			if (!xmlhttp){ 
        			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    			} 
    
		} 


  		return xmlhttp; 

  
	} 

	var http=this.getHTTPObject();

	this.handleHttpResponse=function(){

       		 if (http.readyState == 4) { 
             		if(http.status==200) { 
                 		 var results=http.responseText; 
				if(pgType=='normal'){

					var menus=results.split(/MYCONTENT:/);
					document.getElementById("pageMenus").innerHTML=menus[0];
					document.getElementById("pageContent").innerHTML=menus[1];
				} else {
					loadMainRotator(results);
              				 

				}
             		} 
         	} 
	}
            
	this.requestInfo=function () {

		if(reqType=="get"){
		         
       	 		http.open("GET",this.myURL,true); 
        		http.onreadystatechange = this.handleHttpResponse; 

		} else {
			         
        		http.open("POST",this.myURL,true); 
			http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        		http.onreadystatechange = this.handleHttpResponse; 
     	
		} 

		http.send(this.myData);
	} 
}

