var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
var bingMap;

function divShow( show, hide )
{
	var showDiv = document.getElementById( show );
	var hideDiv = document.getElementById( hide );

	showDiv.style.display = 'block';
	hideDiv.style.display = 'none';
}

function shortenTitles()
{
	var div = document.getElementById( 'bottom' );
	var divs = div.getElementsByTagName('DIV');
	var total = divs.length;

	for ( var i = 0; i < total; i++ )
	{
		if ( divs[i].className == 'blog-title' )
		{
			var alink = divs[i].getElementsByTagName('A');
			
			if ( alink.length == 1 )
			{
				if ( alink[0].innerHTML.length > 15 )
				{
					alink[0].innerHTML = alink[0].innerHTML.substr( 0, 15 ) + "...";
				}
			}
		};
	}
}

/**
 * Add any function to be executed when the DOM is ready (or add an event yourself).
 */
function init()
{
	if ( IE6 )
	{
		//nl.ydso.compatibility.supersleight.init();
	}
	
	if ( bingMap )
	{
		GetMap();
	}
}


nl = {};
nl.ydso = {};
nl.ydso.modules = {};

com = {};
com.ydso = {};
com.ydso.modules = {};

/*****************************************************************************************************************************
 * domready.js
 * 
 * Cross browser mozilla's 'onDOMContentLoaded' implementation.
 * Executes a function when the dom tree is loaded without waiting for images.
 * 
 * Based on +Element.Events.domready+ from Mootools open source project, 
 * this tiny javascript library adds the emulated 'DOMContentLoaded' functionality.
 * 
 * Features:
 *	 - No dependency on external libraries
 *	 - Compatible with Prototype.js 
 * 
 * Tested browsers (Windows):
 *	 - IE 7 (XP standalone)
 *	 - IE 6 SP2
 *	 - Firefox 2.0.0.4
 *	 - Opera 9.21
 * 
 * Tested browsers (Mac OS X):
 *	 - Safari 2.0.4
 *	 - Firefox 2.0.0.4
 *	 - Mac Opera 9.21
 *	 - Mac IE 5.2.3
 *
 * Copyright (c) 2007 Takanori Ishikawa.
 * License: MIT-style license.
 * 
 * MooTools Copyright:
 * copyright (c) 2007 Valerio Proietti, <http://mad4milk.net>
 *
 *
 * See Also:
 *
 *	 mootools 
 *	 http://mootools.net/
 *	 
 *	 The window.onload Problem - Solved!
 *	 http://dean.edwards.name/weblog/2005/09/busted/
 *	 
 *	 [PATCH] Faster onload for Event.onload
 *	 http://dev.rubyonrails.org/ticket/5414
 *	 Changeset 6596: Support for "DOMContentLoaded" event handling (prototype.js event branch)
 *	 http://dev.rubyonrails.org/changeset/6596
 *
*****************************************************************************************************************************/
com.ydso.Event = {};
com.ydso.Event.domReady = {
	add: function(fn) {
		
		//-----------------------------------------------------------
		// Already loaded?
		//-----------------------------------------------------------
		if ( com.ydso.Event.domReady.loaded )
		{
			return fn();
		}
		
		//-----------------------------------------------------------
		// Observers
		//-----------------------------------------------------------
		var observers = com.ydso.Event.domReady.observers;
		
		if ( !observers )
		{
			observers = com.ydso.Event.domReady.observers = [];
		}
		// Array#push is not supported by Mac IE 5
		observers[observers.length] = fn;
		
		//-----------------------------------------------------------
		// domReady function
		//-----------------------------------------------------------
		if ( com.ydso.Event.domReady.callback) return;
		
		com.ydso.Event.domReady.callback = function()
		{
			if ( com.ydso.Event.domReady.loaded) return;
			
			com.ydso.Event.domReady.loaded = true;
			if (com.ydso.Event.domReady.timer) {
				clearInterval(com.ydso.Event.domReady.timer);
				com.ydso.Event.domReady.timer = null;
			}
			
			var observers = com.ydso.Event.domReady.observers;
			for (var i = 0, length = observers.length; i < length; i++) {
				var fn = observers[i];
				observers[i] = null;
				fn(); // make 'this' as window
			}
			com.ydso.Event.domReady.callback = com.ydso.Event.domReady.observers = null;
		};
		
		//-----------------------------------------------------------
		// Emulates 'onDOMContentLoaded'
		//-----------------------------------------------------------
		var ie = !!(window.attachEvent && !window.opera);
		var webkit = navigator.userAgent.indexOf('AppleWebKit/') > -1;
		
		if (document.readyState && webkit)
		{
			// Apple WebKit (Safari, OmniWeb, ...)
			com.ydso.Event.domReady.timer = setInterval(function() {
				var state = document.readyState;
				if (state == 'loaded' || state == 'complete') {
					com.ydso.Event.domReady.callback();
				}
			}, 50);
			
		}
		else if (document.readyState && ie)
		{
			// Windows IE 
			var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)';
			document.write(
				'<script type="text/javascript" defer="defer" src="' + src + '" ' + 
				'onreadystatechange="if (this.readyState == \'complete\') com.ydso.Event.domReady.callback();"' + 
				'><\/script>');
		}
		else
		{
			if (window.addEventListener)
			{
				// for Mozilla browsers, Opera 9
				document.addEventListener("DOMContentLoaded", com.ydso.Event.domReady.callback, false);
				// Fail safe 
				window.addEventListener("load", com.ydso.Event.domReady.callback, false);
			}
			else if (window.attachEvent)
			{
				window.attachEvent('onload', com.ydso.Event.domReady.callback);
			}
			else
			{
				// Legacy browsers (e.g. Mac IE 5)
				var fn = window.onload;
				
				window.onload = function()
				{
					com.ydso.Event.domReady.callback();
					if (fn) fn();
				}
			}
		}
	}
}


