function isValid(type, str) {
  if (type.toLowerCase() == "email") {
    if ((str == null) || (str == "")) return false;
    var at="@";
    var dot=".";
    var lat=str.indexOf(at);
    var lstr=str.length;
    var ldot=str.indexOf(dot);
    if (str.indexOf(at)==-1) return false;
    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
    if (str.indexOf(at,(lat+1))!=-1) return false;
    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
    if (str.indexOf(dot,(lat+2))==-1) return false;
    if (str.indexOf(" ")!=-1) return false;
    return true;
  }
};

(function($) {
  $(function() {
    $("input[type=text][title]").each(function() { $(this).val($(this).attr("title")); if($.trim($(this).val()) == "") $(this).val($(this).attr("title")); $(this).focus(function() { if($(this).val() == $(this).attr("title")) $(this).val(""); }).blur(function() { if($.trim($(this).val()) == "") $(this).val($(this).attr("title")); }); });
    $("a[href][rel*=external]").each(function() { $(this).attr("target", "_blank"); });
    $(".lo").hoverIntent(function() { $(this).removeClass("lo").addClass("hi"); }, function() { $(this).removeClass("hi").addClass("lo"); });
    $("ul.form > li:not(.buttons)").each(function() { var $$ = $(this); $$.find(":input").each(function() { $(this).focus(function() { $$.addClass("focused"); }).blur(function() { $$.removeClass("focused"); }); }); }); //determining li parents for w forms
    $("#nav div.nav").hoverIntent({ sensitivity: 3, interval: 200, over: function() { $(this).removeClass("lo").addClass("hi").find("div.subnav table").show("slide", { direction: "left" }, "slow") }, timeout: 2000, out: function() { $(this).removeClass("hi").addClass("lo").find("div.subnav table").hide("slide", { direction: "right" }, "slow") } });
    $(".fade-hover").hoverIntent(function() { $(this).fadeTo("fast", 0.5); }, function() { $(this).fadeTo("fast", 1.0); });
    
    $("#email-marketing-form").submit(function() {
      return isValid("email", this.email.value);
    });
    
    //$.sifr({ path: "scripts/jquery/resources/", save: true }); $("#page-heading").css("font-size", "40px").sifr({ font: "ten ton ballyhoo" }).css("margin-bottom", "16px");
    //if ($("body").hasClass("ie_6")) { $("#footer").fixMargin(); $.ifixpng("images/reusable/pixel.gif"); $("img[@src$=.png]").ifixpng(); alert($.ie6log); }
  });
})(jQuery);