// <!--
// BEGIN Script

function dropDown(img,tbl) {
	if (typeof img == 'string' ) img = document.getElementById( img );
	if (typeof tbl == 'string' ) tbl = document.getElementById( tbl );
	if (tbl.style.display=='none') {
		tbl.style.display='';
		img.src="/figis/assets/images/search/lessinfo_black.gif";
		img.alt="collapse";
	} else {
		tbl.style.display='none';
		img.src="/figis/assets/images/search/addinfo_black.gif";
		img.alt="expand";
	}
}

function rewrite4dropdown() {
	var divs = document.getElementsByTagName('DIV');
	for ( var i = 0; i < divs.length; i++ ) {
		var d = divs[i];
		if ( d.className.indexOf('autoExpandable') < 0 ) continue;
		var id = String(Math.floor(Math.random()*10000000000));
		var ectext;
		if ( d.getAttribute('title') ) {
			ectext = d.getAttribute('title');
			d.removeAttribute('title');
		} else {
			ectext = 'Display/hide details';
		}
		var h = d.innerHTML;
		var nh = '<div class="autoExpandSwitch"><a href="javascript:dropDown(\'img_' + id + '\',\'div_' + id + '\')">' + ectext +
			' <img id="img_' + id + '" src="/figis/assets/images/search/addinfo_black.gif" alt="expand" border="0" /></a></div>' +
			'<div id="div_' + id + '" style="display:none;" class="autoExpandBody">' + h + '</div>';
		d.innerHTML = nh;
	}
}

var alreadyrunflag_rewrite4dropdown=0 //flag to indicate whether target function has already been run

function addRewrite4dropdownEvent() {
	if(/Safari/i.test(navigator.userAgent)){ //Test for Safari
		alreadyrunflag_rewrite4dropdown=setInterval( function() {
			if(/loaded|complete/.test(document.readyState)) {
				clearInterval(alreadyrunflag_rewrite4dropdown);
				rewrite4dropdown() // call target function
			}
		}, 10);
	} else if (document.addEventListener) {
		document.addEventListener("DOMContentLoaded", function(){alreadyrunflag_rewrite4dropdown=1; rewrite4dropdown(); }, false);
	} else if (document.all && !window.opera) {
		document.write('<script type="text/javascript" id="contentloadtag_rewrite4dropdown" defer="defer" src="javascript:void(0)"><\/script>');
		var contentloadtag=document.getElementById("contentloadtag_rewrite4dropdown");
		contentloadtag.onreadystatechange=function(){
			if (this.readyState=="complete") {
				alreadyrunflag_rewrite4dropdown=1;
				rewrite4dropdown();
			}
		};
	} else {
		window.onload = rewrite4dropdown;
	}
};

addRewrite4dropdownEvent();

// END Script
// -->

