/*
--------------------------------------------------------------------------- 
Default Javascript File
(c) 2006 Select Performers

Version:	1.00
Date:		06/01/2007
Author:		Ian Anderson Gray
Website:	http://selectperformers.com/
---------------------------------------------------------------------------
Notes:	
		
---------------------------------------------------------------------------
To Do

---------------------------------------------------------------------------
Change Log

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




document.write('<style media="screen">body div#toolTip {-moz-border-radius:5px;} #nav li ul	{filter:alpha(opacity=90);-moz-opacity:.9;opacity:.9;}</style>');





var ap_instances = new Array();

function ap_stopAll(playerID)
	{
		for(var i = 0;i<ap_instances.length;i++)
			{
				try
					{
						if(ap_instances[i] != playerID)
							{
								document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
							}
						else
							{
								document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
							}
					}
				catch( errorObject )
					{
						// stop any errors
					}
			}

	}



function ap_registerPlayers()
	{
		var objectID;
		var objectTags = document.getElementsByTagName("object");
		for(var i=0;i<objectTags.length;i++)
			{
				objectID = objectTags[i].id;
				if(objectID.indexOf("audioplayer") == 0)
					{
						ap_instances[i] = objectID.substring(11, objectID.length);
					}
			}
	}




$(document).ready(function()
	{
  		
		
		
		$('.moreOne').hide();
		$('.moreTwo').hide();
		$bka = 0; $bkb = 0;
		$('a.showOne').click(function() { $('.moreOne').toggle('slow'); return false; }); 
		$(function() {
    $('#weddingRightDiv').crossSlide({
      fade: 1
    }, [
      {
        src:  '/images/photos/slideshow/wedding.jpg',
        from: '100% 80% 1x',
        to:   'top center 1.4x',
        time: 8
      }, {
        src:  '/images/photos/slideshow/bwWedding.jpg',
        from: '100% 80% 1x',
        to:   'top right 1.4x',
        time: 8
      }, {
        src:  '/images/photos/slideshow/guitarinRoom.jpg',
        from: '100% 100% 1.4x',
        to:   '80% 70% 1x',
        time: 8
      }, {
        src:  '/images/photos/slideshow/wheel.jpg',
        from: '100% 80% 1x',
        to:   'top right 1.4x',
        time: 8
      }, {
        src:  '/images/photos/slideshow/church.jpg',
        from: '100% 100% 1.4x',
        to:   '80% 70% 1x',
        time: 8
      }, {
        src:  '/images/photos/slideshow/laneWedding.jpg',
        from: '70% 70%',
        to:   '100% 100% 1.4x',
        time: 8
      }
    ]);
 	
		
		
		$(function() {
    $('#jpSlideShow').crossSlide({
      fade: 1
    }, [
      {
        src:  '/images/photos/frontSlideshow/image5.jpg',
        from: '100% 80% 1x',
        to:   'top center 1.4x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image2.jpg',
        from: '100% 100% 1x',
        to:   'center top 1.5x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image3.jpg',
        from: '100% 100% 1.4x',
        to:   '80% 70% 1x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image4.jpg',
        from: '70% 70%',
        to:   '100% 100% 1.4x',
        time: 4
      },{
        src:  '/images/photos/frontSlideshow/image1.jpg',
        from: '100% 100% 1x',
        to:   '70% 90% 1.4x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image6.jpg',
        from: '100% 80% 1x',
        to:   'center center 1.4x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image7.jpg',
        from: '100% 100% 1.4x',
        to:   '80% 70% 1x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image8.jpg',
        from: '100% 100%',
        to:   'center left 1.4x',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image9.jpg',
        from: '70% 70% 1.4x',
        to:   '100% 100%',
        time: 4
      }, {
        src:  '/images/photos/frontSlideshow/image10.jpg',
        from: '100% 100% 1.4x',
        to:   'center center 1x',
        time: 4
      }
    ]);
  });

  });  });






  






/*-----------------------------------------------------------------------------*/
// Start of window.onload fix (by Dean Edwards/Matthias Miller/John Resig)
/*-----------------------------------------------------------------------------*/
	function init()
		{
   			// quit if this function has already been called
  	 		if (arguments.callee.done) return;

    		// flag this function so we don't do the same thing twice
    		arguments.callee.done = true;

    		// kill the timer
    		if (_timer) clearInterval(_timer);
			
			
			/*-----------------------------------------------------------------------------*/
			/*-----------------------------------------------------------------------------*/
    		// Start of Javascript to initialise when page loads...
				
			doExternalLink();
			Fat.fade_all();
			var FO ={movie:"/media/swf/jonPickard.swf",width:"216", height:"322", majorversion:"6", build:"40", quality:"high", wmode:"transparent", menu:"false", idy:"jpF"};
			UFO.create(FO, "jpFlash");
			
			var FO ={movie:"/media/swf/weddingspage.swf",width:"310", height:"233", majorversion:"6", build:"40", quality:"high", wmode:"transparent", menu:"false", idy:"jpWedding"};
			UFO.create(FO, "weddingFlash");
			
			
			// YouTube 1
			swfobject.embedSWF("http://www.youtube.com/v/finFgl1lp_k&hl=en_GB&fs=1&rel=0&showinfo=0", "youTubeOne", "300", "200", "9.0.0","/media/swf/swfObject/expressInstall.swf", {menu:"false"}, {"quality":"high", "wmode":"transparent", allowSciptAccess:"always", "allowfullscreen":"true"});
			
			// YouTube 2
			swfobject.embedSWF("http://www.youtube.com/v/dSSxxEMvsVU&hl=en_GB&fs=1&rel=0&showinfo=0", "youTubeTwo", "300", "200", "9.0.0","/media/swf/swfObject/expressInstall.swf", {menu:"false"}, {"quality":"high", "wmode":"transparent", allowSciptAccess:"always", "allowfullscreen":"true"});
			
			// YouTube 3
			swfobject.embedSWF("http://www.youtube.com/v/fVQp9dclSyQ&hl=en_GB&fs=1&rel=0&showinfo=0", "youTubeThree", "300", "200", "9.0.0","/media/swf/swfObject/expressInstall.swf", {menu:"false"}, {"quality":"high", "wmode":"transparent", allowSciptAccess:"always", "allowfullscreen":"true"});
			// swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes, callbackFn) 
			
		



			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=1&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/asturiasLeyenda.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false", idy:"audioplayer1"};
			UFO.create(FO, "audio1");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=2&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/canarios.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false", idy:"audioplayer2"};
			UFO.create(FO, "audio2");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=3&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/elNoyDeLaMare.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer3"};
			UFO.create(FO, "audio3");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=4&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/recuerdosDeLaAlhambra.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer4"};
			UFO.create(FO, "audio4");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=5&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/romance.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer5"};
			UFO.create(FO, "audio5");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=6&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/koyunbaba.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer6"};
			UFO.create(FO, "audio6");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=7&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/rioAncho.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer7"};
			UFO.create(FO, "audio7");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=8&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/sahara.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer8"};
			UFO.create(FO, "audio8");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=9&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/majestuosos.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer9"};
			UFO.create(FO, "audio9");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=10&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/tangos.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer10"};
			UFO.create(FO, "audio10");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=11&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/malaguena.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer11"};
			UFO.create(FO, "audio11");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=12&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/danzaBrasiliera.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer12"};
			UFO.create(FO, "audio12");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=13&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/unSuenoEnLaFloresta.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer13"};
			UFO.create(FO, "audio13");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=14&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/veranoPorteno.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer14"};
			UFO.create(FO, "audio14");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=15&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/milongaDelAngel.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer15"};
			UFO.create(FO, "audio15");
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=16&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/cavatina.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer16"};
			UFO.create(FO, "audio16");
			
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=16&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/danzaBrasileraUpbeat.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer17"};
			UFO.create(FO, "audio17");
			
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=16&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/libertango.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer18"};
			UFO.create(FO, "audio18");
			
			var FO ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID=16&bg=0xF8F8F8&leftbg=0xBBCAE1&rightbg=0xBBCAE1&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x666666&slider=0x666666&track=0x333333&oader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://jonpickard.co.uk/media/audio/ticoTico.mp3&autostart=yes", quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer19"};
			UFO.create(FO, "audio19");
			
			pageLoader();
			document.getElementById('printPage').innerHTML = '<a href="javascript:window.print()" title="Print this Page" class="print">Print this Page</a>';
			document.getElementById('favorites').innerHTML = "<a href=\"javascript:bookmarksite('"+document.title+"', '"+location.href+"')\" title=\"Add this page to your favourites\" class=\"favorites\">Add to Favourites</a>";
			var ap_clearID = setInterval( ap_registerPlayers, 100 );
			showHide("showHideButtonId", "elementId");
			// End of Javascript to initialise when page loads
			/*-----------------------------------------------------------------------------*/
			/*-----------------------------------------------------------------------------*/
		};

	/* for Mozilla/Opera9 */
	if (document.addEventListener)
		{
   			document.addEventListener("DOMContentLoaded", init, false);
		}

	/* for Internet Explorer */
	/*@cc_on @*/
	/*@if (@_win32)
   	 	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
   	 	var script = document.getElementById("__ie_onload");
    	script.onreadystatechange = function()
			{
        		if (this.readyState == "complete")
					{
            			init(); // call the onload handler
        			}
    		};
		/*@end @*/

	/* for Safari */
		if (/WebKit/i.test(navigator.userAgent))
			{ // sniff
    			var _timer = setInterval(function()
					{
        				if (/loaded|complete/.test(document.readyState))
							{
            					init(); // call the onload handler
        					}
    				}, 10);
			}

	/* for other browsers */
		window.onload = init;

