﻿

function embedMastheadWithSwfSecure(title, content, swf, height) {



  var swfUrl = "https://dwdjpm6e3wiia.cloudfront.net/swf/" + swf;

  var flashvars = {

    sectionname: escape(title),

    contentsrc: content

  };

  var params = { wmode: 'transparent', allowScriptAccess: 'always' };

  var attributes = {};

  swfobject.embedSWF(swfUrl, 'masthead-flash', '100%', height, '9.0.27', null, flashvars, params, attributes);

}



function embedMastheadSecure(title, content) {

  embedMastheadWithSwfSecure(title, content, 'Header.swf', '142');

}



function embedMastheadWithSwf(title, content, swf, height) {



  var swfUrl = "http://dwdjpm6e3wiia.cloudfront.net/swf/" + swf;

  var flashvars = {

    sectionname: escape(title),

    contentsrc: content

  };

  var params = { wmode: 'transparent', allowScriptAccess: 'always' };

  var attributes = {};

  swfobject.embedSWF(swfUrl, 'masthead-flash', '100%', height, '9.0.27', null, flashvars, params, attributes);

}



function embedMasthead(title, content) {

  embedMastheadWithSwf(title, content, 'Header.swf', '142');

}



function embedCommunityMasthead() {



  var swfUrl = 'http://dwdjpm6e3wiia.cloudfront.net/swf/Community.swf';

  var flashvars = {

    servicewsdl: '/sites/services/cmsservice.asmx?wsdl'

  };

  var params = { wmode: 'transparent', allowScriptAccess: 'always' };

  var attributes = {};

  swfobject.embedSWF(swfUrl, 'masthead-flash', '100%', '210', '9.0.27', null, flashvars, params, attributes);

}



function setProfileOnline(profileId) {



  lmajax_request('/sites/main/pages/asynctasks.aspx?action=profileonline&profileId=' + profileId,

                "",

                "",

                "json");

}



function subscribeVal() {



  if ($("#sub_email").val().indexOf("@") == -1) {

    alert("Please enter your email address before subscribing.");

    return false;

  }

  else if (!$("#sub_terms").is(":checked")) {

    alert("You must agree to our terms and conditions before subscribing.");

    return false;

  }

  else {

    return true;

  }

}



//resets the sexy combo lists using the pathes to the <div class='combo sexy'> elements

function resetSexyCombos(path) {



  var selects = $(path).parent();

  for (var i = 0; i < selects.length; i++) {

    $elem = $(selects[i]).children("div.combo").children(":eq(0)");

    $html = "<select name=\"" + $elem.attr("name") + "\" id=\"" + $elem.attr("id") + "\">" + $elem.html() + "</select>"

    $(selects[i]).children("div.combo").remove();

    if ($(selects[i]).children("label").size() > 0) {

      $(selects[i]).children("label").after($html);

    }

    else {

      $(selects[i]).append($html);

    }

    $(selects[i]).children("select").sexyCombo();

  }

}



function stripSexyCombos(path) {

    $(path).children().each(function() {

        if (this.type == "select-one" || this.type == "select-multiple") {

            $(this).parent().replaceWith(this);

        }

    });

}



function openHelp(url, categoryId, itemId) {



  url = url + "help/help.aspx";

  if (categoryId != 0)

    url += "?categoryId=" + categoryId.toString();

  if (itemId != 0) {

    if (categoryId != 0)

      url += "&";

    else

      url += "?";

    url += "questionId=" + itemId.toString();

  }

  window.open(url, "", "left=0,top=50,width=780,height=500,status=yes,scrollbars=yes");

}



function handlePromoClick(event) {

  try {

    var url = $(this).attr("href");

    var href = location.href;

    if (href.indexOf("?") > -1)

      href = href.substring(0, href.indexOf("?"));

    title = href.substring(href.lastIndexOf("/") + 1).replace(".aspx", "");

    var parts = title.split("-");

    title = "PromoTile_";

    for (var i = 0; i < parts.length; i++) {

      title += parts[i].substr(0, 1).toUpperCase() + parts[i].substr(1).toLowerCase();

    }

    title += "_" + event.data.index.toString();

    var pageTracker = _gat._getTracker("UA-15548392-1");

    pageTracker._trackPageview(href + '/' + title);

    setTimeout('document.location = "' + url + '"', 250);

    event.preventDefault();

  } catch (err) { }

}

// JavaScript Document
