﻿function bookmark(service) {
	var socialBookmark = "";
	var url = "";
	var title =  "";
	var loc = escape("http://www.HARLEMSHOTS.com");
	switch (service) {
		case "twitter":
			socialBookmark = "HARLEM®.  The bold, ice cold shot drink. HARLEMSHOTS.com " + loc;
			url = "http://twitter.com/home?status=" + socialBookmark.replace(" ", "+");
			break;
		case "delicious":
			title = "HARLEM®. The bold, ice cold shot drink IMPORTED FROM HOLLAND.";
			socialBookmark = "HARLEM®. The bold, ice cold shot drink IMPORTED FROM HOLLAND.It’s your night. Call the shots.";
			url = "http://delicious.com/save?url=" + loc + "&title=" + title.replace(" ", "+") + "&notes=" + socialBookmark.replace(" ", "+");
			break;
		case "myspace":
			title = "HARLEM®. The bold, ice cold shot drink IMPORTED FROM HOLLAND.";
			socialBookmark = "HARLEM®. The bold, ice cold shot drink imported from Holland. Distinctively smooth, HARLEM is made with herbs the Dutch call kruiden. Everything else you need to know is just one shot away. It’s your night. Call the shots.";
			url = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + loc + "&t=" + title.replace(" ", "+") + "&c=" + socialBookmark.replace(" ", "+");
			break;
		case "digg":
			title = "HARLEM®. The bold, ice cold shot drink IMPORTED FROM HOLLAND.";
			socialBookmark = "Distinctively smooth, HARLEM is made with herbs the Dutch call kruiden. Everything else you need to know is just one shot away. It’s your night. Call the shots.";
			url = "http://www.addthis.com/bookmark.php?pub=cleversky&v=250&source=tbx-250&s=" + service + "&url=" + loc + "&title=" + title.replace(" ", "+") + "&content=" + socialBookmark.replace(" ", "+");
			break;
		case "facebook":
			url = "http://www.facebook.com/sharer.php?u=" + loc;
			break;
	}
	return url;
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	expiredays = 60;
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) {
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}


function callPublish(userName, score) {
	FB.ensureInit(function () {
	 var attachment = { 'name': userName +' just set a personal best on Call the Shots', 
				  'description':score + ' in a row! Can you top that?', 
				  //'properties':[{'category':['text':'humor','href':'http://bit.ly/KYbaN'],'ratings':'5 stars'}],
				  'media':[{'type':'image','src':'http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=164041417481&v=1&size=z&cksum=e48a1f8225ad2fc2371dd8796e53c975&src=http%3A%2F%2Fwww.umbrellamobile.com%2Fimages%2FHeadsBig.png','href':'http://www.harlemshots.com/'}]}; 
	var action_links = [{'text':'Get the App','href':'http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=323249356&mt=8&ref=nf'}]; 
	FB.Connect.streamPublish('', attachment, action_links);
  });
}
