Shadowbox.init({skipSetup: true,players:["html","flv","iframe","swf"]});
function loadLink(action,url){

	//SETTINGS
	var startUrl_music = ""; // path to your local mp3 directory, example: "/mp3/";
	var startUrl_video = ""; // path to your local video directory, example: "/video/";

	//set defaults;
	startUrl='';endUrl='';loadHeight='';loadWidth='';

	/*
	//TYPES OF LINKS ACCEPTED
	
	video - load a video stored on your website
	javascript:loadLink('video','videofile.flv')
	
	music - load a music file stored on your website
	javascript:loadLink('music','musicfile.mp3')
	
	youtube - load a youtube video (defaults to high quality)
	Note: Use the video link but change the ? and = to / eg: this example used this original video link: http://www.youtube.com/watch?v=rE3hle3FoTE
	javascript:loadLink('youtube','http://www.youtube.com/watch/v/rE3hle3FoTE')
	
	fbvideo - load a facebook video (requires video id from facebook URL string)
	javascript:loadLink('fbvideo','12345678')
	
	fbvideo_comments - load a facebook video with comments and page templates (requires video id from facebook URL string)
	javascript:loadLink('fbvideo_comments','12345678')
	
	link - load an internal or external link
	javascript:loadLink('link','http://example.com')
	
	myspace - load a myspace link (you can't use link for myspace because it cancels out the shadowbox frame)
	javascript:loadLink('myspace','http://myspace.com/username')
	
	popup - load a link in a new window, not in the shadowbox popup
	javascript:loadLink('popup','')
	
	section - load a section within the megazine as defined by the megazine.mz3 anchor or page number
	javascript:loadLink('section','example_anchor')
	javascript:loadLink('section','03')
	
	mailto - send an e-mail (this can go to a function or be tracked with analytics
	javascript:loadLink('mailto','me@example.com')
	
	*/
		
	if(action=="video" || action=="music"){
		if(action=="music"){
			startUrl = startUrl_music; //
		} else {
			startUrl = startUrl_video;
		}
		loadHeight = 350;
		loadWidth = 622;
		loadPlayer = "flv";
		
	} else if(action=="youtube" || action=="fbvideo" || action=="fbvideo_comments" || action=="link"){
		if(action=="youtube"){
			endUrl = "&amp;autoplay=1&amp;hl=en&amp;fs=1&amp;ap=%2526fmt%3D18"; //&fmt=18 to force HQ
			
		} else if(action=="fbvideo_comments"){
			startUrl = "http://www.facebook.com/video/video.php?v="; //include comments but window needs to full screen or bigger
			
		} else if(action=="fbvideo"){
			startUrl = "http://www.facebook.com/v/"; //raw video
		}
		if(action!="link" && action!="fbvideo_comments"){
			loadHeight = 505;
			loadWidth = 854;
		}
		loadPlayer = "iframe";

	} else if(action=="myspace" || action=="popup"){
		window.open(url,"popup");
		action = false; //don't load shadowbox

	} else if(action=="section"){
		location.hash="#/"+url;
		action = false; //don't load shadowbox
		
	} else if(action=="mailto"){
		action = false; //don't load shadowbox
		parent.location="mailto:" + url;

	}
	
	if(action){
		Shadowbox.open({ content:startUrl+url+endUrl, player:loadPlayer, height:loadHeight, width:loadWidth });
	} else {
		Shadowbox.close(); //fix for using browser history retaining shadowbox
	}
}