/*-----------------------------------------------------------------------------*/
// End of window.onload fix
/*-----------------------------------------------------------------------------*/



function showHide(showHideButtonId, elementId)
	{ /* we have to wait until the DOM has loaded before we can hook into it. */
		if (document.getElementById(showHideButtonId)) 
			{
				var button = document.getElementById(showHideButtonId);
			}
		else return;
		button.onclick = function()
			{ /* lets do our thing when a user clicks on the Login title */
				var target = document.getElementById(elementId);
				if (target.style.display == 'none') { target.style.display = "block";} 
				else if (target.style.display == 'block') {target.style.display = "none";}
				else  { target.style.display = "block";} 
				for(i=1; i<300;i++)
					{
						window.scrollBy(0,1);
					}
			}
	}




/*-----------------------------------------------------------------------------*/
// Greeting Script
/*-----------------------------------------------------------------------------*/

function greeting()
	{
		var date=new Date(); // Gets the full date!
		var day=date.getHours(); // Gets the hours!
		if (day<=11)
			{
				greeting = 'Good Morning'; // If it's before 12 PM then display this!
			}
		else if(day<18)
			{
				greeting = 'Good Afternoon'; // After 12 PM display this!
			} 
		else 
			{
				greeting = 'Good Evening'; // After 6 PM display this!
			}
		return greeting;
	}
			




