﻿function embedFlash (width, height, id, align, path, bgcolor, trans, flashvar) {
	if (flashvar=="undefined") flashvar="";	
	var wmode1="",wmode2="";

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width=' + width + ' height=' + height + ' id=' + id + ' align=' + align + wmode1+ '><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value=' + path + ' /><param name="quality" value="high" /><param name="bgcolor" value=' + bgcolor + ' />'+wmode2+'<param name="flashvars" value="'+ flashvar +'"  /><param name="menu" value="false" /><embed src="' + path + '" quality="high" bgcolor="' + bgcolor + '" width="' + width + '" height="' + height + '" name="' + id + '" align="' + align + '" FlashVars="'+ flashvar +'"  menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}


var cachedBandColor;
function getBandColor()
{
	if(cachedBandColor)return cachedBandColor;
	for(styleIndex=0;styleIndex<document.styleSheets.length;styleIndex++)
	{
		var rules=document.styleSheets[styleIndex].rules;
		if(rules==null)rules=document.styleSheets[styleIndex].cssRules;
		if(rules && rules.length){
			for(ruleIndex=0;ruleIndex<rules.length;ruleIndex++)
			{
		
				if(rules[ruleIndex].selectorText=="#band" && rules[ruleIndex].style.backgroundColor)
				{
				cachedBandColor=rules[ruleIndex].style.backgroundColor;
				return cachedBandColor;
				}
		    }
	    }
	}
}


RGBtoHex = function (color) {
	var components=color.replace("rgb(","").replace(")","").split(',');
	var r=parseInt(components[0]).toString(16);
	var g=parseInt(components[1]).toString(16);
	var b=parseInt(components[2]).toString(16);
    if (r.length == 1) r = '0' + r;
    if (g.length == 1) g = '0' + g;
     if (b.length == 1) b = '0' + b;
     return '#' + r + g + b;
    }