function swapImg(image,st){
	eval('document.' + image + '.src = "images/n_' + image + st + '.gif"');
	}
	
function lbImg(image,st,thefile){
	if (thefile == 1) usefile = "addlightbox";
	if (thefile == 2) usefile = "remlightbox";
	if (thefile == 3) usefile = "enlarge";
	if (thefile == 4) usefile = "savelightbox";
	if (thefile == 5) usefile = "fullsize";
	if (thefile == 6) usefile = "email";
	if (thefile == 7) usefile = "closeme";
	eval('document.' + image + '.src = "images/n_' + usefile + st + '.gif"');
	}
		
function validateContact(){
	valid = 1;
	missed = new Array();
	if (document.contactform.Name.value == ""){
		valid = 0;
		missed[missed.length] = "Name";
		}
	if (document.contactform.Enquiry.value == ""){
		valid = 0;
		missed[missed.length] = "Enquiry";
		}
	if (document.contactform.email.value == "" && document.contactform.Phone.value == ""){
		valid = 0;
		missed[missed.length] = "Phone Number OR Email Address";
		}
	if (valid){
	document.contactform.realname.value = document.contactform.Name.value;
	document.contactform.submit();
	}
	else {
		errormsg = "Please make sure you have filled in the following fields:\n\n";
		for (i=0;i<missed.length;i++){
			errormsg += missed[i] + "\n";
			}
		alert(errormsg);
		}
	}
	
function validateStock(){
	valid = 1;
	missed = new Array();
	if (document.contactform.elements['Image ID or Lightbox ID'].value == ""){
		valid = 0;
		missed[missed.length] = "Image ID or Lightbox ID";
		}
	if (document.contactform.elements['Name'].value == ""){
		valid = 0;
		missed[missed.length] = "Your Name";
		}
	if (document.contactform.elements['email'].value == ""){
		valid = 0;
		missed[missed.length] = "Your Email Address";
		}
	if (document.contactform.elements['Phone'].value == ""){
		valid = 0;
		missed[missed.length] = "Your Phone Number";
		}
		
	if (valid){
		document.contactform.realname.value = document.contactform.Name.value;
		
		var lbuid = document.contactform.elements['Image ID or Lightbox ID'].value;
		var re = new RegExp ('ka', 'gi') ;
		var lbuid = lbuid.replace(re,'');
		
		var lbname = document.contactform.elements['Lightbox Name'].value;
		
		if (lbuid != '' && lbname != ''){
			document.contactform.elements['Direct Link to Lightbox'].value = "http://www.kevinallenphotography.co.uk/lightbox.php?lb_uid=" + lbuid + "&lb_name=" + lbname;
			}
			//alert (document.contactform.elements['Direct Link to Lightbox'].value);
		document.contactform.submit();
		}
	else {
		errormsg = "Please make sure you have filled in the following fields:\n\n";
		for (i=0;i<missed.length;i++){
			errormsg += missed[i] + "\n";
			}
		alert(errormsg);
		}
	}
	
function showImg(image){
	eval('window.open("showimage.php?id=' + image + '","","width=500,height=460,resizable=1,scrollbars=1,status=1")');
	}