﻿function g728() {
	document.write('<script type="text/javascript">\n' +
	'<!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 728;\n' +
	'google_ad_height = 90;\n' +
	'google_ad_format = "728x90_as";\n' +
	'google_ad_channel ="2635888420";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'google_alternate_ad_url = "http://www.xb360info.de/alternate_ad_728.php";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

function gadba() {
	document.write('<script type="text/javascript">\n' +
	'<!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 468;\n' +
	'google_ad_height = 60;\n' +
	'google_ad_format = "468x60_as";\n' +
	'google_ad_type = "text";\n' +
	'google_ad_channel ="5184510658";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

var hide_336=false;
function gadmr() {
	hide_336=true;
	document.write('<script type="text/javascript">\n' +
	'<!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 300;\n' +
	'google_ad_height = 250;\n' +
	'google_ad_format = "300x250_as";\n' +
	'google_ad_type = "text";\n' +
	'google_ad_channel ="7050639703";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

function gadms() {
	hide_336=true;
	document.write('<script type="text/javascript">\n' +
	'<!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 250;\n' +
	'google_ad_height = 250;\n' +
	'google_ad_format = "250x250_as";\n' +
	'google_ad_type = "text";\n' +
	'google_ad_channel ="1908177697";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

function gadb() {
	if (!hide_336) {
		document.write('<script type="text/javascript"><!--\n' +
		'google_ad_client = "pub-3587182881822058";\n' +
		'google_ad_width = 336;\n' +
		'google_ad_height = 280;\n' +
		'google_ad_format = "336x280_as";\n' +
		'google_ad_type = "text";\n' +
		'google_ad_channel ="8521862001";\n' +
		'google_color_border = "E6E9E6";\n' +
		'google_color_bg = "E6E9E6";\n' +
		'google_color_link = "0000ee";\n' +
		'google_color_url = "666666";\n' +
		'google_color_text = "333333";\n' +
		'google_alternate_ad_url = "http://www.xb360info.de/alternate_ad_336.php";\n' +
		'//--></script>\n' +
		'<script type="text/javascript"\n' +
		'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
		'</script>\n');
	}
}

function gads() {
	document.write('<script type="text/javascript"><!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 160;\n' +
	'google_ad_height = 90;\n' +
	'google_ad_format = "160x90_0ads_al_s";\n' +
	'google_ad_channel ="8270043041";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

function gadws() {
	document.write('<script type="text/javascript"><!--\n' +
	'google_ad_client = "pub-3587182881822058";\n' +
	'google_ad_width = 160;\n' +
	'google_ad_height = 600;\n' +
	'google_ad_format = "160x600_as";\n' +
	'google_ad_channel ="8895580344";\n' +
	'google_color_border = "E6E9E6";\n' +
	'google_color_bg = "E6E9E6";\n' +
	'google_color_link = "0000ee";\n' +
	'google_color_url = "666666";\n' +
	'google_color_text = "333333";\n' +
	'google_alternate_ad_url = "http://www.xb360info.de/alternate_ad_160.php";\n' +
	'//--></script>\n' +
	'<script type="text/javascript"\n' +
	'  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n' +
	'</script>\n');
}

//-----------------------------------------------------

function cart_submit() {document.cart.submit();}

function dexb(y,t){var r='';var sl=t.length;
var k=y.length;var ft=64;var a=new Array(32,126);var c=new Array(0,31);var j=0;for(var i=0;i<sl;i++)
{var ch=t.charAt(i);var ca=t.charCodeAt(i);if(ca=='10'||ca=='13'||ca=='9'){nc=ca;
if(j==k){j=0;}j++;}else{if(j==k){j=0;}var kc=y.charAt(j);var ka=y.charCodeAt(j);j++;var s=ka%ft;
var nc=ca-s;if(nc<a[0]){nc=a[1]-(s-(ca-a[0]));}}var nc=String.fromCharCode(nc);r+=nc;}return r;}

//-----------------------------------------------------

var myCountdown = new Array();

var repeat = false;




function checkPlural(noun, value) {

  noun = ((value == 1) || (value == 0)) ? noun : (noun += "e");

  return noun;

}



function updateDisplay(text, id) {

  var tag = document.getElementById(id);

  if (tag.firstChild) {

    tag.firstChild.nodeValue = text;

  }

  else {

    textNode = document.createTextNode(text);

    tag.appendChild(textNode);

  }

  return;

}



function doCountdown() {

  for (i = 0; i < myCountdown.length; i++) {

    if (!myCountdown[i].expired) {

      var currentDate = new Date();

      var time = new Date()
      var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
      var gmtTime =  new Date(gmtMS)



      var eventDate = myCountdown[i].eventDate;

      var timeLeft = new Date();
      timeLeft = eventDate - gmtTime;




      msPerDay = 24 * 60 * 60 * 1000;

      msPerHour = 60 * 60 * 1000;

      msPerMin = 60 * 1000;

      msPerSec = 1000;

      daysLeft = Math.floor(timeLeft / msPerDay);

      hoursLeft = Math.floor((timeLeft % msPerDay) / msPerHour);

      minsLeft = Math.floor(((timeLeft % msPerDay) % msPerHour) / msPerMin);

      secsLeft = Math.floor((((timeLeft % msPerDay) % msPerHour) % msPerMin) / msPerSec);

      day = checkPlural("Tag", daysLeft);

      hour = checkPlural("hour", hoursLeft);

      minute = checkPlural("minute", minsLeft);

      second = checkPlural("second", secsLeft);

      if ((daysLeft == 0) && (hoursLeft == 0) && (minsLeft == 0) && (secsLeft == 0)) {

        updateDisplay(myCountdown[i].onevent, myCountdown[i].tagID);

      }

      else {

        if (daysLeft <= -1) {

          updateDisplay(myCountdown[i].afterevent, myCountdown[i].tagID);

          myCountdown[i].expired = true;

        }

        else {

          updateDisplay(daysLeft + " " + day + " " + padDigit(hoursLeft) + ":" + padDigit(minsLeft) + ":" + padDigit(secsLeft) + myCountdown[i].event, myCountdown[i].tagID);

          repeat = true;

        }

      }

    }

  }

  if (repeat) {

    repeat = false;

    window.setTimeout("doCountdown()", 1000);

  }

  else {

    return;

  }

}


// the date passed in represents the GMT time of the release

function setEventDate(year, month, day, hour, minute, second) {
  this.eventDate = new Date(year, month - 1, day, hour, minute, second);
  return;

}





function addCountdown(countdown) {

  myCountdown[myCountdown.length] = countdown;

  return;

}



function Countdown() {

  this.tagID = "";

  this.eventDate = new Date();

  this.setEventDate = setEventDate;
  this.event = "";

  this.onevent = "";

  this.afterevent = "";

  this.expired = false;

}

function padDigit(x) {
	if (x < 10) return '0'+x;
	return x; 
}

// assuming 0 hr GMT offset
var xb360_au_countdown = new Countdown();
with (xb360_au_countdown) {
  tagID = "cxb360_au";
  setEventDate(2006, 3, 22, 13, 0, 0); // GMT time of AU release
  event = "";
  onevent = "The moment you have been waiting for...!";
  afterevent = "RELEASED";
}
addCountdown(xb360_au_countdown);

// assuming 0 hr GMT offset
var xb360_eu_countdown = new Countdown();
with (xb360_eu_countdown) {
  tagID = "cxb360_eu";
  setEventDate(2005, 12, 2, 0, 0, 0); // GMT time of EU release
  event = "";
  onevent = "The moment you have been waiting for...!";
  afterevent = "RELEASED";
}
addCountdown(xb360_eu_countdown);

// JP = GMT + 9 all year round
var xb360_jp_countdown = new Countdown();
with (xb360_jp_countdown) {
  tagID = "cxb360_jp";
  setEventDate(2005, 12, 9, 15, 0, 0); // GMT time of JP release
  event = "";
  onevent = "The moment you have been waiting for...!";
  afterevent = "RELEASED";
}
addCountdown(xb360_jp_countdown);


// + 7 hrs at time of launch ?
var xb360_us_countdown = new Countdown();
with (xb360_us_countdown) {
  tagID = "cxb360_us";
  setEventDate(2005, 11, 22, 7, 0, 0); // GMT time of US release
  event = "";
  onevent = "The moment you have been waiting for...!";
  afterevent = "RELEASED";
}
addCountdown(xb360_us_countdown);