$(function(){
		   
	t = 3000;

	SetRollOvers();
	$().pngFix(); 
	
	$('a[href^=http]').click( function() {
   		window.open(this.href);
        return false;
    });
	
	$('#enquiry input, #enquiry textarea').focus(function() {
  		if($("#chatter").is(":visible")){
			$("#chatter").fadeOut("slow");
		}
	});
	
	$('#contact_form').submit(function(event) {  
       	event.preventDefault();
		$("#chatter").hide();
		$("#chatter").css({'position' : 'absolute', 'left' : '5px', 'top': '210px' });
		$("#loader").show();
		$.post("index.php/home/ajax_process_form", { message: $('#message').val(), name: $('#name').val(), email: $('#email').val(), phone: $('#phone').val() }, 
			function(data) {  
				if(data.substr(0, 1) == "O"){ $("#chatter").addClass("error"); }
				else { $("#chatter").removeClass("error"); }
				$("#chatter").html("<div><p>"+data+"</p></div>");  
				$("#chatter").fadeIn("slow");
				$("#loader").hide();
			}
		);
    });  
	
	$('.anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 600,             // How long the slide transition takes
                hashTags: true,                 // Should links change the hashtag in the URL?
                buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Go",             // Start text
		        stopText: "Stop",               // Stop text
            });
	
});

function SetRollOvers(){
	// usage: add the class 'rollover' to image elements
	jQuery("input[type=image].rollover, a.rollover img, img.rollover").hover(function(){
		    $(this).attr("src",jQuery(this).attr("src").replace(/(\.[^.]+)$/, '-hi$1'));
	    },function(){
		    $(this).attr("src",jQuery(this).attr("src").replace(/-hi(\.[^.]+)$/, '$1'));
	});
}
