function showDetails( url ) {
	window.open( url,'aerologic_details','width=438, height=546, scrollbars=no, status=no, resize=no');
}

function openDPS( url ) {
	window.open( url,'aerologic_dps','width=308, height=235, scrollbars=no, status=no, resize=no');
}

function showLayer( which ) {
	document.getElementById('techimage').src='/aerologic/frontend/img/tech_layer'+which+'.gif';
	document.getElementById('layer'+which).style.display='block';
}

function hideAllLayers() {
	document.getElementById('layer1').style.display='none';
	document.getElementById('layer2').style.display='none';
	document.getElementById('layer3').style.display='none';
	document.getElementById('layer4').style.display='none';
	document.getElementById('layer5').style.display='none';
	document.getElementById('techimage').src='/aerologic/frontend/img/blank_1x1.gif';
}

function flash_detection ( required, max ) {
	var required_version = required;
	var max_version = max;
	var available_version = 0;

	if(typeof(navigator.plugins["Shockwave Flash"]) == "object") {
		var description = navigator.plugins["Shockwave Flash"].description;
		available_version = description.substr(16, (description.indexOf(".", 16) - 16));
	} else if(typeof(ActiveXObject) == "function") {
		for(var i = 2; i < (max_version + 1); i ++) {
			try {
                if(typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i)) == "object") {
                   available_version = i;
                }
           }
           catch(error)
           {
           }
        }
    }

    return [available_version, required_version];
}

function writeFlash ( swf, fallback, width, height, wmode ) {
	var flashver = flash_detection(6, 9);

	if (flashver[0] >= 6) {	
		document.write(
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">' +
         			'<param name="movie" value="'+swf+'" />' +
         			'<param name="quality" value="high" />');
         			if (!wmode) {
                 	document.write('<param name="wmode" value="transparent" />');    
              }
   document.write('<embed id="flash" src="'+swf+'" quality="high" ');
            if (!wmode) {
              document.write('wmode="transparent"');
            } 
            document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>' +
  				'</object>'
			);
	} else {
		document.getElementById(fallback).style.display = 'block';
	}
}

function showJobDetails ( url ) {
	window.open( url,'aerologic_details','width=646, height=547, scrollbars=yes, status=no, resize=no');
}

function showJobDetailsOld ( which ) {
	var loop = true;
	var cnt = 0;
	while (loop==true) {
		cnt++;
		if (document.getElementById('line'+cnt)!=undefined) {
			hideJobDetails('line'+cnt);
		} else {
			loop = false;
		}
	}
	document.getElementById(which).style.visibility = 'collapse';
	var panelHeight = document.getElementById(which+'_content').clientHeight;
	document.getElementById(which+'_details').style.height = (panelHeight+9)+'px';
	document.getElementById(which+'_details').style.visibility = 'visible';
}

function hideJobDetails ( which ) {
	document.getElementById(which+'_details').style.height = 'auto';
	document.getElementById(which+'_details').style.visibility = 'collapse';
	document.getElementById(which).style.visibility = 'visible';
}

function showOperational() {
	if ( (document.getElementById('man_top_start').style.display=='none') && (document.getElementById('man_operational').style.display=='block') ) {
		document.getElementById('man_top').style.display = 'none';
		document.getElementById('man_top_start').style.display = 'block';

		document.getElementById('man_operational').style.display = 'none';
		document.getElementById('man_commercial').style.display = 'none';
	} else {
		document.getElementById('man_top_start').style.display = 'none';
		document.getElementById('man_top').style.display = 'block';

		document.getElementById('top_commercial').className = 'top_unselected_r';
		document.getElementById('top_operational').className = 'top_selected';

		document.getElementById('man_commercial').style.display = 'none';
		document.getElementById('man_operational').style.display = 'block';
	}
}

function showCommercial() {
	if ( (document.getElementById('man_top_start').style.display=='none') && (document.getElementById('man_commercial').style.display=='block') ) {
		document.getElementById('man_top').style.display = 'none';
		document.getElementById('man_top_start').style.display = 'block';

		document.getElementById('man_operational').style.display = 'none';
		document.getElementById('man_commercial').style.display = 'none';
	} else {
		document.getElementById('man_top_start').style.display = 'none';
		document.getElementById('man_top').style.display = 'block';

		document.getElementById('top_operational').className = 'top_unselected_l';
		document.getElementById('top_commercial').className = 'top_selected';

		document.getElementById('man_operational').style.display = 'none';
		document.getElementById('man_commercial').style.display = 'block';
	}
}