com.ydso.Event.domReady.add(function()
{
	com.ydso.lightbox.addEventListeners();
	init();
});


nl.ydso.compatibility = {};
/*****************************************************************************************************************************
 * Create suckerfish menu with support for easy CSS when levels are deeeep.
 *****************************************************************************************************************************/
nl.ydso.compatibility.suckerfish =
{
	event: false,
	menus: new Array(),
	add: function ( element )
	{
		this.menus.push( element );
		
		if ( !this.event && IE6 )
		{
			this.event = true;
			
			com.ydso.Event.domReady.add(function()
			{
				nl.ydso.compatibility.suckerfish.init();
			});
		}
	},
	init: function( element )
	{
		var total = this.menus.length;

		for ( var i = 0; i < total; i++ )
		{
			this.attachStyles( document.getElementById( this.menus[i] ), 1 );
		}
	},
	attachStyles: function ( element, level )
	{
		var children	= element.childNodes; //getElementsByTagName("LI")[0]
		var total		= children.length;

		for ( var i = 0; i < total; i++ )
		{
			if ( children[i].innerHTML != undefined )
			{
				children[i].className += " level" + level;
				
				children[i].onmouseover = function()
				{
					this.className += " hover";
//					alert("adding .hover style to: " + this.innerHTML);
				}
				
				children[i].onmouseout = function()
				{
					this.className = this.className.replace(new RegExp(" hover\\b"), "");
					
				}
				
				if ( children[i].getElementsByTagName("UL").length > 0 )
				{
					//alert( i + "has subs" + "\n" + children[i].getElementsByTagName("UL")[0].innerHTML );
					children[i].className += " children";
					var subchildren = children[i].getElementsByTagName("UL")[0];
					this.attachStyles( subchildren, level + 1 );
				}
			}
		}
		
		return;
	}
};


