var bgEnabled = ("").length > 0 && "" != "false";
var sponsorEnabled  = ("").length > 0 && "" != "false";
var adDeactivated = ("").length > 0 && "" != "false";

var iOneGallery233757 = new SWFTag("gallery_launcher_app_233757", "http://cdn.newsone.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=ee48677", '100%', '100%', SWFTag.V10);
iOneGallery233757.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://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/overlay-gallery.swf?ver=ee48677</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">no 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">cconnewsone,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>') ;
iOneGallery233757.style =  escape('<?xml version="1.0" encoding="UTF-8"?><properties id="styles"><map id="font"><property id="url">http://cdn.newsone.com/wp-content/plugins/ione-core/framework/fonts/Aller_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">#000000</property><!-- defines button over color for all nav buttons --><property id="selected_color">#b9b8b8</property><!-- defines button selected color for thumb view page buttons --><property id="background_color">#DE0B1F</property><!-- navigation bg color--><property id="font">{"fontName":"Aller", "fontSize":14, "fontWeight":"bold"}</property><!-- json notation font --><property id="text_offset">0,0</property><!-- comma separated values top, left --></map><map id="slide_display"><property id="background">http://cdn.newsone.com/wp-content/themes/radio/styles/NewsOne/images/mediatray/default_image_background_v2.gif</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">#CCCCCC</property><!-- OPTIONAL - border around the photo well --><property id="preloader_color">#000000</property><property id="error_color">#000000</property><!-- credit field --><property id="credit_font">{"color":"#8B8B8B","fontName":"Aller", "fontSize":10}</property><!-- json notation font --><property id="credit_text_offset">3,0</property><!-- comma separated values top, left --><!-- caption field (under photo) --><property id="caption_font">{"color":"#FFFFFF","fontName":"Aller", "fontWeight":"bold", "fontSize":18}</property><!-- json notation font --><property id="caption_text_offset">0,-2</property><!-- comma separated values top, left --><property id="description_font">{"color":"#FFFFFF","fontName":"Aller", "fontSize":14}</property><!-- json notation font --><property id="description_text_offset">0,0</property><!-- comma separated values top, left --><property id="caption_background">{"color":"#292929", "alpha":0.75}</property><property id="caption_border">{"color":"#D1D1D1"}</property></map><map id="thumbnails"><property id="background_color">#b9b8b8</property><!-- thumbnail countainer background color --><property id="border_color">#CCCCCC</property><!-- thumbnail container border color --><property id="preloader_color">#CCCCCC</property><property id="error_color">#CCCCCC</property><!-- thumbnail photo wells --><property id="well_border_up">#DE0B1F</property><!-- thumbnail border upstate color --><property id="well_up_alpha">0.4</property><!-- thumbnail upstate alpha --><property id="well_border_over">#FFFFFF</property><!-- thumbnail border overstate color --><!-- applies to "Next Gallery" button --><property id="btn_background_color_up">#FFFFFF</property><!--OPTIONAL: next gallery background color --><property id="btn_background_color_over">#000000</property><!--OPTIONAL: next gallery background color --><property id="btn_border_up">#DE0B1F</property> <!-- OPTIONAL: next gallery foreground color --><property id="btn_border_over">#DE0B1F</property><!-- OPTIONAL: next gallery foreground over color --><property id="font">{"fontName":"Aller", "fontSize":11, "fontWeight":"bold"}</property><!-- json notation font --><property id="text_offset">0,0</property><!-- comma separated values top, left --></map><map id="endcard"><property id="background_color">#b9b8b8</property><!-- endcard background color --><property id="border_color">#CCCCCC</property><!-- endcard border color --><property id="icon_fg_up">#FFFFFF</property><!-- endcard icon foreground upstate color --><property id="icon_bg_up">#DE0B1F</property><!-- endcard icon background upstate color --><property id="icon_fg_over">#FFFFFF</property><!-- endcard icon foreground overState color --><property id="icon_bg_over">#000000</property><!-- endcard icon background overState color --><property id="font">{"fontName":"Aller", "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">#DE0B1F</property><property id="upstate">{"iconColor":"#000000", "iconBackground":"#FFFFFF", "fontColor":"#FFFFFF" ,"fontName":"Aller", "fontSize":18, "fontWeight":"bold"}</property><property id="overstate">{"iconColor":"#000000", "iconBackground":"#FFFFFF", "backgroundUp":"#DE0B1F", "backgroundOver":"#000000", "fontColor":"#FFFFFF" ,"fontName":"Aller", "fontSize":12, "fontWeight":"bold"}</property></map><!-- GALLERY LAUNCHER STYLE --><map id="launcher"><property id="frame">{"color":"#FFFFFF", "padding":10}</property><property id="background">#FFFFFF,#CCCCCC</property><property id="border">#DBD9D9</property></map><map id="launcher_nav"><property id="background">http://cdn.newsone.com/wp-content/themes/radio/styles/NewsOne/images/mediatray/launcher_background.gif</property><property id="button">{"background_up":"#DCDCDC","foreground_up":"#DE0B1F","background_over":"#FFFFFF","foreground_over":"#DE0B1F"}</property><property id="text">{"color":"#FFFFFF","fontName":"Aller", "fontWeight":"bold","fontSize":14}</property><property id="text_offset">0,-1</property><property id="sponsor_border">{"up_color":"#FFFFFF","over_color":"#DE0B1F", "width":1}</property></map><map id="launcher_main_photo"><property id="credit">{"color":"#000000","fontName":"Aller", "fontSize":8, "padding":2}</property><property id="caption_background">{"color":"#292929", "alpha":0.75}</property><property id="caption_border">{"color":"#D1D1D1"}</property><property id="caption_font">{"color":"#FFFFFF","fontName":"Aller", "fontSize":22, "fontWeight":"bold"}</property><property id="caption_text_offset">0,1</property><property id="description_font">{"color":"#FFFFFF","fontName":"Aller", "fontSize":14}</property><property id="description_text_offset">0,0</property></map><map id="launcher_title"><property id="text">{"color":"#333333","fontName":"Aller", "fontSize":32, "fontWeight":"bold"}</property><property id="text_offset">0,-2</property><property id="background">#FFFFFF</property><property id="icon">#DE0B1F</property></map><!-- MORE GALLERIES MODULE --><map id="tabs"><property id="background">{"upColor":"#DE0B1F","overColor":"#9c9c9c","selectedColor":"#000000","border":"3"}</property><!-- up,over,selected--><property id="label">{"y":"9","x":"16","upColor":"#FFFFFF","overColor":"#FFFFFF","selectedColor":"#FFFFFF","fontFamily":"Aller","fontWeight":"bold","fontSize":"18px"}</property></map><map id="panes"><property id="pane">{"backgroundColor":"#000000","itemSpacing":"9","margin":"11"}</property></map><map id="items"><property id="title">{"selectedColor":"#000000","upColor":"#FFFFFF","fontFamily":"Aller","fontSize":"15px"}</property><property id="description">{"selectedColor":"#FFFFFF","upColor":"#cccccc","fontFamily":"Aller","fontSize":"12px","leading":"1"}</property><property id="thumb">{"selectedColor":"#b9b8b8","upColor":"#CCCCCC"}</property><property id="border">{"selectedColor":"#DE0B1F","upColor":"#FFFFFF"}</property><property id="background">{"selectedColor":"#b9b8b8","upColor":"#000000"}</property><property id="preloader">{"color":"#000000"}</property><property id="error">{"color":"#000000"}</property></map><map id="scroller"><property id="colors">{"trackColor":"#b9b8b8","knobBgColor":"#DE0B1F","knobGripColor":"#333333"}</property></map></properties>') ;
iOneGallery233757.source =  "http://cdn1.newsone.com/?ione-gallery-xml=233757&ione-gallery-type=live";
try{
	iOneGallery233757.source = iOneGallery233757.source.split('/')[2].split('.')[0];
} catch(e){};
try{
	if (document.referrer && document.referrer != "" ){
		iOneGallery233757.referrer = document.location.href;
	}else{
		iOneGallery233757.referrer = null;
	}
} catch(e){};
iOneGallery233757.bgColor = "";
iOneGallery233757.fgColor = "";
iOneGallery233757.galleryOpenCallback = "onGalleryOpen";
iOneGallery233757.galleryCloseCallback = "onGalleryClose";

