function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
     anchor.target = "_blank";
   }
 }
}


$(document).ready(function() {
	
    $('body#presspage #thumbs a').lightBox();
    $('body#presspage #thumbs li:nth-child(7n)').addClass('norightmargin');

    $('body#fanpage #thumbs a').lightBox();
    $('body#fanpage #thumbs li:nth-child(5n)').addClass('norightmargin');

    $('body#collectionspage #subnav li:not(.selected) ul').hide();
    $('body#collectionspage #photos li:nth-child(3n)').addClass('norightmargin');
    $('body#collectionspage #photos.thumbs li a').lightBox();

$('body#shoppage input[type=text]').addClass('inputtext');

$('body#shoppage input[type=image]').addClass('image');

	$('body#shoppage #table2 a.lightbox').lightBox();

	$('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });

    $('body#retailerspage div.phpGoogleStoreLocator_result:even').addClass('resultalt');

	$(".striped tr:not(.exclude)").mouseover(function() {
		$(this).addClass("over");
	});

	$(".striped tr").mouseout(function() {
		$(this).removeClass("over");

	});


	$("body#retailerspage #locatorForm").validate({
		rules: {

			zipcode: {
				required: true,
				minlength: 5
			}
		},
		messages: {
			zipcode: {
				required: "Please enter a zipcode",
				minlength: "Your zipcode must consist of at least 5 characters"
			}
		}
	});

});


