/* --------------------------------------------------------------------------------------------*/

var email_this_page_html;//global variable for email_this_page AJAX functionality
var featuredPanel;//global variable telling accordion which panel to open on startup
var bookPanelID; var audioPanelID; var ebookPanelID; var otherPanelID;




jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}


function cleanISBN (isbn) {
	
 return isbn.replace(/[^\d]/g, "");
				
            }



function categoryClick(categoryName)
{
	s.linkTrackVars="eVar18,prop13"; 
	s.prop13=s.eVar18=categoryName;
	
	s.tl(this,'o','Category Click');
}

function tagClick(tagName)
{
	s.linkTrackVars="eVar17,prop12"; 
	s.prop12=s.eVar17=tagName;
	
	s.tl(this,'o','Tag Click');


}



function handleOver() {
 if (document.images) 
  document.imgName.src=img_on.src;
}

function handleOut() {
 if (document.images) 
  document.imgName.src=img_off.src;
}

function build_insight_widget(radio){
	if (!radio.widgetbuilt){
		if (document.insightdata[radio.value]){

			if(getFlashVersion() >= 9) {

				var widgetHTML = BookViewerText('preview', radio.value, document.insightdata[radio.value]['title'], document.insightdata[radio.value]['authorweb'], 0, document.insightdata[radio.value]['configUrlString'], 'http://www.randomhouse.com/cgi-bin/buy_landing.php?isbn=' + radio.value, '', 'skip_catalog_page_on_buy=1');
		
//alert(widgetHTML);
				var insight_holder = getByID('insight_holder');
				insight_holder.innerHTML = widgetHTML;
				var widget = insight_holder.firstChild;

				widget.style.position = 'absolute';
				widget.style.left = 0;
				widget.style.top = 0;

				var cover_holder = getByClass('fake_insight_cover', radio.covers)[radio.radionum];
				cover_holder.appendChild(widget);

				radio.widgetbuilt = 1;
			}
		}
	}
}

function promoteTab(panel, tab){
	tab = getByClass('tab', tab)[0];
	tab.promoted = 1;
	tab.style.backgroundPosition = tab.backX + ' 0px';
	var coverbottoms = getByClass('coverbottoms', panel)[0];
	$(coverbottoms).fadeTo(500, 1);
}
function demoteTab(panel, tab){
	
	tab = getByClass('tab', tab)[0];
	tab.promoted = 0;
	tab.style.backgroundPosition = tab.backX + ' 335px';
	var coverbottoms = getByClass('coverbottoms', panel)[0];
	$(coverbottoms).fadeTo(500, 0);
}
function show_tags_cat(remainder, seemore){
	$(remainder).slideDown(500);
	$(seemore).hide();
}
function hide_tags_cat(remainder, seemore){
	$(remainder).slideUp(500);
	$(seemore).delay(500).show(0);
}
function promote_major_tab(tab, initial){
if (initial==null)//make omniture call only if tab is clicked on,
{
	s.linkTrackVars="prop1,prop4,prop5,prop6,prop7,prop8"; 
	if (tab.tab_name)
		s.pageName = "PD: Tab - "+ tab.tab_name + ": " + omniture_workid + ": " + omniture_title + ": " + omniture_author;
	else 
		s.pageName = "PD: Tab - " + ": " + omniture_workid + ": " + omniture_title + ": " + omniture_author;
	s.prop4 = "Product Tab";
	s.tl(this,'o','Tab Click');
}

	tab.focused = 1;

	tab.style.padding = '8px 9px 8px 9px';
	tab.style.borderWidth = '1px';
	tab.style.borderBottom = '0px';

	var normal = getByClass('normal', tab)[0];
	var selected = getByClass('selected', tab)[0];

	if (document.ie){
		normal.saved_src = normal.src;
		normal.src = selected.src;
	}
	else{
		$(normal).fadeTo(500, 0);
		$(selected).fadeTo(500, 1);
	}
	tab.style.backgroundImage = 'url(/book/images/gradient2.png)';

	for (var i=0; i<tab.peers.length; i++){
		demote_major_tab(tab.peers[i]);
	}
	$(tab.mypanel).show();
}
function demote_major_tab(tab){
	if (tab.focused > 0){
		$(tab.mypanel).hide();
		tab.focused = 0;
	
		tab.style.padding = '9px 10px 9px 10px';
		tab.style.borderWidth = '0';

		var normal = getByClass('normal', tab)[0];
		var selected = getByClass('selected', tab)[0];

		if (document.ie){
			normal.src = normal.saved_src;
		}
		else{
			$(selected).fadeTo(500, 0);
			$(normal).fadeTo(500, 1);
		}

		tab.style.backgroundImage = 'none';
	}
}
function promote_minor_tab(tab){
	$(tab.myblurb).show();
	$(tab).removeClass('minor_tab_unfocused');

	for (var i=0; i<tab.peers.length; i++){
		demote_minor_tab(tab.peers[i]);
	}
}
function demote_minor_tab(tab){
	$(tab).addClass('minor_tab_unfocused');
	$(tab.myblurb).hide();
}

