//Taken from http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function doSifrThing(webRoot)
{
    var fontinSansRegular =     {
                                    src: webRoot + "swf/fontinsans-regular.swf" 
                                };

    var fontinSansItalic =      {
                                    src: webRoot + "swf/fontinsans-italic.swf" 
                                };
                                
    var fontinSansBold =        {
                                    src: webRoot + "swf/fontinsans-bold.swf" 
                                };

    var fontinSansBoldItalic =  {
                                    src: webRoot + "swf/fontinsans-bolditalic.swf" 
                                };
                                
    var fontinSmallcaps =       { 
                                    src: webRoot + "swf/fontinsans-smallcaps.swf" 
                                };

    sIFR.activate(fontinSansRegular,
                  fontinSansItalic, 
                  fontinSansBold,
                  fontinSansBoldItalic,
                  fontinSmallcaps);
                                        
    sIFR.replace(fontinSansRegular,     {
                                            selector: '#divMainMenu ul li',
                                            css:    [ 
                                                        '.sIFR-root { background-color: #181b1c; }',
                                                        '.sIFR-root, a { color:#999999; cursor:pointer; font-size:13px; text-decoration:none; }',
                                                        'a:hover { color:#bbbbbb; }',
                                                    ],
                                            forceSingleLine: true,
                                            opaque: true
                                        });
                                        
    sIFR.replace(fontinSansRegular,     {
                                            selector: 'h2.titleNormal',
                                            wmode: 'transparent',
                                            css: [ '.sIFR-root { color:#0091ca; font-size:20px; }' ],
                                            forceSingleLine: true
                                        });

    sIFR.replace(fontinSansBoldItalic,  {
                                            selector: '#divSidebar h2, h2.titleItalic',
                                            wmode: 'transparent',
                                            css: [ '.sIFR-root { color:#0091ca; font-size:20px; }' ]
                                        });
                                        
    sIFR.replace(fontinSmallcaps,       {
                                            selector: '#ulSideMenu li.group, #divProductRight h3',
                                            css: [ '.sIFR-root { color:#181b1c; font-size:16px; }' ],
                                            tuneHeight: -10,
                                            selectable: false,
                                            opaque: true
                                        });
                                        
    sIFR.replace(fontinSmallcaps,       {
                                            selector: 'div.categoryProduct div.name',
                                            css: [ 
                                                    '.sIFR-root, a { color:#181b1c; cursor:pointer; font-size:16px; text-decoration:none}', 
                                                    'a:hover { color:#181b1c; }' 
                                                ],
                                            tuneHeight: -5
                                        });
                                        
    sIFR.replace(fontinSmallcaps,       {
                                            selector: 'p.testimonial span',
                                            css: [ '.sIFR-root { color:#0091ca; font-size:15px; margin-top:30px;}' ],
                                            tuneHeight: -8
                                        });
                                        
    sIFR.replace(fontinSmallcaps,       {
                                            selector: '#divHomeTestimonial div.seeMore',
                                            css: [ 
                                                    '.sIFR-root, a { color:#000000; cursor:pointer; text-decoration:none; }',
                                                    'a:hover { color:#555555; }' 
                                                 ],
                                            selectable: false,
                                            forceSingleLine: true,
                                            tuneHeight: -6,
                                            opaque: true
                                        });
                                            
        sIFR.replace(fontinSansBold,        {
                                                selector: 'h2.title',
                                                wmode: 'transparent',
                                                css: [ '.sIFR-root { color:#0091ca; font-size:20px; }' ]
                                            });
                                        
                                        
                                        
    //This stuff was really broken on IE6 so it doesn't get used in that case
    if (getInternetExplorerVersion() < 0.0 || getInternetExplorerVersion() > 6.0)
    {
        sIFR.replace(fontinSansRegular,     {
                                                selector: 'span.homeTitleNormal',
                                                wmode: 'transparent',
                                                css: [ '.sIFR-root { color:#0091ca; font-size:20px; }' ],
                                                forceSingleLine: true
                                            });
                                            
        sIFR.replace(fontinSansBold,        {
                                                selector: 'span.homeTitleBlackBold',
                                                wmode: 'transparent',
                                                css: [ '.sIFR-root { color:#000000; font-size:20px; }' ],
                                                forceSingleLine: true
                                            });
                                            
        sIFR.replace(fontinSansBold,        {
                                                selector: 'span.homeTitleBold',
                                                wmode: 'transparent',
                                                css: [ '.sIFR-root { color:#0091ca; font-size:20px; }' ],
                                                forceSingleLine: true
                                            });
    }
}
