
window.onload=function(){
FB.XFBML.parse();
}

function shareHomeFB(ImageUrl,url,atext,alink,name,desc){
var theMedia = {
type:'image',
src:ImageUrl,
href:url
}

var link1 = {
      text: atext,
      href: alink
    }

FB.ui({
method: 'stream.publish',
attachment: {
	  href:url,
      name: name,
      description:desc,
	  media: [theMedia],
    },
	action_links: [link1],
  }
);
}

function sharePostFB(theLink,image,author,date,title,excerpt){
var theMedia = {
type:'image',
src:image,
href:theLink
}

var theProps = {
	  'Author':author,
	  'Date':date,
	  }

var link1 = {
      text: 'Read More',
      href: theLink
    }
	

FB.ui({
method: 'stream.publish',
attachment: {
	  href: theLink,
      name: title,
      description:excerpt,
	  media: [theMedia],
	  properties: theProps,
    },
	action_links: [link1],
  }
);
}



//Login Functions
function fb_login(){
FB.login(reLoadFB, {perms: 'email,read_stream,publish_stream'});
	}
	
function fb_logout(){
FB.logout(function(response) {
        window.location.reload();
});

	}	
	
function reLoadFB(){
window.location.reload(); 
}