/*****************************************************************************************************************************
 * SuperSleight IE6 PNG fix
 * This should be checked, rewritten and added to com.ydso
 *****************************************************************************************************************************/
nl.ydso.compatibility.supersleight =
{
	applyPositioning	: false,
	shim				: '/javascript/x.gif',
	init : function()
	{
		root = document;
		
		for (var i = root.all.length - 1, obj = null; (obj = root.all[i]); i--)
		{
			// background pngs
			if (obj.currentStyle.backgroundImage.match(/\.png/i) !== null) {
				this.bg_fnFixPng(obj);
			}
			// image elements
			if (obj.tagName=='IMG' && obj.src.match(/\.png$/i) !== null){
				this.el_fnFixPng(obj);
			}
			// apply position to 'active' elements
			if ( this.applyPositioning && (obj.tagName=='A' || obj.tagName=='INPUT') && obj.style.position === ''){
				obj.style.position = 'relative';
			}
		}
	},

	bg_fnFixPng : function(obj)
	{
		var mode = 'scale';
		var bg	= obj.currentStyle.backgroundImage;
		var src = bg.substring(5,bg.length-2);
		if (obj.currentStyle.backgroundRepeat == 'no-repeat') {
			mode = 'crop';
		}
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')";
		obj.style.backgroundImage = 'url('+this.shim+')';
	},

	el_fnFixPng : function(img)
	{
		var src = img.src;
		img.style.width = img.width + "px";
		img.style.height = img.height + "px";
		img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
		img.src = this.shim;
	}
};



/*****************************************************************************************************************************
 * Helper functions to get information about the page in a cross browser compatible way
 *****************************************************************************************************************************/
com.ydso.document = {
	viewportWidth : function()
	{
		if ( typeof( window.innerWidth ) == 'number' )
		{
			return window.innerWidth;
		}
		else if ( document.documentElement && document.documentElement.clientWidth )
		{
			//IE 6+ in 'standards compliant mode'
			return document.documentElement.clientWidth;
		}
		else if ( document.body && document.body.clientWidth )
		{
			//IE 4 compatible
			return document.body.clientWidth;
		}
	},
	viewportHeight : function()
	{
		if ( typeof( window.innerWidth ) == 'number' )
		{
			return window.innerHeight;
		}
		else if ( document.documentElement && document.documentElement.clientHeight )
		{
			return document.documentElement.clientHeight;
		}
		else if ( document.body && document.body.clientHeight )
		{
			return document.body.clientHeight;
		}
	}
}

/*****************************************************************************************************************************
 * Easing functions for animations
 *****************************************************************************************************************************/
