$(document).ready(function(){
	$("table").tablesorter()
	$( "td" ).dblclick(function() {
		var cssClass = $(this).attr("class");
		var style =$(this).attr("style");
		if (style != undefined && style.length  > 0){
			$("td."+cssClass).attr("style", "");
		}else {
			var cellText = $(this).text();
			$("td."+cssClass).each(function() {
				if (cellText == $(this).text()){
					$(this).attr("style", "background-color:yellow");
				}
			});
		}
	});
			$("h2").each(function(i,item) {
				var cssClass = "domain"+ i;
				$("#serviceDomain").append('<input type="checkbox" name="' + cssClass + '" onclick="toggleVisFull(this)" checked> ' + $(this).text());
				$(this).addClass(cssClass);
			});	
});


function toggleVis(checkBx){


	// Once the cells and checkbox object has been retrieved
	// the show hide choice is simply whether the checkbox is
	// checked or clear
	if (checkBx.checked){
		$("td."+checkBx.name).attr("style", "");
		$("th."+checkBx.name).attr("style", "");

	}else {
		$("td."+checkBx.name).attr("style", "display:none" );
		$("th."+checkBx.name).attr("style", "display:none");
	}


	
}
function toggleVisFull(checkBx){


	// Once the cells and checkbox object has been retrieved
	// the show hide choice is simply whether the checkbox is
	// checked or clear
	var cssClass = "." + checkBx.name;
	if (checkBx.checked){
		$(cssClass).parent().attr("style", "");
	}else {
		$(cssClass).parent().attr("style", "display:none" );
	}


	
}