function montre(id)
{
	var flashLayer = document.getElementById("featimage_home")
	flashLayer.style.zIndex=100
	
	var mainnavigation = document.getElementById("mainnavigation")
	mainnavigation.style.zIndex=1000
	
	
	var li = document.getElementById(id);
	
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	
	if (li) {li.style.display='block';}
}





function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Nav_AboutUs_over = newImage("../htmlimages/Nav_AboutUs_over.gif");
		Nav_Engineering_over = newImage("../htmlimages/Nav_Engineering_over.gif");
		Nav_Animations_over = newImage("../htmlimages/Nav_Animations_over.gif");
		Nav_Events_over = newImage("../htmlimages/Nav_Events_over.gif");
		Nav_Media_over = newImage("../htmlimages/Nav_Media_over.gif");
		Nav_Contact_over = newImage("../htmlimages/Nav_Contact_over.gif");
		Nav_TheCounties_over = newImage("../htmlimages/Nav_ClientAccess_over.gif");
		preloadFlag = true;
	}
}
function swapimage(id){

		var path = document.getElementById("bigimage")
		var _html

		if(id.length == 0){
				id = "noimage.gif"
		}
		
		if(id.substring(id.indexOf(".")) == ".flv"){
				
				_html =  '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="314" height="209" id="engine" align="middle">'
				_html += '<param name="allowScriptAccess" value="sameDomain" />'
				_html += '<param name="movie" value="engine.swf?filename=' + id + '" />'
				_html += '<param name="quality" value="high" />'
				_html += '<param name="bgcolor" value="#ffffff" />'
				_html += '<embed src="engine.swf?filename=' + id + '" quality="high" bgcolor="#ffffff" width="314" height="209" name="engine" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
				_html += '</object>'
       	               
		}else{
				_html = '<img src="data/userFiles/' + id + '" alt="" />'
		
		}		
		
		 path.innerHTML = _html
}
function toggleDiv(id){
		var path = document.getElementById(id)
		
		if(path.style.display == "none"){
				path.style.display = "inline"
		}else{
				path.style.display = "none"
		}
		
}
function submitForm(formName){
				document.getElementById(formName).submit()
}

function login(){
		document.getElementById("loginForm").submit()
}

function toggleDiv2(divID){
		var thediv
		thediv = document.getElementById(divID)
		if(thediv.style.display == "none"){
				thediv.style.display = "block"
		}else{
				thediv.style.display = "none"
		}
}

function showpopup(file){
	var editWin
	editWin = window.open("download.aspx?file=" + file,"_downloadwin","height=200,width=400");
	editWin.focus();
	//var interval_name = setInterval("editWin.close();clearInterval()", 100);
}

function showlegal(){
	//var editWin
	//editWin = window.open("legal.aspx","height=600,width=400");
	//editWin.focus();
	var UploadWindow =window.open("legal.aspx","NewWindow",
   "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=400,height=600");
   UploadWindow.location = "legal.aspx"; 
}
function showStudy(){
	var id = document.getElementById("studyselect").options[document.getElementById("studyselect").selectedIndex].value
	location = 'aboutus.aspx?page=hi-profile cases&id=' + id
}

var currentNewsItem = 1
function newsScroller(){
//alert("changing")		
		var todisplay
		
		if((currentNewsItem + 1) > newscount){
				todisplay = 1
		}else{
				todisplay = (currentNewsItem + 1)
		}
		
		document.getElementById("news_" + currentNewsItem).style.display = "none"
		document.getElementById("news_" + todisplay).style.display = "inline"
		currentNewsItem = todisplay
		
}
function toggleRollovers(section, dir){
		var thediv
		var theimage
		var sectionarray = new Array("about", "engineering", "animations", "media", "contact")
		var i = 0
		var imagestr
		
		imagestr = section.substring(0,1).toUpperCase() + section.substring(1);
		
		if(imagestr == "About") imagestr = "AboutUs"
				
		theimage = document["Nav_"+section];
		thediv = document.getElementById("navover_"+section);
		
		switch(dir){
			case "over":
				for(i=0; i<sectionarray.length; i++){
					toggleRollovers(sectionarray[i], 'hide')
				}				
				theimage.src = "data/htmlimages/Nav_"+imagestr+"_over.gif"
				if(thediv != undefined) thediv.style.display = "block"
				break;
			case "out":
				if(thediv == undefined) theimage.src = "data/htmlimages/Nav_"+imagestr+".gif"
				break;
			case "hide":
				theimage.src = "data/htmlimages/Nav_"+imagestr+".gif"
				thediv.style.display = "none"
				break;
		}
											
}
