$(document).ready(function(){
   // Change the image of hoverable images
  	
	var hoverImg;
	var normalImg;
	var isSelected;
	
   $(".imgHoverable").hover( function() {
	  
       if(isSelected != $(this).parent().parent().attr('ID')){
		   hoverImg = HoverImgOf($(this).attr("src"));
		   //
		   $(this).attr("src", hoverImg);
	   }
     }, function() {		
		if(isSelected != $(this).parent().parent().attr('ID')){
			normalImg = NormalImgOf($(this).attr("src"));
			$(this).attr("src", normalImg);
		}	   
     }
   );
   
   $(".imgHoverable").click(function() {
	   
	   for(i=1;i<25;i++){
		   normalImg = NormalImgOf($("#logo"+i+" a img").attr("src"));
			$($("#logo"+i+" a img")).attr("src", normalImg);
	   }
	   isSelected= $(this).parent().parent().attr('ID');	   
		hoverImg = HoverImgOf($(this).attr("src"));
		$(this).attr("src", hoverImg);
		
     });
   
   
// Logos Click function on Home Page
  
  
  
// +++++++++++++++++++++++++++++++++++++   
});


function HoverImgOf(filename) {
    try {
        var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
        return filename.replace(re, "$1_hover.$2");
    }
    catch (Error) {
    }
}
function NormalImgOf(filename) {
    try {

        var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
        return filename.replace(re, "$1.$2");
    }
    catch (Error) {
    }
   
}



