function facebook() {
	url = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(document.location);
	
	var posX, posY; //position of popup
	var w=625, h=425; //size of popup
	var offsetX=30, offsetY=30; //x and y offset relative to the parent window
	if (typeof window.screenLeft != "undefined"){ //IE
	posX = window.screenLeft + offsetX;
	posY = window.screenTop + offsetY; 
	}
	else if (typeof window.screenX != "undefined"){ //NS/Moz
	posX = window.screenX + offsetX;
	posY = window.screenY + offsetY;
	}
	else { //default - center of screen
	posX = screen.availWidth/2 - w/2;
	posY = screen.availHeight/2 - h/2;
	}
	var win = window.open(url,"_blank","width="+w+",height="+h+",left="+posX+",top="+posY);
	win.focus();
}

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{ objXMLHttp=new XMLHttpRequest() }
	else if (window.ActiveXObject)
	{ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") }
	return objXMLHttp
}

var xmlHttp

function likeArticle(article,media_url) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{ 
		alert ("Browser does not support HTTP Request")
		return 
	} 
	var url="/publications/article/"+article+"/like/"
	xmlHttp.open("GET",url,true)
	xmlHttp.onreadystatechange = function() {
    	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    	{ 
    		document.getElementById("recLink").style.display='none';
    		document.getElementById("recTopRight").style.display='none';
    		document.getElementById("recTopLeft").style.display='none';

    		document.getElementById("recTextTop").style.display='inline';
    		document.getElementById("recText").style.display='inline';
    		if(xmlHttp.responseText > 1) {
    			document.getElementById("recTextTop").innerHTML='<img src="'+media_url+'images/publications/thumbsup.png" border="0" width="24" style="vertical-align:middle; padding-bottom:7px;" />     ' + xmlHttp.responseText+' people recommend this. ';
    			document.getElementById("recText").innerHTML='<img src="'+media_url+'images/publications/thumbsup.png" border="0" width="24" style="vertical-align:middle;" />     ' + xmlHttp.responseText+' people recommend this. '; }
    		else {
    			document.getElementById("recTextTop").innerHTML='<img src="'+media_url+'images/publications/thumbsup.png" border="0" width="24" style="vertical-align:middle; padding-bottom:7px;" />     ' + xmlHttp.responseText+' person recommends this. ';
    			document.getElementById("recText").innerHTML='<img src="'+media_url+'images/publications/thumbsup.png" border="0" width="24" style="vertical-align:middle;" />     ' + xmlHttp.responseText+' person recommends this. '; }
    	}
	    
	}
	xmlHttp.send(null)
}

function likeMediaArticle(article,media_url) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{ 
		alert ("Browser does not support HTTP Request")
		return 
	} 
	var url="/publications/article/"+article+"/like/"
	xmlHttp.open("GET",url,true)
	xmlHttp.onreadystatechange = function() {
    	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    	{ 
    		
    		if(xmlHttp.responseText > 0) {
				
    			//document.getElementById('art_count').innerHTML= "(" + xmlHttp.responseText + ")";
    			$('.art_count').html("(" + xmlHttp.responseText + ")");
			}
    	}
	    
	}
	xmlHttp.send(null)
}