iOneGallery233757.setAllowScriptAccess(SWFTag.ALWAYS);
iOneGallery233757.setAllowNetworking(SWFTag.ALL);
iOneGallery233757.setWmode(SWFTag.OPAQUE);
try{ iOneGallery233757.setBgColor(iOneGallery233757.bgColor); }catch(e){};
iOneGallery233757.addFlashVar('bgColor', iOneGallery233757.bgColor);
iOneGallery233757.addFlashVar('fgColor', iOneGallery233757.fgColor);
iOneGallery233757.addFlashVar('targetApp', 'http://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/overlay-launcher-v2.swf?ver=ee48677');
iOneGallery233757.addFlashVar('appUrl', document.location.href);
iOneGallery233757.addFlashVar('source', iOneGallery233757.source);
iOneGallery233757.addFlashVar('referrer', iOneGallery233757.referrer);
iOneGallery233757.addFlashVar('plsUrl', 'http://cdn1.newsone.com/?ione-gallery-xml=233757&ione-gallery-type=live&ver=1329107589');
iOneGallery233757.addFlashVar('configData', iOneGallery233757.config);
iOneGallery233757.addFlashVar('styleData', iOneGallery233757.style);
iOneGallery233757.addFlashVar('editorEmbed', '[ione-gallery id="233757" src="http://newsone.com"]');
iOneGallery233757.addFlashVar('adDataUrl', sponsorEnabled ? AdHelper.getAdTag("adx","no.home", "140x60", "dcmt=text/xml", "") : '');
iOneGallery233757.addFlashVar("galleryOpenCallback", iOneGallery233757.galleryOpenCallback);
iOneGallery233757.addFlashVar("galleryCloseCallback", iOneGallery233757.galleryCloseCallback);