function get_featured_panel_by_isbn(format_or_isbn)
{
	
format_or_isbn = cleanISBN(format_or_isbn);//remove nondigits

var print_editions = getByClass('print_editions');
	if(print_editions!="")
	{
		var print_edition_isbns = getByClass('isbn', print_editions[0]);
		
		for (x=0;x<print_edition_isbns.length;x++)
			if (format_or_isbn==cleanISBN(print_edition_isbns[x].innerHTML))
				return bookPanelID;
	}

	var audio_editions = getByClass('audio_editions');
	if(audio_editions!="")
	{
		var audio_edition_isbns = getByClass('isbn', audio_editions[0]);
		
		for (x=0;x<audio_edition_isbns.length;x++)
			if (format_or_isbn==cleanISBN(audio_edition_isbns[x].innerHTML))
				return audioPanelID;
	}
	
	
	var ebook_editions = getByClass('ebook_editions');
	if(ebook_editions!="")
	{
	
		var ebook_edition_isbns = getByClass('isbn', ebook_editions[0]);
		
		for (x=0;x<ebook_edition_isbns.length;x++)
			if (format_or_isbn==cleanISBN(ebook_edition_isbns[x].innerHTML))
				return ebookPanelID;
			
	}
			
	var other_editions = getByClass('other_editions');
	if(other_editions!="")
	{
		var other_edition_isbns = getByClass('isbn', other_editions[0]);		
		for (x=0;x<ebook_edition_isbns.length;x++)
			if (format_or_isbn==cleanISBN(ebook_edition_isbns[x].innerHTML))
				return otherPanelID;
	}
			
			
			


	
}
/* -----------------------------------------------------------------------------------------------*/