/*-----------------------------------------------------------------------------*/
// Start of Bookmark Site function
/*-----------------------------------------------------------------------------*/
function bookmarksite(title,url)
	{
		if (window.sidebar) 
			{// firefox
				window.sidebar.addPanel(title, url, "");
			}
		else if(window.opera && window.print)
			{ // opera
				var elem = document.createElement('a');
				elem.setAttribute('href',url);
				elem.setAttribute('title',title);
				elem.setAttribute('rel','sidebar');
				elem.click();
			} 
		else if(document.all)
			{// ie
				window.external.AddFavorite(url, title);
			}
	}
/*-----------------------------------------------------------------------------*/
// End of Bookmark Site function
/*-----------------------------------------------------------------------------*/
 












/*-----------------------------------------------------------------------------*/
// Start of clearInputs Function
/*-----------------------------------------------------------------------------*/
/*		This function loops through all the text inputs on a page and stores their default values.
		When a text input is brought into focus, its current value is checked against its default value.
		If they are the same, the value is cleared.
		This allows you to add placeholder text to inputs (recommended for accessibility) but users don't have to manually delete the placeholder text.
		This function is triggered when the page loads. */

function clearInputs()
	{
		if (!document.getElementsByTagName)
			{
				return false;
			}
 		var all_inputs = document.getElementsByTagName('input');
 		for (var i=0;i<all_inputs.length;i++)
			{
  				var current_input = all_inputs[i];
  				if (current_input.getAttribute('type') == 'text' && current_input.getAttribute('value') != '')
					{
   						current_input.default_text = current_input.getAttribute('value');
   						current_input.onfocus = function()
							{
    							if (this.getAttribute('value') == this.default_text)
									{
     									this.setAttribute('value','');
									};
							}
					}
			}
	}
/*-----------------------------------------------------------------------------*/
// End of clearInputs Function
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of externalLink function
// Opens a link in a new window when class = externalLink
/*-----------------------------------------------------------------------------*/
function doExternalLink()
	{
		if (!document.getElementsByTagName)
			{
				return false;
			}
  		var links = document.getElementsByTagName("a");
  		for (var i=0; i < links.length; i++)
			{
    			if (links[i].className.match("externalLink"))
					{
						links[i].className = links[i].className + " newWinStyle";
							if (links[i].title == "")
								{
									links[i].title = "(opens in new window)";
								}
							else
								{
									links[i].title = links[i].title + " (opens in new window)";	
								}
	 						links[i].onclick = function(e)
								{
									if(!e)e=window.event;
									if(e.shiftKey || e.ctrlKey || e.altKey) return;
									window.open(this.href);
									return false;
								}
      				}
    		}
	}
/*-----------------------------------------------------------------------------*/
// End of externalLink Function
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of Array Shorthand
/*-----------------------------------------------------------------------------*/
// Shorthand for seeing if something is in an array

Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};
/*-----------------------------------------------------------------------------*/
// End of Array Shorthand
/*-----------------------------------------------------------------------------*/





/*-----------------------------------------------------------------------------*/
// Start of Easy Add Event
/*-----------------------------------------------------------------------------*/
// Easy way of adding an event
function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}
/*-----------------------------------------------------------------------------*/
// End of Easy Add Event
/*-----------------------------------------------------------------------------*/







