var bgEnabled = ("").length > 0 && "" != "false";
var sponsorEnabled  = ("").length > 0 && "" != "false";
var adDeactivated = ("").length > 0 && "" != "false";

var iOneGallery50137 = new SWFTag("gallery_launcher_app_50137", "http://cdn1.elev8.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=4041e1c", '100%', '100%', SWFTag.V10);
iOneGallery50137.config =  escape('<?xml version="1.0" encoding="UTF-8"?><configuration type="gallery"><properties id="properties"><property id="interval">-1</property><property id="email">true</property><property id="getit">false</property><property id="fullscreen">false</property><property id="firstItemTracked">true</property><property id="ad_refresh_interval">1</property><property id="dynamic_open_char">{</property><property id="dynamic_close_char">}</property></properties><properties id="styles"><map id="skin"><property id="url">http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/overlay-gallery.swf?ver=4041e1c</property></map></properties><properties id="tracking"><map id="google"><property id="url">' + impressionUrl  + 'external/google/gallery/' + impressionPostId + '/' + impressionPostSlug + '/</property></map><map id="omniture_config"><property id="movieID">e8 Gallery</property><property id="charSet">UTF-8</property><property id="trackClickMap">true</property><property id="visitorNamespace">communityconnect</property><property id="trackingServer">vs.blackplanet.com</property><property id="trackingServerSecure">vss.blackplanet.com</property><property id="dc">112</property><property id="account">cconelev8,cconbpuniverse,cconcconcvs</property><property id="autoTrack">false</property></map><map id="omniture_pageview"><property id="referrer">{flashvars.referrer}</property><property id="eVar2">G:{flashvars.source}:{flashvars.appUrl}</property><property id="pageName">G:{flashvars.source}:{flashvars.appUrl}</property></map></properties></configuration>') ;
iOneGallery50137.style =  escape('<?xml version="1.0" encoding="UTF-8"?><properties id="styles"><map id="font"><property id="url">http://cdn1.elev8.com/wp-content/plugins/ione-core/framework/fonts/Elev8_v3.swf?ver=05272010</property></map><!-- MAIN GALLERY MODULE --><map id="navigation"><property id="up_color">#FFFFFF</property><!-- defines button up color, text color + divider --><property id="over_color">#603813</property><!-- defines button over color for all nav buttons --><property id="selected_color">#603813</property><!-- defines button selected color for thumb view page buttons --><property id="background_color">#549897</property><!-- navigation bg color--><property id="font">{"fontName":"Lucida Sans", "fontSize":13}</property><!-- json notation font --><property id="text_offset">0,3</property><!-- comma separated values top, left --></map><map id="slide_display"><property id="background">#FFFFFF,#d9e6e6</property><!-- background for photo well.  if it"s a url, it loads the image. if it"s a color, it colors the background.  two colors give a linear gradient --><property id="border_color">#ebedcf</property><!-- OPTIONAL - border around the photo well --><property id="preloader_color">#549897</property><property id="error_color">#549897</property><!-- credit field --><property id="credit_font">{"color":"#8B8B8B","fontName":"Lucida Sans", "fontSize":11}</property><!-- json notation font --><property id="credit_text_offset">4,0</property><!-- comma separated values top, left --><!-- caption field (under photo) --><property id="caption_font">{"color":"#FFFFFF","fontName":"Museo", "fontSize":22}</property><!-- json notation font --><property id="caption_text_offset">0,-4</property><!-- comma separated values top, left --><property id="description_font">{"color":"#FFFFFF","fontName":"Lucida Sans", "fontSize":14}</property><!-- json notation font --><property id="description_text_offset">0,2</property><!-- comma separated values top, left --><property id="caption_background">{"color":"#603813", "alpha":0.75}</property><property id="caption_border">{"color":"#FFFFFF"}</property></map><map id="thumbnails"><property id="background_color">#d4c7b7</property><!-- thumbnail countainer background color --><property id="border_color">#CCCCCC</property><!-- thumbnail container border color --><property id="preloader_color">#FFFFFF</property><property id="error_color">#FFFFFF</property><!-- thumbnail photo wells --><property id="well_border_up">#FFFFFF</property><!-- thumbnail border upstate color --><property id="well_up_alpha">0.4</property><!-- thumbnail upstate alpha --><property id="well_border_over">#549897</property><!-- thumbnail border overstate color --><!-- applies to "Next Gallery" button --><property id="btn_background_color_up">#549897</property><!--OPTIONAL: next gallery background color --><property id="btn_background_color_over">#603813</property><!--OPTIONAL: next gallery background color --><property id="btn_border_up">#FFFFFF</property> <!-- OPTIONAL: next gallery foreground color --><property id="btn_border_over">#FFFFFF</property><!-- OPTIONAL: next gallery foreground over color --><property id="font">{"fontName":"Museo", "fontSize":12}</property><!-- json notation font --><property id="text_offset">0,1</property><!-- comma separated values top, left --></map><map id="endcard"><property id="background_color">#d4c7b7</property><!-- endcard background color --><property id="border_color">#4c4949</property><!-- endcard border color --><property id="icon_fg_up">#FFFFFF</property><!-- endcard icon foreground upstate color --><property id="icon_bg_up">#549897</property><!-- endcard icon background upstate color --><property id="icon_fg_over">#549897</property><!-- endcard icon foreground overState color --><property id="icon_bg_over">#FFFFFF</property><!-- endcard icon background overState color --><property id="font">{"fontName":"Museo", "fontSize":16}</property><!-- json notation font --><property id="text_offset">0,0</property><!-- comma separated values top, left --></map><map id="share"><property id="background_color">#549897</property><property id="upstate">{"iconColor":"#603813", "iconBackground":"#FFFFFF", "fontColor":"#FFFFFF" ,"fontName":"Lucida Sans", "fontSize":20, "textOffset":"-3,0"}</property><property id="overstate">{"iconColor":"#FFFFFF", "iconBackground":"#603813", "backgroundUp":"#549897", "backgroundOver":"#FFFFFF", "fontColor":"#603813" ,"fontName":"Museo", "fontSize":11, "fontWeight":"bold"}</property></map><!-- GALLERY LAUNCHER STYLE --><map id="launcher"><property id="frame">{"color":"#FFFFFF", "padding":10}</property><property id="background">#FFFFFF,#d9e6e6</property><property id="border">#ebedcf</property></map><map id="launcher_nav"><property id="background">#faf6f6,#d4c7b7</property><property id="button">{"background_up":"#603813","foreground_up":"#FFFFFF","background_over":"#549897","foreground_over":"#FFFFFF", "disableEffects":"true"}</property><property id="text">{"color":"#603813","fontName":"Lucida Sans", "fontSize":14, "disableDropShadow":"true"}</property><property id="text_offset">0,0</property><property id="sponsor_border">{"up_color":"#FFFFFF","over_color":"#549897", "width":1}</property></map><map id="launcher_main_photo"><property id="credit">{"color":"#603813","fontName":"Lucida Sans", "fontSize":8, "padding":2}</property><property id="caption_background">{"color":"#603813", "alpha":0.75}</property><property id="caption_border">{"color":"#FFFFFF"}</property><property id="caption_font">{"color":"#FFFFFF","fontName":"Museo", "fontSize":22}</property><property id="caption_text_offset">0,0</property><property id="description_font">{"color":"#FFFFFF","fontName":"Lucida Sans", "fontSize":14}</property><property id="description_text_offset">0,0</property></map><map id="launcher_title"><property id="text">{"color":"#603813","fontName":"Museo", "fontSize":32}</property><property id="text_offset">0,-5</property><property id="background">#FFFFFF</property><property id="icon">#549897</property></map><!-- MORE GALLERIES MODULE --><map id="tabs"><property id="background">{"upColor":"#549897","overColor":"#603813","selectedColor":"#d4c7b7","border":"3"}</property><!-- up,over,selected--><property id="label">{"y":"9","x":"14","upColor":"#FFFFFF","overColor":"#FFFFFF","selectedColor":"#603813","fontFamily":"Lucida Sans","fontSize":"18px"}</property></map><map id="panes"><property id="pane">{"backgroundColor":"#d4c7b7","itemSpacing":"9","margin":"11"}</property></map><map id="items"><property id="title">{"selectedColor":"#FFFFFF","upColor":"#603813","fontFamily":"Museo","fontSize":"15px"}</property><property id="description">{"selectedColor":"#FFFFFF","upColor":"#826239","fontFamily":"Lucida Sans","fontSize":"11px","leading":"1"}</property><property id="thumb">{"selectedColor":"#FFFFFF","upColor":"#FFFFFF"}</property><property id="border">{"selectedColor":"#ebedcf","upColor":"#ebedcf"}</property><property id="background">{"selectedColor":"#603813","upColor":"#d4c7b7"}</property><property id="preloader">{"color":"#549897"}</property><property id="error">{"color":"#549897"}</property></map><map id="scroller"><property id="colors">{"trackColor":"#FFFFFF","knobBgColor":"#549897","knobGripColor":"#FFFFFF"}</property></map></properties>') ;
iOneGallery50137.source =  "http://cdn.elev8.com/?ione-gallery-xml=50137&ione-gallery-type=live";
try{
	iOneGallery50137.source = iOneGallery50137.source.split('/')[2].split('.')[0];
} catch(e){};
try{
	if (document.referrer && document.referrer != "" ){
		iOneGallery50137.referrer = document.location.href;
	}else{
		iOneGallery50137.referrer = null;
	}
} catch(e){};
iOneGallery50137.bgColor = "#faf6f5";
iOneGallery50137.fgColor = "#c4dce6";
iOneGallery50137.galleryOpenCallback = "onGalleryOpen";
iOneGallery50137.galleryCloseCallback = "onGalleryClose";

