function updateVndFav(mid, vid)
{

	if (mid=="" || vid=="")
	{
		document.vndfav.btnUpdateVndFav.value="Error";
		return;
	} 
	
	var a = "add";
	
	if(document.vndfav.btnUpdateVndFav.value == "Remove From Favorites")
		a="remove";
	else
		a="add";
	
	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)
		{
			if(a == "add")
			{
				document.vndfav.btnUpdateVndFav.value = "Remove From Favorites";
				document.vndfav.btnUpdateVndFav.style.border = "1px solid red";
			}
			else
			{
				document.vndfav.btnUpdateVndFav.value = "Add to Favourites";
				document.vndfav.btnUpdateVndFav.style.border = "1px solid green";
			}
			
			document.getElementById("favvndstatus").innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","/member-updateVndFav.php?mid="+mid+"&vid="+vid+"&a="+a,true);
	xmlhttp.send();	
}

function updateVndFavList(mid, vid, a)
{
	var r=confirm("Really Remove "+vid+ " from Favourites?");
	if (r!=true) return;

	if (mid=="" || vid=="" || a=="")
	{
		document.getElementById("listoffavproducts").innerHTML="<b>Error</b>";
		return;
	} 
	
	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)
			document.getElementById("listoffavproducts").innerHTML=xmlhttp.responseText;
	}
	xmlhttp.open("GET","/member-updateVndFavList.php?mid="+mid+"&vid="+vid+"&a="+a,true);
	xmlhttp.send();	
}

function updateTop10Listt(so)
{
	if (so=="")
	{
		document.getElementById("listoftop10products").innerHTML="<b>Error</b>";
		return;
	} 
	
	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)
			document.getElementById("listoftop10products").innerHTML=xmlhttp.responseText;
	}
	xmlhttp.open("GET","/getTop10Products.php?so="+so,true);
	xmlhttp.send();	
}

function updateTop100ProductsList(page)
{
	if (page=="")
	{
		document.getElementById("listoftop100products").innerHTML="<b>Error</b>";
		return;
	} 
	
	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)
			document.getElementById("listoftop100products").innerHTML=xmlhttp.responseText;
	}
	xmlhttp.open("GET","/getTop100Products.php?pg="+page,true);
	xmlhttp.send();	
}