/*-----------------------------------------------------------------------------*/
// Start of IE Cache Fix
/*-----------------------------------------------------------------------------*/
// Solves an IE caching problem
var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();
addEvent(window,'unload',EventCache.flush);
/*-----------------------------------------------------------------------------*/
// End of IE Cache Fix
/*-----------------------------------------------------------------------------*/










/*-----------------------------------------------------------------------------*/
//		Start of Unobtrusive Flash Objects (UFO) v3.21
/*-----------------------------------------------------------------------------*/
/*	Unobtrusive Flash Objects (UFO) v3.22 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005-2007 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
			
	This function inserts the flash objects into the page if the visitor has flash enabled. */


var UFO = {
	req: ["movie", "width", "height", "majorversion", "build","idy"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen", "allownetworking", "allowfullscreen", "allowFullScreen"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				_obj.setAttribute("id", _fo.idy);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0" id="' + _fo.idy + '"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}
// End of UFO Function
/*-----------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------*/
//		Start of SWFObject v2.2 
/*-----------------------------------------------------------------------------*/
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
/*-----------------------------------------------------------------------------*/
// End of SWFObject v2.2 
/*-----------------------------------------------------------------------------*/





/*-----------------------------------------------------------------------------*/
// Start of Sweet Titles
/*-----------------------------------------------------------------------------*/
/*
Sweet Titles (c) Creative Commons 2005
http://creativecommons.org/licenses/by-sa/2.5/
Author: Dustin Diaz | http://www.dustindiaz.com
*/
var sweetTitles = { 
	xCord : 0,				// @Number: x pixel value of current cursor position
	yCord : 0,				// @Number: y pixel value of current cursor position
	tipElements : ['a','abbr','acronym'],	// @Array: Allowable elements that can have the toolTip
	obj : Object,			// @Element: That of which you're hovering over
	tip : Object,			// @Element: The actual toolTip itself
	active : 0,				// @Number: 0: Not Active || 1: Active
	init : function() {
		if ( !document.getElementById ||
			!document.createElement ||
			!document.getElementsByTagName ) {
			return;
		}
		var i,j;
		this.tip = document.createElement('div');
		this.tip.id = 'toolTip';
		document.getElementsByTagName('body')[0].appendChild(this.tip);
		this.tip.style.top = '0';
		this.tip.style.visibility = 'hidden';
		addEvent(document,'mousemove',this.updateXY);
		if ( document.captureEvents ) {
				document.captureEvents(Event.MOUSEMOVE);
		}
		var tipLen = this.tipElements.length;
		for ( i=0; i<tipLen; i++ ) {
			var current = document.getElementsByTagName(this.tipElements[i]);
			var curLen = current.length;
			for ( j=0; j<curLen; j++ ) {
				if ( current[j].title != "") {
					addEvent(current[j],'mouseover',this.tipOver);
					addEvent(current[j],'mouseout',this.tipOut);
					current[j].setAttribute('tip',current[j].title);
					current[j].removeAttribute('title');
				}
			}
		}
	},
	updateXY : function(e) {
		if ( document.captureEvents ) {
			sweetTitles.xCord = e.pageX;
			sweetTitles.yCord = e.pageY;
		} else if ( window.event.clientX ) {
			sweetTitles.xCord = window.event.clientX+document.documentElement.scrollLeft;
			sweetTitles.yCord = window.event.clientY+document.documentElement.scrollTop;
		}
	},
	tipOut: function() {
		if ( window.tID ) {
			clearTimeout(tID);
		}
		if ( window.opacityID ) {
			clearTimeout(opacityID);
		}
		sweetTitles.tip.style.visibility = 'hidden';
	},
	checkNode : function() {
		var trueObj = this.obj;
		if ( this.tipElements.inArray(trueObj.nodeName.toLowerCase()) ) {
			return trueObj;
		} else {
			return trueObj.parentNode;
		}
	},
	tipOver : function() {
		sweetTitles.obj = this;
		tID = window.setTimeout("sweetTitles.tipShow()",500)
	},
	tipShow : function() {		
		var scrX = Number(this.xCord);
		var scrY = Number(this.yCord);
		var tp = parseInt(scrY+15);
		var lt = parseInt(scrX+10);
		var anch = this.checkNode();
		var addy = '';
		var access = '';
		if ( anch.nodeName.toLowerCase() == 'a' ) {
			addy = (anch.href.length > 48 ? anch.href.toString().substring(0,48)+"..." : anch.href);
			addy = addy.replace("callto:","Phone ");
			var access = ( anch.accessKey ? ' <span>Shortcut Access key: ['+anch.accessKey+']</span> ' : '' );
		} else {
			addy = anch.firstChild.nodeValue;
		}
		if (addy.substring(0,4) == "java") {addy = "";}
		
		tipy = anch.getAttribute('tip');
		tipy = tipy.replace("(opens in new window)",'<span class="ttNewWindow">This page opens in a new window.</span>');
		if (addy.indexOf(window.location.hostname) == -1) {
		this.tip.innerHTML = "<p>"+tipy+"<em>"+access+addy+"</em></p>";
		}
		else {
			this.tip.innerHTML = "<p>"+tipy+"<em>"+access+"</em></p>";
		}
		if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
			this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
		} else {
			this.tip.style.left = lt+'px';
		}
		if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
			this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
		} else {
			this.tip.style.top = tp+'px';
		}
		if (((anch.getAttribute('tip') || access) != "") || (addy.indexOf(window.location.hostname) == -1)) {
			this.tip.style.visibility = 'visible';
			this.tip.style.opacity = '.1';
			this.tipFade(10);	
		}
	},
	tipFade: function(opac) {
		var passed = parseInt(opac);
		var newOpac = parseInt(passed+10);
		if ( newOpac < 80 ) {
			this.tip.style.opacity = '.'+newOpac;
			this.tip.filter = "alpha(opacity:"+newOpac+")";
			opacityID = window.setTimeout("sweetTitles.tipFade('"+newOpac+"')",20);
		}
		else { 
			this.tip.style.opacity = '.80';
			this.tip.style.filter = "alpha(opacity:80)";
		}
	}
};
function pageLoader() {
	sweetTitles.init();
}

