var xmlHttp

function showPicComments(args) {

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	
	showloading("Rating");
	
	xmlHttp.onreadystatechange=stateChanged_pic
	xmlHttp.open("GET",'ajax.php?args='+args,true)
	xmlHttp.send(null)
}

function showloading(id) {
	document.getElementById(id).innerHTML='<center><img src="images/loading-rev.gif"></center>';
}

function showUser(str,songid,type,member,id) {

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	
	showloading("reviews");
	xmlHttp.onreadystatechange=stateChanged_cmnt
	xmlHttp.open("GET",'ajax.php?args=user/reviews/' + member + '/' + songid + '&page='+str, true)
	xmlHttp.send(null)
}

function showUserold(str,songid,type,member,id) {
	
	alert('str = ' + str + '\nsongid = ' + songid + '\ntype = ' + type + '\nmember = ' + member + '\nid = ' + id);

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	
	showloading("txtHint");
	
	if(type=="fan")
		var url="http://www.emcblue.com/sComments.php?type=fan&fanid="+songid+"&page="+str+"&rand="+Math.random();
	else
		var url="http://www.emcblue.com/sComments.php?nsongid="+songid+"&page="+str+"&rand="+Math.random();
	
	xmlHttp.onreadystatechange=stateChanged_cmnt
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}

function stateChanged_pic() { 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("Rating").innerHTML=xmlHttp.responseText 
	}
}

function stateChanged_cmnt() { 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("reviews").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 add_buddy(visitor, member) {
	
	jQuery.facebox('Please wait...')
		
	$.ajax({
		type: "GET",
		url: "ajax.php",
		data: "args=user/add_buddy/" + visitor + "/" + member,
		success: function(msg){
			
			jQuery.facebox(msg)
			
		}
	});

	
}

function add_buddy() {
	
	jQuery.facebox('Please wait...')
		
	jQuery.ajax({
		type: "GET",
		url: "ajax.php",
		data: "args=invite/" + jQuery('#email_address').val(),
		success: function(msg){
			
			jQuery.facebox(msg)
			
		}
	});
	
	jQuery('#email_address').val('Enter email addresses here');
	jQuery('#email_address').addClass('grey_14');
	
}

