

/*
 *Share functions
*/

function shareLink(pageUrl, windowName, winProperties) {
	
	var winNew = window.open(pageUrl, windowName, winProperties);
	
	if (! winNew) {
		getSwf(swfId).openWindowFromSwf(pageUrl);
	} else {
		winNew.focus();
	}
};


var url = "http://www.harley-davidson.com/en_US/Content/Pages/Events/Sturgis.html";

function share(service) {
	switch (service) {
		case 'facebook':
		shareFacebook();
		break;
		case 'myspace':
		shareMyspace();
		break;        
		case 'twitter':
		shareTwitter();
		break;
	}
};

//Share Facebook
function shareFacebook() {
var url = "http://www.harley-davidson.com/en_US/Content/Pages/Events/Sturgis.html?locale=en_US&bmLocale=en_US&sturgis2010";
	var u = url;
	var t = 'Sturgis | Harley-Davidson USA';
	var finalURL = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t);
	var properties = 'toolbar=0,status=0,width=626,height=436';
	shareLink(finalURL, 'Facebook', properties);
	//hbx
	_hbPageView('Facebook', '/Experience/Events/Sturgis/Social+Sharing/Facebook'); 
};

//Share MySpace

function shareMyspace() {
	var finalURL = 'http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent(document.location.toString());				
	var properties = 'toolbar=0,status=0,width=440,height=450';
	shareLink(finalURL, 'MySpace', properties);
	//hbx
	_hbPageView('MySpace', '/Experience/Events/Sturgis/Social+Sharing/MySpace');
};


//Share Twitter
function shareTwitter() {
	var finalURL = 'http://twitter.com/home?status=Sturgis Motorcycle Rally is August 6-13, and Harley-Davidson will be right in the thick of it again this year. www.h-d.com/Sturgis';
	var properties = 'width=1024,height=768,scrollbars=yes,resizable=yes,toolbar=no,location=no,menubar=no,directories=no,status=no';
	shareLink(finalURL, 'Twitter', properties);
	//hbx
	_hbPageView('Twitter', '/Experience/Events/Sturgis/Social+Sharing/Twitter');
};



