function clearSearch() {
	return (document.getElementById("txt4").value == "Search...") ? "" : document.getElementById("txt4").value;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; 
  if(d.images){ 
		if(!d.MM_p) 
			d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ 
				d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
			}
	}
}

/* Top-Ad functions */
function GrowBanner() { document.getElementById("banner").style.height = 188; }
function ShrinkBanner() { document.getElementById("banner").style.height = 35; }

function headerInit() {
	MM_preloadImages(
		'http://test.hrstest.com/img/header/r4_c12_f2.jpg',
		'http://test.hrstest.com/img/header/r4_c15_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c2_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c3_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c5_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c6_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c7_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c9_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c11_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c14_f2.jpg',
		'http://test.hrstest.com/img/header/r5_c16_f2.jpg',
		'http://test.hrstest.com/img/bkgd/go2.jpg',
		'http://test.hrstest.com/img/footer/social_r2_c2_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c4_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c6_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c8_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c10_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c11_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c12_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c14_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c16_f2.png',
		'http://test.hrstest.com/img/footer/social_r2_c18_f2.png',
		'http://test.hrstest.com/productpg/img/btn/descriptionTab-on.png',
		'http://test.hrstest.com/productpg/img/btn/descriptionTab-off.png',
		'http://test.hrstest.com/productpg/img/btn/descriptionTab-hover.png',
/* 		'http://test.hrstest.com/productpg/img/btn/reviewsTab-on.png',
		'http://test.hrstest.com/productpg/img/btn/reviewsTab-off.png',
		'http://test.hrstest.com/productpg/img/btn/reviewsTab-hover.png', */
		'http://test.hrstest.com/productpg/img/btn/specsTab-on.png',
		'http://test.hrstest.com/productpg/img/btn/specsTab-off.png',
		'http://test.hrstest.com/productpg/img/btn/specsTab-hover.png',
		'http://test.hrstest.com/productpg/img/btn/videosTab-on.png',
		'http://test.hrstest.com/productpg/img/btn/videosTab-off.png',
		'http://test.hrstest.com/productpg/img/btn/videosTab-hover.png');
}

// BEGIN Christmas Countdown
function targetDate() {
	if (document.getElementById("countdowncontainer")) {
	var d=new Date();

		var month=new Array(12);
		month[0]="January";
		month[1]="February";
		month[2]="March";
		month[3]="April";
		month[4]="May";
		month[5]="June";
		month[6]="July";
		month[7]="August";
		month[8]="September";
		month[9]="October";
		month[10]="November";
		month[11]="December";
		
		var target = new Array();
		var date = d.getDate();
		var hour = d.getHours();
		//var minute = d.getMinutes();
		
		if ( (date < 17)  || (date == 17 && hour < 15)) {
			target['date'] = "December 17, 2009 15:00:00 GMT-0600";
			target['ship'] = "Ground Shipping";
			return target;
		} else if ((date < 21) || (date == 21 && hour < 15)) {
			target['date'] = "December 21, 2009 15:00:00 GMT-0600";
			target['ship'] = "3 Day Shipping";
			return target;
		} else if ((date < 22) || (date == 22 && hour < 15)) {
			target['date'] = "December 22, 2009 15:00:00 GMT-0600";
			target['ship'] = "2 Day Shipping";
			return target;
		} else {
			target['date'] = "December 23, 2009 13:00:00 GMT-0600";
			target['ship'] = "1 Day Shipping";
			return target;
		}
	}
	return false;
}

function cdtime(container){
	if (document.getElementById("countdowncontainer")) {
		var targetdate = targetDate();
		if (!document.getElementById || !document.getElementById(container)) return;
		this.container=document.getElementById(container);
		this.currentTime=new Date();
		this.targetdate = new Array();
		this.targetdate['date'] = new Date(targetdate['date']);
		this.targetdate['ship'] = targetdate['ship'];
		this.timesup=false;
		this.updateTime();
	}
}

	cdtime.prototype.updateTime=function(){
		var thisobj=this;
		this.currentTime.setSeconds(this.currentTime.getSeconds()+1);
		setTimeout(function(){thisobj.updateTime()}, 1000);
	}

	cdtime.prototype.displaycountdown=function(baseunit, functionref){
		this.baseunit=baseunit;
		this.formatresults=functionref;
		this.showresults();
	}

	cdtime.prototype.showresults=function(){
		var thisobj=this;
		var timediff=(this.targetdate['date']-this.currentTime)/1000 ;
		var weekday = new Date();
		//if (weekday.getDate() == 24 /*|| weekday.getDay() == 6 */|| timediff < 0 ) { 
		if (weekday.getDate() == 24 || timediff < 0 ) { 
			this.timesup=true;
			this.container.innerHTML=this.formatresults();
			return;
		}

		var oneMinute=60; 
		var oneHour=60*60;
		var oneDay=60*60*24;
		var dayfield=Math.floor(timediff/oneDay);
		var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour);
		var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute);
		var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute));
			
		switch (this.baseunit) {
			case "hours":
				hourfield = dayfield*24+hourfield;
				dayfield = false;
				break;
			case "minutes":
				minutefield = dayfield*24*60+hourfield*60+minutefield;
				dayfield = hourfield = false;
				break;
			case "seconds":
				var secondfield = timediff;
				dayfield = hourfield = minutefield = false;
				break;
		}

		this.container.innerHTML = this.formatresults(dayfield, hourfield, minutefield, secondfield, this.targetdate['ship']);
		setTimeout(function(){thisobj.showresults()}, 1000);
	}

function formatresults(dayfield, hourfield, minutefield, secondfield, shippingMethod){
	if (document.getElementById("countdowncontainer")) {
		if (this.timesup == false){
			var displaystring = "<span class=\"countdown\">Want it by Christmas? Order in the next   ";
			//displaystring += (dayfield) ? "<span class=\"countdownTime\">"+dayfield+":</span>" : "";
			displaystring += (hourfield) ? "<span class=\"countdownTime\">"+hourfield+"</span>:" : "";
			displaystring += (minutefield) ? "<span class=\"countdownTime\">"+((minutefield<10 && hourfield>0)?"0"+minutefield : minutefield)+"</span>:" : "";
			displaystring += "<span class=\"countdownTime\">"+((minutefield>0 && secondfield<10)?"0"+secondfield : secondfield)+"</span>";
			if (hourfield>0) { displaystring += " hour"+((hourfield == 1)?"":"s "); }
				else if (minutefield>0) { displaystring += " minute"+((minutefield == 1)?"":"s "); }
				else if (secondfield>0) { displaystring += " second"+((secondfield == 1)?"":"s "); }
			displaystring += " with <span class=\"countdownShipping\">"+shippingMethod+"!</span></span>";
		} else{ 
			var weekday = new Date();
			if (weekday.getDate() >= 23 && weekday.getDate() <= 26) {
				var displaystring = "<span class=\"countdown\"><span class=\"countdownTime\">Hit! Run! Score!</span> wishes you and your family a <span class=\"countdownTime\">Merry Christmas!</span></span>";
			} else if (weekday.getDay() == 0 || weekday.getDay() == 6) {
				var displaystring = "<span class=\"countdown\">Orders placed today will be processed the next business day.</span>";
			} else {
				var displaystring = "<span class=\"countdown\">Orders placed after <span class=\"countdownTime\">1pm CST</span> will be processed next business day.</span>";
			}
		}
		return displaystring;
	}
	return false;
}
// END Christmas Countdown