com.ydso.lightbox =
{
	container	: 0,
	overlay		: 0,
	image		: 0,
	img			: null,
	addEventListeners: function()
	{
		var links = document.getElementsByTagName("A");
		var total = links.length;
	
		for ( var i = 0; i < total; i++ )
		{
			if ( links[i].rel == "overlay" )
			{
				clickFunction = 'com.ydso.lightbox.show("' + links[i].href + '"); return false;';
				links[i].onclick = new Function( clickFunction );
			}
		}
	},
	show: function( image )
	{
		this.image = image;
		this.container	= document.createElement('div');
		this.overlay	= document.createElement('div');
		
		this.loader		= document.createElement('img');
		this.loader.src	= "/skins/www.ydso.nl/javascript/ajax-loader.gif";
		
		this.img		= document.createElement('img');
		
		this.container.appendChild( this.overlay );
		this.container.appendChild( this.loader );
		this.container.appendChild( this.img );
		
		
		document.body.appendChild( this.container );
		
		with ( this.container.style )
		{
			position		= "absolute";
			top				= "0px";
			left			= "0px";
			display			= "block";
			width			= "100%";
			height			= "100%";
		}
		
		with ( this.overlay.style )
		{
			position		= "absolute";
			top				= "0px";
			left			= "0px";
			display			= "block";
			width			= "100%";
			height			= "100%";
			backgroundColor = "#000000";
			opacity			= "0";					/* 0 tot 1 */
			MozOpacity		= "0";					/* 0 tot 1 */
			KhtmlOpacity	= "0";					/* 0 tot 1 */
			filter			= "alpha(opacity=0)";		/* 1 tot 100 */
		}
		
		with ( this.loader.style )
		{
			position		= "absolute";
			top				= ( parseInt( com.ydso.document.viewportHeight() / 2 ) - 12 ) + "px";
			left			= ( parseInt( com.ydso.document.viewportWidth() / 2 ) - 12 ) + "px";
		}
		
		with ( this.img.style )
		{
			position		= "absolute";
			display			= "none";
		}
		
		this.img.src	= image;
		this.img.style.position = "absolute";
		this.img.onclick= function() { com.ydso.lightbox.remove(); };
		this.img.onload	= function() { com.ydso.lightbox.resize(); };

		var tween = new com.ydso.transitions.Tween( this.overlay, "alpha", com.ydso.easing.linear, 0, 0.8, 500, com.ydso.lightbox.overlayC );
	},
	resize: function()
	{
		imageWidth		= this.img.width;
		imageHeight		= this.img.height;

		viewportWidth	= com.ydso.document.viewportWidth() - 20;
		viewportHeight	= com.ydso.document.viewportHeight() - 20;
		
		ratio = this.img.height / this.img.width;
	
		if( imageWidth >= viewportWidth && ratio <= 1 )
		{
			this.img.width	= viewportWidth;
			this.img.height = this.img.width * ratio;
		}
		else if ( imageHeight >= viewportHeight )
		{
			this.img.height = viewportHeight;
			this.img.width = this.img.height / ratio;
		}
		
		this.img.style.top		= parseInt( ( com.ydso.document.viewportHeight() / 2 ) - ( this.img.height / 2 ) ) + "px";
		this.img.style.left		= parseInt( ( com.ydso.document.viewportWidth() / 2 ) - ( this.img.width / 2 ) ) + "px";
		
		var tweenX = new com.ydso.transitions.Tween( this.img, "x", com.ydso.easing.linear, parseInt( com.ydso.document.viewportWidth() / 2 ), parseInt( ( com.ydso.document.viewportWidth() / 2 ) - ( this.img.width / 2 ) ), 500, null );
		var tweenY = new com.ydso.transitions.Tween( this.img, "y", com.ydso.easing.linear, parseInt( com.ydso.document.viewportHeight() / 2 ), parseInt( ( com.ydso.document.viewportHeight() / 2 ) - ( this.img.height / 2 ) ), 500, null );
		var tweenW = new com.ydso.transitions.Tween( this.img, "width", com.ydso.easing.outBack, 0, this.img.width, 500, null );
		var tweenH = new com.ydso.transitions.Tween( this.img, "height", com.ydso.easing.linear, 0, this.img.height, 500, null );
		
		this.img.style.display	= "block";		
	},
	remove: function()
	{
		this.container.parentNode.removeChild( this.container );
	}
};

/*****************************************************************************************************************************
 * Tween class to animate html blocks
 *****************************************************************************************************************************/