//window.onload=function(){
//pageLoader();
//}
/*-----------------------------------------------------------------------------*/
// End of Sweet Titles
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of F.A.T.
/*-----------------------------------------------------------------------------*/
// @name      The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version   1.0-RC1
// @author    Adam Michela

var Fat = {
	make_hex : function (r,g,b) 
	{
		r = r.toString(16); if (r.length == 1) r = '0' + r;
		g = g.toString(16); if (g.length == 1) g = '0' + g;
		b = b.toString(16); if (b.length == 1) b = '0' + b;
		return "#" + r + g + b;
	},
	fade_all : function ()
	{
		var a = document.getElementsByTagName("*");
		for (var i = 0; i < a.length; i++) 
		{
			var o = a[i];
			var r = /fade-?(\w{3,6})?/.exec(o.className);
			if (r)
			{
				if (!r[1]) r[1] = "";
				if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
			}
		}
	},
	fade_element : function (id, fps, duration, from, to) 
	{
		if (!fps) fps = 30;
		if (!duration) duration = 3000;
		if (!from || from=="#") from = "#FFFF33";
		if (!to) to = this.get_bgcolor(id);
		
		var frames = Math.round(fps * (duration / 1000));
		var interval = duration / frames;
		var delay = interval;
		var frame = 0;
		
		if (from.length < 7) from += from.substr(1,3);
		if (to.length < 7) to += to.substr(1,3);
		
		var rf = parseInt(from.substr(1,2),16);
		var gf = parseInt(from.substr(3,2),16);
		var bf = parseInt(from.substr(5,2),16);
		var rt = parseInt(to.substr(1,2),16);
		var gt = parseInt(to.substr(3,2),16);
		var bt = parseInt(to.substr(5,2),16);
		
		var r,g,b,h;
		while (frame < frames)
		{
			r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
			g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
			b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
			h = this.make_hex(r,g,b);
		
			setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);

			frame++;
			delay = interval * frame; 
		}
		setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
	},
	set_bgcolor : function (id, c)
	{
		var o = document.getElementById(id);
		o.style.backgroundColor = c;
	},
	get_bgcolor : function (id)
	{
		var o = document.getElementById(id);
		while(o)
		{
			var c;
			if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
			if (o.currentStyle) c = o.currentStyle.backgroundColor;
			if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
			o = o.parentNode;
		}
		if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
		var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
		if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
		return c;
	}
}
/*-----------------------------------------------------------------------------*/
// End of F.A.T.
/*-----------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
 *  Smooth Scroller Script, version 1.0.1
 *  (c) 2007 Dezinerfolio Inc. <midart@gmail.com>
 *
 *  For details, please check the website : http://dezinerfolio.com/
 *
/*--------------------------------------------------------------------------*/

