var bgEnabled = ("").length > 0 && "" != "false";
var sponsorEnabled  = ("").length > 0 && "" != "false";
var adDeactivated = ("").length > 0 && "" != "false";

var iOneGallery83971 = new SWFTag("gallery_launcher_app_83971", "http://cdn.kissrichmond.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?cacheburst=13787", '100%', '100%', SWFTag.V10);
iOneGallery83971.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">3</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.kissrichmond.com/wp-content/plugins/ione-gallery/resources/overlay-gallery.swf?cacheburst=13787</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">wkjs 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="pageName">wkjs:wp-admin+options-general.php+index.html:Gallery</property><property id="account">cconwkjm,cconRadio,cconbpuniverse,cconricmarket</property><property id="autoTrack">false</property></map><map id="omniture_pageview"><property id="eVar2">wkjs:wp-admin+options-general.php+index.html:gallery:{track.number}:{track.location}</property></map><map id="omniture_launcher"><property id="eVar2">gallery:launch</property></map></properties></configuration>') ;
iOneGallery83971.style =  escape('<?xml version="1.0" encoding="UTF-8"?><properties id="styles"><map id="font"><property id="url">http://cdn.kissrichmond.com/wp-content/plugins/ione-core/framework/fonts/LucidaGrande_v3.swf?ck=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">#333333</property><!-- defines button over color for all nav buttons --><property id="selected_color">#333333</property><!-- defines button selected color for thumb view page buttons --><property id="background_color">#6699FF</property><!-- navigation bg color--><property id="font">{"fontName":"Lucida Grande", "fontSize":15}</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.kissrichmond.com/wp-content/themes/radio/images/mediatray/default_image_background.png</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">#999999</property><property id="error_color">#999999</property><!-- credit field --><property id="credit_font">{"color":"#8B8B8B","fontName":"Lucida Grande", "fontSize":9}</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":"Lucida Grande", "fontWeight":"bold", "fontSize":19}</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 Grande", "fontSize":12}</property><!-- json notation font --><property id="description_text_offset">0,2</property><!-- comma separated values top, left --><property id="caption_background">{"color":"#292929", "alpha":0.75}</property><property id="caption_border">{"color":"#FFFFFF"}</property></map><map id="thumbnails"><property id="background_color">#2A2A2A</property><!-- thumbnail countainer background color --><property id="border_color">#B6B6B6</property><!-- thumbnail container border color --><property id="preloader_color">#999999</property><property id="error_color">#999999</property><!-- thumbnail photo wells --><property id="well_border_up">#6699FF</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">#333333</property><!--OPTIONAL: next gallery background color --><!--<property id="btn_border_up">#333333</property> OPTIONAL: next gallery foreground color --><property id="btn_border_over">#6699FF</property><!-- OPTIONAL: next gallery foreground over color --><property id="font">{"fontName":"Lucida Grande", "fontSize":11}</property><!-- json notation font --><property id="text_offset">0,0</property><!-- comma separated values top, left --></map><map id="endcard"><property id="background_color">#2A2A2A</property><!-- endcard background color --><property id="border_color">#B6B6B6</property><!-- endcard border color --><property id="icon_fg_up">#6699FF</property><!-- endcard icon foreground upstate color --><property id="icon_bg_up">#FFFFFF</property><!-- endcard icon background upstate color --><property id="icon_fg_over">#6699FF</property><!-- endcard icon foreground overState color --><property id="icon_bg_over">#333333</property><!-- endcard icon background overState color --><property id="font">{"fontName":"Lucida Grande", "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">#6699FF</property><property id="upstate">{"iconColor":"#000000", "iconBackground":"#FFFFFF", "fontColor":"#FFFFFF" ,"fontName":"Lucida Grande", "fontSize":20, "textOffset":"-2,0"}</property><property id="overstate">{"iconColor":"#FFFFFF", "iconBackground":"#000000", "backgroundUp":"#6699FF", "backgroundOver":"#FFFFFF", "fontColor":"#000000" ,"fontName":"Lucida Grande", "fontWeight":"bold", "fontSize":11}</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_title"><property id="text">{"color":"#333333","fontName":"Lucida Grande", "fontSize":28}</property><property id="text_offset">0,-2</property><property id="background">#FFFFFF</property><property id="icon">#6699FF</property></map><map id="launcher_main_photo"><property id="credit">{"color":"#000000","fontName":"Lucida Grande", "fontSize":9, "padding":2}</property><property id="caption_background">{"color":"#292929", "alpha":0.75}</property><property id="caption_border">{"color":"#FFFFFF"}</property><property id="caption_font">{"color":"#FFFFFF","fontName":"Lucida Grande", "fontWeight":"bold", "fontSize":23}</property><property id="caption_text_offset">0,0</property><property id="description_font">{"color":"#FFFFFF","fontName":"Lucida Grande", "fontSize":14}</property><property id="description_text_offset">0,1</property></map><map id="launcher_nav"><property id="background">#000000</property><property id="button">{"background_up":"#EEEEEE","foreground_up":"#6699FF","background_over":"#FFFFFF","foreground_over":"#000000"}</property><property id="text">{"color":"#FFFFFF","fontName":"Lucida Grande", "fontSize":14}</property><property id="text_offset">0,-2</property><property id="sponsor_border">{"up_color":"#FFFFFF","over_color":"#0000CC", "width":1}</property></map><!-- MORE GALLERIES MODULE --><map id="tabs"><property id="background">{"upColor":"#6699FF","overColor":"#CCCCCC","selectedColor":"#8B8B8B","border":"3"}</property><!-- up,over,selected--><property id="label">{"y":"9","x":"10","upColor":"#FFFFFF","overColor":"#333333","selectedColor":"#FFFFFF","fontFamily":"Lucida Grande","fontSize":"20px"}</property></map><map id="panes"><property id="pane">{"backgroundColor":"#8B8B8B","itemSpacing":"7","margin":"5"}</property></map><map id="items"><property id="title">{"selectedColor":"#000000","upColor":"#000000","fontFamily":"Lucida Grande","fontSize":"15px"}</property><property id="description">{"selectedColor":"#FFFFFF","upColor":"#FFFFFF","fontFamily":"Lucida Grande","fontSize":"13px","leading":"2"}</property><property id="thumb">{"selectedColor":"#AAAAAA","upColor":"#AAAAAA"}</property><property id="border">{"selectedColor":"#222222","upColor":"#FFFFFF"}</property><property id="background">{"selectedColor":"#CCCCCC","upColor":"#8B8B8B"}</property><property id="preloader">{"color":"#333333"}</property><property id="error">{"color":"#333333"}</property></map><map id="scroller"><property id="colors">{"trackColor":"#333333","knobBgColor":"#6699FF","knobGripColor":"#333333"}</property></map></properties>') ;
iOneGallery83971.bgColor = "#000000";
iOneGallery83971.fgColor = "#666666";
iOneGallery83971.galleryOpenCallback = "onGalleryOpen";
iOneGallery83971.galleryCloseCallback = "onGalleryClose";

