var flashCanPlay = false;
var currentPath = window.location.pathname.split('/');
var sectionId = currentPath[currentPath.length - 2];
var pageId = currentPath[currentPath.length - 1];
sectionId = sectionId.replace(/-/g,"");
if(pageId.indexOf(".") > 0){pageId = pageId.substr(0,pageId.indexOf("."));}
pageId = pageId.replace(/-/g,"");
if(sectionId == '')
{
	if(pageId == 'index' || pageId == '') {sectionId = 'home';}
}
var catRequest = location.search;
if(catRequest != '')
{
	if(catRequest.indexOf('cat=') > 0){
		catRequest = catRequest.substr(catRequest.indexOf('cat=')+4,1);
	}else{
		catRequest = '';
	}
}
$(document).ready(function(){
	$("#"+sectionId+"Back").css('top','0px');
	$("#"+sectionId+"Button").css('color','#fff');
	$("#"+sectionId+"Sub").css('top','0px');
	$("#"+pageId+"Button").css('color','#ec008c');
	if(catRequest != '')
	{
		catRequest = parseInt(catRequest);
		var whichLink = portfolioCats[catRequest].toLowerCase();
		$("#"+whichLink+"Button").css('color','#791d7e');
	}
	
	var flashVars = '?section='+sectionId+'&page='+pageId;
	if(sectionId == 'brandingidentitycollateralinteractiveadvertisingpackagingportfolio'){flashVars += '&cat='+catRequest;}
	var flashInfo = prepFlash('/flash/banner.swf',flashVars,'banner','960','279','ffffff','','left','showAll',9,'','','true');
	if(flashCanPlay){
		$('#bannerDiv').html(flashInfo);
	}
	
	$("body").mouseover(function(){
		clearMenu();
		$("#mainMenu > a").not("#"+sectionId+"Button").css('color','#717073');
		$("#"+sectionId+"Button").css('color','#fff');
		$("#menuBacks > span").each(function(){
			var fPos = $(this).position();
			if(fPos.top < 63 && $(this).attr('id') != sectionId+"Back")
			{
				$(this).stop(true).animate({top:63});
			}
			else if($(this).attr('id') == sectionId+"Back")
			{
				$(this).stop(true).animate({top:0});
			}
		});
		//$(".subMenu").not("#"+sectionId+'Sub').css('top','-20px');
		$("#"+sectionId+'Sub').stop(true).animate({top:0});
	});
	
	$("#subMenus").mouseover(function(event){
		event.stopPropagation();
	});
	
	$("#mainMenu > a").mouseover(function(event){
		clearMenu($(this));
		event.stopPropagation();
		var whichButton = $(this).attr('id');
		var whichId = whichButton.substr(0,whichButton.indexOf('B'));
		$("#"+whichId+'Sub').stop(true).animate({top:0});
		$("#"+whichId+'Back').animate({top:0});
		$(this).css('color','#fff');
	});
});

function clearMenu(exceptFor)
{
	if(exceptFor != undefined)
	{
		var whichButton = exceptFor.attr('id');
		var whichId = whichButton.substr(0,whichButton.indexOf('B'));
		$(".subMenu").not("#"+whichId+"Sub").stop().animate({top:-30});
		$("#mainMenu > a").not("#"+whichId+"Button").css('color','#717073');
		$("#menuBacks > span").not("#"+whichId+"Back").each(function(){
			var fPos = $(this).position();
			if(fPos.top < 63)
			{
				$(this).stop().animate({top:63});
			}
		});
	}else{
		$(".subMenu").animate({top:-30});
		$("#mainMenu > a").css('color','#717073');
		$("#menuBacks > span").each(function(){
			var fPos = $(this).position();
			if(fPos.top < 63)
			{
				$(this).stop().animate({top:63});
			}
		});
	}
}

function fillBanner(){
	var bannerClip = getFlashMovieObject('banner');
	bannerClip.callPopInfo(bannerInfo[0],bannerInfo[1],bannerInfo[2],bannerInfo[3]);
}

function movieIsLoaded(theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}
			
function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function getWidth()
{
	var frameWidth = '';
  if (self.innerWidth)
  {
	frameWidth = self.innerWidth;
  }
  else if (document.documentElement && document.documentElement.clientWidth)
  {
	frameWidth = document.documentElement.clientWidth;
  }
  else if (document.body)
  {
	frameWidth = document.body.clientWidth;
  }
  return frameWidth;
}

