


var site_root = 'http://';


//	Browser detection
var w3c = (document.getElementById) ? true : false;
var ie = (document.all && w3c) ? true : false;
var ie7 = (document.all && document.getElementById && window.XMLHttpRequest) ? true : false;
var ie6 = (ie && !ie7) ? true : false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;


// Styles applied by JavaScript before the page loads
var the_styles = '';
the_styles += '<style type="text/css">';
the_styles += '';
the_styles += '</style>';

document.write(the_styles);
// End styles applied by JavaScript before the page loads


// Flash content control.
var pages_with_flash = new Array();
pages_with_flash[0] = new Array('sitewide','flash_intro/dhi_intro.swf',256,523,'dhiIntro');

// Page elements declared for global use
var body_tag;
var mother_div;
var banner_div;
var content_div;
var menu_div;
var footer_div;

function init() {
	body_tag = document.getElementsByTagName('BODY')[0];
	mother_div = document.getElementById('mother');
	banner_div = document.getElementById('banner');
	content_div = document.getElementById('content');
	menu_div = document.getElementById('menu');
	footer_div = document.getElementById('footer');
	
	//runFlash();
	
	//setLinks();
	
	
	/* ::::::: SHOW CONTENT AREA :::::::  */
	if (content_div) {
		content_div.style.visibility = 'visible';
	}
	/* ::::::: END SHOW CONTENT AREA :::::::  */
	
}

if (w3c) { window.onload=init; }






function setLinks() {
	//OpeningPDF
	var all_links = document.getElementsByTagName('A');
	
	for (var aa=0; aa<all_links.length; aa++) {
		if (all_links[aa].target.toLowerCase() == 'openingpdf') {
			all_links[aa].onclick = function () {
				link_string = this.toString();
				slash_char = link_string.lastIndexOf('/') + 1;
				popupWindow(site_root + 'pdf/index.html?' + link_string.substr(slash_char), this.target, 'menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=785,height=520');
				return false;
				
			}
		}
	}
	
	
}


var pdf_loaded = false;
function loadPDF() {
	var pdf_page = document.getElementById('pdfPage');
	if (pdf_loaded == true) {
		location.href = location.search.substr(1);
	}
	if (pdf_page && pdf_loaded == false) {
		pdf_loaded = true;
		setTimeout('loadPDF()',1500);
	}
}

//	Popup window code
var page_position = (parseInt(navigator.appVersion) > 3) ? 'left=0,top=0,screenX=0,screenY=0,' : "";
var popup_features = 'menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=785,height=480';

function popupWindow(url, target, features) {
	if (isUndefined(features)) {
		features = popup_features;
	}
	if (isUndefined(target)) {
		target = '_blank';
	}
	var the_window = window.open(url, target, page_position+features);
	the_window.focus();
	return the_window;
}

function linkPopup(src, features) {
	return popupWindow(src.getAttribute('href'),src.getAttribute('target') || '_blank',features);
}//	End Popup window code

//	Utility function [currently used in popupWindow()]
function isUndefined(v) { 
	//	Returns true if [v] is not defined, false otherwise
	//	IE 5.0 does not support the undefined keyword, so we cannot 
	//	do a direct comparison such as v===undefined.
	var undef;
	return v===undef;
}





function runFlash() {
	
	var this_url = location.href;
	var swf_url;
	var swf_name;
	var swf_height;
	var swf_width;
	var swf_element_id;
	var swf_element;
	
	for (var aa=0; aa<pages_with_flash.length; aa++) {
		
		swf_url = pages_with_flash[aa][0];
		swf_name = pages_with_flash[aa][1];
		swf_height = pages_with_flash[aa][2];
		swf_width = pages_with_flash[aa][3];
		swf_element_id = pages_with_flash[aa][4];
		swf_element = document.getElementById(swf_element_id);
		
		if ((this_url.indexOf(swf_url) != -1  || swf_url == 'sitewide') && swf_element) {
			
			swf_element.style.height = swf_height + 'px';
			swf_element.style.width = swf_width + 'px';
			insertFlash(swf_name,swf_height,swf_width,swf_element_id);
			
		}
	}
}


function ieHoverHelper(parent_id, hover_element, class_name) {
	if (ie6) {
		var rollies = document.getElementById(parent_id).getElementsByTagName(hover_element);
		
		for (aa=0; aa<rollies.length; aa++) {

			rollies[aa].onmouseenter = function() {
				if (this.className == '') {
					this.className = class_name;
				} else {
					this.className = class_name +  ' ' + this.className;
				}
			}
			rollies[aa].onmouseleave = function() {
				if (this.className == class_name) {
					this.className = '';
				} else {
					str = class_name+' ';
					if (this.className.indexOf(str) != -1) {
						remove_class = this.className.split(str);
						this.className = remove_class[1];
					}
				}
			}
		}
	}
}


//	FLASH PLAYER CHECK
//	Variable [hasRightVersion] will be set to true or false

var requiredVersion = 8;
var hasRightVersion = false;


if (navigator.plugins) {
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]
	&& navigator.mimeTypes["application/x-shockwave-flash"] 
	&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {		
		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		
	}
}

//	Write VBScript on IE Windows
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
if (isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  	document.write('on error resume next \n');
	document.write('hasFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('hasFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('hasFlash8 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
	document.write('hasFlash9 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
	document.write('hasFlash10 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');
	document.write('hasFlash11 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.11"))) \n');
	document.write('hasFlash12 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.12"))) \n');
  	document.write('</SCR' + 'IPT\> \n');
	
	for (var i=6; i <= requiredVersion; i++) {  
		if (eval("hasFlash" + i) == true) {
			flashVersion = i;
		}
	}
}

if (flashVersion >= requiredVersion) {
	hasRightVersion = true;
}//	End Flash Player check


var site_bg = '#000';
//	This function returns the <object> and <embed> tags in variable [oeTags]
function makeFlashTags(the_swf,the_height,the_width) {
	var flashTag;
	if (isIE && isWin) {
		flashTag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		+ 'width="'+the_width+'" height="'+the_height+'"'
		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
		+ '<param name="movie" value="../'+the_swf+'" />'
		+ '<param name="play" value="true" />'
		+ '<param name="quality" value="high" />'
		+ '<param name="menu" value="false" />'
		+ '<param name="bgcolor" value="' + site_bg + '" />'
		//	+ '<param name="loop" value="false" />'
		+ '</object>';
	} else {
		flashTag = '<embed src="'+the_swf+'"'
		+ 'width="'+the_width+'" height="'+the_height+'"'
		+ 'play="true"'
		+ 'quality="high"'
		+ 'menu="false"'
		+ 'bgcolor="' + site_bg + '"'
		+ 'type="application/x-shockwave-flash"'
		+ 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
		//	+ 'loop="false"'
		+ '</embed>';			
	}
	return flashTag;
	
}
//	This function swaps innerHTML of [the_container] with makeOETags()
function insertFlash(the_swf,the_height,the_width,the_container) {
	if (hasRightVersion) {
		document.getElementById(the_container).style.display = '';
		document.getElementById(the_container).innerHTML = makeFlashTags(the_swf,the_height,the_width);
		document.getElementById(the_container).style.display = 'block';
	}
}


