﻿$(document).ready(function(){
    
    $(".bNav").mouseover(function(event){
       var name = $(this).attr("id");
       
       if(name=="bAbout"){            
        $(this).css("background", "url(/images/navigation.gif) no-repeat -108px 0px");       
       }else if(name=="bServices"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -317px 0px");
       }else if(name=="bWoodFloor"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -553px 0px");
       }else if(name=="bCollection"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -810px 0px");
       }else if(name=="bContact"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -1041px 0px");
       }
       
     });
     $(".bNav").mouseout(function(event){
       var name = $(this).attr("id");
       
       if(name=="bAbout"){            
        $(this).css("background", "url(/images/navigation.gif) no-repeat 0px 0px");       
       }else if(name=="bServices"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -216px 0px");
       }else if(name=="bWoodFloor"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -418px 0px");
       }else if(name=="bCollection"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -688px 0px");
       }else if(name=="bContact"){
        $(this).css("background", "url(/images/navigation.gif) no-repeat -932px 0px");
       }
       
     });
	 
	 /*
	 COLLECTIONS
	 */
		
		$('#gallery img').each(function (i) {
        	this.style.position = 'absolute';
			// this.style.zIndex = 0;
      	});
		
		$("#gLeftButton").mouseover(function(event){											 	
			$('.leftArrow').css('display','block');
		});
		$("#gLeftButton").mouseout(function(event){											 	
			$('.leftArrow').css('display','none');
		});
		
		$("#gRightButton").click(function(){			
			
			$('#gallery img').each(function (i) {	
											 
				if(this.style.zIndex == 1){ 
					var IMAGE_CURRENT = parseFloat($(this).attr('id'));
					var IMAGE_NEXT = (IMAGE_CURRENT+1);
					
					switch(IMAGE_CURRENT){
						case 6 : IMAGE_CURRENT = 6; IMAGE_NEXT = 0; break;
					}
						
					$("#"+IMAGE_CURRENT).css('z-index','0');
					$("#"+IMAGE_NEXT).css('z-index','1');
					
					return false;					
				}
			});
			
		});
		
		$("#gLeftButton").click(function(){
			
			$('#gallery img').each(function (i) {	
											 
				if(this.style.zIndex == 1){ 
					var IMAGE_CURRENT = parseFloat($(this).attr('id'));
					var IMAGE_NEXT = (IMAGE_CURRENT-1);
					
					switch(IMAGE_CURRENT){
						case 0 : IMAGE_CURRENT = 0; IMAGE_NEXT = 6; break;
					}
						
					$("#"+IMAGE_CURRENT).css('z-index','0');
					$("#"+IMAGE_NEXT).css('z-index','1');					
					
					return false;						
				}
			});
			
		});
		
		$("#gRightButton").mouseover(function(event){											 	
			$('.rightArrow').css('display','block');
		});
		$("#gRightButton").mouseout(function(event){											 	
			$('.rightArrow').css('display','none');
		});
});