// ajax.js

// newFunction
<!-- 
//Browser Support Code
function getOrganizations(  ){ 
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('events');
				document.getElementById('events').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getOrganizations.jsp?sid="+ Math.random() + "&view=1", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function getOrganizationDetail(id  ){ 
	 
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('eventsdetail');
				document.getElementById('eventsdetail').innerHTML = ajaxRequest.responseText;
			  
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getOrganizations.jsp?sid="+ Math.random() + "&view=2&id=" + id , true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function visitSite(url  ){ 
	
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('website');
				document.getElementById('website').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "http://" + url, true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}
function getEventsDetail(id  ){ 
	 
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('eventsdetail');
				document.getElementById('eventsdetail').innerHTML = ajaxRequest.responseText;
			 //document.getElementById('eventsdetail1').innerHTML = ajaxRequest.responseText;
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getEvents.jsp?sid="+ Math.random() + "&view=2&id=" + id , true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function getEvents(  ){ 
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('events');
				document.getElementById('events').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getEvents.jsp?sid="+ Math.random() + "&view=1", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function getManufacturers(){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 var searchterm =  document.go.type.value; 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('manufacturers');
				document.getElementById('manufacturers').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getManufacturerData.jsp?sid="+ Math.random() + "&type=" + searchterm + "&view=1", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function getSuppliers(){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 var searchterm =  document.go.type.value; 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('manufacturers');
				document.getElementById('suppliers').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getManufacturerData.jsp?sid="+ Math.random() + "&type=" + searchterm + "&view=3", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function getManufacturersSearchTerm(){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 var searchterm =  document.searchmanufacturers.searchterm.value; 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('manufacturers');
				document.getElementById('manufacturers').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getManufacturerData.jsp?sid="+ Math.random() + "&type=" + searchterm + "&view=2", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}


function viewMachinesDropdown( customerid, companyid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinesdropdown').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&companyid=" + companyid + "&view=11&thecustomerid=" + customerid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}
// Suppliers Serarch Term
function getSuppliersSearchTerm(){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 var searchterm =  document.searchmanufacturers.searchterm.value; 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('manufacturers');
				document.getElementById('suppliers').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getManufacturerData.jsp?sid="+ Math.random() + "&type=" + searchterm + "&view=4", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}


function viewMachinesDropdown( customerid, companyid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinesdropdown').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&companyid=" + companyid + "&view=11&thecustomerid=" + customerid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}



function getMachinesDropdown( customerid, companyid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinesdropdown').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&companyid=" + companyid + "&view=6&thecustomerid=" + customerid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}



function viewMachineMatrix( customerid, companyid, machineid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinematrix').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&thecompanyid=" + companyid + "&view=10&thecustomerid=" + customerid + "&themachineid=" + machineid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}


function getMachineMatrix( customerid, companyid, machineid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinematrix').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&thecompanyid=" + companyid + "&view=7&thecustomerid=" + customerid + "&themachineid=" + machineid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}


function viewMachineMatrix( customerid, companyid, machineid, rows, cols){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	numrows = 0;
	numcols = 0;
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('machinesdropdown');
				document.getElementById('machinematrix').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function() 
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&thecompanyid=" + companyid + "&view=10&numrows=" + numrows + "&numcols=" + numcols + "&thecustomerid=" + customerid + "&themachineid=" + machineid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

 
function rowcolUpdate( customerid, companyid, machineid, rows, cols){

	var customerid = document.form1.customerid.value; 
	var machineid = document.form1.machineid.value; 
	var numrows = document.form1.numrows.value; 
	var numcols = document.form1.numrows.value; 

	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('companydropdown');
				document.getElementById('viewmachinematrix').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&companyid=" + companyid + "&view=9&numrows=" + numrows + "&numcols=" + numcols + "&thecustomerid=" + customerid + "&themachineid=" + machineid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}
function getContactsDropdown( customerid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	 
	 
	 
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Contact Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('companydropdown');
				document.getElementById('contactsdropdown').innerHTML = ajaxRequest.responseText;
			 
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&view=3&customerid=" + customerid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}
function getContactData( contactid){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
//======================================================================
// Receive Function For Account Name Dropdown
//======================================================================
		ajaxRequest.onreadystatechange = 
		function(){			 
			if(ajaxRequest.readyState == 4){
				var ajaxDisplay = document.getElementById('companydropdown');
				document.getElementById('contactdata').innerHTML = ajaxRequest.responseText;
			 	
			} 
		}		// End of function()
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&view=4&id=" + contactid + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
	
}

function fillNumber( type ){
	var thenull = "";
		if(type == "cell"){
	 
		document.forms.addnew.number.value = thenull; 
		  
		var thehiddencellvalue = document.forms.addnew.hiddencell.value
		document.forms.addnew.number.value = thehiddencellvalue; 
	}
	if(type == "fax"){
		document.forms.addnew.number.value = thenull; 
		 
		var thehiddenfaxvalue = document.forms.addnew.hiddenfax.value
		document.forms.addnew.number.value = thehiddenfaxvalue; 
	}
	if(type == "tel"){
		document.forms.addnew.number.value = thenull; 
		 
		var thehiddentelvalue = document.forms.addnew.hiddentel.value
		document.forms.addnew.number.value = thehiddentelvalue; 
	}
 	 
}
 
function clearName( ){
	document.forms.addnew.to.value = ""; 
}



function getContactName( contactID){
	document.forms.addnew.toid.value = contactID;
	var ajaxRequest;  	
	try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest = new ActiveXObject("Msxml3.XMLHTTP");} catch (e) {try{ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){alert("Your browser broke!");
	return false;}}}ajaxRequest.onreadystatechange = function(){if(ajaxRequest.readyState == 4){
				// do the dispaly processing here
				document.forms.addnew.to.value = ajaxRequest.responseText;
				// End the display processing
	}}
	ajaxRequest.open("POST", "getContactData.jsp?sid="+ Math.random() + "&view=5&contactID=" + contactID + "", true);
	ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	ajaxRequest.send(null); 
}
// Tab View Item
function sack(file){
	this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";
	this.requestFile = file;
	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = true;
	this.execute = false;

	this.onLoading = function() { };
	this.onLoaded = function() { };
	this.onInteractive = function() { };
	this.onCompletion = function() { };

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err) {
				this.xmlhttp = null;
			}
		}
		if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
			this.xmlhttp = new XMLHttpRequest();
		if (!this.xmlhttp){
			this.failed = true; 
		}
	};
	
	this.setVar = function(name, value){
		if (this.URLString.length < 3){
			this.URLString = name + "=" + value;
		} else {
			this.URLString += "&" + name + "=" + value;
		}
	}
	
	this.encVar = function(name, value){
		var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	return varString;
	}
	
	this.encodeURLString = function(string){
		varArray = string.split('&');
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split('=');
			if (urlVars[0].indexOf('amp;') != -1){
				urlVars[0] = urlVars[0].substring(4);
			}
			varArray[i] = this.encVar(urlVars[0],urlVars[1]);
		}
	return varArray.join('&');
	}
	
	this.runResponse = function(){
		eval(this.response);
	}
	
	this.runAJAX = function(urlstring){
		this.responseStatus = new Array(2);
		if(this.failed && this.AjaxFailedAlert){ 
			alert(this.AjaxFailedAlert); 
		} else {
			if (urlstring){ 
				if (this.URLString.length){
					this.URLString = this.URLString + "&" + urlstring; 
				} else {
					this.URLString = urlstring; 
				}
			}
			if (this.encodeURIString){
				var timeval = new Date().getTime(); 
				this.URLString = this.encodeURLString(this.URLString);
				this.setVar("rndval", timeval);
			}
			if (this.element) { this.elementObj = document.getElementById(this.element); }
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					var totalurlstring = this.requestFile + "?" + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
				}
				if (this.method == "POST"){
  					try {
						this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')  
					} catch (e) {}
				}

				this.xmlhttp.send(this.URLString);
				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState){
						case 1:
							self.onLoading();
						break;
						case 2:
							self.onLoaded();
						break;
						case 3:
							self.onInteractive();
						break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;
							self.onCompletion();
							if(self.execute){ self.runResponse(); }
							if (self.elementObj) {
								var elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							self.URLString = "";
						break;
					}
				};
			}
		}
	};
this.createAJAX();
}

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

// tablewidget for sorting
var tableWidget_tableCounter = 0;
	var tableWidget_arraySort = new Array();
	var tableWidget_okToSort = true;
	var activeColumn = new Array();
	var arrowImagePath = "images/";	// Path to arrow images
	
	function addEndCol(obj)
	{
		if(document.all)return;
		var rows = obj.getElementsByTagName('TR');
		for(var no=0;no<rows.length;no++){
			var cell = rows[no].insertCell(-1);
			cell.innerHTML = ' ';
			cell.style.width = '13px';
			cell.width = '13';

		}	
		
	}
	
	function highlightTableHeader()
	{
		this.className='tableWigdet_headerCellOver';
		if(document.all){	// I.E fix for "jumping" headings
			var divObj = this.parentNode.parentNode.parentNode.parentNode;
			this.parentNode.style.top = divObj.scrollTop + 'px';

		}
			
	}
	
	function deHighlightTableHeader()
	{
		this.className='tableWidget_headerCell';		
	}
	
	function mousedownTableHeader()
	{
		this.className='tableWigdet_headerCellDown';
		if(document.all){	// I.E fix for "jumping" headings
			var divObj = this.parentNode.parentNode.parentNode.parentNode;
			this.parentNode.style.top = divObj.scrollTop + 'px';
		}		
	}
	
	function sortNumeric(a,b){
		
		a = a.replace(/,/,'.');
		b = b.replace(/,/,'.');
		a = a.replace(/[^\d\.\/]/g,'');
		b = b.replace(/[^\d\.\/]/g,'');
		if(a.indexOf('/')>=0)a = eval(a);
		if(b.indexOf('/')>=0)b = eval(b);
		return a/1 - b/1;
	}
	

	function sortString(a, b) {

	  if ( a.toUpperCase() < b.toUpperCase() ) return -1;
	  if ( a.toUpperCase() > b.toUpperCase() ) return 1;
	  return 0;
	}	
	function cancelTableWidgetEvent()
	{
		return false;
	}
	
	function sortTable()
	{
		if(!tableWidget_okToSort)return;
		tableWidget_okToSort = false;
		/* Getting index of current column */
		var obj = this;
		var indexThis = 0;
		while(obj.previousSibling){
			obj = obj.previousSibling;
			if(obj.tagName=='TD')indexThis++;		
		}
		var images = this.getElementsByTagName('IMG');
		
		if(this.getAttribute('direction') || this.direction){
			direction = this.getAttribute('direction');
			if(navigator.userAgent.indexOf('Opera')>=0)direction = this.direction;
			if(direction=='ascending'){
				direction = 'descending';
				this.setAttribute('direction','descending');
				this.direction = 'descending';	
			}else{
				direction = 'ascending';
				this.setAttribute('direction','ascending');		
				this.direction = 'ascending';		
			}
		}else{
			direction = 'ascending';
			this.setAttribute('direction','ascending');
			this.direction = 'ascending';
		}
		
		
		
		if(direction=='descending'){
			images[0].style.display='inline';
			images[0].style.visibility='visible';
			images[1].style.display='none';
		}else{
			images[1].style.display='inline';
			images[1].style.visibility='visible';
			images[0].style.display='none';		
		}

		
		var tableObj = this.parentNode.parentNode.parentNode;
		var tBody = tableObj.getElementsByTagName('TBODY')[0];
		
		var widgetIndex = tableObj.id.replace(/[^\d]/g,'');
		var sortMethod = tableWidget_arraySort[widgetIndex][indexThis]; // N = numeric, S = String
		if(activeColumn[widgetIndex] && activeColumn[widgetIndex]!=this){
			var images = activeColumn[widgetIndex].getElementsByTagName('IMG');
			images[0].style.display='none';
			images[1].style.display='inline';
			images[1].style.visibility = 'hidden';
			if(activeColumn[widgetIndex])activeColumn[widgetIndex].removeAttribute('direction');			
		}

		activeColumn[widgetIndex] = this;
		
		var cellArray = new Array();
		var cellObjArray = new Array();
		for(var no=1;no<tableObj.rows.length;no++){
			var content= tableObj.rows[no].cells[indexThis].innerHTML+'';
			cellArray.push(content);
			cellObjArray.push(tableObj.rows[no].cells[indexThis]);
		}
		
		if(sortMethod=='N'){
		
			
			cellArray = cellArray.sort(sortNumeric);
		}else{
			
			cellArray = cellArray.sort(sortString);
		}
		
		if(direction=='descending'){
			for(var no=cellArray.length;no>=0;no--){
				for(var no2=0;no2<cellObjArray.length;no2++){
					if(cellObjArray[no2].innerHTML == cellArray[no] && !cellObjArray[no2].getAttribute('allreadySorted')){
						cellObjArray[no2].setAttribute('allreadySorted','1');	
						tBody.appendChild(cellObjArray[no2].parentNode);				
					}				
				}			
			}
		}else{
			for(var no=0;no<cellArray.length;no++){
				for(var no2=0;no2<cellObjArray.length;no2++){
					if(cellObjArray[no2].innerHTML == cellArray[no] && !cellObjArray[no2].getAttribute('allreadySorted')){
						cellObjArray[no2].setAttribute('allreadySorted','1');	
						tBody.appendChild(cellObjArray[no2].parentNode);				
					}				
				}			
			}				
		}
		
		for(var no2=0;no2<cellObjArray.length;no2++){
			cellObjArray[no2].removeAttribute('allreadySorted');		
		}

		tableWidget_okToSort = true;
		
		
	}
	
	function initTableWidget(objId,width,height,sortArray)
	{
		width = width + '';
		height = height + '';
		var obj = document.getElementById(objId);
		obj.parentNode.className='widget_tableDiv';
		if(navigator.userAgent.indexOf('MSIE')>=0){
			obj.parentNode.style.overflowY = 'auto';
		}		
		tableWidget_arraySort[tableWidget_tableCounter] = sortArray;
		if(width.indexOf('%')>=0){
			obj.style.width = width;
			obj.parentNode.style.width = width;
		}else{
			obj.style.width = width + 'px';
			obj.parentNode.style.width = width + 'px';
		}
		
		if(height.indexOf('%')>=0){
			//obj.style.height = height;		
			obj.parentNode.style.height = height;			
			
		}else{
			//obj.style.height = height + 'px';		
			obj.parentNode.style.height = height + 'px';
		}
		obj.id = 'tableWidget' + tableWidget_tableCounter;
		addEndCol(obj);
		
		obj.cellSpacing = 0;
		obj.cellPadding = 0;
		obj.className='tableWidget';
		var tHead = obj.getElementsByTagName('THEAD')[0];
		var cells = tHead.getElementsByTagName('TD');
		for(var no=0;no<cells.length;no++){
			cells[no].className = 'tableWidget_headerCell';
			cells[no].onselectstart = cancelTableWidgetEvent;
			if(no==cells.length-1){
				cells[no].style.borderRight = '0px';	
			}
			if(sortArray[no]){
				cells[no].onmouseover = highlightTableHeader;
				cells[no].onmouseout =  deHighlightTableHeader;
				cells[no].onmousedown = mousedownTableHeader;		
				cells[no].onmouseup = highlightTableHeader;		
				cells[no].onclick = sortTable;	
				
				var img = document.createElement('IMG');
				img.src = arrowImagePath + 'arrow_up.gif';
				cells[no].appendChild(img);	
				img.style.visibility = 'hidden';
				
				var img = document.createElement('IMG');
				img.src = arrowImagePath + 'arrow_down.gif';
				cells[no].appendChild(img);	
				img.style.display = 'none';
				
				
			}else{
				cells[no].style.cursor = 'default';	
			}
			
			
		}		
		var tBody = obj.getElementsByTagName('TBODY')[0];
		if(document.all && navigator.userAgent.indexOf('Opera')<0){
			tBody.className='scrollingContent';
			tBody.style.display='block';			
		}else{
			tBody.className='scrollingContent';
			tBody.style.height = (obj.parentNode.clientHeight-tHead.offsetHeight) + 'px';
			if(navigator.userAgent.indexOf('Opera')>=0){
				obj.parentNode.style.overflow = 'auto';
			}
		}
		
		for(var no=1;no<obj.rows.length;no++){
			obj.rows[no].onmouseover = highlightDataRow;
			obj.rows[no].onmouseout = deHighlightDataRow;
			for(var no2=0;no2<sortArray.length;no2++){	/* Right align numeric cells */
				if(sortArray[no2] && sortArray[no2]=='N')obj.rows[no].cells[no2].style.textAlign='right';
			}
		}
		for(var no2=0;no2<sortArray.length;no2++){	/* Right align numeric cells */
			if(sortArray[no2] && sortArray[no2]=='N')obj.rows[0].cells[no2].style.textAlign='right';
		}		
		
		tableWidget_tableCounter++;
	}
	
	
	function highlightDataRow()
	{
		if(navigator.userAgent.indexOf('Opera')>=0)return;
		this.className='tableWidget_dataRollOver';
		if(document.all){	// I.E fix for "jumping" headings
			var divObj = this.parentNode.parentNode.parentNode;
			var tHead = divObj.getElementsByTagName('TR')[0];
			tHead.style.top = divObj.scrollTop + 'px';
			
		}	
	}
	
	function deHighlightDataRow()
	{
		if(navigator.userAgent.indexOf('Opera')>=0)return;
		this.className=null;
		if(document.all){	// I.E fix for "jumping" headings
			var divObj = this.parentNode.parentNode.parentNode;
			var tHead = divObj.getElementsByTagName('TR')[0];
			tHead.style.top = divObj.scrollTop + 'px';
		}			
	}
	

