
sps = "/stellent/images/SiteStudioLibrarySite/spacer.gif";

$('document').ready(function(){
	var $sb = $('#navbarform input[type="text"]')
    $sb.attr('value','Quick catalogues search');
    $sb.addClass('knockedback');
    $sb.focus(function(e){
		$sb.attr('value','');
		$sb.removeClass('knockedback');
    });

});


function formatTable(table){
	var coln = countCols(table.rows[0]);
	table.style.marginTop=table.style.marginBottom="10px";
	table.style.width = "100%";
	table.border=0;
	table.cellPadding=table.cellSpacing=0;
	table.rows[0].cells[0].style.width = "40%";
	table.rows[0].className = "brownbg";
	for(var i=0; i<table.rows[0].cells.length; i++){
		table.rows[0].cells[i].className = "headerline";
	}

	for(var i = 1; i<table.rows.length; i++){
		table.rows[i].className = "lightbg";
		for(var j=0; j<coln; j++){
			if(j>0 && table.rows[i].cells[j]){
				table.rows[i].cells[j].className = "lightbgline";
			}
			if(table.rows[i].cells[j] && table.rows[i].cells[j].firstChild && table.rows[i].cells[j].firstChild.className == "DOMTable"){
				table.rows[i].cells[j].className = "brownbg2";
			}
			if(table.rows[i].cells[j] && table.rows[i].cells[j].className == ""){
				table.rows[i].cells[j].className = "table5pad";
			}
		}
	}
	if(coln==5){
		for (i=0; i<4; i++)
		{
			table.rows[0].cells[i].style.width = "24%";
		}
			table.rows[0].cells[4].style.width = "1%";
	}

}

function countCols(row){
	var n = 0;
	for(var i=0; i<row.cells.length;i++)
		n+=row.cells[i].colSpan;
	return n;
}

//Form validation

function checkSearch(form){
	if (form.search.value == "") {
		alert("Please enter a search term.");
		form.search.focus();
		return false;
	}
	return true;
}

function checkSearch2(form){
	if (form.searchterm.value == "") {
		alert("Please enter a search term.");
		form.search.focus();
		return false;
	}
	return true;
}

function checkFeedback(form){
	if (form.reply[1].checked && form.email.value == "") {
		alert("If you wish to be contacted by email, please provide an address");
		return false;
	}
		
	if (form.reply[2].checked && form.Address.value == "") {
		alert("If you wish to be contacted by post, please provide an address");
		return false;
	}
}
