FlashObject = function(swf, id, w, h, ver, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver || 7; 
	this.align = "middle"; 
	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.altTxt = "<a href='http://www.macromedia.com/go/getflashplayer'><img src='/elearning/images/noFlash.png' alt='Get Flash!' border='0'></a>";
	this.bypassTxt = "";
	this.params = new Object();
	this.variables = new Object();
	if (c) this.color = this.addParam('bgcolor', c);
	this.addParam('quality', 'best');
	this.doDetect = getQueryParamValue('detectflash');
}

FlashObject.prototype.addParam = function(name, value) {
	this.params[name] = value;
}

FlashObject.prototype.getParams = function() {
    return this.params;
}

FlashObject.prototype.getParam = function(name) {
    return this.params[name];
}

FlashObject.prototype.addVariable = function(name, value) {
	this.variables[name] = value;
}

FlashObject.prototype.getVariable = function(name) {
    return this.variables[name];
}

FlashObject.prototype.getVariables = function() {
    return this.variables;
}

FlashObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
}

FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) {
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
        if (this.getParamTags() != null) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    else {
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs() != null) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    }
    return flashHTML;
}
FlashObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
        variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
        return variablePairs.join("&");
    }
    else {
        return null;
    }
}
FlashObject.prototype.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') {
		if (elementId) {
			document.getElementById(elementId).innerHTML = this.getHTML();
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else {
			if (elementId) {
				document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
			} else {
				document.write(this.altTxt +""+ this.bypassTxt);
			}
		}
	}		
}
function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.plugins.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x){
			if (x.description) {
				var y = x.description;
	   			flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}
function detectFlash(ver) {	
	if (getFlashVersion() >= ver) {
		return true;
	} else {
		return false;
	}
}
function getQueryParamValue(param) {
	var q = document.location.search;
	var detectIndex = q.indexOf(param);
	var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length;
	if(q.length > 1 && detectIndex != -1) {
		return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
	} else {
		return "";
	}
}
if(Array.prototype.push == null){
	Array.prototype.push = function(item){
		this[this.length] = item;
		return this.length;
	}
}

///////////////////

var divTitles = new Array('aboutusMenu','productsMenu','freetoolsMenu','solutionsMenu','supportMenu');
var timerTime = "";
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function showMenu(button) {
	clearMenus();
	if(browser == 'Internet Explorer' && OS == 'Windows'){
		a = 0;
		p = 84;
		f = 176;
		u = 279;
		s = 376;	
	} else if(browser == 'Safari' && OS == 'Mac'){
		a = 10;
		p = 92;
		f = 178;
		u = 200;
		s = 269;
	} else {
		a = 9;
		p = 88;
		f = 181;
		u = 284;
		s = 382;
	}
	if(button == 'aboutusMenu'){
		var x = 15;
		//var x = ((document.body.offsetWidth-992)/2)+a;
	} else if(button == 'productsMenu'){
		var x = 95;
		//var x = ((document.body.offsetWidth-992)/2)+p;
	} else if(button == 'freetoolsMenu'){
		var x = 190;
		//var x = ((document.body.offsetWidth-992)/2)+f;
    	}  else if(button == 'solutionsMenu'){
		var x = 293;
		//var x = ((document.body.offsetWidth-992)/2)+u;		
	} else if(button == 'supportMenu'){
		var x = 390;
		//var x = ((document.body.offsetWidth-992)/2)+s;
	}
	//alert(x);
	
	var y = 101;
	eval ('document.getElementById(\''+button+'\').style.visibility = "visible";');
	eval ('document.getElementById(\''+button+'\').style.left = x + "px";');
	eval ('document.getElementById(\''+button+'\').style.top = y + "px";');
	eval ('document.getElementById(\''+button+'_tab\').style.visibility = "visible";');
	eval ('document.getElementById(\''+button+'_tab\').style.left = x + "px";');
	eval ('document.getElementById(\''+button+'_tab\').style.top = (y-15) + "px";');
}

function clearMenus(){
	for (x=0; x < divTitles.length; x++){
		eval ('document.getElementById(\''+divTitles[x]+'\').style.visibility = "hidden";');
		eval ('document.getElementById(\''+divTitles[x]+'_tab\').style.visibility = "hidden";');
	}
}

function timeOut(t){
	if (timerTime != ""){
		clearTimeout(timerTime);
	}
    timerTime = setTimeout("clearMenus()", t);
}

function demoItNowLaunch(){
	demoItNowClose_QL();
	presentationClose();
	demoItNowSize();
	eval ('document.getElementById(\'demo_it_now\').style.zIndex = 9000;');
	eval ('document.getElementById(\'demo_it_now\').style.visibility = "visible";');
	window.document.demoItNow.SetVariable("openWindow" , 1);
}

function demoItNowClose(){
	eval ('document.getElementById(\'demo_it_now\').style.visibility = "hidden";');
	eval ('document.getElementById(\'demo_it_now\').style.zIndex = 0;');
	window.document.demoItNow.SetVariable("closeWindow" , 1);
}

function demoItNowSize(){
	var y = 110;
	var x = ((document.body.offsetWidth-720)/2);
	eval ('document.getElementById(\'demo_it_now\').style.left = x + "px";');
	eval ('document.getElementById(\'demo_it_now\').style.top = y + "px";');
}

//Added

function demoItNowLaunch_QL(course, cat){
	demoItNowClose();
	presentationClose();
	demoItNowSize_QL();
	eval ('document.getElementById(\'demo_it_now_QL\').style.zIndex = 9000;');
	eval ('document.getElementById(\'demo_it_now_QL\').style.visibility = "visible";');
	window.document.demoItNow_QL.SetVariable("OneCatSelected", cat);
	window.document.demoItNow_QL.SetVariable("OneCourseSelected", course);	
}

function demoItNowClose_QL(){
	eval ('document.getElementById(\'demo_it_now_QL\').style.visibility = "hidden";');
	eval ('document.getElementById(\'demo_it_now_QL\').style.zIndex = 0;');
	window.document.demoItNow_QL.SetVariable("closeWindow" , 1);
}

function demoItNowSize_QL(){
	var y = 110;
	var x = ((document.body.offsetWidth-720)/2);
	eval ('document.getElementById(\'demo_it_now_QL\').style.left = x + "px";');
	eval ('document.getElementById(\'demo_it_now_QL\').style.top = y + "px";');
}

//End Added

function presentationSizeLaunch(m,p){
	demoItNowClose();
	presentationSize();
	eval ('document.getElementById(\'presentation_Player\').style.zIndex = 9001;');
	eval ('document.getElementById(\'presentation_Player\').style.visibility = "visible";');
	window.document.presentationPlayer.SetVariable("market" , m);
	window.document.presentationPlayer.SetVariable("newPath" , p);
}

function presentationClose(){
	eval ('document.getElementById(\'presentation_Player\').style.visibility = "hidden";');
	eval ('document.getElementById(\'presentation_Player\').style.zIndex = 0;');
	window.document.presentationPlayer.SetVariable("newPath" , 1);
}

function presentationSize(){
	var y = 55;
	var x = ((document.body.offsetWidth-640)/2)+60;
	eval ('document.getElementById(\'presentation_Player\').style.left = x + "px";');
	eval ('document.getElementById(\'presentation_Player\').style.top = y + "px";');
}

function popup(url,high,wide){
	subwin=window.open(url,"","width=" + wide + ",height=" + high + ",location=no,toolbar=no,menubar=yes,status=yes,scrollbars=yes");
}
function doResizes(){
	//clearMenus();
	//demoItNowSize();
	//presentationSize();
}