iOneGallery83971.setAllowScriptAccess(SWFTag.ALWAYS);
iOneGallery83971.setAllowNetworking(SWFTag.ALL);
iOneGallery83971.setWmode(SWFTag.OPAQUE);
try{ iOneGallery83971.setBgColor(iOneGallery83971.bgColor); }catch(e){};
iOneGallery83971.addFlashVar('bgColor', iOneGallery83971.bgColor);
iOneGallery83971.addFlashVar('fgColor', iOneGallery83971.fgColor);
iOneGallery83971.addFlashVar('targetApp', 'http://cdn.kissrichmond.com/wp-content/plugins/ione-gallery/resources/overlay-launcher-v2.swf?cacheburst=13787');
iOneGallery83971.addFlashVar('appUrl', document.location.href);
iOneGallery83971.addFlashVar('plsUrl', 'http://cdn.kissrichmond.com/?ione-gallery-xml=83971&ione-gallery-type=live&cache=1283850308');
iOneGallery83971.addFlashVar('configData', iOneGallery83971.config);
iOneGallery83971.addFlashVar('styleData', iOneGallery83971.style);
iOneGallery83971.addFlashVar('editorEmbed', '[ione-gallery id="83971" src="http://kissrichmond.com"]');
iOneGallery83971.addFlashVar('adDataUrl', sponsorEnabled ? AdHelper.getAdTag("adx","r1.ra.ric.wkjs", "140x60", "dcmt=text/xml") : '');
iOneGallery83971.addFlashVar("galleryOpenCallback", iOneGallery83971.galleryOpenCallback);
iOneGallery83971.addFlashVar("galleryCloseCallback", iOneGallery83971.galleryCloseCallback);

iOneGallery83971.addFlashVars(document.location.search.substring(1));

// function to set height of launcher embed to photo size
iOneGallery83971.setMovieHeight = function(h){
	jQuery('#gallery_launcher83971').css({'height':h});
}