com.ydso.transitions = {};
com.ydso.transitions.Tween = function( id, property, easingFunction, begin, finish, duration, callback )
{
	/**
	 * 30fps = 1s / 30fps
	 * 1s = 1000ms
	 * 1000ms / 30fps = 33ms
	 * 1 frame = 33ms
	 *
	 * uitrekenen: hoe groot wordt de stap om div in "time" volledig te verplaatsen
	 * step = ( finish - begin ) / frames
	 * frames = duration / timeout
	 * timeout = duur van 1 frame = 33ms
	 * step = ( finish - begin ) / ( duration / 33 )
	 */
	 
	var _self			= this;													// Self reference for timer callback
	var stepCurrent		= 0;													// Current step number
	var begin			= begin;												// Start position/number
	var finish			= finish;												// End position/number
	var callback		= callback;												// Function to call when the tween is complete
	var property		= property;												// Which property to change ( x, y, alpha, width, height )
	var stepSize		= ( finish - begin ) / ( duration / 33 );				// Total change in one step
	var stepTotal		= Math.abs( ( finish - begin ) / stepSize ); 			// Total number of steps
	var stepValue		= begin;												// Current value...
	var stepTime		= setInterval( function() { _self.step(); }, 33 );		// Timer to perform next tween step
	var easingFunction	= easingFunction;
	
	if ( typeof id == "object" )
	{
		var element = id;
	}
	else
	{
		var element = document.getElementById( id );
	}
	
	//alert ( 'Stepsize: '+ stepSize +'\nstepValue: '+ stepValue +'\nstepCurrent: '+ stepCurrent +'\nstepTotal: '+ stepTotal +'\nbegin: '+ begin +'\nfinish: '+ finish );
	
	this.step = function()
	{
		if ( stepCurrent > stepTotal )
		{
			clearInterval( stepTime );
			
			stepValue = finish;
			
			setTimeout( function() { _self.change(); }, 33) 
			
			if ( callback )
			{
				callback();
			}
		}
		else
		{
			this.change();

			stepValue = easingFunction( stepCurrent * 33, begin, ++stepCurrent * stepSize, duration );
		}
	}

	this.change = function()
	{
		switch ( property )
		{
			/**
			 * Move over x axis
			 */
			case 'x':
				element.style.left 		= Math.round( stepValue ) + "px";
				break;
	
			/**
			 * Move over y axis
			 */
			case 'y':
				element.style.top		= Math.round( stepValue ) + "px";
				break;
	
			/**
			 * Change width
			 */
			case 'width':
				element.style.width		= Math.round( stepValue ) + "px";
				break;
				
			/**
			 * Change height
			 */
			case 'height':
				element.style.height	= Math.round( stepValue ) + "px";
				break;
				
			/**
			 * Change alpha
			 *
			 * Needs browser check for compatibility 
			 */
			case 'alpha':
				element.style.opacity		= stepValue;
				element.style.MozOpacity	= stepValue;
				element.style.KhtmlOpacity	= stepValue;
				element.style.filter		= "alpha( opacity=" + stepValue * 100 + ")";
				break;
		}
	}
}

/*****************************************************************************************************************************
 * Easing functions for animations
 *****************************************************************************************************************************/
com.ydso.easing = {
	linear : function ( t, b, c, d )
	{
		t/=d;
		return b+c*(t);
	},
	outBack : function ( t, b, c, d )
	{
		var ts=(t/=d)*t;
		var tc=ts*t;
		return b+c*(4*tc + -9*ts + 6*t);
	},
	inElastic : function(t, b, c, d)
	{
		var ts=(t/=d)*t;
		var tc=ts*t;
		return b+c*(33*tc*ts + -59*ts*ts + 32*tc + -5*ts);
	},
	backInCubic : function (t, b, c, d)
	{
		var ts=(t/=d)*t;
		var tc=ts*t;
		return b+c*(4*tc + -3*ts);
	},
	outBackCubic : function(t, b, c, d)
	{
		var ts=(t/=d)*t;
		var tc=ts*t;
		return b+c*(4*tc + -9*ts + 6*t);
	}
}

/*****************************************************************************************************************************
 * Ajax request
 *
 * Some of the XML function are doing partly the same. They could be merged.
 *****************************************************************************************************************************/
