$(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');
			}
		});
		
		$("p.fbtoo").easyTooltip();
			$("a.fbconnect_login_button").easyTooltip({
				tooltipId: "easyTooltip2",
				content: '<p>Although you can check out my site as much as you like without signing in, signing in unlocks extra functionality and allows me to connect with you better.</p><p>I use Facebook Connect so you don\'t have to create another profile/password here and so I can attach a real person to your comments and interaction with my blog.</p>'
			});
			$("p.fbtool2").easyTooltip({
				xOffset: -20,
				yOffset: 277,
				tooltipId: "easyTooltip1",
				content: '<p>Although you can check out my site as much as you like without signing in, signing in unlocks extra functionality and allows me to connect with you better.</p><p>I use Facebook Connect so you don\'t have to create another profile/password here and so I can attach a real person to your comments and interaction with my blog.</p>'
			});
		

	/* 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
		});
		
		

});