// Rewritten version
// By @mathias, @cheeaun and @jdalton

(function(doc) {

	var addEvent = 'addEventListener',
	    type = 'gesturestart',
	    qsa = 'querySelectorAll',
	    scales = [1, 1],
	    meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];

	function fix() {
		meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
		doc.removeEventListener(type, fix, true);
	}

	if ((meta = meta[meta.length - 1]) && addEvent in doc) {
		fix();
		scales = [.25, 1.6];
		doc[addEvent](type, fix, true);
	}

}(document));


$(document).ready(function(){
    $(".tweet").tweet({
        username: "dreamtimefilm",
        avatar_size: 40,
        count: 4,
		template: "{avatar} {text} {time}",
        loading_text: "Loading tweets..."
    });
});

var tumblr_callback = function() {
	$('.tumblr_posts').show();
	$('.latest .status').hide();
}

$('.tumblr_posts').hide();

$(document).ready(function () {
	if ($('.tumblr_posts').length > 0) {
		$('.tumblr_posts').tumblr({
			url: 'http://dreamtimefilm.tumblr.com',
			timeago: false,
			perPage: 20,
			callback: tumblr_callback
		}).tumblr('reload');
	}
});

$(document).ready(function () {
	$(".map div").gMap({latitude:54.2684, longitude: -2.9594, zoom: 12 });
});
