// JavaScript Document
function ajax_material()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","ajax_get_material.php",true);
	xmlhttp.send();
	
}



function cat_material(idval,num_row,counter,check_id)
{	
	var aa;
	//alert(counter);
	if(check_id=='1')
	{
		for(aa=0;aa<100;aa++)
		{
			$('#sub_cat'+aa).css('color','#666666');
		}
		for(aa=0;aa<num_row;aa++)
		{
			$('#cat'+aa).css('color','#666666');
		}
		$('#cat'+counter).css('color','#440846');
		//alert(num_row1);
	}
	if(check_id=='2')
	{
		//alert(counter);
		for(aa=0;aa<100;aa++)
		{
			$('#sub_cat'+aa).css('color','#666666');
		}
		for(aa=0;aa<num_row;aa++)
		{
			$('#sub_cat'+aa).css('color','#666666');
		}
		$('#sub_cat'+counter).css('color','#440846');
	}
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","ajax_catget_material.php?curid="+idval,true);
	xmlhttp.send(null);
}



function ajax_searching(mat_idval,col_idval,sortted,sh_page,p)
{
	//alert(sh_page);
	var xmlhttp,matid,colid,sort_list,show_page;
	matid=document.getElementById(mat_idval).value;	
	colid=document.getElementById(col_idval).value;
	sort_list=document.getElementById(sortted).value;
	
	show_page=document.getElementById('page').value;	

	//alert(show_page)
	
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{			
		//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	// xmlhttp.open("GET","ajax_search_material.php",true); 
	//alert(show_page);
	xmlhttp.open("GET","ajax_search_material.php?midval="+matid+"&cidval="+colid+"&sidval="+sort_list+"&spageval="+show_page+"&page_name="+p,true);
	xmlhttp.send();	
	
}

function subcat_material(idval)
{	
	
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","ajax_subcat_material.php?curid="+idval,true);
	xmlhttp.send();
}

//==================================================================== //if nothing selected

function paging(pageval,val)
{
	
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","ajax_search_material.php?page="+pageval+"&checkall="+val,true);
	xmlhttp.send();
}

//====================================================================



//==================================================================== //if sorting selected

function pagingSort(pageval,val,sortid)
{
	
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		document.getElementById("txtProdDet").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","ajax_search_material.php?page="+pageval+"&checkall="+val+"&sidval="+sortid,true);
	xmlhttp.send();
}

//====================================================================


