$(document).ready(function(){

$("#infobar_btn").toggle(
  function () {
    $("#infobar").removeClass('off');
    $("#infobar").addClass('on');
  },
  function () {
    $("#infobar").removeClass('on');
    $("#infobar").addClass('off');
  }
);

//Styleswitch stylesheet switcher by Kelvin Luck http://www.kelvinluck.com/
$('.styleswitch').click(function() {
  switchStylestyle(this.getAttribute("rel"));
  return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);
// /Styleswitch stylesheet switcher by Kelvin Luck http://www.kelvinluck.com/

});//close document ready

// http://www.selfcontained.us/2008/03/08/simple-jquery-image-rollover-script/  
$(function() {
	$('.rollover').hover(function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	}, function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	});
});

// http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
$(function(){ 
  $('#s').hint();
})		
jQuery.fn.hint = function() {
  return this.each(function(){
    var t = $(this); // get jQuery version of 'this'
    var title = t.attr('title'); // get it once since it won't change
    
    if (title) { // only apply logic if the element has the attribute
      
      // on focus, set value to blank if current value matches title attr
      t.focus(function(){
        if (t.val() == title) {
          t.val('');
          t.removeClass('blur');
        }
      })

      // on blur, set value to title attr if text is blank
      t.blur(function(){
        if (t.val() == '') {
          t.val(title);
          t.addClass('blur');
        }
      })

      // clear the pre-defined text when form is submitted
      t.parents('form:first()').submit(function(){
        if (t.val() == title) {
          t.val('');
          t.removeClass('blur');
        }
      });

      // now change all inputs to title
      t.blur();
    }
  })				
}

// Styleswitch stylesheet switcher by Kelvin Luck http://www.kelvinluck.com/
function switchStylestyle(styleName) {
	$('link[@rel*=style][@title]').each(function(i) 
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	createCookie('style', styleName, 365);
}
// /Styleswitch stylesheet switcher by Kelvin Luck http://www.kelvinluck.com/

// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days) {
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
// /cookie functions