//displays the sublist under the dropdown sections of the navigation 
function toggle(obj) {	
	var menu = document.getElementById('menu' + obj);
	if (menu.style.display == 'none' || menu.style.display == ''){
		menu.style.display = 'block';
	} else {
		menu.style.display = 'none';
	}
}

function toggletable(obj) {
	var menu = document.getElementById(obj);
	if (menu.style.display == 'none'){
		menu.style.display = 'block';
	} else {
		menu.style.display = 'none';
	}
}

//the triangle next to the navigation sections with sublists
var triangle = { down: new Image(), right: new Image() };
    triangle.down.src  = '../images/triangleblue.gif';
    triangle.right.src = '../images/triangle90blue.gif';

//makes the triangle change direction
function displayList(idx) {
	var d = document.getElementById('image' + idx);
    if (d.src == triangle.down.src) d.src = triangle.right.src;
    else d.src = triangle.down.src;
    toggle(idx);
}

//makes the image under the header load randomly
function rndImage()
{	
image0="../images/photo/cmsdynamic.jpg"
alt0="cmsdynamic"
image1="../images/photo/cmsdiverse.jpg"
alt1="cmsdiverse"
image2="../images/photo/cmsunique.jpg"
alt2="cmsunique"
image3="../images/photo/cmsinnovative.jpg"
alt3="cmsinnovative"
image4="../images/photo/cmsglobal.jpg"
alt4="cmsglobal"
photo="photo"

len=5
now=new Date()
now=now.getSeconds()
rnd=now%len
image=eval("image"+rnd)
alt=eval("alt"+rnd)
document.write("<img src=" + image + " alt=" + alt + " id=" + photo + "></a>")
}

function movepic(img_name,img_src) {

image1 = new Image();
image1.src = "../images/circleblue.gif";

image2 = new Image();
image2.src = "../images/blackcircle.gif";
document[img_name].src=img_src;
}


var imArray = 
[
	"../images/photo/cmsdynamic.jpg",
	"../images/photo/cmsdiverse.jpg",
	"../images/photo/cmsunique.jpg",
	"../images/photo/cmsinnovative.jpg",
	"../images/photo/cmsglobal.jpg",
	"../images/triangleblue.gif",
	"../images/triangle90blue.gif"
]

function  prerun(){
	preload(imArray);
}

 
function preload(arr)
{ 
	for(var i=0; i<arr.length; i++)
	{
		 var img = new Image;
		 img.src = arr[i]
		 arr[i]  = img;
	}
}


