var houseObj; 
var houseCol;
$(document).ready(function() {

$('a').each(function() {
$(this).attr("href", function(index, old) {
return old.replace("refnavid=x", "refnavid=" + $('[name="NavID"]').val()
)
                                       })     
})



houseVal = $('[name="cat"]').val(); 
houseVal2 = $('[name="House"]').val();


if (houseVal2 !=undefined ) {
$(".houseTable img").each(function() {
if ($(this).attr("src").indexOf("/icons/vc") >= 0)  { $(this).remove();}

}); 
	var houseVal =  $('[name="House"]').val()

	if (houseVal == 'LA') {
		houseCol = 'Green'
	} 
	else if (houseVal == 'LC'){
		houseCol= 'Red';
	}
                                           else if (houseVal == 'both'){
		houseCol= 'Grey';
	}

	else{
		houseCol = 'Blue';
	}
}

else if ( houseVal !=undefined ) {

	if (houseVal == 'la') {
		houseCol = 'Green'
	} 
	else if (houseVal == 'lc'){
		houseCol= 'Red';
	}

	else if (houseVal == 'both'){
		houseCol= 'Grey';
	}
	else{
		houseCol = 'Blue';
	}
}

		
else {


		houseCol = 'Blue';
	}

$(".houseTable th").addClass("dark" + houseCol + "BG");
$(".houseTable a").addClass(houseCol);


$("#hansText div:first").addClass(houseCol + "Text");




var categoriesObj = $('[name="hasCategories"]');

if (categoriesObj != null && categoriesObj !=undefined ) {
	if (categoriesObj.val() == 'true'){
	//this is only for categorised views


$(".catcol").each(function() {
$(this).closest('td').prev().css('width', '5px')
$(this).addClass(houseCol + 'Text');

})



	$(".houseTable tr").each(function() {
                                     	if ($(this).attr('bgcolor') =='#efefef') {
                                           $(this).addClass("soft" + houseCol + "BG");
};    

	})


	$('.heading').each(function() {
	 $(this).addClass(houseCol);
	$(this).closest('td').prev().hide();    

                                                
	})


	}

	else{


		$(".houseTable tr:even").addClass("soft" + houseCol + "BG");
                                                $(".houseTable tr:odd").addClass("whiteBG");

}


}

	else{


		$(".houseTable tr:even").addClass("soft" + houseCol + "BG");
                                                $(".houseTable tr:odd").addClass("whiteBG");

}


})








