
is_chrome = 0;
is_safari = 0;
is_iphone = 0;
is_ipod = 0;
is_ipad = 0;
is_htc = 0;
is_mobile = 0;
is_smallscreen = 0;
is_touchscreen = 0;

var now=new Date();
var firstvisit=null;
var secssince=0;
var now_hour        = now.getHours();
var now_minute      = now.getMinutes();
var now_second      = now.getSeconds();
var now_monthnumber = now.getMonth(); // 0-11
var now_monthday    = now.getDate();
var now_year        = now.getYear();
var now_weekday     = now.getDay(); // 0-6 (Sun to Sat)

function get_browser_info(){
	uagent=navigator.userAgent.toLowerCase();
	is_chrome = uagent.indexOf('chrome') > -1;
	is_safari = uagent.indexOf('safari') > -1;
	is_iphone = uagent.indexOf('iphone') > -1;
	is_ipod = uagent.indexOf('ipod') > -1;
	is_ipad = uagent.indexOf('ipad') > -1;
	is_htc = uagent.indexOf('htc') > -1;
	if((is_iphone+is_ipod+is_htc)>0) is_mobile=1;
	if((is_iphone+is_ipod+is_ipad+is_htc)>0) is_touchscreen=1;
	if((is_iphone+is_ipod+is_htc)>0) is_smallscreen=1;
//alert(uagent);
}
get_browser_info();


function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );
  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }
  if ( path ) cookie_string += "; path=" + escape ( path );
  if ( domain ) cookie_string += "; domain=" + escape ( domain );
  if ( secure ) cookie_string += "; secure";
  document.cookie = cookie_string;
}
function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

cook=get_cookie("header");
if(cook==null)
{
	set_cookie ( "header", now, 2015, 1, 1);
}
else
{
	firstvisit = new Date(cook);
	secssince=parseInt((now-firstvisit)/1000);
}

var ipath="steve";
var headtopoffs="headtopoffs_normal";
var txttype='face="Times New Roman" color="#000000"';
var iconpath="inner-icons";
var hiagain_message = "Hi again!";
var goodday_message = "Good afternoon";
var intro2_message = "Don't forget to click the news button<br>to find out what\'s happening...";
var intro2_time=50;
var forcebgr="";
var himespos=0;
var specialbgr=0;

if(now_hour<12) goodday_message = "Good morning";
if(now_hour>=18) goodday_message = "Good evening";

var dy  = now_monthday;
var mth = now_monthnumber+1; // 1-12
if((dy==17)&&(mth==3)) // St. Patrick's Day
{
	hiagain_message = "Happy St. Patrick\'s Day!";
	txttype='face="Times New Roman" color="#008800"';
	iconpath="inner-icons-stpat";
	ipath="steve-stpat";
	headtopoffs="headtopoffs_stpat";
}
if((dy==9)&&(mth==6)) // Clive's Birthday
{
	hiagain_message = "I'm a hologram to celebrate Clive\'s Birthday!";
	txttype='face="Times New Roman" color="#002288"';
	iconpath="inner-icons-tec";
	himespos=1;
	specialbgr=1;
	ipath="steve-holo";
	//intro2_message = "52 52 32 84 111 100 97 121 33";
	intro2_message = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;00110100&nbsp;&nbsp;00110100&nbsp;&nbsp;00100000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;01010100&nbsp;&nbsp;01101111&nbsp;&nbsp;01100100<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;01100001&nbsp;&nbsp;01111001&nbsp;&nbsp;00100001";
	intro2_time=150;
}

if((dy==10)&&(mth==8)) // Jason's Birthday
{
	hiagain_message = "Happy Jason\'s Birthday!";
	txttype='face="Times New Roman" color="#000088"';
	iconpath="inner-icons-blue";
}
if((now_weekday==3)&&(dy<8)) // Quiz Night
{
	hiagain_message = "It\'s Quiz Night! Can you beat the champs?";
	forcebgr="active_centre/bgr/quiz.jpg";
	himespos=1;
}
if((dy==29)&&(mth==4)) // Will & Kate's wedding
{
	ipath="steve-crown";
	headtopoffs="headtopoffs_crown";
	hiagain_message = "Congratulations Wills & Kate!";
	txttype='face="Times New Roman" color="#000088"';
}
if((dy==31)&&(mth==10)) // Halloween
{
	ipath="steve-halloween";
	txttype='face="Times New Roman" color="#880000"';
	forcebgr="active_centre/bgr/halloween.jpg";
}

