// JavaScript Document
dataURL = "/";
baseURL = "/";
var ulrImg = "http://media.trangvangkhuyenmai.vn/"
function load_specproduct(_oid, _pid, _tvid){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		$("#indicator").css("display", 'block');		
		if(!obj){return;}
		obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=spec_product&pid=" + _pid + "&tvid=" + _tvid +"&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){
					obj.innerHTML = HttpRequest.responseText;							
			   }
			   $("#indicator").css("display", 'none');
		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}


function listShopSallingProduct(_oid, _pid, _fillter, _sort){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		if(!obj){return;}
		obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=listshop_sallingproduct&pid=" + _pid + "&fillter=" + _fillter + "&sort=" + _sort  +"&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{		
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){
					obj.innerHTML = HttpRequest.responseText;							
			   }

		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}



function listQAProduct(_oid, _pid){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		if(!obj){return;}
		obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=list_qa_product&pid=" + _pid +"&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{		
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){
					obj.innerHTML = HttpRequest.responseText;							
			   }

		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}



function OnStreet(_oid){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		if(!obj){return;}
		//obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=onstreet&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{		
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){
					obj.innerHTML = HttpRequest.responseText;							
			   }

		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}


function CheckShop(_oid, _shopname){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		if(!obj){return;}
		obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=checkshopname&shopname=" + _shopname +"&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{		
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){			       
					obj.innerHTML = HttpRequest.responseText;							
			   }

		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}


function LoadVideo(_oid, _vid){
	try{
		var HttpRequest = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		if (!HttpRequest) return;
		var getStr = "";
		var obj = document.getElementById(_oid);				
		if(!obj){return;}
		obj.innerHTML = "<p class='loading'><img src='" + ulrImg + "common/loading.gif' alt='Loading' /></p>"
		
		getStr += "?type=playvideo&vid=" + _vid +"&rd=" + Math.random();  ;
		var actionURL = baseURL + "ajax/action.aspx" + getStr;
		HttpRequest.open("GET",actionURL);
		HttpRequest.onreadystatechange = function()
		{		
		   if (HttpRequest.readyState == 4 && HttpRequest.status == 200)
		   {
			   if(HttpRequest.responseText.indexOf('err=')!=0){
					obj.innerHTML = HttpRequest.responseText;							
			   }

		   }
		}
		HttpRequest.send(null);
		return;
		
	}catch(ex){}
}
