//facebookfunction fanBox() {	populateRightContentWell("facebook");	jQuery('#facebookDiv').empty();	var fbook= "";	var dateVar = new Date().getTime();	fbook = "<script type=\"text/javascript\">FB.init(\"fc4ff2c5eb4c144be1dc670253604ba5\");</script><fb:fan profile_id=\"121374518999\" stream=\"1\" connections=\"9\" height=\"545px\" width=\"560px\" css=\"http://www.novatechhelp.com/dev/18th2/Styles/facebook.css?"+ dateVar + "\"></fb:fan>";		jQuery('#facebookDiv').append(fbook);};//yelp function constructYelpURL() {	var URL = "http://api.yelp.com/business_review_search?"+		"callback=" + "handleResults&term=18th%amendment&num_biz_requested=1&lat=38.885102&long=-76.997882&radius=0&ywsid=Q4-SsLHXGM7UGsP_eKP0Lw&category=pubs";	return encodeURI(URL);}function getYelp() {	populateRightContentWell("yelp");        var yelpRequestURL = constructYelpURL();        /* do the api request */        var script = document.createElement('script');        script.src = yelpRequestURL;        script.type = 'text/javascript';        var head = document.getElementsByTagName('head').item(0);        head.appendChild(script);        return false;    }function handleResults(data) {	if(data.message.text == "OK") {		if (data.businesses.length == 0) {			alert("Error: No businesses were found near that location");			return;		}		biz = data.businesses[0];		formatData(biz);	} else {		alert("Error: " + data.message.text);	}}function formatData(biz) {	var html = "";	html += generateReviewHtml(biz.reviews[0]);	html += generateReviewHtml(biz.reviews[1]);	html += generateReviewHtml(biz.reviews[2]);	$('#yelpDiv').empty();	$('#yelpDiv').html(html);}function constructAddress(biz) {    var returnValue = "";    returnValue +=biz.address1 +"<br/>";    returnValue+=biz.address2;    if(biz.address2!="") {        returnValue+="<br/>";    }    returnValue+=biz.address3;    if(biz.address3!="") {        returnValue+="<br/>";    }    returnValue+=biz.city + ", " + biz.state + " " + biz.zip + "<br/>";    returnValue+=formatPhone(biz.phone) + "<br/>";    return returnValue;}function getRatingImage(rating) {    var starRating="";    if(rating==3)		{starRating="Images/3stars.png";}	else if(rating==4)		{starRating="Images/4stars.png";}	else if(rating==2)		{starRating="Images/2stars.png";}	else if(rating==1)		{starRating="Images/1stars.png";}	else		{starRating="Images/5stars.png";}	return starRating;}function formatPhone(phone) {    var returnValue="( ";    returnValue+=phone.substring(0, 3)+" ) ";    returnValue+=phone.substring(3, 6) + " - ";    returnValue += phone.substring(6);    return returnValue;}function generateReviewHtml(review) {	var returnValue = "";	var starRating=null;	returnValue = "<div class=\"xsnazzy\">"; 	returnValue +="<b class=\"xb1\"></b><b class=\"xb2\"></b><b class=\"xb3\"></b><b class=\"xb4\"></b><b class=\"xb5\"></b><b class=\"xb6\"></b><b class=\"xb7\"></b>";returnValue +="<div class=\"xboxcontent\">"; returnValue +="<a href=\"" + review.user_url + "\" target=\"_blank\"><img src=\"" + review.user_photo_url + "\" width=\"82\" height=\"82\"></a><p>" + review.text_excerpt + "...<a href=\"" + review.url + "\" target=\"_blank\">Read more</a>";returnValue +="<div></div>"returnValue +="Review left by <a href=\"" + review.user_url + "\" target=\"_blank\">\"" + review.user_name  + "\"</a> on " + review.date  + " <img src=\"" + getRatingImage(review.rating) + "\"/></p>";returnValue +="</div>";	//returnValue += "<a href=\"" + review.user_url + "\" target=\"_blank\"><img src=\"" + review.user_photo_url + "\" width=\"82\" height=\"82\"></a>";	//returnValue += "<span class=\"reviewText\">" + review.text_excerpt + "...<a href=\"" + review.url + "\" target=\"_blank\">Read more</a></span>";	//returnValue += "<img src=\"" + getRatingImage(review.rating) + "\"/>";	returnValue +="<b class=\"xb7\"></b><b class=\"xb6\"></b><b class=\"xb5\"></b><b class=\"xb4\"></b><b class=\"xb3\"></b><b class=\"xb2\"></b><b class=\"xb1\"></b>"; 	returnValue +="<em></em><span></span>"; 	returnValue += "</div>";	return returnValue;	}  /*FLICKR */function getFlickrPhotoSet(photoSetID) {	var apiKey = 'd157cc566f24b88329fc2a17c4747a85';	var returnedData;	//the initial json request to flickr	if(photoSetID == '72157622066082983') {		jQuery.getJSON('http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&api_key=' + apiKey + '&photoset_id=' + photoSetID + '&format=json&jsoncallback=?',  function(data){		returnedData = data;		processPhotos(returnedData, "official");});	} else {		jQuery.getJSON('http://api.flickr.com/services/rest/?&method=flickr.photos.search&api_key=' + apiKey + '&tags=' + photoSetID + '&tag_mode=all&format=json&jsoncallback=?', function(data){		returnedData = data;		processPhotos(returnedData, "user");});		}}function processPhotos(data, type) {	var flickrHtml="<div id=\"photoStream\">";	if(type=="user") {		jQuery.each(data.photos.photo, function(i,item){ 			var photoURL = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '.jpg';		 	flickrHtml+="<img src=\"" + photoURL + "\" style=\"text-align:center;\"/>";	 	});	} else {		jQuery.each(data.photoset.photo, function(i,item){ 			var photoURL = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '.jpg';		 	flickrHtml+="<img src=\"" + photoURL + "\" style=\"text-align:center;\"/>";	 	});	}	 flickrHtml+="</div><a class=\"nav\" id=\"prev\" href=\"#\"></a> <a class=\"nav\" id=\"next\" href=\"#\"></a>";	 $('#flickrDiv').empty();	 $('#flickrDiv').html(flickrHtml);  	 setUpSlideShow();}function setUpSlideShow() {	jQuery('#photoStream').cycle({		fx:     'scrollRight',		speed:    'normal',		timeout:  3000,		next:   '#next',		prev:   '#prev'	});}//TWITTER //function showTwitter() { 	//populateRightContentWell("twitter");	//$('#twitterDiv').empty();	//var twitterhtml="<div id=\"twtr-profile-widget\"></div>";	//$('#twitterDiv').html(twitterhtml);	//new TWTR.Widget({  	//	profile: true,  	//	id: 'twtr-profile-widget',  	//	loop: false,  	//	width: 560,  	//	height: 390,  	//	theme: {shell: {background: '#72361e', color: '#ffffff'}, tweets: {background: '#ffffff', color: '#444444', links: '#1985b5' }}	//}).render().setProfile('18thAmendment').start();//} function showTwitter() { 	populateRightContentWell("twitter"); 	getStatusTimeline();}function getStatusTimeline() {	//var returnedData;	  $.jsonp({      "url": "http://twitter.com/statuses/user_timeline/18thAmendment.json?count=10&callback=?",      "data": {          "alt": "json-in-script"      },      "success": function(statuses) {      	processTweets(statuses);      },      "error": function(XHR, textStatus, errorThrown){            //alert("ERREUR: " + textStatus);           // alert("ERREUR: " + errorThrown);            processTwitterError();        }    });	//	jQuery.getJSON('http://twitter.com/status/user_timeline/18thAmendment.json?count=10&callback=?', function(data){//		returnedData = data;	//	processTweets(returnedData);//	});}function processTwitterError(){	$('#twitterDiv').empty();	$('#twitterDiv').html("<div class=\"xsnazzy\"><b class=\"xb1\"></b><b class=\"xb2\"></b><b class=\"xb3\"></b><b class=\"xb4\"></b><b class=\"xb5\"></b><b class=\"xb6\"></b><b class=\"xb7\"></b><div class=\"xboxcontent\"><p>Something is goofy with twitter right now.  Stay tuned while we get things back in line!</p></div><b class=\"xb7\"></b><b class=\"xb6\"></b><b class=\"xb5\"></b><b class=\"xb4\"></b><b class=\"xb3\"></b><b class=\"xb2\"></b><b class=\"xb1\"></b><em></em><span></span></div><div id=\"bird\"><img src=\"Images/TwitterBird.png\"></div>");		}/*function processTweets(data) {	var twitterHtml = "<div class=\"twtr-timeline\" ><div class=\"twtr-tweets\"><div class=\"twtr-reference-tweet\"></div><div style=\"opacity: 1; height: 82px;\" class=\"twtr-tweet\" id=\"tweet-id-2\"><div class=\"twtr-tweet-wrap\"><div class=\"twtr-avatar\"><div class=\"twtr-img\"><a href=\"http://twitter.com/18thAmendment\"><img src=\"http://a1.twimg.com/profile_images/391637386/18th1_bigger.jpg\"></a></div></div>";	jQuery.each(data, function(i, item) {		twitterHtml += "<div class=\"twtr-tweet-text\"><p><a href=\"http://www.twitter.com/" + item.user.screen_name + "\" class=\"twtr-user\">" + item.user.screen_name + "</a> - " + item.text.linkify() + "<i><a href=\"http://twitter.com/twitter/status/" + item.id + "\">" + relative_time(item.created_at) + "</a></i></p></div></div></div><div style=\"opacity: 1; height: 82px;\" class=\"twtr-tweet\" id=\"tweet-id-1\"><div class=\"twtr-tweet-wrap\"><div class=\"twtr-avatar\"><div class=\"twtr-img\"><a href=\"http://twitter.com/" + item.user.screen_name + "\"><img src=\"" + item.user.profile_image_url + "\"></a></div></div>";	});	 	$('#twitterDiv').empty(); 	$('#twitterDiv').html(twitterHtml);}*/function processTweets(data) {	var twitterHtml="";	var twitterCode=""; 							   jQuery.each(data, function(i, item) {		twitterCode = "<a><img src=\"" + item.user.profile_image_url + "\"></a><div class=\"twtr-tweet-text\"><p>" + item.text.linkify() + "</p></div><div> &nbsp;</div><a href=\"http://twitter.com/" + item.user.screen_name + "\"> Posted by <a href=\"" + item.user.profile_image_url + "\" target=\"_blank\">\"" + item.user.screen_name  + "\"</a>&nbsp;" + relative_time(item.created_at)  + " ";										twitterHtml += makeBubble(twitterCode);														  });							   	$('#twitterDiv').empty(); 	$('#twitterDiv').html(twitterHtml);}		function makeBubble(twitterCode){		var twitterHtml="";twitterHtml ="<div class=\"xsnazzy\">"; twitterHtml +="<b class=\"xb1\"></b><b class=\"xb2\"></b><b class=\"xb3\"></b><b class=\"xb4\"></b><b class=\"xb5\"></b><b class=\"xb6\"></b><b class=\"xb7\"></b>"; twitterHtml +="<div class=\"xboxcontent\">"; twitterHtml +="<p>";twitterHtml += twitterCode;twitterHtml +="</p>"; twitterHtml +="</div>";twitterHtml +="<b class=\"xb7\"></b><b class=\"xb6\"></b><b class=\"xb5\"></b><b class=\"xb4\"></b><b class=\"xb3\"></b><b class=\"xb2\"></b><b class=\"xb1\"></b>"; twitterHtml +="<em></em><span></span>"; twitterHtml +="</div>";return twitterHtml;	}function relative_time(time_value) {	  var values = time_value.split(" ");	  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];	  var parsed_date = Date.parse(time_value);	  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();	  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);	  delta = delta + (relative_to.getTimezoneOffset() * 60);	  var r = '';	  if (delta < 60) {	    r = 'a minute ago';	  } else if(delta < 120) {	    r = 'couple of minutes ago';	  } else if(delta < (45*60)) {	    r = (parseInt(delta / 60)).toString() + ' minutes ago';	  } else if(delta < (90*60)) {	    r = 'an hour ago';	  } else if(delta < (24*60*60)) {	    r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';	  } else if(delta < (48*60*60)) {	    r = '1 day ago';	  } else {	    r = (parseInt(delta / 86400)).toString() + ' days ago';	  }	  	  return r;}function populateRightContentWell(type) {	if(type=="twitter") {		$("[class*='dxx']").hide();		$(".dxxtwittertext").show();		return false;	} else if(type=="flickr") {		$("[class*='dxx']").hide();		$(".dxxflickrtext").show();		return false;	} else if(type=="facebook") {		$("[class*='dxx']").hide();		$(".dxxfacebooktext").show();		return false;	} else if(type=="yelp") {		$("[class*='dxx']").hide();		$(".dxxyelptext").show();		return false;	} else if(type=="community") {		$("[class*='dxx']").hide();		$(".dxxcommunitytext").show();		return false;	}}