/* 
 *
 *	File Description & Change Log
 *	-------------------------------------------------------
 *
 *	Details
 *	-------
 *
 *	Title: 		scripts.css
 *	Author: 	Andy Smith
 *	Of:			Verb Digital
 *	Creation:	18-8-2011
 *
 *	Note:		This is the general jScript file.
 *	-------------------------------------------------------
 *	
 *	Edits
 *	-----
 *
 *	Author: 	Andy Smith
 *	Date:		24-7-11
 *
 *	Note:		
 *
 *	-------------------------------------------------------
 *
 */

WebFontConfig = {
	google: { families: [ 'Cabin:400,700,400italic:latin'] }
};
(function() {
	var wf = document.createElement('script');
	wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
	wf.type = 'text/javascript';
	wf.async = 'true';
	var s = document.getElementsByTagName('script')[0];
	s.parentNode.insertBefore(wf, s);
})();

var uniformLoad$ = jQuery.noConflict();

uniformLoad$(function(){
	uniformLoad$(".uniform input, .uniform textarea, .uniform select").uniform();
	});
	 
// Homepage question answering
var slideJQ = jQuery.noConflict();
// slideJQ(function() {
slideJQ(window).load(function() {
	slideJQ("#socialTabs ul").tabs("#socialPanes > .block", {
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 400

	});
});


var validate = jQuery.noConflict();
//validate(function() {
validate(window).load(function() {
	// validate signup form on keyup and submit 
	var validator = validate("#enquiry_form").validate({ 
		rules: { 
			app_name: "required",
			app_email: { 
				required: true, 
				email: true 
			}
		}, 
		messages: { 
			app_name: "Please enter your name",
			email: { 
				required: "Please enter a valid email address", 
				minlength: "Please enter a valid email address"
			} 
			
		}, 
		// the errorPlacement has to take the table layout into account 
		errorPlacement: function(error, element) { 
			if ( element.is(":radio") ) 
				error.appendTo( element.next() ); 
			else if ( element.is(":checkbox") ) 
				error.appendTo ( element.next() ); 
			else 
				error.appendTo( element.next() ); 
		}, 
		// specifying a submitHandler prevents the default submit, good for the demo 
		 
		// set this class to error-labels to indicate valid fields 
		success: function(label) { 
			// set   as text for IE 
			label.html(" ").addClass("checked");
		} 
	}); 

});

var twitterers = jQuery.noConflict();
twitterers(window).load(function() {

	getTwitters('mostEntTweets', {
		id: 'mostent', 
		count: 4, 
		withFriends: true, // currently disabled due to change in Twitter API
		enableLinks: true, 
		ignoreReplies: false,
		onTimeout: function () {
			this.innerHTML = '<p>Hmmm, Sadly the twitter feed seems to be down. It would be great if you could <a href="http://twitter.com/moletamunro" title="Follow our Twitter Feed">follow us online</a> we\'ll keep you uptodate.</p>';
		},
		template: '<span class="twitterPrefix"><a href="http://twitter.com/mostent" title="Twitter Account" class="twit_image"><img height="32" width="32" src="%user_profile_image_url%" alt="" /></a><div class="twitContainer"><a href="http://twitter.com/mostent" title="Twitter Account" class="twitterStatus">%text%</a><em class="twitterTime"><a href="http://twitter.com/%user_screen_name%/statuses/%id%">%time%</a></em></div><div class="clearfix"></div>'
	});

});
