// JavaScript Document
function getHTTPObject(){

	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest) return new XMLHttpRequest();

	else {
		alert("Your browser does not support AJAX.");
		return null;
	}
}

function pagging_output() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx1').innerHTML = httpObject.responseText;
	}
}

function pagging_output2() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx2').innerHTML = httpObject.responseText;
	}
}

function pagging_output3() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx3').innerHTML = httpObject.responseText;
	}
}

function pagging_output4() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx4').innerHTML = httpObject.responseText;
	}
}

function pagging_output5() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx5').innerHTML = httpObject.responseText;
	}
}

function pagging_output7() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx7').innerHTML = httpObject.responseText;
	}
}

function pagging_output6() {
	if(httpObject.readyState == 4){
		document.getElementById('proddacbietx6').innerHTML = httpObject.responseText;
	}
}

function paggingLoad(start, id) {
	list1 = document.getElementsByClassName("activate1");
	for (index1 = 0; index1 < list1.length; ++index1) {
		list1[index1].setAttribute("class", "unactivate1");
	}
	
	getid1 = "1"+start;
	
	document.getElementById(getid1).setAttribute("class", "activate1");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_specialgiua&id="+id+"&format=raw&start="+start+"&end=6&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output;
	}
}

function paggingLoad2(start, id) {
	list2 = document.getElementsByClassName("activate2");
	for (index2 = 0; index2 < list2.length; ++index2) {
		list2[index2].setAttribute("class", "unactivate2");
	}
	
	getid2 = "2"+start;
	
	document.getElementById(getid2).setAttribute("class", "activate2");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_moinhat&id="+id+"&format=raw&start="+start+"&end=3&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output2;
	}
}

function paggingLoad3(start, id) {
	list3 = document.getElementsByClassName("activate3");
	for (index3 = 0; index3 < list3.length; ++index3) {
		list3[index3].setAttribute("class", "unactivate3");
	}
	
	getid3 = "3"+start;
	
	document.getElementById(getid3).setAttribute("class", "activate3");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_xemnhieu&id="+id+"&format=raw&start="+start+"&end=6&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output3;
	}
}

function paggingLoad4(start, id) {
	list4 = document.getElementsByClassName("activate4");
	for (index4 = 0; index4 < list4.length; ++index4) {
		list4[index4].setAttribute("class", "unactivate4");
	}
	
	getid4 = "4"+start;
	
	document.getElementById(getid4).setAttribute("class", "activate4");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_ngaunhien&id="+id+"&format=raw&start="+start+"&end=6&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output4;
	}
}

function paggingLoad5(start, id, catid) {
	list5 = document.getElementsByClassName("activate5");
	for (index5 = 0; index5 < list5.length; ++index5) {
		list5[index5].setAttribute("class", "unactivate5");
	}
	
	getid5 = "5"+start;
	
	document.getElementById(getid5).setAttribute("class", "activate5");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_cungloai&id="+id+"&catid="+catid+"&format=raw&start="+start+"&end=6&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output5;
	}
}



function paggingLoad6(start, id, catid) {
	list6 = document.getElementsByClassName("activate6");
	for (index6 = 0; index6 < list6.length; ++index6) {
		list6[index6].setAttribute("class", "unactivate6");
	}
	
	getid6 = "6"+start;
	
	document.getElementById(getid6).setAttribute("class", "activate6");

	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "index.php?option=com_user&task=loadPagging&type=product_renhat&id="+id+"&catid="+catid+"&format=raw&start="+start+"&end=6&time="+new Date().getTime(), true);
		httpObject.send(null);
		httpObject.onreadystatechange = pagging_output6;
	}
}
