// JavaScript Document

 


function validate(form) {
var mes = "";

	//If none of the product fields have been filled in, throw an error
	if (document.mailOrder.first_name.value == "") {
	mes = mes+"\nA billing first name is required";	
	}
	if (document.mailOrder.name.value == "") {
	mes = mes+"\nA billing last name is required";	
	}
	if (document.mailOrder.addr1.value == "" ) {
	mes = mes+"\nA full billing address is required";	
	}
	if (document.mailOrder.town.value == "") {
	mes = mes+"\nA billing county is required";	
	}	 
	if (document.mailOrder.postcode.value == "") {
	mes = mes+"\nA billing postcode is required";	
	}	
	if (document.mailOrder.county.value == "") {
	mes = mes+"\nA billing county is required";	
	}	 
	  
	if (document.mailOrder.email.value == "") {
	mes = mes+"\nAn email address is required";	
	}	 
	
	if (document.mailOrder.email.value != document.mailOrder.email_confirm.value) {
	mes = mes+"\nPlease confirm your email address";	
	}	 
	if (document.mailOrder.password.value == "") {
	mes = mes+"\nA password is required";	
	}	 
	
	if (document.mailOrder.password.value != document.mailOrder.password_confirm.value) {
	mes = mes+"\nPlease confirm your password";	
	}	
 
  if (!document.mailOrder.del.checked) {
	if (document.mailOrder.name_d.value == "") {
	mes = mes+"\nA delivery name is required";	
	}
	if (document.mailOrder.addr1_d.value == "" || document.mailOrder.addr1.value == "") {
	mes = mes+"\nA full delivery address is required";	
	}
	if (document.mailOrder.town_d.value == "") {
	mes = mes+"\nA delivery town is required";	
	}	 
	if (document.mailOrder.county_d.value == "") {
	mes = mes+"\nA delivery county is required";	
	}
	if (document.mailOrder.postcode_d.value == "") {
	mes = mes+"\nA delivery postcode is required";	
	}	
	
	
	if (!document.mailOrder.terms.checked) {
	mes = mes+"\nPlease tick the Terms and Conditions box";	
	}	
	
	} 
	if (mes) {
	 
		alert(mes+"\n\nPlease complete before continuing.");
		return false;
		
	}  else {
		return true;
	}
}
 
 function ChangeState(obj)
		{
			document.getElementById('addr1_d').disabled = obj.checked;
			document.getElementById('addr2_d').disabled = obj.checked;
			document.getElementById('town_d').disabled = obj.checked;
			document.getElementById('county_d').disabled = obj.checked;
			document.getElementById('postcode_d').disabled = obj.checked;
			document.getElementById('name_d').disabled = obj.checked;
		}

 
 function ChangeState2(obj)
		{
			document.getElementById('send_date').disabled = obj.checked; 
		}
 
function validate2(form) {
var mes = ""; 
	 
	if (mes) {
	 
		alert(mes+"\n\nPlease complete before continuing.");
		return false;
		
	}  else {
		return true;
	}
}
 
 function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(artist,"Artist must be filled out!")==false)
  {artist.focus();return false;}
  if (validate_required(single,"Single must be filled out!")==false)
  {single.focus();return false;}
  if (validate_required(message,"Your Message must be filled out!")==false)
  {message.focus();return false;}
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function showhide(layer_ref){
 

var state = 'none';
 
 

if(document.all){ //IS IE 4 or 5 (or 6 beta)
eval("document.all." +layer_ref+ ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
} 

function thankyou()
{
var agree=confirm("Thank you - Caption Saved.");
if (agree)
	return true ;
else
	return false ;
}	

function confirmLogout()
{
var agree=confirm("Your changes have not been saved. Click 'Cancel' to remain logged in or 'OK' to logout.");
if (agree)
	return true ;
else
	return false ;
}



function confirmStartAgain()
{
var agree=confirm("Are you sure you wish to start again? If you do, all captions, messages and photos will be removed.");
if (agree)
	return true ;
else
	return false ;
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=650,height=600');");
}


function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600');");
}



 


