nmsInit = function() {
	hideAllLabels();
	findLinksInNewWindows();
	setupTabs();
	var albert = new Font('albert.swf', {tags:'h1'});
	albert.replace();
	$$('div.wasp').each(function(item) {
		wasp(item.id, "000000", "240", "186", "http://www.nms.ac.uk/media/NMS Restoration Video 1256K.flv", "");
	});
}

// simply insert the active content
// (avoids user needing to click on viewer to interact)
function insert_peter_final_content(width, height)
{
   if (!width) width = 350;
   if (!height) height = 250;
	var str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-4443m553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="3dsom_viewer" align="middle" >';
		str += '<param name="allowScriptAccess" value="sameDomain" >';
			str += '<param name="allowFullScreen" value="false" >';
			str += '<param name="base" value="/threedee/">';
			str += '<param name="movie" value="/threedee/3dsom_viewer.swf" >';
			str += '<param name="quality" value="high" >';
			str += '<param name="bgcolor" value="#ffffff" >';
			str += '<embed src="/threedee/3dsom_viewer.swf" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="3dsom_viewer" base="/threedee/" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" >';
			str += '</object>';
	document.write(str);
}

function clearText(textBoxID,defaultVal){
	if (document.getElementById(textBoxID).value == defaultVal) document.getElementById(textBoxID).value = '';
}

/*Occurs for nmsshop on your details page only */

	// Dot Net 1 - roXx0rS
	var haveOnchangesBeenset =0;
	var cb;
	var title1, title2, forename1, forename2, surname1, surname2, house1, house2, addressA1, addressA2, addressB1, addressB2,  city1, city2, pc1, pc2, country1, country2;

/* Variation of SitePoint's target _blank links in XHTML strict function */
findLinksInNewWindows = function() {
	if (!document.getElementsByClassName) return;
	var anchors = document.getElementsByClassName('newWindow');
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		anchor.target = "_blank";
	}
}

hideAllLabels = function() {
	var fieldsetList = document.getElementsByClassName('hiddenLabel');
	fieldsetList.each( function(fsItem) {
		fieldsetHideLabel(fsItem);
	});
}

/* Function that moves the label into the */
fieldsetHideLabel = function(fieldset) {
	var labelItems = $A(fieldset.getElementsByTagName('label'));
	labelItems.each( function(labelItem) {
		var field = $(labelItem.htmlFor);
		if (field) {
			field.labelValue = labelItem.innerHTML;
			field.value = labelItem.innerHTML;
			field.onclick = function() {		
				if (this.value == this.labelValue)
					this.value = '';		
			}
			
			field.onblur = function() {
				if (this.value == '')
					this.value = this.labelValue;
			}
		}
		
		labelItem.parentNode.removeChild(labelItem);		
	});	
}

setupTabs = function() {
	var tabCollection = $('tabCollection');
	var tabOptions = $('tabOptions');
	Element.addClassName(tabCollection,'jsIsOn');

	if ((tabCollection) && (tabCollection.className.indexOf('nojs') == -1)) {	
		// Give new onClick events to the links
		var tabLinks = $A(tabOptions.getElementsByTagName('a'));
		if (tabLinks) {
			tabLinks.each( function(tabLink) {
				tabLink.tabCollection = tabCollection;
				tabLink.tabOptionLinks = tabLinks;
				
				if (tabLink.parentNode.className.indexOf('current') > -1) {
					var docLink = getDocumentLinkFromUrl(tabLink.href);
					Element.addClassName($(docLink).parentNode,'default');	
				}
			
				tabLink.onclick = function() {
					if (this.parentNode.className.indexOf('current') < 0) {
						var docLink = getDocumentLinkFromUrl(this.href);
						if ($(docLink)) {
							setCurrentStates(this);
							Element.addClassName(this.parentNode,'current');
							
							hideAllTabs(this.tabCollection);
							Element.show($(docLink).parentNode);
						}
					}
					return false;
				}
			});
		}
		
		hideAllTabs(tabCollection);
	}
}

getDocumentLinkFromUrl = function(currentUrl) {
	return currentUrl.substr(currentUrl.indexOf('#')+1,currentUrl.length);
}

hideAllTabs = function(tabCollection) {
	// hide all tabs, while we're here we'll hide all h2's too!
	
	var allTabs = document.getElementsByClassName('tabbable', tabCollection);
	if (allTabs) {
		// If a tab is set as default, then let it show, and strip off the default tag, otherwise hide it.
		allTabs.each( function(tab) {
			var allH2s = $A(tab.getElementsByTagName('h2'));
			allH2s.each( function(eachH2) {
				Element.hide(eachH2);
			});
		
			if(tab.className.indexOf('default') < 0)
				Element.hide(tab);
			else
				Element.removeClassName(tab,'default');
		});
	}
}

