// JavaScript Document
$(document).ready(function() {
	externalLinks();
	$('#bottomnav a.thickbox,#tsandcs a.thickbox').each(function(){
		this.href = (this.href + "?tb=true&amp;KeepThis=true&amp;TB_iframe=true&amp;height=500&amp;width=700").replace(/spages/,"ispages");	
	});
	$('.required').focus(function(){clearDefault(this);});
	$('#productlist li').css({cursor:"pointer"});
	$('#productlist li').click(function(){
		//alert($(this).children('span').children('a').attr('href'));
		window.location= $(this).children('span').children('a').attr('href');
	});
	$('#productlist li span a.editlink').click(function(){
		var newWindow = window.open($(this).attr('href'), '_blank');
		newWindow.focus();
		return false;
	});
});

function clearDefault(el) {
	var	input =  $(el).val()
  	if (input =="Required" | input =="Search") {$(el).val("")}
}

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";
 }
}
