var sPATH = ''; 

jQuery.noConflict();
jQuery( document ).ready( function () {

    // initialize png fix
    if (window.initPNG) { initPNG(); }

    // initialize image reflections
/*
    jQuery('img.reflect_20').each(function() { jQuery(this).load(function() { jQuery(this).reflect({ height: 0.20 }); }); });
    jQuery('img.reflect_25').each(function() { jQuery(this).load(function() { jQuery(this).reflect({ height: 0.25, margin: 1 }); }); });
    jQuery('img.reflect_30').each(function() { jQuery(this).load(function() { jQuery(this).reflect({ height: 0.30, margin: 1 }); }); });
*/
    // initialize prev/next background colour
    jQuery( 'table.grid_0 tr:last' ).each( function () {
      if (jQuery( this ).attr( 'class' ).match( 'odd' ) == null) {
        jQuery( 'div#divContent table.box table.grid_1 tr td div.link a').css( 'background-color', '#D9D9D9' );
        jQuery( 'div#divContent table.box table.grid_1 tr td div.link a').hover(
          function () { jQuery( this ).css( 'background-color', '#E9E9E9' ); },
          function () { jQuery( this ).css( 'background-color', '#D9D9D9' ); }
        );
      }
    } );

} );

function displayFlashPro(sFileName, sMode, sText, sURL, sSort, bIsCurrent, nWidth) {
  displayFlashBase(sFileName, '/Uploads/', sMode, sText, sURL, sSort, bIsCurrent, nWidth);
}

function displayFlash(sFileName, sMode, sText, sURL, sSort, bIsCurrent, nWidth ) {
  displayFlashBase(sFileName, '/media/swf/', sMode, sText, sURL, sSort, bIsCurrent, nWidth);
}

function displayFlashBase(sFileName, path, sMode, sText, sURL, sSort, bIsCurrent, nWidth) {
  var oCONSTANT = { BASE: sPATH + path,
                    SWF: { 
                      'heading_18':       { WIDTH: 640, HEIGHT: 13 },
                      'heading_24':       { WIDTH: 640, HEIGHT: 18 },
                      'heading_36':       { WIDTH: 640, HEIGHT: 27 },
                      'heading_blue_420': { WIDTH: 420, HEIGHT: 38 },
                      'heading_blue_680': { WIDTH: 680, HEIGHT: 38 },
                      'heading_grid':     { WIDTH: 400, HEIGHT: 10 },
                      'intro': { WIDTH: 710, HEIGHT: 330 },
                      'menu_left':        { WIDTH: 195, HEIGHT: 24 },
                      'menu_top':         { WIDTH: 186, HEIGHT: 26 }
                    }
                  }

  var sParam = '<param name="allowScriptAccess" value="sameDomain" />'
             + '<param name="allowFullScreen" value="false" />'
             + '<param name="base" value="' + oCONSTANT.BASE + '" />'
             + '<param name="flashvars" value="text=' + escape( sText ) + (sMode      ? '&mode=' + sMode        : '')
                                                                        + (sURL       ? '&url='  + sURL         : '')
                                                                        + (sSort      ? '&sort=' + sSort        : '')
                                                                        + (bIsCurrent ? '&current=true'         : '')
                                                                        + (nWidth     ? '&custom_width=true'    : '')
             + '" />'
             + '<param name="menu" value="false" />'
             + '<param name="quality" value="high" />'
             + '<param name="scale" value="noscale" />'
             //+ '<param name="bgcolor" value="FFA500">';
             + '<param name="wmode" value="transparent">';

  var sHTML = '<object id="objectFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + (nWidth ? nWidth : oCONSTANT.SWF[sFileName].WIDTH) + '" height="' + oCONSTANT.SWF[sFileName].HEIGHT + '">'
            +   '<param name="movie" value="' + oCONSTANT.BASE + sFileName + '.swf" />'
            +   sParam
            + '<!--[if !IE]>-->'
            +   '<object type="application/x-shockwave-flash" data="' + oCONSTANT.BASE + sFileName + '.swf" width="' + (nWidth ? nWidth : oCONSTANT.SWF[sFileName].WIDTH) + '" height="' + oCONSTANT.SWF[sFileName].HEIGHT + '">'
            +     sParam
            + '<!--<![endif]-->'
            +     '<p><a href="http://www.adobe.com/go/getflashplayer" target="_blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>'
            +     '<p>If you are having issues viewing this website, please contact us at <a href="mailto:help@earetailprofessionals.com">help@earetailprofessionals.com</a>.</p>'
            + '<!--[if !IE]>-->'
            +   '</object>'
            + '<!--<![endif]-->'
            + '</object>';

  document.write( sHTML );
}

function displayHeading( nSize, sText, nWidth )                  { displayFlash( 'heading_'      + nSize, null,  sText, null, null,  null,       nWidth ); }
function displayHeading_blue( nSize, sText )                     { displayFlash( 'heading_blue_' + nSize, null,  sText, null, null,  null,       null ); }
function displayHeading_grid( sText, sSort, nWidth, bIsCurrent ) { displayFlash( 'heading_grid',          null,  sText, null, sSort, bIsCurrent, nWidth ); }
function displayIntro() { displayFlash('intro', null, null, null, null, null, null); }
function displayMenu( sType, sMode, sText, sURL, bIsCurrent )    { displayFlash( 'menu_' + sType,         sMode, sText, sURL, null,  bIsCurrent, null ); }


function ViewSwitch( view1, view2 ) {

  var v1 = document.getElementById( view1 );
  var v2 = document.getElementById( view2 );

  if (v1.style.display == 'none') {
    v1.style.display = '';
    v2.style.display = 'none';
  } else {
    v1.style.display = 'none';
    v2.style.display = '';
  }
}

function StoreLocationOtherDivision( dropDownListId, divId ) {

  var v1  = document.getElementById( divId );
  var ddl = document.getElementById( dropDownListId ).value;

  if (ddl == '0') {
    v1.style.display = '';
  } else {
    v1.style.display = 'none';
  }
}

function ShowDivision( divId ) {
  var v1 = document.getElementById( divId );
  v1.style.display = '';
}

function HideDivision(divId) {
  var v1 = document.getElementById( divId );
  v1.style.display = 'none';
}