/*******************************************************************************
 * Class for embedding flash into the Lightbox 29.01.2009
 * *****************************************************************************
 *
 * @author Stanislav Zorjan - Stasha - [zstasa][@][yahoo].[com]
 *
 *
 * Licensed under the Creative Commons Attribution 3.0 License
 * http://creativecommons.org/licenses/by/3.0/
 *
 * - Free for use in both personal and commercial projects
 * - Attribution requires leaving author name, author link, and the license info intact.
 *



/*                            !!!!  ATTENTION !!!                             */
/* The FlashInLightBox class uses "swfobject" for embedding flash into the Lightbox
 * swfobject can be downloaded from: http://code.google.com/p/swfobject/
 * ****************************************************************************/

/* THE INFO ON HOW TO USE THIS CLASS IS ON THE BOTTOM OF THE CLASS */

/* Class was build and tested on
 * Lightbox v2.04       http://www.lokeshdhakar.com/projects/lightbox2/
 * swfobject v2.1       http://code.google.com/p/swfobject/
 *
 * Tested on Browsers
 * IE 6, 7
 * FF 3.0.5
 * Opera 9.63
 * Safari 3.1.2
 * Chrome 1.0.154.43

/*******************************************************************************
 * Constructor
 */
function FlashInLightBox(){
    var _$this$_ = this;
    /*link to video*/
    this.url = "";
   
    /**************************************************************************/
    /* PARAMETERS */
   
    /*interval after which video is embedded to stage.
     *This is needed because of Lightbox animation.
     *If the value of timeout is smaller than animation time
     *video may be embedded on wrong position, or it won't be
     *visible. If You experience such a problems than try to
     *increase this value.
     */
    this.timeout = 1500 // milliseconds;

    /* END OF PARAMETERS */
    /**************************************************************************/
   
     this.interval = 0;

    /***************************************************************************
     * Method for embeding video
     */
    this.embed = function(url){
        if(url != ''){

            this.url = url;

            var imageContainer = document.getElementById("imageContainer");
            var overlay = document.getElementById('overlay');
            var lightbox = document.getElementById('lightbox');
            var close = document.getElementById('bottomNavClose');


            overlay.onclick = lightbox.onclick = close.onclick = this.close;

            //document.getElementById('hoverNav').onclick = function(event){event.stopPropagation()}
            //document.getElementById('imageDataContainer').onclick = function(event){event.stopPropagation()}
            //document.getElementById('imageDetails').onclick = function(event){event.stopPropagation()}
           
           $('hoverNav').observe('click', (function(event) { event.stop();}));
           $('imageDataContainer').observe('click', (function(event) { event.stop();}));
           $('imageDetails').observe('click', (function(event) { event.stop();}));


            try{
                imageContainer.removeChild(document.getElementById("_$flash$_"));
            }catch(e){};

            var _$flash$_ = document.createElement("div");
            var _$flash$__holder = document.createElement("div");

            _$flash$_.setAttribute("id", "_$flash$_");
            _$flash$__holder.setAttribute("id", "_$flash$__holder");
            _$flash$__holder.setAttribute("style", "position:absolute");
            _$flash$_.appendChild(_$flash$__holder);

            imageContainer.appendChild(_$flash$_);
 
            this.a = setInterval(function(){
                _$this$_.embed2()
            }, this.timeout);
           
        }
    }

    /***************************************************************************
     * Method invoked by timer event for embedding
     */
    this.embed2 = function(){
       
        clearInterval(this.a);
        var image = document.getElementById('imageContainer');
        var _$flash$_ = document.getElementById('_$flash$_');
        _$flash$_.style.position = "absolute";
        _$flash$_.style.clear = "both";

        _$flash$_.style.top = image.offsetTop + image.offsetTop + image.firstChild.offsetTop +"px";
        _$flash$_.style.left = image.offsetLeft  + image.firstChild.offsetLeft+"px";
        swfobject.embedSWF(this.url, "_$flash$__holder", parseInt(image.firstChild.offsetWidth), parseInt(image.firstChild.offsetHeight), "9.0.0");
    }

    this.close = function(){
        document.getElementById('_$flash$_').innerHTML = "";
    }
}

/* Creating new object of FlashInLightBox */
var flash_in_lightbox = new FlashInLightBox();

/* EXAMPLE OF SIMPLE Lightbox LINK WITHOUT FLASH */
/* <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a> */

/* EXAMPLE OF LINK WITH EMBEDDING FLASH TO Lightbox */
/* <a onclick="flash_in_lightbox.embed('http://cz.youtube.com/watch?v=d_qRTMKDqXA')" href="images/EMPTY_IMAGE.jpg" rel="lightbox" title="my caption">image #2</a> */

/* The flash will be resized to size of image you pass to Lightbox, in this case it is "EMPTY_IMAGE.jpg" */
/* First is displayed image You pass to Lightbox and then flash is embedded */


/* Order in which javascripts should be included in the html page */

/*
   <script type="text/javascript" src="js/prototype.js"></script>
   <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
   <script type="text/javascript" src="js/lightbox.js"></script>
   <script type="text/javascript" src="js/swfobject.js"></script>
   <script type="text/javascript" src="js/FlashInLightBox.js"></script>
*/

/* Attach events */
if (typeof document.attachEvent!='undefined')
   window.attachEvent('onload',nmsInit);
else
   window.addEventListener('load',nmsInit,false);