com.ydso.net = {}
com.ydso.net.HTTPRequest = function ()
{
	this.url			= '';
	this.callback		= '';
	this.loader			= '';
	this.post			= new Object();
	this.mimeType		= 'text/html';		// 'text/xml'request.mimeType	= "text/xml";
	this.mode			= 'JSON';			// 'JSON', 'TEXT', 'XML'
	
	var httpRequest		= false;			// protected
	var parent			= this;				// Otherwise object is not available from onreadystatechange function call
	
	this.send = function()
	{
		var parameters	= '';
		
		// Mozilla, Safari,...
		if (window.XMLHttpRequest) 
		{
			this.httpRequest = new XMLHttpRequest();
			
			if ( this.mode != 'XML' )
			{
				if ( this.httpRequest.overrideMimeType )
				{
					this.httpRequest.overrideMimeType( this.mimeType );
				}
			}
		}
		// Internet Explorer
		else if ( window.ActiveXObject )
		{
			try
			{
				this.httpRequest = new ActiveXObject('Msxml2.XMLHTTP');
			}
			catch (e)
			{
				try
				{
					this.httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
				}
				catch (e)
				{
					
				}
			}
		}
		
		if ( !this.httpRequest )
		{
			alert('Please update your browser.');
			return false;
		}
		
		if ( this.loader )
		{
			var loaderElement = document.getElementById( this.loader );
			loaderElement.style.visibility = "visible";
		}
		
		if ( this.button )
		{
			document.getElementById( this.button ).disabled = true;
		}
		
		for ( var i in this.post )
		{
			parameters += i + "=" + escape( this.post[i] ) + "&";
		}

		if ( parameters.length > 0 )
		{
			var method = 'POST';
		}
		else
		{
			var method = 'GET';
		}
		
		this.httpRequest.open( method, this.url, true );
		this.httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		//this.httpRequest.setRequestHeader("Content-length", parameters.length );
		//this.httpRequest.setRequestHeader("Connection", "close");
		this.httpRequest.onreadystatechange = this.response;
		this.httpRequest.send( parameters );
	};
	
	this.response = function()
	{
		if ( parent.httpRequest.readyState == 4 )
		{
			if ( parent.httpRequest.status == 200 )
			{
				//if ( dbg ) 
				//{
				//alert(parent.httpRequest.responseText);
				//}
				switch ( parent.mode )
				{
					case 'XML':
					
						parent.callback( parent.httpRequest.responseXML.documentElement );
						break;
						
					case 'JSON':
						parent.callback( parent.httpRequest.responseText.parseJSON() );
						break;
				}
			}
			else
			{
				alert( "Oops, cannot load the page: " + parent.httpRequest.status );
			}
			
			if ( parent.loader )
			{
				var loaderElement = document.getElementById( parent.loader );
				loaderElement.style.visibility = "hidden";
			}
			
			if ( parent.button )
			{
				document.getElementById( parent.button ).disabled = false;
			}
		}		
	};
}


/*****************************************************************************************************************************
 * v1.7
 * Flash Player Version Detection
 * Detect Client Browser type
 * Copyright 2005-2007 Adobe Systems Incorporated.	All rights reserved.
 *****************************************************************************************************************************/
var isIE	= (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray		 = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString		= tempArray[1];			// "2,0,0,11"
			versionArray		= tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray		= versionStr.split(".");
		}
		var versionMajor		= versionArray[0];
		var versionMinor		= versionArray[1];
		var versionRevision	 = versionArray[2];

			// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
	if (src.indexOf('?') != -1)
	return src.replace(/\?/, ext+'?'); 
	else
	return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
	var str = '';
	if (isIE && isWin && !isOpera)
	{
	str += '<object ';
	for (var i in objAttrs)
	{
		str += i + '="' + objAttrs[i] + '" ';
	}
	str += ' style="position: relative; z-index: 1;">';
	for (var i in params)
	{
		str += '<param name="' + i + '" value="' + params[i] + '"/> ';
	}
	str += '</object>';
	}
	else
	{
	str += '<embed ';
	for (var i in embedAttrs)
	{
		str += i + '="' + embedAttrs[i] + '" ';
	}
	str += '> </embed>';
	}

	document.write(str);
}