// overlay opener code, including gallery embed
iOneGallery83971.openOverlay = function(launcher_id, onCloseCallback){
	Logger.info('openOverlay(), launcher_id: ' + launcher_id + ", onCloseCallback: " + onCloseCallback);

	//Gallery Module
	var gallerySwf =  new SWFTag("gallery_app_83971", "http://cdn.kissrichmond.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?cacheburst=13787", '100%', '100%', SWFTag.V10);
	try{ gallerySwf.setBgColor(iOneGallery83971.bgColor); }catch(e){};
	gallerySwf.addFlashVar("bgColor", iOneGallery83971.bgColor);
	gallerySwf.addFlashVar("fgColor", iOneGallery83971.fgColor);
	gallerySwf.addFlashVar("targetApp", "http://cdn.kissrichmond.com/wp-content/plugins/ione-core/framework/media-framework-v3.swf?cacheburst=13787");
	gallerySwf.addFlashVar("plsUrl", "http://cdn.kissrichmond.com/?ione-gallery-xml=83971&ione-gallery-type=live?cache=1283850308");
	gallerySwf.addFlashVar("configData", iOneGallery83971.config);
	gallerySwf.addFlashVar("styleData", iOneGallery83971.style);
	gallerySwf.addFlashVar("pageName", document.title);
	gallerySwf.addFlashVar('bgActive', bgEnabled);

	// MORE GALLERIES Module
	var moreSwf =  new SWFTag("rss_navigation_83971", "http://cdn.kissrichmond.com/wp-content/plugins/ione-core/framework/preloader-v3.swf?cacheburst=13787", '100%', '100%', SWFTag.V10);
	try{ moreSwf.setBgColor(iOneGallery83971.bgColor); }catch(e){};
	moreSwf.addFlashVar("bgColor", iOneGallery83971.bgColor);
	moreSwf.addFlashVar("fgColor", iOneGallery83971.fgColor);
	moreSwf.addFlashVar("playlists", "http://cdn.kissrichmond.com/feed/?galleries=1&type=related&related-id=83971|http://cdn.kissrichmond.com/feed/?galleries=1&type=hot&duration=60|http://cdn.kissrichmond.com/feed/?galleries=1");
	moreSwf.addFlashVar("plsUrl", "http://cdn.kissrichmond.com/?ione-gallery-xml=83971&ione-gallery-type=live");
	moreSwf.addFlashVar("tabs", "RELATED|HOT|RECENT");
	moreSwf.addFlashVar("configData", iOneGallery83971.config);
	moreSwf.addFlashVar("styleData", iOneGallery83971.style);
	moreSwf.addFlashVar("targetApp", "http://cdn.kissrichmond.com/wp-content/plugins/ione-gallery/resources/more-galleries.swf?cacheburst=13787");

	// BACKGROUND LOADER Module
	var bgLoaderSwf = new SWFTag("overlay_bg_loader_flash_83971", "http://cdn.kissrichmond.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?cacheburst=13787","100%","100%", SWFTag.V10)
	bgLoaderSwf.addFlashVar("adDataUrl", bgEnabled ? AdHelper.getAdTag("adx","r1.ra.ric.wkjs", "980x780", "dcmt=text/xml") : "");

	// SPONSOR Module
	var sponsorSwf = new SWFTag("overlay_sponsor_flash_83971", "http://cdn.kissrichmond.com/wp-content/plugins/ione-gallery/resources/ad-module.swf?cacheburst=13787","100%","100%", SWFTag.V10);
	sponsorSwf.addFlashVar("adDataUrl", sponsorEnabled ? AdHelper.getAdTag("adx","r1.ra.ric.wkjs", "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.kissrichmond.com/wp-content/plugins/ione-gallery/resources/ad.php?adUrl='+escape(AdHelper.getAdTag("adj","r1.ra.ric.wkjs", "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
iOneGallery83971.addFlashVar('launchGalleryFn', 'iOneGallery83971.openOverlay');
iOneGallery83971.addFlashVar('setHeightFn', 'iOneGallery83971.setMovieHeight');

// Add parameters from page's URL as flashvars:
if(document.location.search != null && document.location.search.length > 1) {
	iOneGallery83971.addFlashVars(document.location.search);
}
// Generate markup:
iOneGallery83971.fillElementId('gallery_launcher83971');

// external launcher button
if (openGallery == null){
	var openGallery = function(){
		iOneGallery83971.openOverlay('gallery_launcher_app_83971', iOneGallery83971.galleryCloseCallback);
		jQuery('#gallery_launcher_app_83971')[0][iOneGallery83971.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_83971').after('<!-- EMBED:\r\r[ione-gallery id="83971" src="http://kissrichmond.com"]\r\r-->');