iOneGallery50137.setAllowScriptAccess(SWFTag.ALWAYS);
iOneGallery50137.setAllowNetworking(SWFTag.ALL);
iOneGallery50137.setWmode(SWFTag.OPAQUE);
try{ iOneGallery50137.setBgColor(iOneGallery50137.bgColor); }catch(e){};
iOneGallery50137.addFlashVar('bgColor', iOneGallery50137.bgColor);
iOneGallery50137.addFlashVar('fgColor', iOneGallery50137.fgColor);
iOneGallery50137.addFlashVar('targetApp', 'http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/overlay-launcher-v2.swf?ver=4041e1c');
iOneGallery50137.addFlashVar('appUrl', document.location.href);
iOneGallery50137.addFlashVar('source', iOneGallery50137.source);
iOneGallery50137.addFlashVar('referrer', iOneGallery50137.referrer);
iOneGallery50137.addFlashVar('plsUrl', 'http://cdn.elev8.com/?ione-gallery-xml=50137&ione-gallery-type=live&ver=1328447066');
iOneGallery50137.addFlashVar('configData', iOneGallery50137.config);
iOneGallery50137.addFlashVar('styleData', iOneGallery50137.style);
iOneGallery50137.addFlashVar('editorEmbed', '[ione-gallery id="50137" src="http://elev8.com"]');
iOneGallery50137.addFlashVar('adDataUrl', sponsorEnabled ? AdHelper.getAdTag("adx","e8.home", "140x60", "dcmt=text/xml", "") : '');
iOneGallery50137.addFlashVar("galleryOpenCallback", iOneGallery50137.galleryOpenCallback);
iOneGallery50137.addFlashVar("galleryCloseCallback", iOneGallery50137.galleryCloseCallback);

