function getOption(url,type){
	document.frmAjax.type.value=type;
	xmlhttpPost(url,type);
}
function xmlhttpPost(strURL,type,size_id) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText,type);
        }
    }
    self.xmlHttpReq.send(getquerystring(type,size_id));
}

function getquerystring(type,size_id) {
	if(type == 'show_dorder') {
		var type = type;
		var size_id  = size_id;
		qstr = 'type=' + escape(type) +'&size_id='+ escape(size_id);  
	}
	if(type == 'show_pages') {
		var type = type;
		qstr = 'type=' + escape(type);  
	}
	if(type == 'addForm') {
		var type = type;
		qstr = 'type=' + escape(type);  
	}
	if(type == 'checkuser') {
		var type = type;
		var user_name = document.frmadd.user_name.value;
		qstr = 'type=' + escape(type)+'&user_name='+escape(user_name);  
	}
	//alert(qstr);
	return qstr;
}

function updatepage(str,type){
	if(type == 'show_dorder') {
		 document.getElementById("display_order").innerHTML = str;
	}
	if(type == 'show_pages') {
		 document.getElementById("show_pages").innerHTML = str;
	}
	if(type == 'addForm') {
		 document.getElementById("display_form").innerHTML = str;
	}
	if(type == 'checkuser') {
		if(str ==1){	
		 	document.getElementById("displayMsg").innerHTML = "<font color=red>The Username you have given already exists.</font>";
			document.frmadd.user_name.value="";
			document.frmadd.user_name.focus();
		}
		else document.getElementById("displayMsg").innerHTML = "";
	}
}

