var xmlHttp
function showGallery(str)
{
	var totfeatured=document.getElementById('totfeatured').value;
	if (str.length==0)
	{ 
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getgallery.php";
	url=url+"?side="+str+"&tot="+totfeatured;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 
function showGallery1(str)
{
	var totfeatured=document.getElementById('totfeatured1').value;
	if (str.length==0)
	{ 
		document.getElementById("txtHint1").innerHTML="";
		return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getgallery1.php";
	url=url+"?side="+str+"&tot="+totfeatured;

	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 
function shownewreleased(str)
{
	
	var totnewrelease=document.getElementById('totnewrelease').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxnewreleased").innerHTML="";
		return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getnewreleased.php";
	url=url+"?side="+str+"&tot="+totnewrelease;

	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}
function stateChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("txtHint1").innerHTML=xmlHttp.responseText;
	}
}
function stateChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("ajaxnewreleased").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{  
		  xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{  
		try
    	{
		    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
  		catch (e)
	    {
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
 	}
	return xmlHttp;
}

function showtop10(str)
{
	
	var tottop10=document.getElementById('tottop10').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxtop10").innerHTML="";
		return;
	}
	xmlHttp_top10=GetXmlHttpObject()
	if (xmlHttp_top10==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getnewtop10.php";
	url=url+"?side="+str+"&tot="+tottop10;

	xmlHttp_top10.onreadystatechange=stateChangedtop10;
	xmlHttp_top10.open("GET",url,true);
	xmlHttp_top10.send(null);
}
function stateChangedtop10() 
{ 
	if (xmlHttp_top10.readyState==4)
	{ 
		document.getElementById("ajaxtop10").innerHTML=xmlHttp_top10.responseText;
	}
}

function showbundle(str)
{
	
	var totbundles=document.getElementById('totbundles').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxbundle").innerHTML="";
		return;
	}
	xmlHttp_bundle=GetXmlHttpObject()
	if (xmlHttp_bundle==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getnewbundle.php";
	url=url+"?side="+str+"&tot="+totbundles;
	xmlHttp_bundle.onreadystatechange=stateChangedbundle;
	xmlHttp_bundle.open("GET",url,true);
	xmlHttp_bundle.send(null);
}
function showvideocategory(str)
{
	
	var totbundles=document.getElementById('totbundles').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxbundle").innerHTML="";
		return;
	}
	xmlHttp_bundle=GetXmlHttpObject()
	if (xmlHttp_bundle==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getvideocategory.php";
	url=url+"?side="+str+"&tot="+totbundles;
	xmlHttp_bundle.onreadystatechange=stateChangedbundle;
	xmlHttp_bundle.open("GET",url,true);
	xmlHttp_bundle.send(null);
}

function stateChangedbundle() 
{ 
	if (xmlHttp_bundle.readyState==4)
	{ 
		document.getElementById("ajaxbundle").innerHTML=xmlHttp_bundle.responseText;
	}
}

function showdjfav(str)
{
	
	var totdjfav=document.getElementById('totdjfav').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxdjfav").innerHTML="";
		return;
	}
	xmlHttp_djfav=GetXmlHttpObject()
	if (xmlHttp_djfav==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getnewdjfav.php";
	url=url+"?side="+str+"&tot="+totdjfav;
	xmlHttp_djfav.onreadystatechange=stateChangedjfav;
	xmlHttp_djfav.open("GET",url,true);
	xmlHttp_djfav.send(null);
}
function stateChangedjfav() 
{ 
	if (xmlHttp_djfav.readyState==4)
	{ 
		document.getElementById("ajaxdjfav").innerHTML=xmlHttp_djfav.responseText;
	}
}


function showrecom(str)
{
	
	var totrecom=document.getElementById('totrecom').value;
	if (str.length==0)
	{ 
		document.getElementById("ajaxrecom").innerHTML="";
		return;
	}
	xmlHttp_recomm=GetXmlHttpObject()
	if (xmlHttp_recomm==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getnewrecomm.php";
	url=url+"?side="+str+"&tot="+totrecom;
	xmlHttp_recomm.onreadystatechange=stateChangerecom;
	xmlHttp_recomm.open("GET",url,true);
	xmlHttp_recomm.send(null);
}
function stateChangerecom() 
{ 
	if (xmlHttp_recomm.readyState==4)
	{ 
		document.getElementById("ajaxrecom").innerHTML=xmlHttp_recomm.responseText;
	}
}

///Function for add cart

function funcpur(itemid,itemprice,path)
{
	if(itemid != "" && itemprice != "" && path !="")
	{
		var str="addtocartajax.php?path="+path+"&pid="+itemid+"&quantity=1&pr="+itemprice+"&ttype=album+&prtype=";
	}
	else
	{
		var str="addtocartajax.php";
	}
	ajaxaddcart(str);
	return false;
}

//Ajax function for cart
function ajaxaddcart(str)
{
	xmlHttp_Cart=GetXmlHttpObject()
	if (xmlHttp_Cart==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	url=str;
	xmlHttp_Cart.onreadystatechange=stateCartChange;
	xmlHttp_Cart.open("GET",url,true);
	xmlHttp_Cart.send(null);
}

function stateCartChange()
{
	if (xmlHttp_Cart.readyState==4)
	{ 
		document.getElementById("CartDisplayId").innerHTML=xmlHttp_Cart.responseText;
		document.getElementById("CartDisplayId").focus();
	}
}
//End

//Show CartItems
function DisplayCart(prtype,pid,qty,orgprz,prz,prztype)
{
	xmlHttp_ShowCart=GetXmlHttpObject()
	if (xmlHttp_ShowCart==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	if(prtype =="")
		url="showcart.php";
	else if(prtype =="Delete")
	 	url="showcart.php?op=delete";
	else if(prtype =="Update")
		url="showcart.php?op=update&pid="+pid+"&qty="+qty+"&oprz="+orgprz+"&nprz="+prz+"&prtype="+prztype;
	else if(prtype =="Remove")
		url="showcart.php?op=remove&pid="+pid;

	xmlHttp_ShowCart.onreadystatechange=stateShowCartChange;
	xmlHttp_ShowCart.open("POST",url,true);
	xmlHttp_ShowCart.send(null);
}

function stateShowCartChange()
{
	if (xmlHttp_ShowCart.readyState==4)
	{ 
		document.getElementById("CartViewId").innerHTML=xmlHttp_ShowCart.responseText;
	}
}
//End

//Show PlayerItems
function DisplayPlayer()
{
	xmlHttp_Displayplayer=GetXmlHttpObject()
	if (xmlHttp_Displayplayer==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	url="displayplayer.php";
	xmlHttp_Displayplayer.onreadystatechange=stateDisplayPlayerChange;
	xmlHttp_Displayplayer.open("POST",url,true);
	xmlHttp_Displayplayer.send(null);
}

function stateDisplayPlayerChange()
{
	if (xmlHttp_Displayplayer.readyState==4)
	{ 
		document.getElementById("ajaxplayer").innerHTML=xmlHttp_Displayplayer.responseText;
	}
}
//End
//Show PlayerItems
function AddtoCue(trackid)
{
	xmlHttp_AddtoCue=GetXmlHttpObject()
	if (xmlHttp_AddtoCue==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	url="addtocue.php?trackid="+trackid;
	xmlHttp_AddtoCue.onreadystatechange=stateAddtoCueChange;
	xmlHttp_AddtoCue.open("POST",url,true);
	xmlHttp_AddtoCue.send(null);
	DisplayPlayer();
}

function stateAddtoCueChange()
{
	if (xmlHttp_AddtoCue.readyState==4)
	{ 
		document.getElementById("ajaxplayer").innerHTML=xmlHttp_AddtoCue.responseText;
	}
}
//End
