// ##########################
// JavaScript Document
// Created by 101 Web Technology
// http://www.101webtech.com
// ##########################

// ###################################################################
// Global Variables, to be accessed by all the functions..
   var mydate = new Date();
   var newline = '\n';
//
//####################################################################
//
// The below function is used to write the current date on to each page.
//
//####################################################################
	function date() {
		var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
		//document.write('today is ')
		document.write(mydate.getDate() + " ")
		document.write(monthname[mydate.getMonth()] + " ")
		document.write(mydate.getFullYear())
		
	}

//####################################################################
//
// The below function is used to set a random enquiry number on the contact page
// 
//####################################################################

	function randomNumber() {
	var sYear = mydate.getFullYear() + '';
	var sMonth = mydate.getMonth() + 1 + '';
	var sDay = mydate.getDate() + '';
	var myRandom = Math.round(Math.random()*100);
	var inqNumber = sYear + sMonth + sDay + myRandom;
	var theDate = sDay + '/' + sMonth + '/' + sYear;
	
	document.enquiry.Enquiry_Number.value = inqNumber;
	
	document.enquiry.Enquiry_Date.value = theDate;
	}


function popUp(theURL, name, w, h, t, l) {
	var windowName = name;
	var features = "status=yes,scrollbars=yes,resizable=yes,width="+w+",height="+h+",top="+t+",left="+l+"";
	var newWindow = window.open("", windowName, features);
	newWindow.focus();
	newWindow.location = theURL;
	
}


function buildEmail(user, form) {
	var at = "@";
	var domain = "fantasticgames.com";
	
	Email = user + at + domain;
	
	if (form == "n") {
		document.write('<a href=mailto:' + Email + '>' + Email + '</a>');
	} 
	
	if (form == "y") {
		getvalue=eval('document.'+formName+'.'+fieldName+'');
		getvalue.value = Email;
	}
		
}

var mydate = new Date(); 
 function calcOrder() { 
  var strYear = mydate.getFullYear() + '';
  var strMonth = mydate.getMonth() + 1 + '';
  var strDay = mydate.getDate() + '';
  var myRandom = Math.round(Math.random()*100);
  var strCustomerRef = strYear + strMonth + strDay + myRandom;
  var iPrice = 49.90;
  var iPostage = 10;
  var strQuantity = document.gameOrder.quantity.value;  

 // Calculate the total amount
  iTotal = iPrice * strQuantity + iPostage; 
  // round number to second decimal point
  document.gameOrder.amt.value = Math.round(iTotal*100)/100;
  document.gameOrder.mtid.value = strCustomerRef;
	
 }
 



		


