/*
 * These are the Droids main javascript, Wordpress Theme
 * http://www.thesearethedroids.com
 *
 * Copyright (c) 2009 Benjamin Shockley
 *
 * Date: 23 September 2009
 * Revision: 5
 */
var wW = $(window).width();
window.onresize = setSizes;


$(function() {
        var randomImages = ['N1_top_300','Droid_Top300x308'];
        var rndNum = Math.floor(Math.random() * randomImages.length);
        //alert("url(img/" + randomImages[rndNum] + ".png) no-repeat");
        //$("#sliderwrapper").css({ 'background-image' : "url(img/" + randomImages[rndNum] + ".png) no-repeat" });
	$("#sliderwrapper").css("background","url(http://www.thesearethedroids.com/wp-content/themes/android2/img/" + randomImages[rndNum] + ".png)");
	setSizes();
	$("#drawerHandle").toggle(
		function () {
			$("#drawer").animate({"bottom": 0+"px"},1000);
		},
		function () {
			$("#drawer").animate({"bottom": -350+"px"},1000);
		}
	);
	showClock();
});

function setSizes() {
	wW = $(window).width();
	wH = $(window).height();
	$("#drawerHandle").css({"left" : ((wW/2)-160)+"px"});
}

function showClock() {
	var clock=new Date();
	var hours=clock.getHours();
	var minutes=clock.getMinutes();
	var timeValue = "" + ((hours > 12) ? hours -12 : (hours==0) ? "12" : hours);
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	timeValue += (hours >= 12) ? " PM " : " AM ";
	document.getElementById('showText').innerHTML=timeValue;
	t=setTimeout('showClock()',5000);
}