My code gives me an error only the first time when i press the checkbox. If i press it for the second time or just to uncheck the checkbox and it gives me the right answer.
Can you please help me, i tried almost everything. I use IE7, xampp with appache server and Windows7.

Message: 'null' is null or not an object
Line: 76
Char: 3
Code: 0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

<script language="javascript" type="text/javascript">

document.write("PDB1: <input type='text' name='workbenchPDB1' id='workbenchPDB1' size='4' maxlength='4'/>");
document.write("PDB2: <input type='text' name='workbenchPDB2'  id='workbenchPDB2' size='4' maxlength='4'  />");
document.write("<input type='checkbox' id='option4'  value='pw_fatcat' onclick='pairwise();'>jFatCat_rigid<br>");
document.write("Try with this proteins :  3gys,2x4n,1crn,3gus,  1Q94   ,   1QEW  ,   1QLF 1QQD,1QR1,1QRN")

function pairwise() {
//i put as trusted sites and  Miscellaneous > Access Data across domains > Enable.

	var action='pw_fatcat';
	var pdbfile=encodeURIComponent(document.getElementById("workbenchPDB1").value);
	var pdbfile1=encodeURIComponent(document.getElementById("workbenchPDB2").value);
	var pdbfile2='a'
	var pdbfile3='a';	
	var ajaxRequest;  // The variable that makes Ajax possible!
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
			var xmlDoc = ajaxRequest.responseXML;
				var x=xmlDoc.getElementsByTagName("AFPChain")[0]; 
  var length_pdb1=x.getAttribute("ca1Length"); 
  var length_pdb2=x.getAttribute("ca2Length"); 
         //   alert("Error: returned status code " + ajaxRequest.status);