/**
 * script for JustBlack theme
 *
 * PhpGedView: Genealogy Viewer
 * Copyright (C) 2002 to 2009  PGV Development Team.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @package PhpGedView
 * @subpackage Themes
 * @version $Id: icons.js 2011-04-08 JustCarmen $
 */
 
jQuery.noConflict();
jQuery(document).ready(function($){						
	
	$('.menuitem').each(function(){
		$(this + 'a[href$="gedcom"] img').attr('src',function(index,attr){
			return attr.replace('gedcom.gif','home.gif');		  
		});
	});	
	
	$('.submenuitem').each(function(){
		$(this).find('a[onclick*="quickEdit"] img').attr('src',function(index,attr){
        	return attr.replace('indis.gif','add_edit.gif');		  
        });
        $(this).find('a[href="uploadmedia.php"] img').attr('src',function(index,attr){
        	return attr.replace('menu_media.gif','add_media.gif');		  
        });
		 $(this).find('img').attr('src',function(index,attr){
			return attr.replace('small/fanchart.gif','small/circle.gif');
		});
		$(this).find('img').attr('src',function(index,attr){
			return attr.replace('small/gedcom.gif','small/fanchart.gif');
		});
		$(this).find('img').attr('src',function(index,attr){
			return attr.replace('modules/googlemap/images/pedigree_map.gif','themes/justblack/images/pedigree_map.gif');
		});
		$(this).find('a[href*="reports"] img').attr('src',function(index,attr){
        	return attr.replace('place.gif','report.gif');
      	});		
		$(this).find('a[href^="module.php?mod=research_assistant"] img').attr('src',function(index,attr){
    		return attr.replace('modules/research_assistant','themes/justblack/modules/research_assistant');		  
		});	
        $(this).find('a[href*="action=mytasks"] img').attr('src',function(index,attr){
        	return attr.replace('folder_blue_icon.gif', 'mytasks.gif');		  
       	});
		
		/* Icons for the wiki links in the help menu - the PGV code doesn't support icons in these particular items */				
		var path = 'themes/justblack/images/small/'
		var params = 'class="icon" alt="icon"';						
                            
		$(this).find('a[href*="title=Main_Page"]').prepend('<img src="' + path + 'wiki.gif" ' + params + ' />');
		$(this).find('a[href*="title=Users_Guide"]').prepend('<img src="' + path + 'wiki.gif" ' + params + ' />');
		$(this).find('a[href*="title=Administrators_Guide"]').prepend('<img src="' + path + 'wiki.gif" ' + params + ' />');
		$(this).find('a[href*="show_context_help=no"]').prepend('<img src="' + path + 'help.gif" ' + params + ' />');
		
		/* change the contact icon */
		$(this).find('a[onclick^="message"] img').attr('src',function(index,attr){
			return attr.replace('my_gedview.gif','contact.gif');		  
		})
		
		/* last help icon is the wrong one (resolve bug) */
		 $(this).find('a[href$="show_context_help=no"] img').attr('src',function(index,attr){
			return attr.replace('help.gif','menu_help.gif');		  
		})
	});
	
	$('div.menu_separator img').attr({'width':'75', 'height':'3'});
		
});
