// JavaScript Document

creoff.initHomepage = function() {


}

writeGreeting = function() {
		var today = new Date();
		var now = today.getHours();

		/* use this to calculate the timezone if necessary
		myTZO = today.getTimezoneOffset(); // get difference in minutes with GMT
		var gmtHours = -today.getTimezoneOffset()/60;
		alert("The local time zone is: GMT " + gmtHours);
		*/
		var weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
		var dayzone;
		if (now>5 && now<12 ) dayzone = 'morning';
		else if (now>=12 && now<17 ) dayzone = 'afternoon';
		else if (now>=17 && now<23 ) dayzone = 'evening';
		else dayzone = 'night';
		document.write("Welcome to CreOFF on this fine "+weekday[today.getDay()]+" "+dayzone+"");
	}


creoff.initFlash = function() {

	creoff.genericText = "Have a look\naround this site.";
	setFlashText("Welcome.\nWanna have a look around the site?");

	$("DIV.homeBox.left").hover(function(){
	  setFlashText("Be sure to \nvisit the blog.\nInteresting!");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText);setFlashPic(1);
	});

	$("DIV.homeBox.right").hover(function(){
	  setFlashText("A widget...\n...and it's \nfree, FREE, *FREE*!!");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText);setFlashPic(1);
	});

	$("#creofflogo").hover(function(){
	  setFlashText("CreOFF...\nRemember that name.");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText);setFlashPic(1);
	});

	$("#nav").hover(function(){
	  setFlashText("Don't hesitate.\nJust CLICK.");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText);setFlashPic(1);
	});


	$("DIV.col.left").hover(function(){
	  setFlashText("Yep... Could be working for YOU!");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText);setFlashPic(1);
	});

	$("DIV.col.right").hover(function(){
	  setFlashText("More info available.");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText); setFlashPic(1);
	});

	$("#loginbutton").hover(function(){
	  setFlashText("Wanna go private?");
	  setFlashPic(2);
	},function(){
	  setFlashText(creoff.genericText); setFlashPic(1);
	});

	// start tracing for movement
	$("body").mousemove( function(event) {
		creoff.SWF("flashvisual").moveEyes(event.pageX+","+event.pageY);
	});


}

function setFlashText(str) {
	//
	creoff.SWF("flashvisual").setFlashText(str);
}

function setFlashPic(str) {
	//
	creoff.SWF("flashvisual").setFlashPic(str);
}

function getSWFposition() {
	var eyemotionObj = creoff.SWF("flashvisual");
	var str = REALoffsetLeft(eyemotionObj)+","+ REALoffsetTop(eyemotionObj);
	eyemotionObj.init(str);
	creoff.initFlash();

}

function REALoffsetLeft(MyObject) { if (MyObject.offsetParent) return (MyObject.offsetLeft + REALoffsetLeft(MyObject.offsetParent)); else return (MyObject.offsetLeft); }
function REALoffsetTop(MyObject) { if (MyObject.offsetParent) return (MyObject.offsetTop + REALoffsetTop(MyObject.offsetParent)); else return (MyObject.offsetTop); }