// JavaScript Document
$(document).ready(
		function() {
			
			if ($.browser.msie) {
     			$('#shifter_arrow').css({'display': 'none'})
  			 }
			
			function preload(arrayOfImages) {
    			$(arrayOfImages).each(function(){
        		$('<img/>')[0].src = this;
        		// Alternatively you could use:
        		// (new Image()).src = this;
    			});
			}
			
			preload([
				'images/btn_home1.jpg',
    			'images/btn_about1.jpg',
    			'images/btn_services1.jpg',
				'images/btn_news1.jpg',
				'images/btn_faq1.jpg',
    			'images/btn_contact1.jpg'
			]);
			
			/*---- ID the page, set the menu button of current page to ON -------*/
			var pagelink = $(page).attr("src");
			var pageon = pagelink.replace(/.jpg$/gi,"1.jpg");
			$(page).attr("src",pageon);
			$(page).removeClass('button');
			$('.button').hover(function(){
									var hlink = $(this).attr('src');
									globalVar = hlink;
									var on = hlink.replace(/.jpg$/gi,"1.jpg");
									$(this).attr('src',on);
										},function() {
											$(this).attr('src',globalVar);
										});
			
			/*---- Shifter -------*/
			var step=1;
			var degree=0;
			$("#shifter").click(
				function() {
					step=step+1;
					if(step==2) { degree='35deg', tmargin='-118px', pleft='-1000', num='2' };
					if(step==3) { degree='70deg', tmargin='-261px', pleft='-2000', num='3' };
					if(step==4) { degree='108deg', tmargin='-401px', pleft='-3000', num='4' };
					if(step==5) { degree='140deg', tmargin='-543px', pleft='-4000', num='5' };
					if(step==6) { degree='180deg', tmargin='-682px', pleft='-5000', num='6' };
					if(step>6) { degree='0deg', step=1, tmargin='21px', pleft='0', num='1' };
						$('#shifter_trigger').animate({rotate: '-20deg'}, 200, function() {
																				$('#shifter_trigger').animate({rotate: '0deg'}, 300); 
																				 });
						$('#shifter_arrow').animate({rotate: degree}, 500);
						$("#steps_content1").animate({ marginTop: tmargin}, 500);
						$('#index_top_container').animate({left: pleft}, 500);
						$('#circle_content').html(num);
						
				}
			);
		});
