
	$(document).ready(function() {
			
		if($("#tab1").attr("src")){
			/* initialize: the Veteran Story tab is on state */
			$("#tab1").attr("src",$("#tab1").attr("src").replace("_off", "_on"));
			$("#tabs-1").show();
			$("#tabs-2").hide();
			$("#tabs-3").hide();
			//alert($("li#link2").html());

			//alert($("#tabs-2").text()== "<span></span>");
			if($("#tabs-2").html() == "<span></span>"){
				
				
			}
			
			$("div#tabs ul li a img").each(function (i) {
				//alert($(this).attr("class"));
				$(this).click(function () { 
					/* 
						initialize the state for all the Tabs and reset the current one to On state
						there must be a way to code this in a smart way, 
						but I don't have time to do this at the moment.
					*/
					$("#tabs-1").hide();
					$("#tabs-2").hide();
					$("#tabs-3").hide();
					$("#tab1").attr("class", "unselected");
					$("#tab1").attr("src",$("#tab1").attr("src").replace("_on", "_off"));
					$("#tab2").attr("class", "unselected");
					$("#tab2").attr("src",$("#tab2").attr("src").replace("_on", "_off"));
					$("#tab3").attr("class", "unselected");
					$("#tab3").attr("src",$("#tab3").attr("src").replace("_on", "_off"));
				    $(this).attr("src",$(this).attr("src").replace("_off", "_on"));
				    $(this).attr("class","isselected");	
					if ($(this).attr("id")=='tab1') {
						$("#tabs-1").show();
					}
					if ($(this).attr("id")=='tab2') {
						$("#tabs-2").show();
					}
					if ($(this).attr("id")=='tab3') {
						$("#tabs-3").show();
					}
				});	
				
				$(this).hover(function () {
					if ($(this).attr("class") == 'unselected'){						
						$(this).attr("src",$(this).attr("src").replace("_off", "_on"));
					}
				}, function () {
					 if ($(this).attr("class") == 'unselected'){
				  		$(this).attr("src",$(this).attr("src").replace("_on", "_off"));
					 }
				});
						
			});
		}
		
		//Show or Hide Participant Profile for the Admin on the veteran page
		if($("#participantProfile").attr("style")){
			// hide #participantProfile
			$("#participantProfile").hide();
			
			//show
			$("#e").click(function() {
				$("#participantProfile").show();
			});
			
			//hide
			$("#d").click(function() {
				$("#participantProfile").hide();
			});
		}

        if($("a.CMSBreadCrumbsLink").attr("href")){
            //$("a.CMSBreadCrumbsLink").attr("href","window.history.go(-1);");
            //alert($("a.CMSBreadCrumbsLink").attr("href"));
        }
		
	});
	
    