


var site_root = 'http://206.102.88.36/_projects/els/site/';


//	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 subMenu_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');
	subMenu_div = document.getElementById('subMenu');
	footer_div = document.getElementById('footer');
	
	
	//startLists();
	
	runFlash();
	
	setPopupLinks();
	
}

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


function setPopupLinks() {
	var all_links = document.getElementsByTagName('A');
	
	for (var aa=0; aa<all_links.length; aa++) {
		this_targ = all_links[aa].getAttribute('target');
		if (this_targ) {
			//all_links[aa].attr = '';
			all_links[aa].onclick = openPopup;
		}
	}	
}



function openPopup () {
	if (!this.attr) {
		this.attr = 'menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes,width=850,height=600';
	}
	this.attr += ',left=0,top=0,screenX=0,screenY=0';
	new_win = window.open(this,this.target,this.attr);
	new_win.focus();
}


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="../../site/attachments/'+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';
	}
}

function display(num)
{
	var change = document.getElementById("notification_report");
	var change2 = document.getElementById("nrlink");
	
	if (num == 1)
	{
		change.style.display = "block";
		//closes SSN Alert Message for admin
		change2.style.display = "none";
	}
	else
	{
		change.style.display = "none";	
	}
}

function chairchecked(formId)
{
	var check = document.getElementById("chair_checked_"+formId);
	
	if (check.checked)
	{
		check.value = 1;
	}
	else
	{
		check.value = 0;
	}
	
	//alert (check.value);
	
	httpObject = getHTTPObject();
	if (httpObject != null) {

		var url = "../ssn_new/save_check.php";
		var params = "detail_form_id="+formId+ "&" +
					 "checked=" + check.value;
		httpObject.open("POST", url, true);

		//Send the proper header information along with the request
		httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		httpObject.setRequestHeader("Content-length", params.length);
		httpObject.setRequestHeader("Connection", "close");

//		httpObject.open("GET", "upperCase.php?inputText="+document.getElementById('inputText').value, true);
		httpObject.send(params);
		httpObject.onreadystatechange = response_saveTestFolder;
	
	}
	
}

//a check for the checkchair function
function response_saveTestFolder() {
	if(httpObject.readyState == 4){
		var ajaxResponse = httpObject.responseText;
		//alert(ajaxResponse);
	}
}

function viewStudentsForm(id,act,intnt) {
	formView = window.open('','formView','width=800,height=600,toolbar=yes,location=no,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
	d = formView.document;
	d.open();
	d.write("<html>");
	d.write("<body style='background-color: #FFFFFF;'><span style='font-weight:bold;font-size:16px;'>Retrieving Form ...</span>");
	d.write("<form name='a' action='" + act + "' method='post'>");
	d.write("<input type='hidden' name='detail_form_id' value='" + id + "'>");
	d.write("<input type='hidden' name='notabs' value='yes'>");
	d.write("<input type='hidden' name='isPopUP' value='yes'>");
	d.write("<input type='hidden' name='intent' value='" + intnt + "'>");
	d.write("<input type='hidden' name='plainMode' value='yes'>");
d.write("</form></body></html>");
	d.close();
	formView.document.forms[0].submit();
	formView.focus();
}

function getHTTPObject(){
	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest) return new XMLHttpRequest();
	else {
			alert("Your browser does not support AJAX.");
			return null;
	}
}

function editReferral(a) {
	f = document.getElementById("theForm");
//	e = MWJ_findObj("referral_id");
	f.referral_id.value = a;
	f.submit();
}

function printreport() 
{
	iframe = document.getElementById("printForm");
	
   if(iframe.contentDocument)   
      // Firefox, Opera   
      d = iframe.contentDocument;   
   else if(iframe.contentWindow)   
      // Internet Explorer   
      d = iframe.contentWindow.document;   
   else if(iframe.document)   
      // Others?   
      d = iframe.document;  
	  
	d.open();
	d.write("<html><body style='background-color: #FFFFFF;'><span style='font-weight:bold;font-size:16px;'>Retrieving Form ...</span>");
	d.write("<form name='a' action='notification_report.php' method='post'>");
	d.write("</form></body></html>");
	d.close();
	d.forms[0].submit();
}

function displaymessage(num)
{
	var e = document.getElementById("assigned_forms");
	
	if (num == 1)
	{
		e.style.display = "block";	
	}
	else
	{
		e.style.display = "none";
	}
}

function displayvideo(num)
{
	var e = document.getElementById("videodiv");
	
	if (num == 1)
	{
		e.style.display = "block";	
	}
	else
	{
		e.style.display = "none";
	}
}

function displaynrlink(num)
{
	var e = document.getElementById("nrlink");
	
	if (num == 1)
	{
		e.style.display = "block";	
	}
	else
	{
		e.style.display = "none";
	}
}