
        var helvetica45 = { src: '/_resx/sifr/helvetica-neue-45.swf' };
        var helvetica75 = { src: '/_resx/sifr/helvetica-neue-75.swf' };		

        sIFR.useDomLoaded = true;
        sIFR.activate(helvetica45);
        sIFR.activate(helvetica75);


		sIFR.replace(helvetica45, {
		selector: '#section-header h2, #welcome p',
			transparent: true,
			offsetLeft: 0,
			thickness: -25,
			tuneWidth: 20,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#ffffff',	strength: 1,	alpha: 1,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root { color: #999;}',
					'em {font-size: 11px; display: inline; font-style: normal}',
					'a {color: #D3222A; text-decoration: none}',
					'a:hover {color: #D3222A; text-decoration: none}',
					'strong {color: #ffffff}',
					'.special {font-family: arial}'
					],
			modifyCss: sifrSetColor
		});
		
		sIFR.replace(helvetica45, {
		selector: '#welcome h1',
			transparent: true,
			offsetLeft: 0,
			thickness: -25,
			offsetTop: -2,
			tuneWidth: -20,
			css: ['.sIFR-root { color: #999; text-align: right;}'],
			modifyCss: sifrSetColor
		});		

		sIFR.replace(helvetica45, {
		selector: '#footer h3',
			transparent: true,
			offsetLeft: 0,
			thickness: 0,
			sharpness: 0,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#000000',	strength: .2,	alpha: 1,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root { color: #999;}'],
			modifyCss: sifrSetColor
		});


		sIFR.replace(helvetica45, {
		selector: '#content.alternate #page-header h1',
			transparent: true,
			offsetLeft: 0,
			thickness: 0,
			sharpness: 0,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#000000',	strength: .1,	alpha: 1,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root { color: #color: #999; font-size: 36px; }'],
			modifyCss: sifrSetColor
		});	

		sIFR.replace(helvetica45, {
		selector: '#content h1',
			transparent: true,
			offsetLeft: 0,
			thickness: 0,
			sharpness: 0,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#ffffff',	strength: 1,	alpha: 1,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root { color: #color: #999; font-size: 36px; leading: -7;}',
			      'strong {color: #00ff00; display: inline; font-weight: normal;}'
			],
			modifyCss: sifrSetColor
		});	

		/*sIFR.replace(helvetica75, {
		selector: '#sidebar h3, .events-list .summary',
			transparent: true,
			offsetLeft: 0,
			thickness: 0,
			sharpness: 0,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#ffffff',	strength: 100,	alpha: 1,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root {font-weight: bold; color: #999; text-transform: uppercase; leading: -5}',
				  'strong {color: #d3222a;}',
				  'a {color: #d3222a; text-decoration: none}',
				  'a:hover {color: #d3222a;}'
				  ],
			modifyCss: sifrSetColor
		});	*/
		
/*		sIFR.replace(helvetica75, {
		selector: '#primary-feature .summary',
			transparent: true,
			offsetLeft: 0,
			thickness: 0,
			sharpness: 0,
			filters: {
				DropShadow: {	distance: 1,	blurY: 0,	blurX: 0,	color: '#000000',	strength: 100,	alpha: .75,	angle: 90,	distance: 1	}
			},
			css: ['.sIFR-root {font-weight: bold; color: #999; text-transform: uppercase; leading: -7}',
				  'strong {color: #d3222a;}',
				  'a {color: #d3222a; text-decoration: none}',
				  'a:hover {color: #d3222a;}'
				  ],
			modifyCss: sifrSetColor
		});		*/	



function sifrSetColor(css, contentNode, selector){
	var hexColor = new RGBColor( $(contentNode).css("color") ).toHex();
	
	var cssString = ""
	
	var newCss = [];
	
	for(var o in css){
		var cssString = o;
		var cssObj = css[o];
		cssString += "{ ";
		for(var c in cssObj){
			
			try {
				var e = $(o, contentNode);
				
				if(c == "color" && o == ".sIFR-root"){
					cssString += "color: " + hexColor + ";";
				}else if (c == "color" && e.length > 0){
					cssString += "color: " + new RGBColor( e.css("color") ).toHex() + ";";
				}else {
					cssString += c + ": " + cssObj[c] +"; ";
				}
			} catch(err) {
				cssString += c + ": " + cssObj[c] +"; ";
			}
		}
		cssString += "}";
		newCss.push(cssString);
	}
	
	return newCss;
}


/* ============================================================= */
/**
 * A class to parse color values
 * @author Stoyan Stefanov <sstoo@gmail.com>
 * @link   http://www.phpied.com/rgb-color-parser-in-javascript/
 * @license Use it if you like it
 */
function RGBColor(color_string)
{
	
    this.ok = false;
    // strip any leading #
    if (color_string.charAt(0) == '#') { // remove # if any
        color_string = color_string.substr(1,6);
    }

    color_string = color_string.replace(/ /g,'');
    color_string = color_string.toLowerCase();

    // array of color definition objects
    var color_defs = [
        {
            re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
            example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
            process: function (bits){
                return [
                    parseInt(bits[1]),
                    parseInt(bits[2]),
                    parseInt(bits[3])
                ];
            }
        },
        {
            re: /^(\w{2})(\w{2})(\w{2})$/,
            example: ['#00ff00', '336699'],
            process: function (bits){
                return [
                    parseInt(bits[1], 16),
                    parseInt(bits[2], 16),
                    parseInt(bits[3], 16)
                ];
            }
        },
        {
            re: /^(\w{1})(\w{1})(\w{1})$/,
            example: ['#fb0', 'f0f'],
            process: function (bits){
                return [
                    parseInt(bits[1] + bits[1], 16),
                    parseInt(bits[2] + bits[2], 16),
                    parseInt(bits[3] + bits[3], 16)
                ];
            }
        }
    ];

    // search through the definitions to find a match
    for (var i = 0; i < color_defs.length; i++) {
        var re = color_defs[i].re;
        var processor = color_defs[i].process;
        var bits = re.exec(color_string);
        if (bits) {
            channels = processor(bits);
            this.r = channels[0];
            this.g = channels[1];
            this.b = channels[2];
            this.ok = true;
        }

    }
	
    // validate/cleanup values
    this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
    this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
    this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);

    // some getters
    this.toRGB = function () {
        return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
    }
	
    this.toHex = function () {
        var r = this.r.toString(16);
        var g = this.g.toString(16);
        var b = this.b.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;
    }

}
