// Cufon font replacement
Cufon.replace('.header, .point, .title, .ftext, .contactus, .contactphone', { fontFamily: 'Futura' });
Cufon.replace('#slogan1', { fontFamily: 'Deftone Stylus' });

$(function() {

		// Login email field replacement
		$("#email").focus(function() {
			if($(this).val()=="Email address") {
				$(this).attr("value","");
			}
		});
		$("#email").blur(function() {
			if($(this).val()=="") {
				$(this).val("Email address");
			}
		});
		// Sign in button submits form
		$(".blogin").click(function() {
		    if( $("#email").val()!="" && $("#email").val()!="Email address" && $("#password").val()!="" ) {
			$("#loginform").submit();
		    }
		});

		// Logo scroller, jQuery Carousel
		$('#mycarousel').jcarousel({
			auto: 5,
			scroll: 4,
			animation: 'slow',
			wrap: 'last',
			initCallback: mycarousel_initCallback
		});

		// Make Customers slideshow and News block the same height
		$(".equalheights1").equalHeights;
		
		// Get latest tweet
		$.jTwitter('easyfan_corp', 1, function(data){
			$('.twitter').empty();
			$.each(data, function(i, post){
				$('.twitter').append(
					'<span class="twitext">'
					+    post.text
					+' </span>'
				);
			});
		});

	/* Creating custom :external selector
	$.expr[':'].external = function(obj){
		return !obj.href.match(/^mailto\:/)
				&& (obj.hostname != location.hostname);
	};
	
	Add 'external' CSS class to all external links
	$('a:external').addClass('external');
	
	*/		
		
});


// Login password field replacement
function pwdFocus() {
	$('#fakepassword').hide();
	$('#password').show();
	$('#password').focus();
	$('#password').attr("value","");
}
function pwdBlur() {
	if ($('#password').attr("value") == "") {
		$('#password').hide();
		$('#fakepassword').show();
	}
}

// Logos slideshow
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();
    });
};


