function precache (){
	var tmp = new Array( 
	"hnt_investor_relations","hnt_about_the_group","hnt_news","hnt_careers","hnt_contacts","icapsitedropimage","hnt_home"
	);
	precache_imgs( tmp );
}

var Imgs = new Array();

function precache_imgs( theimgs ) {

	for(var i=0; i<theimgs.length; i++) {
		var j = Imgs.length;
		var tmp = { id: theimgs[i], on:null,off:null,text:null }
		Imgs[j] = tmp;
	}
}

// called on mouseover, swaps topnav image 
function img_over( name ) {
	var img = null;
	for(var i=0; i<Imgs.length; i++) {
		if( Imgs[i].id == name ) {
			img = Imgs[i]
		}
	}
	if( img != null ) {
//		document.images[ name ].src = img.on.src;		
	}
}

// called on mouseout, Replaces topnav image 
function img_out( name ) {
	var img = null;
	for(var i=0; i<Imgs.length; i++) {
		if( Imgs[i].id == name ) {
			img = Imgs[i]
		}
	}
	if( img != null ) {
//		document.images[ name ].src = img.off.src;
	}
}

// Topnav DHTML Rollover Code

function showmenu(elmnt,name,offset) {
    var c = getAnchorPosition(name);
	var adjust = offset	
	//alert("X = "+c.x+" , Y = "+c.y);
	if (document.getElementById) {
		var o = document.getElementById(elmnt);
		if (o.style.visibility=="visible") {
			hidemenu(elmnt);
			//if (elmnt=="icapsitedroplist"){
			//	img_out('icapsitedropimage');
			//}
		} else if (o.style) {
			o.style.left = c.x;
			// LGC 2/23/06
			// Add padding for explorer
			// not for firefox.  
			if(navigator.appName == "Microsoft Internet Explorer")
			    o.style.top = c.y + adjust;
			else
			    o.style.top = c.y;
			    
			o.style.visibility = "visible";
			
			//if (elmnt=="icapsitedroplist"){
			//	img_over('icapsitedropimage');
			//}
		}
	} 
}

function hidemenu(elmnt) {
	var o = document.getElementById(elmnt);
	if (o.style) {
			o.style.visibility = "hidden";		
		}
}
// Window Opening / Closing Funcitons 

function openLargePopup( url, windowname ) {
  var popup = window.open( url , windowname, "toolbar=yes,status=yes,scrollbars=yes,menubar=yes,locationbar=yes,top=50,left=70,outerWidth=700,outerHeight=468,width=700,height=468,resizable=yes");
  popup.focus();
}



function openMedPopup( url, myevent ) {
    var mozilla=document.getElementById && !document.all
    var ie=document.all
    
    var Popup=document.getElementById("ContactImage")

    if (mozilla){
        x = myevent.clientX + document.body.scrollLeft + 30;
        y = myevent.clientY + document.body.scrollTop + 40;
        Popup.style.display="block"
        Popup.style.left = x + "px" //
        Popup.style.top = y + "px" //
        Popup.innerHTML = "<img src='http://www.icapenergy.com/US/docs/image/" + url +".jpg'/>";
    return false
    }
    else if (ie){
        x = myevent.clientX + document.body.scrollLeft + 30;
        y = myevent.clientY + document.body.scrollTop + 40;
        Popup.style.display="block";
        Popup.style.left = x;
        Popup.style.top = y;
        Popup.innerHTML = "<img src='http://www.icapenergy.com/US/docs/image/" + url +".jpg'/>";
    return false
    }

}


function HideTooltip()
{
    var x=document.getElementById("ContactImage")
    x.style.display="none";
}


function closeWindow() {
  self.close();
}

// Drop-down location.href redirection
 
function dropdown_redirect(select_name) {
 	location.href=select_name.options[select_name.selectedIndex].value
 }
 
 
 // Share Holder Window Opening / Closing Funcitons 

function openSharePopup( url, windowname ) {
  var popup = window.open( url , windowname, "toolbar=no,status=no,scrollbars=no,menubar=no,locationbar=no,top=50,left=70,outerWidth=700,outerHeight=200,width=700,height=200,resizable=yes");
  popup.focus();
}



function popSwfWin(url) {

window.open(url,'grad','height=530,width=800,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0,left=150,top=100');

}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
	
function changeImages() {
	if (document.images ) {
		for (var i=0; i < changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
