
//////////////////////////////////////////////////////////

function Validate(){
	validated=false;
	if (window.document.form1.name.value == ''){
		alert('Your name has not been entered\nPlease enter your name.');
		return false;}
	if (window.document.form1.email.value == ''){
		alert('Your email address has not been entered\nPlease enter your email address');
		return false;}

	if (window.document.form1.email.value.indexOf('@') == -1){
		alert('A valid email address has not been entered\nPlease enter a valid email address');
		return false;}

	if (window.document.form1.email.value.indexOf('.') == -1){
		alert('A valid email address has not been entered\nPlease enter a valid email address');
		return false;}

	if (validated){return true};

}

function ValidateMerchandise(){
	validated=false;
	if (window.document.form1.name.value == ''){
		alert('Your name has not been entered\nPlease enter your name.');
		return false;}
	if (window.document.form1.address.value == ''){
		alert('Your address has not been entered\nPlease enter your address');
		return false;}
	if (window.document.form1.postcode.value == ''){
		alert('Your postcode has not been entered\nPlease enter your postcode');
		return false;}
	if (window.document.form1.email.value == ''){
		alert('Your email address has not been entered\nPlease enter your email address');
		return false;}

	if (window.document.form1.email.value.indexOf('@') == -1){
		alert('A valid email address has not been entered\nPlease enter a valid email address');
		return false;}

	if (window.document.form1.email.value.indexOf('.') == -1){
		alert('A valid email address has not been entered\nPlease enter a valid email address');
		return false;}

	if (validated){return true};

}



function SubmitForm(){
if (Validate()){
	Sending('register','Registering...')
	document.form1.submit();
	}
}
function Sending(Field,Mess){
	// for IE 4.0+
	if (document.all){
		eval("document.all."+Field+".setAttribute('disabled', true);");
		eval("document.all."+Field+".value='"+Mess+"'");
		eval("document.all."+Field+".style.borderColor='#CCCCCC';");
	}
}



// Pig-O-Meter

// UTC of fixed date
var UTCFROM = Date.UTC(2007,09,1,1,1,1);
// UTC of NOW
var now = new Date();
var month = now.getMonth()*1+1;
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var date = now.getDate();
var year = now.getFullYear();
var UTCNOW = Date.UTC(year,month,date,hours,minutes,seconds);
Counter = (UTCNOW-UTCFROM)/1000*6

function Comma(number) {
    number = '' + number
    if (number.length > 3) {
        var mod = number.length%3;
        var output = (mod > 0 ? (number.substring(0,mod)) : '');
        for (i=0 ; i < Math.floor(number.length/3) ; i++) {
            if ((mod ==0) && (i ==0))
                output+= number.substring(mod+3*i,mod+3*i+3);
            else
                output+= ',' + number.substring(mod+3*i,mod+3*i+3);
        }
        return (output);
    }
    else return number;
}
function FormatCounter(number){
	// Add commas
	FormatNumber = Comma(number)
	// Add padding for lower figure
	if (number < 99999999){
		FormatNumber = " "+FormatNumber	
	}
	return (FormatNumber);
}

function displaytime(){
	Counter=Counter*1+6;
	document.getElementById("servertime").innerHTML="£"+FormatCounter(Counter);
}

window.onload=function(){
	//setInterval("displaytime()", 1000)
}