function AC_FL_RunContent(){
	var ret = 
	AC_GetArgs
	(	arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	 , "application/x-shockwave-flash"
	);
	AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
	var ret = 
	AC_GetArgs
	(	arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
	 , null
	);
	AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
	var ret = new Object();
	ret.embedAttrs = new Object();
	ret.params = new Object();
	ret.objAttrs = new Object();
	for (var i=0; i < args.length; i=i+2){
	var currArg = args[i].toLowerCase();	

	switch (currArg){	
		case "classid":
		break;
		case "pluginspage":
		ret.embedAttrs[args[i]] = args[i+1];
		break;
		case "src":
		case "movie":	
		args[i+1] = AC_AddExtension(args[i+1], ext);
		ret.embedAttrs["src"] = args[i+1];
		ret.params[srcParamName] = args[i+1];
		break;
		case "onafterupdate":
		case "onbeforeupdate":
		case "onblur":
		case "oncellchange":
		case "onclick":
		case "ondblclick":
		case "ondrag":
		case "ondragend":
		case "ondragenter":
		case "ondragleave":
		case "ondragover":
		case "ondrop":
		case "onfinish":
		case "onfocus":
		case "onhelp":
		case "onmousedown":
		case "onmouseup":
		case "onmouseover":
		case "onmousemove":
		case "onmouseout":
		case "onkeypress":
		case "onkeydown":
		case "onkeyup":
		case "onload":
		case "onlosecapture":
		case "onpropertychange":
		case "onreadystatechange":
		case "onrowsdelete":
		case "onrowenter":
		case "onrowexit":
		case "onrowsinserted":
		case "onstart":
		case "onscroll":
		case "onbeforeeditfocus":
		case "onactivate":
		case "onbeforedeactivate":
		case "ondeactivate":
		case "type":
		case "codebase":
		case "id":
		ret.objAttrs[args[i]] = args[i+1];
		break;
		case "width":
		case "height":
		case "align":
		case "vspace": 
		case "hspace":
		case "class":
		case "title":
		case "accesskey":
		case "name":
		case "tabindex":
		ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
		break;
		default:
		ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
	}
	}
	ret.objAttrs["classid"] = classid;
	if (mimeType) ret.embedAttrs["type"] = mimeType;
	return ret;
}


/*****************************************************************************************************************************
 * Javascript JSON function
 *
 * Original Authorship: Douglas Crockford
 * Originating Website: http://www.JSON.org
 *****************************************************************************************************************************/
(function (s) {
	var m = {
		'\b': '\\b',
		'\t': '\\t',
		'\n': '\\n',
		'\f': '\\f',
		'\r': '\\r',
		'"' : '\\"',
		'\\': '\\\\'
	};

	s.parseJSON = function (filter)
	{
		try
		{ //if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this))
			if (/^("(\\.|[^"\\\n\r])*?\"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this))
			{
				var j = eval('(' + this + ')');
				
				if (typeof filter === 'function')
				{
					function walk(k, v)
					{
						if (v && typeof v === 'object')
						{
							for (var i in v)
							{
								if (v.hasOwnProperty(i))
								{
									v[i] = walk(i, v[i]);
								}
							}
						}
						
						return filter(k, v);
					}
	
					j = walk('', j);
				}
				
				return j;
			}
		}
		catch (e)
		{
	
		}
		
		throw new SyntaxError("parseJSON");
	};
	
	s.toJSONString = function ()
	{
		// If the string contains no control characters, no quote characters, and no
		// backslash characters, then we can simply slap some quotes around it.
		// Otherwise we must also replace the offending characters with safe
		// sequences.
		if (/["\\\x00-\x1f]/.test(this))
		{
			return '"' + this.replace(/([\x00-\x1f\\"])/g, function (a, b)
			{
				var c = m[b];
				if (c) return c;
				c = b.charCodeAt();
				return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
			}) + '"';
		}
	
		return '"' + this + '"';
	};

}) (String.prototype);


