var imgPreload = new Array();
//var delay = 10000; // time delay between rotates, 1000 = 1 second
//var noOfImgs = 3; // number of images
//var imgNo=0;

function preloadImages(strPath) {

	if (document.images) {
		
		// set image url
		arrImages = new Array();
		arrImages[0] = "/images/slide1.jpg";
		arrImages[1] = "/images/slide2.jpg";
		arrImages[2] = "/images/slide3.jpg";
		arrImages[3] = "/images/slide4.jpg";
		arrImages[4] = "/images/slide5.jpg";
		arrImages[5] = "/images/slide6.jpg";
		arrImages[6] = "/images/slide7.jpg";
		arrImages[7] = "/images/slide8.jpg";
		arrImages[8] = "/images/slide9.jpg";
		arrImages[9] = "/images/slide10.jpg";
		arrImages[10] = "/images/slide11.jpg";
		arrImages[11] = "/images/slide12.jpg";
		arrImages[12] = "/images/slide13.jpg";
		arrImages[13] = "/images/slide14.jpg";
		arrImages[14] = "/images/slide15.jpg";
		arrImages[15] = "/images/slide16.jpg";
		arrImages[16] = "/images/slide17.jpg";
		arrImages[17] = "/images/slide18.jpg";
		arrImages[18] = "/images/slide19.jpg";
		arrImages[19] = "/images/slide20.jpg";
		arrImages[20] = "/images/slide21.jpg";
		var i = 0;
		for(i=0; i<21; i++) {
			imgPreload[i] = new Image();
			imgPreload[i].src = arrImages[i];
		}
	}
}

//AJAX Functions

var xmlhttp=false;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    xmlhttp = false;
   }
  }
@end @*/

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}  
}


function changeContent(parentDiv,childDiv,page) {
	var element = document.getElementById(parentDiv);
	
	xmlhttp.open("GET", page);      

	xmlhttp.onreadystatechange = function() {
      		if (xmlhttp.readyState == 4){
			if(xmlhttp.status == 200 || xmlhttp.status == 0) {
				deleteChild(parentDiv,childDiv);
				element.innerHTML = xmlhttp.responseText;
        		}
		}
	}
     
	xmlhttp.send(null);
}

function deleteChild(parentDiv,childDiv) {

  	if(document.getElementById(childDiv)) {
		
		//Get a reference to the parent.
		var objParent = document.getElementById(parentDiv);

		//Get a reference to the child.
		var objChild = document.getElementById(childDiv);
  
		//Remove the child.
		objParent.removeChild(objChild);
	}
}

//Change the body ID
function changeBodyId(newId) {
	var arrBody = document.getElementsByTagName('body');
	arrBody[0].id=newId;
}

function changeMainContent(page,bodyId) {

	changeContent('content','slideimage',page);
	//Set the new body ID
	changeBodyId(bodyId);
	
}


