$(document).ready(function(){

	
	function mycarousel_initCallback(carousel)
	{
	    // Disable autoscrolling if the user clicks the prev or next button.
	    carousel.buttonNext.bind('click', function() {
	        carousel.startAuto(0);
	    });

	    carousel.buttonPrev.bind('click', function() {
	        carousel.startAuto(0);
	    });

	    // Pause autoscrolling if the user moves with the cursor over the clip.
	    carousel.clip.hover(function() {
	        carousel.stopAuto();
	    }, function() {
	        carousel.startAuto();
	    });
	};
	
	$('.mycarousel').jcarousel({
        auto: 3,
		scroll: 4,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

	$('.jcarousel-prev-horizontal').css('opacity', 0);
	$('.jcarousel-next-horizontal').css('opacity', 0);
	$('.jcarousel-container').mouseover(function(){
		$('.jcarousel-prev-horizontal').stop().animate({opacity:1});
		$('.jcarousel-next-horizontal').stop().animate({opacity:1});
	});
	$('.jcarousel-container').mouseout(function(){
		$('.jcarousel-prev-horizontal').stop().animate({opacity:0});
		$('.jcarousel-next-horizontal').stop().animate({opacity:0});
	});
	
	getTwitters('tweet', { 
      id: 'cooljor', 
      count: 1, 
      enableLinks: true, 
      ignoreReplies: true, 
      clearContents: true,
	  newwindow: true,
      template: '%text% <a class="tweetA" href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'
    });
	
	/* Refresh Form on Refresh */
		var formLen = document.forms.length;
		for(var i = 0; i < formLen; i++){
			document.forms[i].reset();
		};

	/* Field OnFocus OnBlur */

		$('#rightCol input[type="text"]').addClass('idleField');
		$('#rightCol input[type="text"]').focus(function(){
			$(this).removeClass('idleField').addClass('focusField');
			if(this.value == this.defaultValue){
				this.value='';
				$(this).addClass('hungry');
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('#rightCol input[type="text"]').blur(function(){
			$(this).removeClass('focusField').addClass('idleField');
			if($.trim(this.value) == ''){
				this.value = (this.defaultValue);
				$(this).removeClass('hungry');
			}
		});
		
		$('.commentInfo input[type="text"]').addClass('idleField');
		$('.commentInfo input[type="text"]').focus(function(){
			$(this).removeClass('idleField').addClass('focusField');
			if(this.value == this.defaultValue){
				this.value='';
				$(this).addClass('hungry');
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('.commentInfo input[type="text"]').blur(function(){
			$(this).removeClass('focusField').addClass('idleField');
			if($.trim(this.value) == ''){
				this.value = (this.defaultValue);
				$(this).removeClass('hungry');
			}
		});

	/* folio slide */
	
		$("#myController").jFlow({
		        slides: "#slides",  // the div where all your sliding divs are nested in
		        controller: ".jFlowControl", // must be class, use . sign
		        slideWrapper : "#jFlowSlide", // must be id, use # sign
		        selectedWrapper: "jFlowSelected",  // just pure text, no sign
		        width: "938px",  // this is the width for the content-slider
		        height: "600px",  // this is the height for the content-slider
		        duration: 400,  // time in miliseconds to transition one slide
		        prev: ".jFlowPrev", // must be class, use . sign
		        next: ".jFlowNext" // must be class, use . sign
		    });
    

});