function paging_search_xmlhttpPost(strURL,elementID,from,car,string) {
	sort_name = document.getElementById('prev_sort').value;
	sort_type = document.getElementById('prev_sort_type').value;

	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');
	
	document.getElementById('loading').innerHTML = "processing<br/><img style=\"margin-left:10px;\" src=\"images/loading.gif\">";	
	
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				document.getElementById('loading').innerHTML = "";
			}
		}
		self.xmlHttpReq.send('input= '+from+"|"+car+"|"+string+"|"+sort_name+"|"+sort_type);
		
}

function Next_Search(max,string){
	for(pn=max-9;pn<=max;pn++){
		if(document.getElementById("page"+pn).className == "current_page"){
			currentPage = pn;
		}
		document.getElementById("page"+pn).className = "not_current_page";
	}
	new_page = parseInt(currentPage) + 1;

	part = new_page;
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	prev_next_search_xmlhttpPost("ajax/prev_next_search.php","page_num_span",max,new_page,"next",lower_limit,car,string);
}

function Previous_Search(min,string){	

	for(pn=min;pn<=parseInt(min)+9;pn++){
		if(document.getElementById("page"+pn).className == "current_page"){
			currentPage = pn;
		}
	document.getElementById("page"+pn).className = "not_current_page";
	}
	new_page = currentPage - 1;

	part = new_page;
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	prev_next_search_xmlhttpPost("ajax/prev_next_search.php","page_num_span",min,new_page,"prev",lower_limit,car,string);
}

function prev_next_search_xmlhttpPost(strURL,elementID,flag,new_page,Type,from,car,string) {
	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) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				paging_info_search_xmlhttpPost("ajax/paging_info_search.php","page_span",from,car,string);
			}
		}
		self.xmlHttpReq.send('input= '+flag+"|"+Type+"|"+new_page+"|"+string);
		
}


function display_search_page(string,part,min,max){
	for(pn=parseInt(min);pn<=parseInt(max);pn++){
		document.getElementById("page"+pn).className ="not_current_page";
	}	
	document.getElementById("page"+part).className = "current_page";
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	paging_info_search_xmlhttpPost("ajax/paging_info_search.php","page_span",lower_limit,car,string);
}

function paging_info_search_xmlhttpPost(strURL,elementID,from,car,string) {
	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) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				paging_search_xmlhttpPost("ajax/paging_search.php","rank",from,car,string);
			}
		}
		self.xmlHttpReq.send('input= '+from+"|"+car+"|"+string);
		
}

function Next(max){
	for(pn=max-9;pn<=max;pn++){
		if(document.getElementById("page"+pn).className == "current_page"){
			currentPage = pn;
		}
		document.getElementById("page"+pn).className = "not_current_page";
	}
	new_page = parseInt(currentPage) + 1;

	part = new_page;
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	prev_next_xmlhttpPost("ajax/prev_next.php","page_num_span",max,new_page,"next",lower_limit,car);
}

function Previous(min){	

	for(pn=min;pn<=parseInt(min)+9;pn++){
		if(document.getElementById("page"+pn).className == "current_page"){
			currentPage = pn;
		}
	document.getElementById("page"+pn).className = "not_current_page";
	}
	new_page = currentPage - 1;

	part = new_page;
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	prev_next_xmlhttpPost("ajax/prev_next.php","page_num_span",min,new_page,"prev",lower_limit,car);
}

function display_page(part,min,max){
	for(pn=parseInt(min);pn<=parseInt(max);pn++){
		document.getElementById("page"+pn).className ="not_current_page";
	}	
	document.getElementById("page"+part).className = "current_page";
	upper_limit = (part*50) - 1;
	lower_limit = upper_limit - 49;
	car = 50;
	paging_info_xmlhttpPost("ajax/paging_info.php","page_span",lower_limit,car);
}

function prev_next_xmlhttpPost(strURL,elementID,flag,new_page,Type,from,car) {
	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) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				paging_info_xmlhttpPost("ajax/paging_info.php","page_span",from,car);
			}
		}
		self.xmlHttpReq.send('input= '+flag+"|"+Type+"|"+new_page);
		
}

function paging_xmlhttpPost(strURL,elementID,from,car) {
	sort_name = document.getElementById('prev_sort').value;
	sort_type = document.getElementById('prev_sort_type').value;

	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');
	
	document.getElementById('loading').innerHTML = "processing<br/><img style=\"margin-left:10px;\" src=\"images/loading.gif\">";	
	
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				document.getElementById('loading').innerHTML = "";
			}
		}
		self.xmlHttpReq.send('input= '+from+"|"+car+"|"+sort_name+"|"+sort_type);
		
}

function paging_info_xmlhttpPost(strURL,elementID,from,car) {
	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) {
				document.getElementById(elementID).innerHTML = self.xmlHttpReq.responseText;
				paging_xmlhttpPost("ajax/paging.php","rank",from,car);
			}
		}
		self.xmlHttpReq.send('input= '+from+"|"+car);
		
}