<!--

//****************************************************************************
// Copyright (C) 2006 CDSM Interactive Solutions Ltd. All Rights Reserved.
//****************************************************************************

/**
 * Nadia JavaScript Functions (for People & Places)
 *
 * Set of functions used for replacing the nadia image with a Nadia animation.  This should only happen if 
 * the Flash player is installed on the client PC.  The parent script should check for the Flash Player version
 * before running this script.
 * 
 * Note: - This script depends on the Adobe/Macromedia script "AC_RunActiveContent.js" to be loaded before 
 *         this one.
 *
 *		 - Also relies on "htmlToFlashFunctions.js" to be loaded befor this one.
 * 
 * @author 	Andrew Evans
 * @version	1.0.0 - initial version (09/10/2006)
 * @version	1.0.2 - Added the color prop to flash vars, see "insertFlashBefore()" - (24/10/2006)
 * @version	1.0.3 - Moved re-usable functions to "htmlToFlashFunctions.js" - (25/10/2006)
 */

/**
 * - Find Nadia Div
 * - Get nadia image
 * - Get nadia link
 * - Remove nadia image
 * - Insert Flash version of Nadia and pass link url as querystring into flash
 */
function replaceNadiaImgWithSwf() {
	//alert("replaceNadiaImgWithSwf called");
	// nadia div element (<div class="head_button" id="nadia">...)
	var nadia = findNadia();
	
	// get "a" element from within the nadia div
	var aTag = getFirstLink(nadia);	
	if (aTag == null) {
		return;
	}
	
	// get the url from the href of the "a" element (aTag)
	var nadiaURL = getURL(aTag);
	if (nadiaURL == null) {
		return;
	}
	
	// get background colour
	var c = getBgColor(nadia);
	if (c == null) {
		return;
	}
	// remove the nadia image (we'll replace it with Flash later)
	var imageRemoved = removeImage(aTag);
	if (imageRemoved == null) {
		return;
	}
	// insert flash before the link
	insertFlashBefore(aTag, nadia, c, nadiaURL);
	
}

/**
 * Find nadia image
 */
function findNadia() {
	//alert("findNadia called");
	elem = document.getElementById("nadiax");	
 	return elem;
	
}

/**
 * Inserts flash using MM's script
 */
function insertFlashBefore(target,parent,color,url) {
	//alert("insertFlashBefore called");
	var flashMarkup = AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','168','height','110','src','/flash/nadia_icon','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/flash/nadia_icon', "FlashVars", "color="+color + "&url="+url, "name", "nadia_icon","id","nadia_icon", "title", "Nadia Animation", 'wmode', 'transparent');
	var flashContainer = document.createElement("span");
		flashContainer.innerHTML = flashMarkup;
	parent.insertBefore(flashContainer,target);
	//parent.innerHTML = flashMarkup;
}

-->
