
	$(document).ready(function(){

		$('#sell').hide();

		$(".buttonshold a.left").hover(function() {
			
			$(".buttonshold").addClass('activeleft');
			
		}, function() {
			
			$(".buttonshold").removeClass('activeleft');
			
		});
		
		$(".buttonshold a.right").hover(function() {
			
			$(".buttonshold").addClass('activeright');
			
		}, function() {
			
			$(".buttonshold").removeClass('activeright');
			
		});
		
		$('#sellit').click(function() {

			$(this).addClass('active');
			$('#specializein').removeClass('active');
			
			$('#whatwe').html('SELL');
			
		});
		
		$('#specializein').click(function() {

			$(this).addClass('active');
			$('#sellit').removeClass('active');
			
			$('#whatwe').html('SPECIALIZE IN');
			
		});
		
		$('#toggleslide').cycle({ 
			fx:     'scrollLeft', 
    		speed:  300, 
			timeout: 0,
			next: "#sellit",
			prev: "#specializein",
			cleartypeNoBg: true
		});
		
		$('#linecard').cycle({ 
		
			fx:     'fade', 
    		speed:  300, 
			timeout: 5000
			
		});
		
		$('#aboutuspics').cycle({ 
		
			fx:     'fade', 
    		speed:  300, 
			timeout: 5000
			
		});
		
		
		$('#addRow').click(function() {

			$("#parts").append('<tr><td><input name="part_no[]" class="forms small" type="text"></td><td><input name="quantity[]" class="forms small" type="text"></td><td><input name="manufacture[]" class="forms small" type="text"></td><td><input name="price[]" class="forms small" type="text"></td><td><input value="Remove" class="partsbtn" onclick="deleteRow(this);" type="button"></td></tr>');
			
		});
		
		$('.removebtn').click(function() {

			$(this).parent().parent().remove();
			
		});
		
		var coords = new Array();
				
		/* HOME GEARS */
		
		coords['grid'] = { "start":0, "coeff":-0.35, "stop":1500 };	
		

		function parallax() {
                
	        windowTop = $(window).scrollTop();  
			
			for(var className in coords) {
				
				if(windowTop >= coords[className]['start'] && windowTop <= coords[className]['stop']) {
				
					newCoord = (windowTop * coords[className]['coeff'])-(coords[className]['start'] * coords[className]['coeff']);
					$('#'+className).css({ "background-position": "0 "+ newCoord + "px" });
			
				}
				
			}
            
        }
        
        didScroll = false;
        
        $(window).scroll(function() {
    		didScroll = true;
		});
        
        setInterval(function() {
        	
		    if (didScroll) {
		    	parallax();
		        didScroll = false;
		    }
		    
		}, 10);
		
		$('.sep').next('br').remove();

				
	});
	
	
	function deleteRow(row) {
	
		$(row).parent().parent().remove();
	
	}
	
	function scrollTo(pos) {
	
		$('html, body').animate({
			scrollTop: $('#mainone').offset().top+pos
		});

	
	}
