var s1fx;
var s2fx;
var params = {};
var options = {};

new Asset.javascript('http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US',{
	onload: function() {
		FB.init("865c66d4c968799b4f832fea5deae992");
	}
});

function hollaBack(postID) {
	if ((postID == "null") || (postID == null) || (postID.toString().length < 5)) {
		alert('Error!\n\nIn order to get the music for free you must publish the Facebook message.\n\nPlease try again.');
	}
	else {
		window.location.href = 'http://www.ghostandthecity.com/Sazerac.zip';
	}
}

function callPublish() {
	FB.ensureInit(function () {
		var attachment = {'name':'Ghost & The City','href':'http://www.ghostandthecity.com','description':'Thank you for downloading our new album, Sazerac. Consume virally and always at 45 RPM.','media':[{'type':'image','src':'http://ghostandthecity.com/img/sazerac500.jpg','href':'http://www.ghostandthecity.com'}]};
    	var action_link = [{'text':'DOWNLOAD HERE','href':'http://www.ghostandthecity.com'}];
		FB.Connect.streamPublish('',attachment, action_link,null,' ',hollaBack);
  	});
}

function stageDos(e) {
	
	var email = $('email').value;
	if (email != "") {
		var req = new Request({method: 'get', url: 'email.php'});
		req.send('email='+email);

		s1fx.slideOut().chain(function(){$('stage2').style.display="block";s2fx.slideIn();});
	} else {
		alert("You must enter a valid email address");
	}
	
	return false;
}

window.addEvent('domready', function() {

	s2fx = new Fx.Slide($('stage2')).hide();
	s1fx = new Fx.Slide($('stage1'));

	options.firstColor = "FAF3E0";
	options.secondColor = "e71110";
	options.backColor = "000000";
	options.strokeColor = "000000";
	options.playlistXmlPath = "playlist.xml";
	options.autoPlay = "true";
	options.defaultVolume = "80";
	options.autoLoad = "true";

	params.allowScriptAccess = "always";
	
	//swfobject.embedSWF("swf/OriginalMusicPlayer.swf", "playerHolder", "250", "86", "9.0.0",false, options, params, {});
	
});
