// JavaScript Document
function makeObject(){
var x;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
	x = new ActiveXObject("Microsoft.XMLHTTP");
}else{
	x = new XMLHttpRequest();
}

return x;
}
//common for all ajax
var request = makeObject();

function get_list_sp(){
///alert('pandi');
var page=document.product_list.page.value;
var sort_order=document.product_list.sort_order.value;
var sort_by=document.product_list.sort_by.value;
request.open('get', 'get_list_sp.php?page='+page+'&sort_order='+sort_order+'&sort_by='+sort_by);
request.onreadystatechange = list_display
request.send('null') 
}		
function list_display()
        {
		
        if(request.readyState == 4)
                {
                var answer = request.responseText
                document.getElementById('display1').innerHTML = answer
                }
				
        }


function page(c)
  {
document.product_list.page.value=c;
get_list_sp();
 }
function sort_by(c,d)
{
	//alert(c);
	///alert(d);
	if(c=='code')
	{
	document.product_list.sort_order.value='code';		
	}
	else if(c=='name')
	{
		document.product_list.sort_order.value='name';		
	}
	else if(c=='price')
	{
		document.product_list.sort_order.value='price';		
	}
	else if(c=='circulation')
	{
		document.product_list.sort_order.value='circulation';		
	}	
	
	if(d=='asc')
	{
	document.product_list.sort_by.value='desc';
	}
	else
	{
	document.product_list.sort_by.value='asc';
	}
	
//alert('pandi');
get_list_sp();
 }