//Cufon
Cufon.replace('ul.nav', { fontFamily: 'Gotham Narrow' });
Cufon.replace('.column > h3', { fontFamily: 'Gotham Narrow' });
Cufon.replace('.mkt-copy', { fontFamily: 'Jenson' });
Cufon.replace('.column > .button', { fontFamily: 'Gotham Narrow' });
Cufon.replace('#footer > .inner > .column > h4', { fontFamily: 'Gotham Narrow' });
Cufon.replace('.column.main > h1', { fontFamily: 'Gotham Book' });
Cufon.replace('.slide-text > h2', { fontFamily: 'Gotham Book' });
Cufon.replace('.slide-text > p', { fontFamily: 'Gotham Narrow' });
Cufon.replace('.tertiary > .inner > .titles > h2.section-title', { fontFamily: 'Gotham Book' });
Cufon.replace('.tertiary > .inner > .titles > h1', { fontFamily: 'Gotham Extra Light' });
Cufon.replace('input#send', { fontFamily: 'Gotham Narrow' });


Cufon.replace('.slide-content > h2', { fontFamily: 'Gotham Book' });
Cufon.replace('.slide-content > p', { fontFamily: 'Gotham Narrow' });

$(document).ready(function(){

	$('.flickr-badge').click(function(){
		window.location.href = "http://www.gocss.com/news/index.php";
	});
	
    //set current x value for margin
    var curPos = 0;
    
    //set slide width
    var w = 960;
    
    //default highlights
    reStyle();
    
    //automation
    //setInterval(function(){
    //	if (curPos > -(3*w) && ){
    //		advanse();
    //		reStyle();
    //	};
    //}, 5000);
    
    $('#slider-frame-outer').everyTime(6000,'auto', function(){
    	if (curPos > -(3*w)){
	    	advanse();
	    };
    	reStyle();
    }, 3);
    
    
    $('.next').click(function(){
    	if (curPos > -(3*w)){
    		advanse();
    	};
    	reStyle();
    });
    
    $('.prev').click(function(){
    	if (curPos < 0){    		
	    	revarse();    	
    	};
    	reStyle();
    });
    $('.one').click(function(){
    	$('#slider-frame-inner').animate({
    		marginLeft: 0
    	});
    	
    	curPos = 0;
    	reStyle();
    });
    $('.two').click(function(){
    	$('#slider-frame-inner').animate({
    		marginLeft: -w
    	});
    	
    	curPos = -w;
    	reStyle();
    });
    $('.three').click(function(){
    	$('#slider-frame-inner').animate({
    		marginLeft: -(w*2)
    	});
    	
    	curPos = -(w*2);
    	reStyle();
    });
    $('.four').click(function(){
    	$('#slider-frame-inner').animate({
    		marginLeft: -(w*3)
    	});
    	
    	curPos = -(w*3);
    	reStyle();
    });
   
   	//set styles based on location
	function reStyle(){
    
		$('.slide-picker > li').removeClass('active');
		$('.next').removeClass('no-link');
		$('.prev').removeClass('no-link');
	
	    if(curPos == 0){
	    	$('.prev').addClass('no-link');
	    	$('.one').addClass('active');
	    };
	    
	    if(curPos == -960){
	    	$('.two').addClass('active');
	   	};
	   	if(curPos == -1920){
	    	$('.three').addClass('active');
	    };
	    if(curPos == -2880){
	    	$('.four').addClass('active');
	    	$('.next').addClass('no-link');
	    };
	};
	
	// moves slides forward
	function advanse(){
		$('#slider-frame-inner').animate({
			marginLeft: curPos - w
		});	
		
		curPos = curPos - w;
	};
	
	// moves slides back
	function revarse(){
		$('#slider-frame-inner').animate({
    		marginLeft: curPos + w
    	});

    	curPos = curPos + w; 	
	};
	
});


