////
//// support code for Denneen site
////

//
// required:
//   jquery.js (version 1.3.2+) (see jquery.com)
//   jquery.ifixpng.js
//   swfobject-2.1.js
//

//
// common functionality
//
$(document).ready(function(){


  ////
  //// fix png images for IE6
  ////
  $.ifixpng('/img/spacer.gif');
  $('img[src$=.png]').ifixpng();


  ////
  //// Flash on home page
  ////
  if ($("body").hasClass("home")) {

    //
    // set up Flash movie
    //
    var params = {
                   play:    "true",
                   loop:    "false",
                   menu:    "false",
                   swLiveConnect: "false",
                   wmode:   "transparent",
                   bgcolor: "#bec1c6",
                   quality: "high",
                   align:   ""
                 };
    var attributes = {
                   id:      "divflash"
                 };
    var flashvars = {
                   debug:    (/debug/).test(location.search) ? "1" : "0",
                   xyzzy:    0
                 };
    if (!(/noflash/).test(location.search)) {
      swfobject.embedSWF("/denneenhome.swf", "divflash", "570", "180", "8.0.0", false, flashvars, params, attributes);
    }
  }

  ////
  //// popups on Services home page
  ////
  if ($("body").hasClass("services_home")) {

    $("#diagrammap area")
      .hover(
              function () {
                $("#divpop"+this.className).show();
              },
              function () {
                $("#divpop"+this.className).hide();
              }
    );
  }

  ////
  //// email to friend links
  ////
  $("ul.sharelist li.email a")
    .click( function() {
      var url = "/scripts/share.php?p="+window.location.href;
      var newwindow = window.open(url, '', 'left=0,top=0,screenX=0,screenY=0,width=600,height=400,resizable=yes,scrollbars=yes,toolbar=no,menubar=yes,status=no');
      if (newwindow) {
        if (window.focus)
          newwindow.focus();
        return false;
      }
      return true; // unsuccessful
    });


});



///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// open map window from directions page
//
function open_map() {
  width = 500;
  height = 488;
  var newwindow = window.open('/map/index.html', 'map', 'width='+width+',height='+height+',resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=no');
  if (newwindow) {
    if (window.focus)
      newwindow.focus();
    return false;
  }
  return true; // unsuccessful
}