Scroller = {
	// control the speed of the scroller.
	// dont change it here directly, please use Scroller.speed=50;
	speed:10,

	// returns the Y position of the div
	gy: function (d) {
		gy = d.offsetTop
		if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
		return gy
	},

	// returns the current scroll position
	scrollTop: function (){
		body=document.body
	    d=document.documentElement
	    if (body && body.scrollTop) return body.scrollTop
	    if (d && d.scrollTop) return d.scrollTop
	    if (window.pageYOffset) return window.pageYOffset
	    return 0
	},

	// attach an event for an element
	// (element, type, function)
	add: function(event, body, d) {
	    if (event.addEventListener) return event.addEventListener(body, d,false)
	    if (event.attachEvent) return event.attachEvent('on'+body, d)
	},

	// kill an event of an element
	end: function(e){
		if (window.event) {
			window.event.cancelBubble = true
			window.event.returnValue = false
      		return;
    	}
	    if (e.preventDefault && e.stopPropagation) {
	      e.preventDefault()
	      e.stopPropagation()
	    }
	},
	
	// move the scroll bar to the particular div.
	scroll: function(d){
		i = window.innerHeight || document.documentElement.clientHeight;
		h=document.body.scrollHeight;
		a = Scroller.scrollTop()
		if(d>a)
			if(h-d>i)
				a+=Math.ceil((d-a)/Scroller.speed)
			else
				a+=Math.ceil((d-a-(h-d))/Scroller.speed)
		else
			a = a+(d-a)/Scroller.speed;
		window.scrollTo(0,a)
	  	if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)
	  	Scroller.offsetTop=a
	},
	// initializer that adds the renderer to the onload function of the window
	init: function(){
		Scroller.add(window,'load', Scroller.render)
	},

	// this method extracts all the anchors and validates then as # and attaches the events.
	render: function(){
		a = document.getElementsByTagName('a');
		Scroller.end(this);
		window.onscroll
	    for (i=0;i<a.length;i++) {
	      l = a[i];
	      if(l.href && l.href.indexOf('#top') != -1 && ((l.pathname==location.pathname) || ('/'+l.pathname==location.pathname)) ){
	      	Scroller.add(l,'click',Scroller.end)
	      		l.onclick = function(){
	      			Scroller.end(this);
		        	l=this.hash.substr(1);
		        	 a = document.getElementsByTagName('a');
				     for (i=0;i<a.length;i++) {
				     	if(a[i].name == l){
				     		clearInterval(Scroller.interval);
				     		Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a[i])+')',10);
						}
					}
				}
	      	}
		}
	}
}
// invoke the initializer of the scroller
Scroller.init();


/*
 * Copyright 2007-2009 by Tobia Conforto <tobia.conforto@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * Versions: 0.1    2007-08-19  Initial release
 *                  2008-08-21  Re-released under GPL v2
 *           0.1.1  2008-09-18  Compatibility with prototype.js
 *           0.2    2008-10-15  Linkable images, contributed by Tim Rainey <tim@zmlabs.com>
 *           0.3    2008-10-22  Added option to repeat the animation a number of times, then stop
 *           0.3.1  2008-11-11  Better error messages
 *           0.3.2  2008-11-11  Fixed a couple of CSS bugs, contributed by Erwin Bot <info@ixgcms.nl>
 *           0.3.3  2008-12-14  Added onclick option
 *           0.3.4  2009-03-12  Added shuffle option, contributed by Ralf Santbergen <ralf_santbergen@hotmail.com>
 *           0.3.5  2009-03-12  Fixed usage of href parameter in 'Ken Burns' mode
 *           0.3.6  2009-04-16  Added alt option
 */

