function randomImage() {

	var objParent = document.getElementById("flash_area");
	var intRandom = randomNumber(9);

	var arrImages = new Array(9);
	arrImages[0] = "flash_img1.png";
	arrImages[1] = "flash_img2.png";
	arrImages[2] = "flash_img3.png";
	arrImages[3] = "flash_img4.png";
	arrImages[4] = "flash_img5.png";
	arrImages[5] = "flash_img6.png";
	arrImages[6] = "flash_img8.png";
	arrImages[7] = "flash_img9.png";
	arrImages[8] = "flash_img10.png";
	//Set up the image tag, DOM style
	var objImage = document.createElement("img");
	objImage.setAttribute("src","/templates/CMIT/images/header/"+arrImages[intRandom]);


	objImage.setAttribute("width","857");
	objImage.setAttribute("height","204");
	objImage.setAttribute("alt","Technology consulting, support, and solutions for small businesses.");
	objImage.setAttribute("title","Technology consulting, support, and solutions for small businesses.");
	objImage.setAttribute("sm:iepng","true");

	//Add Image
	objParent.appendChild(objImage);
}

function randomNumber(num) {
    var intRandom = Math.floor(Math.random()*num);
    return intRandom;
}


var imgPreload = new Array();
var delay = 4000; // time delay between rotates, 1000 = 1 second
//var noOfImgs = 3; // number of images
var imgNo=0;
var imgNoM=4;
var f_url = new Array();
f_url[0] ="/index.php?option=com_content&view=article&id=61&Itemid=74";
f_url[1] ="/index.php?option=com_content&view=article&id=60&Itemid=73";
f_url[2] ="/index.php?option=com_content&view=article&id=59&Itemid=72";
f_url[4] ="/index.php?option=com_content&view=article&id=61&Itemid=133";
f_url[5] ="/index.php?option=com_content&view=article&id=60&Itemid=132";
f_url[6] ="/index.php?option=com_content&view=article&id=59&Itemid=131";
function preloadImages(strPath) {

	if (document.images) {
		
		// set image url
		arrImages = new Array();
		arrImages[0] = "/templates/CMIT/images/featured_serv1.png";
		arrImages[1] = "/templates/CMIT/images/featured_serv2.png";
		arrImages[2] = "/templates/CMIT/images/featured_serv3.png";
		arrImages[3] = "/templates/CMIT_Microsite/images/call_today.jpg";
		arrImages[4] = "/templates/CMIT_Microsite/images/cmitantispam.jpg";
		arrImages[5] = "/templates/CMIT_Microsite/images/cmitguardian.jpg";
		arrImages[6] = "/templates/CMIT_Microsite/images/cmitmarathon.jpg";
		var i = 0;
		for(i=0; i<7; i++) {
			imgPreload[i] = new Image();
			imgPreload[i].src = arrImages[i];
		
		}
	}
}
function rotateImage()
{
	//var imgNo = randomNumber(3);
   if(imgNo == 3)
   {
      imgNo = 0;
  }
   else
   {
    document.getElementById('featured_img').src = arrImages[imgNo];
    document.getElementById('featured_url').href = f_url[imgNo];
   imgNo++;
   }
	var recur_call = "rotateImage()";
   	setTimeout(recur_call, delay);
}
function rotateImageM()
{
	//var imgNo = randomNumber(3);
   if(imgNoM == 7)
   {
      imgNoM = 4;
  }
   else
   {
    document.getElementById('call_today_img').src = arrImages[imgNoM];
    document.getElementById('call_today_url').href = f_url[imgNoM];
   imgNoM++;
   }
	var recur_call = "rotateImageM()";
   	setTimeout(recur_call, delay);
}
