function articleShare(site) {
	var headline = left(trim(stripHTML(document.getElementById('headline').innerHTML)),75);
	var description = left(trim(stripHTML(document.getElementById('story').innerHTML)),347) + "...";
	var source = "The University of Illinois at Springfield";
	var url = document.URL;
	
	switch (site) {
	case "newsvine":
		postPopUp('http://www.newsvine.com/_wine/save?s=' + description + '&h=' + headline + '&u=' + url + '&sourceName=' + source, 'newsvine', 'toolbar=0,status=0,height=445,width=650,scrollbars=yes,resizable=yes');
		break;
	case "facebook":
		postPopUp('http://www.facebook.com/sharer.php?u=' + url + '&t=' + headline, 'facebook', 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
		break;
	case "digg":
		postPopUp('http://digg.com/remote-submit?phase=2&url=' + url + '&title=' + headline + '&bodytext=' + description, 'digg', 'toolbar=0,status=0,height=450,width=650,scrollbars=yes,resizable=yes');
		break;	
	//case "permalink":
	//	postPopUp('http://www.uis.edu/?url=' + url + '&headline=' + headline + '&summary=' + description, 'permalink', 'toolbar=0,status=0,height=410,width=490,scrollbars=yes,resizable=no');
	//	break;	
	}
}

function postPopUp(url, name, params) {
	var win = window.open(url, name, params);
}

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function stripHTML(str)	{
	var regHTML = /<[^>]*>/gi; 
	return str.replace(regHTML, "");
}

function trim(str) {
	return str.replace(/\s{2,}/g," ").replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"");
	//return str.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"").replace(/\s+/g," ");
}