var type2 = 0;
var type_id2;
var user_id2;

function Subscribe(type,type_id,user_id)
{
	type2 = type;
	type_id2 = type_id;
	user_id2 = user_id;
	params = 'type=' + type + '&type_id=' + type_id + '&user_id=' + user_id;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "../subscribe.script.php?" + params;
	xmlHttp.onreadystatechange=Sub
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function Sub()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
	 if (document.getElementById('subscribe_' + type2).value == "Subscribe to this artist" || 		 		 		 document.getElementById('subscribe_' + type2).value == "Subscribe to this work" || 		  		 		 document.getElementById('subscribe_' + type2).value == "Subscribe")
	 {
		 if (type2 == 1)
		 {
			document.getElementById('subscribe_' + type2).value = "Unsubscribe to this artist";
		 }
		 else if (type2 == 2)
		 {
			 document.getElementById('subscribe_' + type2).value = "Unsubscribe to this work";
		 }
		 else if (type2 == 3)
		 {
			 document.getElementById('subscribe_' + type2).value = "Unsubscribe";
		 }
	 }
	else
	{
		if (type2 == 1)
		 {
			document.getElementById('subscribe_' + type2).value = "Subscribe to this artist";
		 }
		 else if (type2 == 2)
		 {
			 document.getElementById('subscribe_' + type2).value = "Subscribe to this work";
		 }
		 else if (type2 == 3)
		 {
			 document.getElementById('subscribe_' + type2).value = "Subscribe";
		 }
	}
		
 }
}