$(document).ready( function(){


    jQuery('#mycarousel').jcarousel({
        visible: 5,
		wrap: 'circular'

    });


var format_or_isbn = window.location.hash.replace("#", "");//used to focus on specific title or format
if (!format_or_isbn)
	format_or_isbn = jQuery.url.segment(3);

	
	
	
	


	/* --------------------------------------------------------------------------------

		This code rearanges the elements of the page to build the accordion
		and the blurb tabs.

		Also, rollovers, onclicks and anything that needs to be precomputed.

	---------------------------------------------------------------------------------*/
	
	/*
	Buy Button Popup Code
	*/
	
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
	s.linkTrackVars="prop1,prop4,prop5,prop6,prop7,prop8,products,eVar7,eVar31,events"; 
	s.linkTrackEvents="event4"; 
	s.events="event4";
	s.pageName = "PD: " + omniture_workid + ": " + omniture_title + ": " + omniture_author + ": Buy Now";
	s.tl(this,'o','Buy From Click');  //this sends the data to Adobe
	
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
		
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(document).width();	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
			
		$('#mask').fadeTo(100,0.3);	
	
		$(id).center();
		
		//transition effect
		$(id).fadeIn(200); 
	
	});
	
	//function buyClick (retailer, isbn)
	$('a[name=other_retailer_link]').click(function(e) {
		

		isbn = $(this).attr('isbn');
		retailer = $(this).attr('retailer');
		s.linkTrackVars="prop1,prop5,prop6,prop7,prop8,eVar7,eVar8,eVar13 ,eVar14,eVar15,products,events"; 
		s.linkTrackEvents="event5"; 
		s.eVar15=retailer; 
		s.products=";" + isbn;  //note the semi-colon 
		s.events="event5"; 
		
		
		s.tl(this,'o','Retailer Click');  //this sends the data to Adobe
		} );
	
			
	
	
	
	email_this_page_html = getByID('email_this_page').innerHTML;
	//display email this page box
	$('a[name=email_this_page_button]').click( function (){
		var maskHeight = $(document).height();
		var maskWidth = $(document).width();	
		
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
			$('#mask').fadeTo(100,0.3);	
			$('#email_this_page').center();
			$('#email_this_page').fadeIn(200);
			return false;
		} );
	
	//if mask is clicked
	$('#mask').click(close);	
	
	//close all open windows
	function close()
	{
		 
		$('.window').hide();
		$('.more_online_stores').hide();
		$('#email_this_page').hide();
		$('#mask').hide();
		 getByID('email_this_page').innerHTML= email_this_page_html;//replace thank you text with original email this page html
		 return false;
	};
	
	/*
	See More Online Stores Drop Down - no longer used but kept incase we want to bring it back
	*/
	
	$("a[name=see_more_online_stores]").toggle(
	 function () {
    $(this).find("img").attr({src:"/book/images/see_less_online_stores.jpg"});
	var id = $(this).attr('href');
	
		//Get the screen height and width
		
	
	
		
	
		//transition effect
		$(id).fadeIn(500); 
  },
  function () {
   $(this).find("img").attr({src:"/book/images/see_more_online_stores.jpg"});
   	var id = $(this).attr('href');
	
		//Get the screen height and width
		
	
	
		
	
		//transition effect
		$(id).fadeOut(500); 
  }
);

			

	
	
	
	
	//if close button is clicked
	$('.close').click(close);		
	
	//if mask is clicked

	/*
	End More Online Stores Drop Down
	*/
	
	$('.yesscript').removeClass('yesscript');

	/* ----- Accordion setup --------------------------------------------------------*/

	var tabFill = getByClass('tab');
	var contentFill = getByClass('panel');
	
	
	var toDemote = [];

	/* ------ Radio button setup ----------------------------------------------------*/
	for (var i=0; i<contentFill.length; i++){
		var editions_panel = contentFill[i];

		var editions 		= getByClass('edition', editions_panel);
		var radios 			= getByClass('radio', editions_panel);
		var covers			= getByClass('covers', editions_panel)[0];
	
		var coverbottoms	= getByClass('coverbottoms', editions_panel)[0];
		
		if (radios[0]){
	
		
			
			//setup functionality for each radio button
			for (var ii=0; ii<radios.length; ii++){
				radio = radios[ii];
			
				radio.hideables = getByClass('edition_hideables', editions[ii]);
				radio.edition_padding = getByClass('edition_padding', editions[ii]);
				radio.covers = covers;
				radio.coverbottoms = coverbottoms;
				radio.panelnum = i;
				radio.radionum = ii;
				radio.format = getByClass('radio_format', editions[ii]);
				radio.isbn = getByClass('isbn', editions[ii]);
				radio.imprint = getByClass('imprint', editions[ii]);
				radio.division = getByClass('division', editions[ii]);
				

				//---- set up peers array --------------------
				radio.peers = [];
				for (var iii=0; iii<radios.length; iii++){
					if (ii != iii){
						radio.peers.push(radios[iii]);
					}
				}

				radio.demote = function(){
					for (var i=0; i<this.hideables.length; i++){

						$(this.hideables[i]).hide(500);
						$(this.edition_padding).animate({
							marginTop: '5px',
							marginBottom: '5px'
						});
					}
					this.checked = false;
				}
				
		
				radio.promote = function(initial) {
					if (this.format[0])
					{
						s.prop8 = this.format[0].innerHTML;//set omniture code format variable
					}
					if (this.imprint[0])
					{
						s.prop5=this.imprint[0].innerHTML; 
						s.eVar7=this.imprint[0].innerHTML;
					}
					if (this.division[0])
					{
						s.eVar31=this.division[0].innerHTML;  //Division 
						s.prop1=this.division[0].innerHTML; 
					}
					if (this.isbn[0])
					{
						s.products=';' + this.isbn[0].innerHTML;  //ISBN 
					
					}
					s.linkTrackVars="prop1,prop4,prop5,prop6,prop7,prop8,products,eVar7,eVar31, events"; 
					s.linkTrackEvents="event3,prodView"; 
					if (initial != 'flexi')//dont set on initial load
					{
						s.events="prodView,event3";
						s.linkTrackVars="prop1,prop4,prop5,prop6,prop7,prop8,products,eVar7,eVar31,events"; 
						s.tl(this,'o','Radio Click');  //this sends the data to Adobe
					}	
					
					var obj = this;
					
					changeFlapCopy(obj.value);
					//build_insight_widget(obj);

					$(this.covers).animate({
						top: '-' + (335 * this.radionum) + 'px'
					}, 500, function () { build_insight_widget(obj) } );
				
					this.coverbottoms.style.top = '-' + (25 * this.radionum) + 'px';

					for (var i=0; i<this.peers.length; i++){
						
						this.peers[i].demote();
					}
					for (var i=0; i<this.hideables.length; i++){
						$(this.hideables[i]).slideDown(500);
						
					}
					$(this.edition_padding).animate({
						marginTop: '15px',
						marginBottom: '19px'
					});
					
					this.dafocus=1;
					this.checked=1;
				}	
				
				//---- attach promote and demote functions ---
				
				$(radio).click(radio.promote);


				if (ii > 0){
				
					if (format_or_isbn && format_or_isbn.replace(/[^\d]/g, "").length === 13) {
						if(radio.isbn[0].innerHTML.replace(/[^\d]/g, "") !== format_or_isbn.replace(/[^\d]/g, "")) {
							toDemote.push(radio);
						}
					}
					//toDemote.push(radio);
				} 			
				
			}
			
	
			
		} else {
				editions.format = getByClass('radio_format', editions[ii]);
				editions.isbn = getByClass('isbn', editions[ii]);
				editions.imprint = getByClass('imprint', editions[ii]);
				editions.division = getByClass('division', editions[ii]);
		}
	}
	
	
	/* --- Accordion Tab Rollovers --------------------------------------------------*/

	// css doesn't allow you to set x/y background position independently, and IE doesn't allow you
	// to read the background position set by css
	var panelCount=0;
	if (getByID('book_tab')) { 		(getByID('book_tab').backX 			= '0px'); panelCount++; bookPanelID = panelCount; } //get id for bookpanel (panel number), used to show specific format
	if (getByID('ebook_tab')) {		(getByID('ebook_tab').backX 		= '124px'); panelCount++;  ebookPanelID = panelCount; }
	if (getByID('audiobook_tab')) {	(getByID('audiobook_tab').backX 	= '186px'); panelCount++;  audioPanelID = panelCount; }
	if (getByID('other_tab')) {		(getByID('other_tab').backX 		= '62px'); panelCount++;  otherPanelID = panelCount; }

	
	$(".tab").hover(
		function (){
			if (! this.promoted){
				this.style.backgroundPosition = this.backX + ' 0px';
			}
		},
		function (){
			if (! this.promoted){
				this.style.backgroundPosition = this.backX + ' 335px';
			}
		}
	);
	
	
	/* support for format/isbn in url ------------------------------------------------------------------------------
	if no format/url specificed show book tab, otherwise set featured panel and radio button based on format_or_isbn url parameter
	*/ 
	
	switch (format_or_isbn)
{
case null:
featuredPanel=1;
break;
case "ebook":
  featuredPanel=ebookPanelID;
  break;
case "audiobook":
 featuredPanel=audioPanelID;
 break;
case "other":
  featuredPanel=otherPanelID;
  break;

default:
  featuredPanel= get_featured_panel_by_isbn(format_or_isbn);
}



	/* ------- Instantiate the Accordion --------------------------------------------*/
	var accordion = new flexiAccordion(getByID('accordion_shell'), {
		
		count           : contentFill.length,
		tabWidth        : 62,
		height          : 365,
		railHeight      : 1,
		tabFill         : tabFill,
		contentFill     : contentFill,
		featuredPanel   : featuredPanel,
		
		promotionCB     : promoteTab,
		demotionCB      : demoteTab
	} );
	/* ------------------------------------------------------------------------------*/

	// Shrink the formats other than the frontlist
	
	for (var i=0; i<toDemote.length; i++){
		toDemote[i].demote();
	}

	/* ---- Set up the blurb tabs ---------------------------------------------------*/
	var major_tabs = getByClass('major_tab');
	var featured_major_tab = 0;
	
	if (major_tabs!="")
	{
		for (var i=0; i<major_tabs.length; i++){
			var major_tab = major_tabs[i];
			major_tab.tab_name = getByClass('omniture_tab_name', major_tabs[i]);
			major_tab.tab_name = major_tab.tab_name[0].innerHTML;
			major_tab.name_lc = major_tab.tab_name.replace(/ /g,'').toLowerCase();
			if (major_tab.name_lc == jQuery.url.param("view") || major_tab.name_lc == format_or_isbn  )
			{
				 featured_major_tab =i;
				
			}
			//support for praise & awards because of the "&"
			//if (major_tab.name_lc == "praise&amp;awards" && (jQuery.url.param("view") == "praiseawards"  || major_tab.name_lc == "praise&amp;awards"))
			if (major_tab.name_lc == "praise&amp;awards" && (jQuery.url.param("view") == "praiseawards"))
			{
				 featured_major_tab =i;
				
				
			}
		
			major_tab.peers = [];
			for (var ii=0; ii<major_tabs.length; ii++){
				if (i != ii){
					major_tab.peers.push(major_tabs[ii]);
				}
			}
		}
	
		$('.major_tab').click(
			function(){
				location.hash = this.name_lc;
				promote_major_tab(this);
			}
		);
		$('.minor_tab').click(
			function(){
				location.hash = this.stripped_lc_tab_name;
				promote_minor_tab(this);
			}
		);
		
		
	
		/* ----- Move the blurb tabs into there new homes -------------------------------*/
	
		var blurb_box 			= getByID('blurb_box');
		var major_blurb_panels 	= getByClass('major_blurb_panel');
		var major_tabs 			= getByClass('major_tab');
		var view				= jQuery.url.param("view");
		var hash				= window.location.hash.replace("#", "");
		if(!view && hash)
			view = hash;
		
	
		for (var i=0; i<major_blurb_panels.length; i++){
			major_tabs[i].mypanel = major_blurb_panels[i];
	
			blurb_box.appendChild(major_blurb_panels[i]);
	
			var panel = major_blurb_panels[i];
			var blurbs = getByClass('blurb', panel);
			var minor_tabs = getByClass('minor_tab', panel);
			var featured_minor_tab=0;
	
			$(panel).hide();
	
			for (var ii=0; ii<minor_tabs.length; ii++){
				minor_tab = minor_tabs[ii];
				minor_tab.name = minor_tab.innerHTML; 
				minor_tab.id = ii;
				
				
				minor_tab.peers = [];
				for (var iii=0; iii<minor_tabs.length; iii++){
					if (ii != iii){
						minor_tab.peers.push(minor_tabs[iii]);
					}
				}
	
				minor_tabs[ii].myblurb = blurbs[ii];
				$(minor_tabs[ii].myblurb).hide();
				
				minor_tab.stripped_lc_tab_name = minor_tab.name.replace(/ /g,'').toLowerCase();
				if ((minor_tab.stripped_lc_tab_name == view || minor_tab.stripped_lc_tab_name == format_or_isbn) )
				{
					featured_minor_tab = minor_tab.id;
					featured_major_tab = i;
				}
				else if (minor_tab.stripped_lc_tab_name == "authorq&amp;a" && ( view == "auqa" || format_or_isbn == "auqa" ))
				{
					
				featured_minor_tab = minor_tab.id;
				
				 featured_major_tab =i;
				}
			}
			
			if (featured_minor_tab)
			{
				promote_minor_tab(minor_tabs[featured_minor_tab]);
			}
			else
			{
				if(typeof(minor_tabs[0]) !== 'undefined') {
					promote_minor_tab(minor_tabs[0]);
				}
			}
		}
		promote_major_tab(major_tabs[featured_major_tab],true);
	}

	/* ------ Buy Button background animation ---------------------------------------*/

	$('.animated_buy_button')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate(
				{
					borderTopColor:'#f9712f',
					borderBottomColor:'#f9712f',
					borderLeftColor:'#f9712f',
					borderRightColor:'#f9712f',
					backgroundPosition:"(0 -125px)"
				},
				{duration:250})
			})
		.mouseout(function(){
			$(this).stop().animate(
				{
					borderTopColor:'#859fac',
					borderBottomColor:'#859fac',
					borderLeftColor:'#859fac',
					borderRightColor:'#859fac',
					backgroundPosition:"(0 0)"
				},
				{duration:250})
			})

	/* ------ Learn more about audio animation --------------------------------------*/
	$('#learn_more_about_audio')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate(
				{
					borderTopColor:'#f9712f',
					borderBottomColor:'#f9712f',
					borderLeftColor:'#f9712f',
					borderRightColor:'#f9712f',
					backgroundPosition:"(0 -179px)"
				},
				{duration:250})
			})
		.mouseout(function(){
			$(this).stop().animate(
				{
					borderTopColor:'#859fac',
					borderBottomColor:'#859fac',
					borderLeftColor:'#859fac',
					borderRightColor:'#859fac',
					backgroundPosition:"(0 0)"
				},
				{duration:250})
			})

	/* ------------------------------------------------------------------------------*/

	$('#arrow_left_tab').click( function (){
			accordion.rightPlease();
		} );
	
	$('#arrow_left_tab').mouseover( function (){
			accordion.movr(1);
		} );
		
		$('#arrow_left_tab').mouseout( function (){
			
			accordion.mout(1);
		} );
	$('#arrow_right_tab').click( function (){
			accordion.leftPlease();
		} );
	
		$('#arrow_right_tab').mouseover( function (){
			accordion.movr(2);
		} );
		
		$('#arrow_right_tab').mouseout( function (){
			accordion.mout(2);
		} );
		
		$('#select_book_button').click( function (){
			accordion.moveToLeft(accordion.bits.panels[bookPanelID-1]);
			accordion.panelProdview(accordion.bits.panels[bookPanelID-1]);
			$(this).addClass('active');
			$('#select_audiobook_button').removeClass("active");
			$('#select_ebook_button').removeClass("active");
			$('#select_other_button').removeClass("active");
		} );
		
		$('#select_audiobook_button').click( function (){
			accordion.moveToLeft(accordion.bits.panels[audioPanelID-1]);
			accordion.panelProdview(accordion.bits.panels[audioPanelID-1]);
			$(this).addClass('active');
			$('#select_book_button').removeClass("active");
			$('#select_ebook_button').removeClass("active");
			$('#select_other_button').removeClass("active");
		} );
		
		$('#select_ebook_button').click( function (){
			accordion.moveToLeft(accordion.bits.panels[ebookPanelID-1]);
			accordion.panelProdview(accordion.bits.panels[ebookPanelID-1]);
			$(this).addClass('active');
			$('#select_book_button').removeClass("active");
			$('#select_audiobook_button').removeClass("active");
			$('#select_other_button').removeClass("active");
		} );
		
		$('#select_other_button').click( function (){
			accordion.moveToLeft(accordion.bits.panels[otherPanelID-1]);
			accordion.panelProdview(accordion.bits.panels[otherPanelID-1]);
			$(this).addClass('active');
			$('#select_book_button').removeClass("active");
			$('#select_audiobook_button').removeClass("active");
			$('#select_ebook_button').removeClass("active");
		} );
		
	

		
	/* Fancy Box Image Gallery Code  ------------------------------------------------------------------------------*/
	
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.resize();">See Full Screen</a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
}

	
		$("a.seelarger").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'cyclic'		:	true,
		'titlePosition' :   'inside'
		//'titleFormat'		: formatTitle

	});



} );
//----------------------------------------------------------------------------------------------------