iOneGallery233757.addFlashVars(document.location.search.substring(1));

// function to set height of launcher embed to photo size
iOneGallery233757.setMovieHeight = function(h){
	jQuery('#gallery_launcher233757').css({'height':h});
}

// overlay opener code, including gallery embed
iOneGallery233757.openOverlay = function(launcher_id, onCloseCallback){
	Logger.info('openOverlay(), launcher_id: ' + launcher_id + ", onCloseCallback: " + onCloseCallback);

	//Gallery Module
	var gallerySwf =  new SWFTag("gallery_app_233757", "http://cdn.newsone.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=ee48677", '100%', '100%', SWFTag.V10);
	try{ gallerySwf.setBgColor(iOneGallery233757.bgColor); }catch(e){};
	gallerySwf.addFlashVar("bgColor", iOneGallery233757.bgColor);
	gallerySwf.addFlashVar("fgColor", iOneGallery233757.fgColor);
	gallerySwf.addFlashVar("targetApp", "http://cdn.newsone.com/wp-content/plugins/ione-core/framework/media-framework-v3.swf?ver=ee48677");
	gallerySwf.addFlashVar("plsUrl", "http://cdn1.newsone.com/?ione-gallery-xml=233757&ione-gallery-type=live?ver=1329107589");
	gallerySwf.addFlashVar("configData", iOneGallery233757.config);
	gallerySwf.addFlashVar("styleData", iOneGallery233757.style);
	gallerySwf.addFlashVar("pageName", document.title);
	gallerySwf.addFlashVar('appUrl', document.location.href);
	gallerySwf.addFlashVar('source', iOneGallery233757.source);
	gallerySwf.addFlashVar('referrer', iOneGallery233757.referrer);
	gallerySwf.addFlashVar('bgActive', bgEnabled);
	
	// MORE GALLERIES Module
	var moreSwf =  new SWFTag("rss_navigation_233757", "http://cdn.newsone.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?ver=ee48677", '100%', '100%', SWFTag.V10);
	try{ moreSwf.setBgColor(iOneGallery233757.bgColor); }catch(e){};
	moreSwf.addFlashVar("bgColor", iOneGallery233757.bgColor);
	moreSwf.addFlashVar("fgColor", iOneGallery233757.fgColor);
	moreSwf.addFlashVar("playlists", "http://cdn1.newsone.com/feed/?galleries=1&type=related&related-id=233757|http://cdn1.newsone.com/feed/?galleries=1&type=hot&duration=60|http://cdn1.newsone.com/feed/?galleries=1");
	moreSwf.addFlashVar("plsUrl", "http://cdn1.newsone.com/?ione-gallery-xml=233757&ione-gallery-type=live");
	moreSwf.addFlashVar("tabs", "RELATED|HOT|RECENT");
	moreSwf.addFlashVar("configData", iOneGallery233757.config);
	moreSwf.addFlashVar("styleData", iOneGallery233757.style);
	moreSwf.addFlashVar("targetApp", "http://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/more-galleries.swf?ver=ee48677");

	// BACKGROUND LOADER Module
	var bgLoaderSwf = new SWFTag("overlay_bg_loader_flash_233757", "http://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?ver=ee48677","100%","100%", SWFTag.V10)
	bgLoaderSwf.addFlashVar("adDataUrl", bgEnabled ? AdHelper.getAdTag("adx","no.home", "1024x576", "dcmt=text/xml", "") : "");

	// SPONSOR Module
	var sponsorSwf = new SWFTag("overlay_sponsor_flash_233757", "http://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?ver=ee48677","100%","100%", SWFTag.V10);
	sponsorSwf.addFlashVar("adDataUrl", sponsorEnabled ? AdHelper.getAdTag("adx","no.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://cdn1.newsone.com/wp-content/plugins/ione-gallery/resources/ad.php?adUrl='+escape(AdHelper.getAdTag("adj","no.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
iOneGallery233757.addFlashVar('launchGalleryFn', 'iOneGallery233757.openOverlay');
iOneGallery233757.addFlashVar('setHeightFn', 'iOneGallery233757.setMovieHeight');

// Add parameters from page's URL as flashvars:
if(document.location.search != null && document.location.search.length > 1) {
	iOneGallery233757.addFlashVars(document.location.search);
}
// Generate markup:
iOneGallery233757.fillElementId('gallery_launcher233757');

// external launcher button
if (openGallery == null){
	var openGallery = function(){
		iOneGallery233757.openOverlay('gallery_launcher_app_233757', iOneGallery233757.galleryCloseCallback);
		jQuery('#gallery_launcher_app_233757')[0][iOneGallery233757.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_233757').after('<!-- EMBED:\r\r[ione-gallery id="233757" src="http://newsone.com"]\r\r-->');
