// by Paul@YellowPencil.com and Scott@YellowPencil.com
// feel free to delete all comments except for the above credit

function showImagePopup(id) {

	var qs = "?id="+id;
	window.open("imagepopup.asp"+qs, "popup", "toolbar=no, menubar=no, scrollbars=yes, height=100, width=600, left=300, top=300, resizable=yes");

	return true;
}

function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function numberFormat(o) {
    var sValue = o.value;
    var sKey = String.fromCharCode(window.event.keyCode);
    if (document.selection.createRange().text == sValue) {
        sValue = sKey;
    } else {
        sValue = sValue + sKey;
    }
    var re = new RegExp("^\\d+$");
    if (!sValue.match(re))
        window.event.returnValue = false;
}

function getVal()
{
 return "JunHsbnnfhByalsdfjLpAXSmioIJopijOjOIJSUyiuyNPqq809"
}
		
function checkRequiredFields(){
	if (document.theForm.NAME.value==''){
		alert('Please provide your name.');
		document.theForm.NAME.focus();
		return false;
	}
	if (document.theForm.EMAIL.value==''
			&& document.theForm.PHONE.value==''){
		alert('Please provide either you email addres or phone number.');
		document.theForm.EMAIL.focus();
		return false;
	}
	if (document.theForm.PHONE.value!='' && document.theForm.PHONE.value.length<6){
		alert('Not enough numbers provided in your phone number.');
		document.theForm.PHONE.focus();
		return false;
	}
	if (document.theForm.ADDRESS_LINE_1.value + document.theForm.ADDRESS_LINE_2.value == ''){
		alert('Please provide your address.');
		document.theForm.ADDRESS_LINE_1.focus();
		return false;
	}
	if (document.theForm.POSTCODE.value==''){
		alert('Please provide your postcode.');
		document.theForm.POSTCODE.focus();
		return false;
	}
}
