﻿// JScript File
function menuHandler(sItem)
{
	var item = document.getElementById(sItem);
	
	if (item.style.display == "none")
	{
		item.style.display = "";
	}
	else
	{
		item.style.display = "none";
	}
}// menuHandler

/**
* Short cut for getting the element by id
* @param anon the string of the element id
*/
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}//end $

function makevisible(cur,which){
    strength=(which==0)? 1 : 0.2

    if (cur.style.MozOpacity)
    cur.style.MozOpacity=strength
    else if (cur.filters)
    cur.filters.alpha.opacity=strength*100
}

function Carousel(){}
						
function DoCallback(url, params)
{
	var pageUrl = url + "?callback=true&param=" + params;
	var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
	xmlRequest.open("POST", pageUrl, false);
    xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlRequest.send(null);
    return xmlRequest;
}

function MoreInfo()
{
    var selectedEmpID = document.all["EmployeeList"].value;
	var xmlRequest = DoCallback("News.aspx", selectedEmpID);

	// sync updates
	Msg.innerHTML = xmlRequest.responseText;
}

/**
* This method is used to get around the "new feature"
* in IE for embedding content in websites
* @param container element id of the container
* @param movie the url of the movie
* @param width the width
* @para, height the height
*/
function showFlash(container, movie, width, height) {                                   
    var output = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+width+"' height='"+height+"' id='myflash'>";
    output += "<param name='WMode' value='transparent'></param>";
    output += "<param name='allowScriptAccess' value='sameDomain' />";
    output += "<param name='movie' value='" + movie + "' />";
    output += "<param name='quality' value='high' />";
    output += "<embed wmode='transparent' src='" + movie + "' quality='high' width='"+width+"' height='"+height+"' name='mymovie' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
    output += "</object>"; 
    $(container).innerHTML = output;
}//end showFlash 


/**
* This method will set the innerHTML of a given div
* to have an embed with the url parameter as the source
*
* @param frameId the Div to put the results in
* @param url the url of the media to display
*/
function setVideoFrame(frameId, url){
   showFlash(frameId, url, "100%", "100%");
   //var element = document.getElementById(frameId);
   //element.innerHTML = "<embed src=\"" + url + "\" width=\"100%\" height=\"100%\"></embed>";
}//end setVideoFrame