// BEGIN BREAK OUT OF FRAMES

function bustFrames(){
  if (window != top){
    top.location.href=location.href
  }
}

// END BREAK OUT OF FRAMES

pathParts = location.pathname.split("/");
currentSection = pathParts[1];
if (currentSection == ""){
    currentSection = "home";
}
// alert("currentSection" + currentSection);  

$(document).ready(function(){

    $("#main_nav li").each(function(){ 
       var link = $(this).children("a"); 
       var image = $(link).children("img"); 
       var imgsrc = $(image).attr("src");
       var imgID = $(image).attr("id");
       if (imgID != currentSection + "_button"){
// alert("Image ID" + imgID);       
           // add mouseover 
           $(link).mouseover(function(){ 
               var on = imgsrc.replace(/.gif$/gi,"_on.gif"); 
               $(image).attr("src",on); 
           });
            // add mouse out 
           $(link).mouseout(function(){ 
                $(image).attr("src",imgsrc); 
           });
       }
       else{var on = imgsrc.replace(/.gif$/gi,"_on.gif"); 
           $(image).attr("src",on); 
       }
    });


    $("#showcase_inner_container_right div.th").each(function(){ 
	    var link = $(this).children("a"); 
	    var image = $(link).children("img"); 
	    // add mouseover 
        $(link).mouseover(function(){
            var theLink = $(image).attr("id").replace("linkthm_","");
// alert("on image"+ on);
            highLight(theLink,image);
        });
        // add mouse out 
        $(link).mouseout(function(){
            var theLink = $(image).attr("id").replace("linkthm_","");
            unhighLight(theLink,image);
        }); 
    });


    $("#showcase_inner_container_left p").each(function(){ 
	    var textlink = $(this).children("a"); 
	    // add mouseover 
        $(textlink).mouseover(function(){ 
    	    var theLink = $(this).attr("id").replace("linktext_","");
    	    var image = $("#linkthm_"+theLink);
            highLight(theLink,image);
        });
        // add mouse out 
        $(textlink).mouseout(function(){ 
    	    var theLink = $(this).attr("id").replace("linktext_","");
    	    var image = $("#linkthm_"+theLink);
            unhighLight(theLink,image);
        }); 
    });


}); 



function highLight(theLink,image){
	$("#linktext_"+theLink).css("color","#000000");
	var imgsrc = $(image).attr("src");
// alert(theLink+" / "+imgsrc)
// alert("imgsrc"+imgsrc);
	var on = imgsrc.replace(/.jpg$/gi,"_on.jpg");
// alert("on"+on);
	$("#linkthm_"+theLink).attr("src",on);
// alert("the image link"+theLink+","+"the text link"+theLink);
}

function unhighLight(theLink,image){
	var imgsrc = $(image).attr("src");
// alert("imgsrc"+imgsrc);
    $("#linktext_"+theLink).css("color","#999999");
    $("#linkthm_"+theLink).attr("src",imgsrc.replace(/_on.jpg$/gi,".jpg"));
}