iOneGallery50137.addFlashVars(document.location.search.substring(1));

// function to set height of launcher embed to photo size
iOneGallery50137.setMovieHeight = function(h){
	jQuery('#gallery_launcher50137').css({'height':h});
}

// overlay opener code, including gallery embed
iOneGallery50137.openOverlay = function(launcher_id, onCloseCallback){
	Logger.info('openOverlay(), launcher_id: ' + launcher_id + ", onCloseCallback: " + onCloseCallback);

	//Gallery Module
	var gallerySwf =  new SWFTag("gallery_app_50137", "http://cdn1.elev8.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=4041e1c", '100%', '100%', SWFTag.V10);
	try{ gallerySwf.setBgColor(iOneGallery50137.bgColor); }catch(e){};
	gallerySwf.addFlashVar("bgColor", iOneGallery50137.bgColor);
	gallerySwf.addFlashVar("fgColor", iOneGallery50137.fgColor);
	gallerySwf.addFlashVar("targetApp", "http://cdn1.elev8.com/wp-content/plugins/ione-core/framework/media-framework-v3.swf?ver=4041e1c");
	gallerySwf.addFlashVar("plsUrl", "http://cdn.elev8.com/?ione-gallery-xml=50137&ione-gallery-type=live?ver=1328447066");
	gallerySwf.addFlashVar("configData", iOneGallery50137.config);
	gallerySwf.addFlashVar("styleData", iOneGallery50137.style);
	gallerySwf.addFlashVar("pageName", document.title);
	gallerySwf.addFlashVar('appUrl', document.location.href);
	gallerySwf.addFlashVar('source', iOneGallery50137.source);
	gallerySwf.addFlashVar('referrer', iOneGallery50137.referrer);
	gallerySwf.addFlashVar('bgActive', bgEnabled);
	
	// MORE GALLERIES Module
	var moreSwf =  new SWFTag("rss_navigation_50137", "http://cdn1.elev8.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=4041e1c", '100%', '100%', SWFTag.V10);
	try{ moreSwf.setBgColor(iOneGallery50137.bgColor); }catch(e){};
	moreSwf.addFlashVar("bgColor", iOneGallery50137.bgColor);
	moreSwf.addFlashVar("fgColor", iOneGallery50137.fgColor);
	moreSwf.addFlashVar("playlists", "http://cdn.elev8.com/feed/?galleries=1&type=related&related-id=50137|http://cdn.elev8.com/feed/?galleries=1&type=hot&duration=60|http://cdn.elev8.com/feed/?galleries=1");
	moreSwf.addFlashVar("plsUrl", "http://cdn.elev8.com/?ione-gallery-xml=50137&ione-gallery-type=live");
	moreSwf.addFlashVar("tabs", "RELATED|HOT|RECENT");
	moreSwf.addFlashVar("configData", iOneGallery50137.config);
	moreSwf.addFlashVar("styleData", iOneGallery50137.style);
	moreSwf.addFlashVar("targetApp", "http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/more-galleries.swf?ver=4041e1c");

	// BACKGROUND LOADER Module
	var bgLoaderSwf = new SWFTag("overlay_bg_loader_flash_50137", "http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?ver=4041e1c","100%","100%", SWFTag.V10)
	bgLoaderSwf.addFlashVar("adDataUrl", bgEnabled ? AdHelper.getAdTag("adx","e8.home", "1024x576", "dcmt=text/xml", "") : "");

	// SPONSOR Module
	var sponsorSwf = new SWFTag("overlay_sponsor_flash_50137", "http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?ver=4041e1c","100%","100%", SWFTag.V10);
	sponsorSwf.addFlashVar("adDataUrl", sponsorEnabled ? AdHelper.getAdTag("adx","e8.home", "140x60", "dcmt=text/xml", "") : "");

	var params = {
		onCloseCallback:onCloseCallback,
		galleryModule_params:{
			swf:gallerySwf
		},
		moreContentModule_params:{
			swf:moreSwf
		},
		sponsorModule_params:{
			swf:sponsorSwf
		},
		adModule_params:{
			adFrameSrc:'http://cdn.elev8.com/wp-content/plugins/ione-gallery/resources/ad.php?adUrl='+escape(AdHelper.getAdTag("adj","e8.home","300x250", "", ""))
		},
		bgLoaderModule_params:{
			swf:bgLoaderSwf
		}
	}
	if (bgEnabled){
		if (adDeactivated) params.modules = ['galleryModule','bgLoaderModule','sponsorModule','moreContentModule'];
		else params.modules = ['galleryModule','bgLoaderModule','sponsorModule','moreContentModule','adModule'];
	}
	MediaTrayFactory.getTray(launcher_id, params).open(onCloseCallback);
}

// JS Callbacks
iOneGallery50137.addFlashVar('launchGalleryFn', 'iOneGallery50137.openOverlay');
iOneGallery50137.addFlashVar('setHeightFn', 'iOneGallery50137.setMovieHeight');

// Add parameters from page's URL as flashvars:
if(document.location.search != null && document.location.search.length > 1) {
	iOneGallery50137.addFlashVars(document.location.search);
}
// Generate markup:
iOneGallery50137.fillElementId('gallery_launcher50137');

// external launcher button
if (openGallery == null){
	var openGallery = function(){
		iOneGallery50137.openOverlay('gallery_launcher_app_50137', iOneGallery50137.galleryCloseCallback);
		jQuery('#gallery_launcher_app_50137')[0][iOneGallery50137.galleryOpenCallback]();
	}
}

if (jQuery('#gallery_open_button').length < 1){
	var launchButton = jQuery('<a id="gallery_open_button" href="javascript:openGallery();" title="View Photos">View Photos</a><div class="clear"></div>');
	var title = jQuery('.compact_post_head');
	title.after(launchButton);
}
jQuery('#gallery_50137').after('<!-- EMBED:\r\r[ione-gallery id="50137" src="http://elev8.com"]\r\r-->');
