// JavaScript Document
$(document).ready(function(){
var StatSel='flip_';
var StatSel_2 = 'ColCode';
var count = 0;
var count_2 = 0;
var count_3 = 0;



	$('#farbcode a').hover(
		function(){$(this).addClass('color_hover');},
		function(){$(this).removeClass('color_hover');}
	);
	
	$('#farbcode a').each(function(){
		count_2++;
		StatSel_2 = 'ColCode'+count_2;
		$(this).addClass(StatSel_2);
	 });
	

	$("#image_flips").children('a').each(function(){
		count++;
		StatSel='flip_'+count;

		flipItem = $(this);
		flipItem.addClass(StatSel);
		flipItem.css({'backgroundImage':'url(' + pathToTheme + 'images/navi/flip_' + count + '.gif)'});
		
	 });
	
	function onOut() {
		var myCount = 0;
		var myURL = $(this).attr('href');
		//alert(myURL);
		$("#image_flips").children('a').each(function(i) {
			if ($(this).attr('href') == myURL) myCount = i+1;
			});
		$(this).css({'backgroundImage':'url(' + pathToTheme + 'images/navi/flip_' + myCount + '.gif)'});
		$('#farbcode a').removeClass('color_hover');
	}
	
	function onHover() {
		var myCount = 0;
		var myURL = $(this).attr('href');
		//alert(myURL);
		$("#image_flips").children('a').each(function(i) {
			if ($(this).attr('href') == myURL) {
					myCount = i+1;
			}
		});

		$(this).css({'backgroundImage':'url(' + pathToTheme + 'images/navi/flip_over_' + myCount + '.gif)'});
			myStatSel='.ColCode'+myCount;
			$(myStatSel).addClass('color_hover');

			myStatSel='.ColCode'+myCount;
			$(myStatSel).addClass('color_hover');

	}
	
	
	
	function onHoverColor() {
				var myCount = 0;
				var myURL = $(this).attr('href');
				var myFlip = '.flip_'
				
				
				$("#farbcode a").each(function(i) {
					if ($(this).attr('href') == myURL) {
							myCount = i+1;
					}
				});
				
				
				myFlip = '.flip_' + myCount;
				$(myFlip).css({'backgroundImage':'url(' + pathToTheme + 'images/navi/flip_over_' + myCount + '.gif)'});
	}
	
		function onOutColor() {
				var myCount = 0;
				var myURL = $(this).attr('href');
				var myFlip = '.flip_'
				
				
				$("#farbcode a").each(function(i) {
					if ($(this).attr('href') == myURL) {
							myCount = i+1;
					}
				});
							
				
				myFlip = '.flip_' + myCount;
				$(myFlip).css({'backgroundImage':'url(' + pathToTheme + 'images/navi/flip_' + myCount + '.gif)'});
			
	}
	

	$("#image_flips").children('a').each(function() {
			$(this).hover(onHover, onOut);
			});
	
	$("#farbcode a").each(function() {
		$(this).hover(onHoverColor, onOutColor);
		});
	
	


	
	
});