/* --------------------------------------------------------------------------------------------*/
// take from http://www.mustardlab.com/developer/dhtml/flashdetection/

b = navigator.userAgent.toLowerCase();
if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
	document.writeln('<script language="VBscript">');
	document.writeln('Function detectActiveXControl(activeXControlName)');
	document.writeln('  on error resume next');
	document.writeln('  detectActiveXControl = False');
	document.writeln('  detectActiveXControl = IsObject(CreateObject(activeXControlName))');
	document.writeln('End Function');
	document.writeln('</scr' + 'ipt>');
}
function getFlashVersion(){
	b = navigator.userAgent.toLowerCase();
	var installedVersion = 0;
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		for (var i=3; i<10; i++){
			if(detectActiveXControl("ShockwaveFlash.ShockwaveFlash."+i) == true) installedVersion = i;
		}
//	installedVersion = 9;
	} else {
		if (navigator.plugins["Shockwave Flash"]) {
			var pluginDesc = navigator.plugins["Shockwave Flash"].description;
			installedVersion = parseInt( pluginDesc.charAt( pluginDesc.indexOf(".")-1 ) );
		}
		if(b.indexOf("webtv") != -1) installedVersion = 3;  
	}
	return installedVersion;
}
/* --------------------------------------------------------------------------------------------*/

//alert(document.compatMode);

/* --------------------------------------------------------------------------------------------*/

