if(!top.content){
	//has to be in a frameset
	top.location = "enter.php?main="+this.location.href;
}

NS4 = (document.layers) ? true : false;

function checkEnter(event) { 	
	var code = 0;
	
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
    if(code==13){
	    getID();
		return false;
    }
}

function getID(){
	var PID = document.getElementById('pid');
		PID.value=PID.value.toLowerCase();
  		if(PID.value==""){
      		alert("You need to enter a reference number");
			return false;
   		}else if(PID.value.length!=7||PID.value.indexOf("com")==-1){
   			if(PID.value.substring(0,4)=="com "){
				//try and fix it, recursive function
				PID.value = PID.value.substring(0,3)+PID.value.substring(4);
				getID();
			}else{
				alert("Reference number incorrect.\n\nAll reference numbers start with \"com\"\nand are followed by a four figure number");
			}
			return false;
   		}
		document.location="details.php?PID="+PID.value;
	//}
	
	//alert("details.php?PID="+PID.value);
}
