//functions.js
//Create a boolean variable to check for a valid IE instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using IE.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}

function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('register_content').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var name = encodeURI(document.getElementById('name').value);
var category = encodeURI(document.getElementById('category').value);
var price = encodeURI(document.getElementById('price').value);
var location = encodeURI(document.getElementById('location').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'send_request.php?name=' + name +'&category=' + category +'&price=' + price +'&location=' + location);
http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('register_content').innerHTML = 'Confirm Your Details:'+response;
send_login(); return false;
}
}
function insert2() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('register_content').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var name = encodeURI(document.getElementById('name').value);
var email = encodeURI(document.getElementById('email').value);
var phone = encodeURI(document.getElementById('phone').value);
var handle = encodeURI(document.getElementById('handle').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'make_request.php?name=' + name +'&phone=' + phone +'&email=' + email +'&handle=' + handle);
http.onreadystatechange = insertReply2;
http.send(null);
}
function insertReply2() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('register_content').innerHTML = 'Confirm Your Details:'+response;
make_request(); return false;
}
}

var nocache = 0;
function pay() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('pay_content').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var coy = encodeURI(document.getElementById('coy').value);
var policyno = encodeURI(document.getElementById('policyno').value);
var debitnoteno = encodeURI(document.getElementById('debitnoteno').value);
var amt = encodeURI(document.getElementById('amt').value);
// Set the random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'pay.php?coy=' + coy +'&policyno=' + policyno +'&debitnoteno=' + debitnoteno +'&amt=' + amt +'&nocache = '+ nocache);
http.onreadystatechange = payReply;
http.send(null);
}
function payReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('pay_content').innerHTML = 'Confirm Your Details:'+response;
}
}

var http = createObject();

// show a preloader while content loads
		function success_handler1(o) {
			replace_html1('taskbox', o.responseText);
		}
 
		function failure_handler1(o) {
			replace_html1('taskbox', 'Slight error. Please try again later.');
		}
 
		function replace_html1(id, taskbox) {
			document.getElementById(id).innerHTML = taskbox;
		}
 
		function show_progressbar1(id) {
			replace_html1(id, '<img src="img/ajax-loader1.gif" border="0" alt="Loading, please wait..." />');
		}
 
		function send_client1(page) {
			show_progressbar1('taskbox');
			var callback1 = { success:success_handler1,	failure:failure_handler1, timeout: 10000 };
			YAHOO.util.Connect.asyncRequest('GET', 'clients.php?page=' + page, callback1);
		}
 
		var progress_bar1 = new Image();
		progress_bar.src1 = 'img/ajax-loader1.gif';