jQuery.fn.crossSlide = function(opts, plan) {
	var self = this,
			self_width = this.width(),
			self_height = this.height();

	// generic utilities
	function format(str) {
		for (var i = 1; i < arguments.length; i++)
			str = str.replace(new RegExp('\\{' + (i-1) + '}', 'g'), arguments[i]);
		return str;
	}

	function abort() {
		arguments[0] = 'crossSlide: ' + arguments[0];
		throw format.apply(null, arguments);
	}

	// first preload all the images, while getting their actual width and height
	(function(proceed) {

		var n_loaded = 0;
		function loop(i, img) {
			// for (i = 0; i < plan.length; i++) but with independent var i, img (for the closures)
			img.onload = function(e) {
				n_loaded++;
				plan[i].width = img.width;
				plan[i].height = img.height;
				if (n_loaded == plan.length)
					proceed();
			}
			img.src = plan[i].src;
			if (i + 1 < plan.length)
				loop(i + 1, new Image());
		}
		loop(0, new Image());

	})(function() {  // then proceed

		// utility to parse "from" and "to" parameters
		function parse_position_param(param) {
			var zoom = 1;
			var tokens = param.replace(/^\s*|\s*$/g, '').split(/\s+/);
			if (tokens.length > 3) throw new Error();
			if (tokens[0] == 'center')
				if (tokens.length == 1)
					tokens = ['center', 'center'];
				else if (tokens.length == 2 && tokens[1].match(/^[\d.]+x$/i))
					tokens = ['center', 'center', tokens[1]];
			if (tokens.length == 3)
				zoom = parseFloat(tokens[2].match(/^([\d.]+)x$/i)[1]);
			var pos = tokens[0] + ' ' + tokens[1];
			if (pos == 'left top'      || pos == 'top left')      return { xrel:  0, yrel:  0, zoom: zoom };
			if (pos == 'left center'   || pos == 'center left')   return { xrel:  0, yrel: .5, zoom: zoom };
			if (pos == 'left bottom'   || pos == 'bottom left')   return { xrel:  0, yrel:  1, zoom: zoom };
			if (pos == 'center top'    || pos == 'top center')    return { xrel: .5, yrel:  0, zoom: zoom };
			if (pos == 'center center')                           return { xrel: .5, yrel: .5, zoom: zoom };
			if (pos == 'center bottom' || pos == 'bottom center') return { xrel: .5, yrel:  1, zoom: zoom };
			if (pos == 'right top'     || pos == 'top right')     return { xrel:  1, yrel:  0, zoom: zoom };
			if (pos == 'right center'  || pos == 'center right')  return { xrel:  1, yrel: .5, zoom: zoom };
			if (pos == 'right bottom'  || pos == 'bottom right')  return { xrel:  1, yrel:  1, zoom: zoom };
			return {
				xrel: parseInt(tokens[0].match(/^(\d+)%$/)[1]) / 100,
				yrel: parseInt(tokens[1].match(/^(\d+)%$/)[1]) / 100,
				zoom: zoom
			};
		}

		// utility to compute the css for a given phase between p.from and p.to
		// phase = 1: begin fade-in,  2: end fade-in,  3: begin fade-out,  4: end fade-out
		function position_to_css(p, phase) {
			switch (phase) {
				case 1:
					var pos = 0;
					break;
				case 2:
					var pos = fade_ms / (p.time_ms + 2 * fade_ms);
					break;
				case 3:
					var pos = 1 - fade_ms / (p.time_ms + 2 * fade_ms);
					break;
				case 4:
					var pos = 1;
					break;
			}
			return {
				left:   Math.round(p.from.left   + pos * (p.to.left   - p.from.left  )),
				top:    Math.round(p.from.top    + pos * (p.to.top    - p.from.top   )),
				width:  Math.round(p.from.width  + pos * (p.to.width  - p.from.width )),
				height: Math.round(p.from.height + pos * (p.to.height - p.from.height))
			};
		}

		// check global params
		if (! opts.fade)
			abort('missing fade parameter.');
		if (opts.speed && opts.sleep)
			abort('you cannot set both speed and sleep at the same time.');
		// conversion from sec to ms; from px/sec to px/ms
		var fade_ms = Math.round(opts.fade * 1000);
		if (opts.sleep)
			var sleep = Math.round(opts.sleep * 1000);
		if (opts.speed)
			var speed = opts.speed / 1000,
					fade_px = Math.round(fade_ms * speed);

		// set container css
		self.empty().css({
			overflow: 'hidden',
			padding: 0
		});
		if (! self.css('position').match(/absolute|relative|fixed/))
			self.css({ position: 'relative' });
		if (! self.width() || ! self.height())
			abort('container element does not have its own width and height');

		// random sorting
		if (opts.shuffle)
			plan.sort(function() {
				return Math.random() - 0.5;
			});

		// prepare each image
		for (var i = 0; i < plan.length; ++i) {

			var p = plan[i];
			if (! p.src)
				abort('missing src parameter in picture {0}.', i + 1);

			if (speed) { // speed/dir mode

				// check parameters and translate speed/dir mode into full mode (from/to/time)
				switch (p.dir) {
					case 'up':
						p.from = { xrel: .5, yrel: 0, zoom: 1 };
						p.to   = { xrel: .5, yrel: 1, zoom: 1 };
						var slide_px = p.height - self_height - 2 * fade_px;
						break;
					case 'down':
						p.from = { xrel: .5, yrel: 1, zoom: 1 };
						p.to   = { xrel: .5, yrel: 0, zoom: 1 };
						var slide_px = p.height - self_height - 2 * fade_px;
						break;
					case 'left':
						p.from = { xrel: 0, yrel: .5, zoom: 1 };
						p.to   = { xrel: 1, yrel: .5, zoom: 1 };
						var slide_px = p.width - self_width - 2 * fade_px;
						break;
					case 'right':
						p.from = { xrel: 1, yrel: .5, zoom: 1 };
						p.to   = { xrel: 0, yrel: .5, zoom: 1 };
						var slide_px = p.width - self_width - 2 * fade_px;
						break;
					default:
						abort('missing or malformed "dir" parameter in picture {0}.', i + 1);
				}
				if (slide_px <= 0)
					abort('picture number {0} is too short for the desired fade duration.', i + 1);
				p.time_ms = Math.round(slide_px / speed);

			} else if (! sleep) { // full mode

				// check and parse parameters
				if (! p.from || ! p.to || ! p.time)
					abort('missing either speed/sleep option, or from/to/time params in picture {0}.', i + 1);
				try {
					p.from = parse_position_param(p.from)
				} catch (e) {
					abort('malformed "from" parameter in picture {0}.', i + 1);
				}
				try {
					p.to = parse_position_param(p.to)
				} catch (e) {
					abort('malformed "to" parameter in picture {0}.', i + 1);
				}
				if (! p.time)
					abort('missing "time" parameter in picture {0}.', i + 1);
				p.time_ms = Math.round(p.time * 1000)
			}

			// precalculate left/top/width/height bounding values
			if (p.from)
				jQuery.each([ p.from, p.to ], function(i, from_to) {
					from_to.width  = Math.round(p.width  * from_to.zoom);
					from_to.height = Math.round(p.height * from_to.zoom);
					from_to.left   = Math.round((self_width  - from_to.width)  * from_to.xrel);
					from_to.top    = Math.round((self_height - from_to.height) * from_to.yrel);
				});

			// append the image (or anchor) element to the container
			var elm;
			if (p.href)
				elm = jQuery(format('<a href="{0}"><img src="{1}"/></a>', p.href, p.src));
			else
				elm = jQuery(format('<img src="{0}"/>', p.src));
			if (p.onclick)
				elm.click(p.onclick);
			if (p.alt)
				elm.find('img').attr('alt', p.alt);
			elm.appendTo(self);
		}
		speed = undefined;  // speed mode has now been translated to full mode

		// find images to animate and set initial css attributes
		var imgs = self.find('img').css({
			position: 'absolute',
			visibility: 'hidden',
			top: 0,
			left: 0,
			border: 0
		});

		// show first image
		imgs.eq(0).css({ visibility: 'visible' });
		if (! sleep)
			imgs.eq(0).css(position_to_css(plan[0], 2));

		// create animation chain
		var countdown = opts.loop;
		function create_chain(i, chainf) {
			// building the chain backwards, or inside out

			if (i % 2 == 0) {
				if (sleep) {

					// still image sleep

					var i_sleep = i / 2,
							i_hide = (i_sleep - 1 + plan.length) % plan.length,
							img_sleep = imgs.eq(i_sleep),
							img_hide = imgs.eq(i_hide);

					var newf = function() {
						img_hide.css('visibility', 'hidden');
						setTimeout(chainf, sleep);
					};

				} else {

					// single image slide

					var i_slide = i / 2,
							i_hide = (i_slide - 1 + plan.length) % plan.length,
							img_slide = imgs.eq(i_slide),
							img_hide = imgs.eq(i_hide),
							time = plan[i_slide].time_ms,
							slide_anim = position_to_css(plan[i_slide], 3);

					var newf = function() {
						img_hide.css('visibility', 'hidden');
						img_slide.animate(slide_anim, time, 'linear', chainf);
					};

				}
			} else {
				if (sleep) {

					// still image cross-fade

					var i_from = Math.floor(i / 2),
							i_to = Math.ceil(i / 2) % plan.length,
							img_from = imgs.eq(i_from),
							img_to = imgs.eq(i_to),
							from_anim = {},
							to_init = { visibility: 'visible' },
							to_anim = {};

					if (i_to > i_from) {
						to_init.opacity = 0;
						to_anim.opacity = 1;
					} else {
						from_anim.opacity = 0;
					}

					var newf = function() {
						img_to.css(to_init);
						if (from_anim.opacity != undefined)
							img_from.animate(from_anim, fade_ms, 'linear', chainf);
						else
							img_to.animate(to_anim, fade_ms, 'linear', chainf);
					};

				} else {

					// cross-slide + cross-fade

					var i_from = Math.floor(i / 2),
							i_to = Math.ceil(i / 2) % plan.length,
							img_from = imgs.eq(i_from),
							img_to = imgs.eq(i_to),
							from_anim = position_to_css(plan[i_from], 4),
							to_init = position_to_css(plan[i_to], 1),
							to_anim = position_to_css(plan[i_to], 2);

					if (i_to > i_from) {
						to_init.opacity = 0;
						to_anim.opacity = 1;
					} else {
						from_anim.opacity = 0;
					}
					to_init.visibility = 'visible';

					var newf = function() {
						img_from.animate(from_anim, fade_ms, 'linear');
						img_to.css(to_init);
						img_to.animate(to_anim, fade_ms, 'linear', chainf);
					};

				}
			}

			// if the loop option was requested, push a countdown check
			if (opts.loop && i == plan.length * 2 - 2) {
				var newf_orig = newf;
				newf = function() {
					if (--countdown) newf_orig();
				}
			}

			if (i > 0)
				return create_chain(i - 1, newf);
			else
				return newf;
		}
		var animation = create_chain(plan.length * 2 - 1, function() { return animation(); });

		// start animation
		animation();

	});

	return self;
};



/*------------------------------------------------------------
 *						END OF CODE
/*-----------------------------------------------------------*/