function getHeight()
{
	var frameHeight = '';
  if (self.innerHeight)
  {
	frameHeight = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
  {
	frameHeight = document.documentElement.clientHeight;
  }
  else if (document.body)
  {
	frameHeight = document.body.clientHeight;
  }
  return frameHeight;
}

function storeSize()
{
	document.cookie = "w=" + getWidth();
	document.cookie = "h=" + getHeight();
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return null
}

function getArgs()
{
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split(',');
	for(var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if(pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}
function verify(f)
{
  var empty_fields = "";
  var fCount = 0;
  var empty_options = "";
  var oCount = 0;
	var empty_checks = '';
	var cCount = 0;
  var errors = "";
  var eCount = 0;
  var msg = "";
	var checkedSets = new Array();

  for(var i = 0; i < f.length; i++)
  {
    var e = f.elements[i];
		e.style.borderColor='#EBEBEB';
		e.style.borderBottomColor='#000';
    if(((e.type == "text") || (e.type == "textarea") || (e.type == "password")) && !e.optional)
    {
      if (((e.value == null) || (e.value == "") || isblank(e.value)) && !e.conditional)
      {
        empty_fields += "\n" + replaceChars(e.name,"_"," ") + " is required";
				e.style.borderColor='#f00';
        fCount += 1
        continue;
      }
		}

		//CHECKBOXES
		if((e.type == 'checkbox') && !e.optional && !e.conditional)
		{
			var setName = e.name;
			var setChecked = false;
			if(!Array.indexOf)
			{
					for(var cs=0; cs<checkedSets.length; cs++)
					{
						if(checkedSets[cs]==setName)
						{
							setChecked = true;
							break;
						}
					}
			}
			if(Array.indexOf)
			{
				if(checkedSets.indexOf(setName) > -1)
				{
					setChecked = true;
				}
			}
			if(!setChecked)
			{
				var checkVal = false;
				var currentSet = f[setName];
				for(zz=0;zz<currentSet.length;zz++)
				{
					if(currentSet[zz].checked)
					{
						checkVal = true;
						break;
					}
				}
				if(!checkVal)
				{
	        empty_checks += "\n" + replaceChars(e.name,"_"," ") + " selection is required";
	        cCount = cCount + 1;
				}
				checkedSets.push(setName);
			}
		}	//END OF CHECKBOXES

		//RADIOS
		if(e.type == 'radio' && (!e.optional || !e.conditional))
		{
			var setName = e.name;
			var setChecked = false;
			if(!Array.indexOf)
			{
					for(var cs=0; cs<checkedSets.length; cs++)
					{
						if(checkedSets[cs]==setName)
						{
							setChecked = true;
							break;
						}
					}
			}
			if(Array.indexOf)
			{
				if(checkedSets.indexOf(setName) > -1)
				{
					setChecked = true;
				}
			}
			if(!setChecked)
			{
				var checkVal = false;
				var currentSet = f[setName];
				for(zz=0;zz<currentSet.length;zz++)
				{
					if(currentSet[zz].checked || currentSet[zz].optional)
					{
						checkVal = true;
						break;
					}
				}
				if(!checkVal)
				{
		      empty_checks += "\n" + replaceChars(e.name,"_"," ") + " selection is required";
					//alert(e.name);
					document.getElementById(e.name).style.borderColor='#f00';  //NAME IS ID OF PARENT CONTAINER
		      cCount = cCount + 1;
				}
				else
				{
					//alert('0'+e.name);
					document.getElementById(e.name).style.borderColor='#fff';
				}
				checkedSets.push(setName);
			}
		}	//END OF RADIOS
		
		//CONDITONAL FIELDS
    if(e.conditional)
    {
			var triggered = false;
			var failed = false;
			//FIRST CHECK IF THE CONDITONAL FIELD IS REQUIRING THIS TO HAVE A VALUE
			var conditionField = e.condition;
			if(regExTest(conditionField,/[\d]/))
			{
				var whatField = f.elements[conditionField];
			}
			else
			{
				var whatField = f[conditionField];
			}
			var fieldType = whatField.type;
			var fieldName = whatField.id;
				//WHAT VALUE TO TRIGGER THIS
			var conditionalValue = e.conValue;
			//alert(e.name+','+e.type+','+e.condition+','+conditionalValue+','+e.optional);
			//WHAT TYPE OF FIELD WAS SELECTED TO TRIGGER THIS
			if(fieldType == 'hidden' && whatField.value == 'true')
			{
				triggered = true;
			}
			if(fieldType == 'checkbox' && whatField.checked)
			{
				triggered = true;
			}
			if(fieldType == 'radio' && whatField.checked)
			{
				triggered = true;
			}
			if(fieldType == 'text')
			{
				if((conditionalValue == 'notNull') && (whatField.value != ''))
				{
					triggered = true;
				}
				else if(whatField.value == conditionalValue)
				{
					triggered = true;
				}
			}
			if(whatField.options)
	    {
      	//if (whatField.selectedIndex == (whatField.length-1))
				if(whatField.value == conditionalValue)
      	{
					triggered = true;
				}
			}
			if(triggered == true)
			{
				//alert('triggered');
				//CHECK THAT THE CONDITION IS MET
				if((e.options || (e.type == 'select-one')) && !e.optional)
    		{
      		var which = e.options.selectedIndex;
					if(which < 0)
					{
						failed = true;
					}else{
						var choice = e.options[which].value;
						if ((choice == null) || (choice == ""))
						{
							failed = true;
						}
					}
				}
				if((e.type == "text") || (e.type == "textarea"))
				{
					if((e.value == null) || (e.value == "") || isblank(e.value))
					{
						failed = true;
					}
				}
				if((e.type == 'checkbox') || (e.type == 'radio'))
				{
					var setName = e.name;
					var setChecked = false;
					if(!Array.indexOf)
					{
							for(var cs=0; cs<checkedSets.length; cs++)
							{
								if(checkedSets[cs]==setName)
								{
									setChecked = true;
									break;
								}
							}
					}
					if(Array.indexOf)
					{
						if(checkedSets.indexOf(setName) > -1)
						{
							setChecked = true;
						}
					}
					if(!setChecked)
					{
						var checkVal = false;
						var currentSet = f[setName];
						for(zz=0;zz<currentSet.length;zz++)
						{
							if(currentSet[zz].checked == true)
							{
								checkVal = true;
								break;
							}
						}
						if(!checkVal)
						{
							failed = true;
						}
						checkedSets.push(setName);
					}
				}
				if(failed == true)
				{
					//alert("failed");
        	empty_fields += "\n" + replaceChars(e.name,"_"," ") + " is required;";
					document.getElementById(e.name).style.borderColor='#f00';  //NAME IS ID OF PARENT CONTAINER
          fCount += 1
					e.style.borderColor='#f00';
				}
				else
				{
					document.getElementById(e.name).style.borderColor='#fff';  //NAME IS ID OF PARENT CONTAINER
				}
			}
    }
		
		if(e.time)
		{
			if(regExTest(e.value,"[^0-9:]") == true)
			{
			  errors += "\nA valid " + replaceChars(e.name,"_"," ") + " is required. Format as: xx:xx";
			  eCount += 1;
				e.style.borderColor='#f00';
			}
    }
		
    if(e.phone)
    {
			var rangePattern = /[^0-9-]/;
			if(regExTest(e.value,rangePattern) == true)
			{
         errors += "\n" + replaceChars(e.name,"_"," ") + " must be numeric. Format as: xxx-xxx-xxxx";
         eCount = eCount + 1;
				e.style.borderColor='#f00';
			}
    }
		
    if(e.money)
    {
			var moneyPattern = /[^0-9\$\.\,]/;
			if(regExTest(e.value,"[^0-9\.\$,]") == true)
			{
         errors += "\n" + replaceChars(e.name,"_"," ") + " must be dollars and cents";
         eCount = eCount + 1;
				e.style.borderColor='#f00';
			}
    }
		
    if(e.numeric)
    {
			var numPattern = /[^0-9\.\,]/;
			if(regExTest(e.value,numPattern) == true)
			{
         errors += "\n" + replaceChars(e.name,"_"," ") + " must be numeric";
         eCount = eCount + 1;
				e.style.borderColor='#f00';
			}
    }
		
    if(e.numericRange)
    {
			var rangePattern = /[^0-9\s\$\.\,-]/;
			if(regExTest(e.value,rangePattern) == true)
			{
         errors += "\n" + replaceChars(e.name,"_"," ") + " must be numeric";
         eCount = eCount + 1;
				e.style.borderColor='#f00';
			}
    }
		
		if(e.date && !e.conditional)
		{
			var datePattern = /\d{1,2}\/\d{1,2}\/\d{4}/;
			if(regExTest(e.value,datePattern) == false)
			{
			  errors += "\nA valid " + replaceChars(e.name,"_"," ") + " is required. Format as: xx/xx/xxxx";
			  eCount += 1;
				e.style.borderColor='#f00';
			}
    }
			
    if(e.count != null)
    {
	    if (e.value.length < e.count)
      {	  
  	    errors += "\n" + replaceChars(e.name,"_"," ") + " must be at least " + e.count + " characters in length";
        eCount = eCount + 1;
				e.style.borderColor='#f00';
      }
    }
    if(e.minValue != null)
    {
		  var v = parseFloat(e.value);
      if (isNaN(v) || ((e.minValue != null) && (v < e.minValue)))
      {	  
        errors += "\n" + replaceChars(e.name,"_"," ") + " must be greater than " + e.minValue;
        eCount = eCount + 1;
				e.style.borderColor='#f00';
      }
    }
    if(e.maxValue != null)
    {
		  var v = parseFloat(e.value);
      if (isNaN(v) || ((e.maxValue != null) && ( v > e.maxValue)))
      {	  
        errors += "\n" + replaceChars(e.name,"_"," ") + " must be less than " + e.maxValue;
        eCount = eCount + 1;
				e.style.borderColor='#f00';
      }
    }
    if(e.email)
    {
			if(regExTest(e.value,"^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$") == false)
			{
			  errors += "\nA valid email address is required";
			  eCount += 1;
				e.style.borderColor='#f00';
			}
    }
		
		if(e.creditcard)
		{
			var ccType = document.getElementById('Credit_Card_Type').value;
			if(ccType != null && ccType != '')
			{
				if(!isValidCC (ccType, e.value))
				{
					errors += "\nInvalid Credit Card Number";
					eCount += 1;
					e.style.borderColor='#f00';
				}
			}
			else
			{
					eCount += 1;
			}
		}
		
		if(e.rx && (e.value != null) && (e.value != "") && !isblank(e.value))
		{
			if(regExTest(e.value,e.pattern) == true)
			{
				errors += "\nInvalid Characters Entered for " + replaceChars(e.name,"_"," ");
				eCount += 1;
				e.style.borderColor='#f00';
			}
		}
		
    if (e.options && !e.optional && !e.conditional)
    {
      var which = e.options.selectedIndex;
			if(which < 0)
			{
        empty_options += "\n" + replaceChars(e.name,"_"," ") + " selection is required";
        oCount = oCount + 1;
				e.style.borderColor='#f00';
			}else{
				var choice = e.options[which].value;
				if ((choice == null) || (choice == "") && !e.conditional)
				{
					empty_options += "\n" + replaceChars(e.name,"_"," ") + " selection is required";
					oCount = oCount + 1;
					e.style.borderColor='#f00';
					//continue;
				}
			}
    }
  }

  if ((!empty_fields) && (!empty_options) && (!empty_checks) && !errors)
  {
    return true;
  }
  else
  {
    msg = "Please be sure to complete all selections or fill in all required fields.\n";
    if (empty_fields)
    {
      fieldsVar = "field"
      if(fCount > 1){fieldsVar += "s"}
      msg += "\n" + fCount + " required " + fieldsVar + " left blank.";
      msg += empty_fields += "\n";
    }
    if (errors)
    {
      fieldsVar = "field"
      if(eCount > 1){fieldsVar += "s"}
      msg += "\n" + eCount + " " + fieldsVar + " with invalid entries.";
      msg += errors += "\n";
    }
    if (empty_options)
    {
      choicesVar = "drop-down selection"
      if (oCount > 1)
        {choicesVar += "s"}
      msg += "\n" + oCount + " required " + choicesVar + " not completed.";
      msg += empty_options += "\n";
    }
    if (empty_checks)
    {
      choicesVar = "checkbox\/radio option"
      if (cCount > 1)
        {choicesVar += "s"}
      msg += "\n" + cCount + " required " + choicesVar + " not chosen.";
      msg += empty_checks += "\n";
    }
    alert(msg);
    return false;
  }
}

function isLetter(str)
{
  var fieldErrors = ""
  var rex = /[^a-zA-Z\s]/

  if ((str == "") || (str == null))
  {
  fieldErrors = "You must enter text.\n";
  }

  if(rex.test(str))
  {
  fieldErrors += "Invalid data was entered.";
  }

  if (fieldErrors)
  {
  return false;
  }
  else
  {
  return true;
  }
}

function isAlphaNum(str)
{
  var fieldErrors = ""
  var rex = /[^\w]/

  if ((str == "") || (str == null) || isblank(str))
  {
  fieldErrors = "You must enter something.\n";
  }

  if(rex.test(str))
  {
  fieldErrors += "Check that you have only entered letters and-or numbers.";
  }

  if (fieldErrors)
  {
  return false;
  }
  else
  {
  return true;
  }
}

function isblank(s)
{
  for(var i = 0; i < s.length; i++)
  {
    var c = s.charAt(i);
    if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
  }
  return true;
}

function replace(string,text,by) 
{
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function regExTest(whatString,whatPattern)
{
	var regX = new RegExp(whatPattern);
	return regX.test(whatString);
}

//AJAX STUFF
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isNN = (navigator.appName.indexOf("Netscape")!=-1) ? true : false;
var requiredMinorVersion = 0;
var requiredRevision = 0;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			//alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function showFlash(whatMovie,paramString,movieName,W,H,BG,Win,Alignment,whatScale,whatVersion,alternateContent)
{
	var requiredMajorVersion = whatVersion;
	if(whatScale == null || whatScale == '')
	{
		whatScale = 'showAll';
	}
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion)
	{  // if we've detected an acceptable version
		var downloadAddress = 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab';
    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + ' width="'+W+'" height="'+H+'" id="'+movieName+'"'
    + ' codebase="'+downloadAddress+'">'
    + '<param name="movie" value="'+whatMovie+paramString+'" />'
    + '<param name="menu" value="false" />'
    + '<param name="quality" value="high" />'
    + '<param name="wmode" value="'+Win+'" />'
    + '<param name="bgcolor" value="#'+BG+'" />'
    + '<param name="scale" value="'+whatScale+'" />'
    + '<embed src="'+whatMovie+paramString+'" menu="false" quality="high"'
    + ' wmode="'+Win+'" bgcolor="#'+BG+'" '
    + ' scale="'+whatScale+'"'
    + ' width="'+W+'" height="'+H+'" name="'+movieName+'" align="'+Alignment+'"'
    + 'play="true"'
    + 'loop="false"'
    + 'quality="high"'
    + 'allowScriptAccess="sameDomain"'
		+ 'swliveconnect="true"'
    + 'type="application/x-shockwave-flash"'
    + 'pluginspage="https://www.macromedia.com/go/getflashplayer">'
    + '<\/embed>'
    + '<\/object>';
		//alert(oeTags);
    document.write(oeTags);   // embed the flash movie
  } 
	else 
	{
		document.write(alternateContent);
  }
}

function prepFlash(whatMovie,paramString,movieName,W,H,BG,Win,Alignment,whatScale,whatVersion,alternateContent,whatAccess)
{
	var requiredMajorVersion = whatVersion;
	if(whatScale == null || whatScale == '')
	{
		whatScale = 'showAll';
	}
	if(whatAccess == null || whatAccess == '')
	{
		whatAccess = 'sameDomain';
	}
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion)
	{
		flashCanPlay = true;
    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + ' width="'+W+'" height="'+H+'" id="'+movieName+'"'
    + ' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="'+whatMovie+paramString+'" />'
    + '<param name="menu" value="false" />'
    + '<param name="quality" value="high" />'
    + '<param name="wmode" value="'+Win+'" />'
    + '<param name="bgcolor" value="#'+BG+'" />'
    + '<param name="scale" value="'+whatScale+'" />'
    + '<embed src="'+whatMovie+paramString+'" menu="false" quality="high"'
    + ' wmode="'+Win+'" bgcolor="#'+BG+'" '
    + ' scale="'+whatScale+'"'
    + ' width="'+W+'" height="'+H+'" id="'+movieName+'" name="'+movieName+'" align="'+Alignment+'"'
    + ' play="true"'
    + ' loop="false"'
    + ' quality="high"'
    + ' allowScriptAccess="'+whatAccess+'"'
    + ' type="application/x-shockwave-flash"'
    + ' pluginspage="https://www.macromedia.com/go/getflashplayer">'
    + '<\/embed>'
    + '<\/object>';
    return oeTags;
  } 
	else 
	{
		return alternateContent;
  }
}
