jQuery.noConflict();


function ShowEmailInputHelper() {
  semail = jQuery("label[for=signup-email]").html();
  if(semail) {
    semail = semail.toLowerCase() + ":";
    jQuery("#signup-email").addClass("helper");
    jQuery("#signup-email").val(semail);
    return true;
  } else {
    return false;
  }
}

function ShowNameInputHelper() {
  sname = jQuery("label[for=signup-name]").html();
  if(sname) {
    sname = sname.toLowerCase() + ":";
    jQuery("#signup-name").addClass("helper");
    jQuery("#signup-name").val(sname);
    return true;
  } else {
    return false;
  }
}

function rand (n) {
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

jQuery.fn.AjaxImageRotator = function(filelist) {


    jQuery.getJSON(filelist, function(data) {
      startkey = rand(data.length)
      setTimeout(function() {swapimage(data, startkey)}, 20000);
    });

}

function swapimage(files,key) {

  if(key >= (files.length - 1)) { key = 0; }
  jQuery("#branding img").fadeOut("slow",function() {

    jQuery(this).attr("src","/images/branding/" + files[key]);

  }).fadeIn("slow");

  key++;
// if(files[key] == undefined) { alert(key); alert(files.length); }

  setTimeout(function() {swapimage(files,key)}, 20000);

}

jQuery(document).ready(function() {

  ShowNameInputHelper();
  ShowEmailInputHelper();

  jQuery("#signup-name").focus(function() {

    if(jQuery(this).val() == "" || jQuery(this).val() == "name:") {
      jQuery(this).val("");
      jQuery(this).removeClass("helper");
    }

  });

  jQuery("#signup-name").blur(function() {

    if(jQuery(this).val() == "" || jQuery(this).val() == "name:") {
      jQuery(this).val("");
      ShowNameInputHelper();
    }

  });

  jQuery("#signup-email").focus(function() {

    if(jQuery(this).val() == "" || jQuery(this).val() == "email:") {
      jQuery(this).val("");
      jQuery(this).removeClass("helper");
    }

  });

  jQuery("#signup-email").blur(function() {

    if(jQuery(this).val() == "" || jQuery(this).val() == "email:") {
      jQuery(this).val("");
      ShowEmailInputHelper();
    }

  });


  jQuery(".pullquote").each(function() {

     quote   = jQuery(this).html();
     classname   = new String("");
     hascl = jQuery(this).hasClass("left");

    if(hascl) {
      classname = "class=\"left\"";
    }

     markup  = "<blockquote " + classname + ">" + quote + "</blockquote>";
     jQuery(this).before(markup);

  });

   jQuery("*[rel=external]").each(function() {

     jQuery(this).click(function() {
       window.open(this.href);
       return false;
     });

   });

   jQuery("#branding img").AjaxImageRotator("/images/branding/rotate.php?list=json");



});


 var fsingrid = {
    src: '/swf/fsingrid.swf'
};

sIFR.activate(fsingrid);
sIFR.replace(fsingrid, {
  selector: '#navigation li',
  css: [
    '.sIFR-root { text-align: right; font-weight: bold; }',
    'a:link {color: #000000; text-decoration: none; font-weight: bold; }',
    'a:visited {color: #000000}',
    'a:hover {color: #ff0000;}',
    'a:active {color: #ff0000;}',
    '.active {color: #ff0000; text-decoration: underline; font-weight: bolder;}',
    'strong {color: #00ff00;}'
  ]
});

sIFR.replace(fsingrid, {
  selector: 'h1 > span',
  leading: '50',
  css: [
    '.sIFR-root {font-size: 21px; line-height: 50px; leading: 5px;}'
  ]
});

sIFR.replace(fsingrid, {
  selector: 'h2',

  css: [
    '.sIFR-root {font-size: 21px; color: #666666; text-transform: lowercase;}'
  ]
});

sIFR.replace(fsingrid, {
  selector: "#splash h3",
  css: [
    '.sIFR-root {font-size: 35px; text-transform: lowercase;}'
  ]
});

sIFR.replace(fsingrid, {
  selector: 'h3',

  css: [
    '.sIFR-root {font-size: 16px; color: #000000; text-transform: lowercase;}'
  ]
});

sIFR.replace(fsingrid, {
  selector: "#main-content blockquote",
  wmode: "transparent",
  css: [
    '.sIFR-root {font-size: 16px; text-align: center; text-transform: lowercase;}'
  ]

});


