 //<![CDATA[
$(document).ready(function() {
  $(".xpando .xpando-content").hide();
  $(".xpando h4 span").wrap("<a href='#'><\/a>");
  $(".xpando h4 span").append("<span class='tog'>&nbsp;(show)<\/span><span class='tog' style='display:none'>&nbsp;(hide)<\/span>");
  $(".xpando h4 a").click(function(event){
       $(this).parents("h4").next(".xpando-content").slideToggle("slow");
	   $(this).children().children().toggle();
	   $(this).blur();
       return false;
     });
});
//]]> 
 
var flash_required = 7;

function write_flash_to_screen(movie_path,width,height,vars) {
	var embed_string = '';
	
	embed_string += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="" align="middle" viewastext>';
	embed_string += '<param name="allowScriptAccess" value="sameDomain" />';
	embed_string += '<param name="movie" value="'+movie_path+'?'+vars+'" />';
	embed_string += '<param name="quality" value="high" />';
	embed_string += '<param name="scale" value="noscale" />';
	embed_string += '<param name="salign" value="t" />';
	embed_string += '<embed src="'+movie_path+'?'+vars+'" scale="noscale" salign="t" quality="high" width="'+width+'" height="'+height+'" name="" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	embed_string += '</object>';
	
	return embed_string;
}

function render_flash(){
	//array elements
	//0: flash movie path
	//1: movie width
	//2: movie height
	//3: movie container div
	//4: movie paramaters
	//5: alternative non-flash image
	//6: url for alternative non-flash image
	//7: target for alternative non-flash image
	//8: alt text for alternative non-flash image

	url_supplied = false;
	target_supplied = false;
	
	if(flash.ver[flash_required]){
		document.getElementById("flash_movie").innerHTML = write_flash_to_screen(flash_details[0],flash_details[1],flash_details[2],flash_details[3],flash_details[4],flash_details[5]);
	}
	else{
		if(((typeof(flash_details[5]) != 'undefined') && (flash_details[5]) != null) && (flash_details[5] != 'null') && (flash_details[5] != '')){
			var image_html = '';

			//check for alternative image href
			if(((typeof(flash_details[6]) != 'undefined') && (flash_details[6]) != null) && (flash_details[6] != 'null') && (flash_details[6] != '')){
				image_html += '<a href="' + flash_details[6] + '"';				
				url_supplied = true;
				
				//check for alternative image target
				if(((typeof(flash_details[7]) != 'undefined') && (flash_details[7]) != null) && (flash_details[7] != 'null') && (flash_details[7] != '')){
					image_html += ' target="' + flash_details[7] + '"';
					target_supplied = true;
				}
				
				//check for alternative image alt text
				if(((typeof(flash_details[8]) != 'undefined') && (flash_details[8]) != null) && (flash_details[8] != 'null') && (flash_details[8] != '')){
					image_html += ' title="' + flash_details[8] + '"';
				}				
				
				image_html += '>';			
			}
			
			image_html += '<img src="' + flash_details[5] + '" height="' + flash_details[2] + '" width="' + flash_details[1] + '"';
			
			if(url_supplied || target_supplied){
				image_html += ' border="0"></a>';
			}
			else{
				image_html += '>';
			}
			
			document.getElementById("flash_movie").innerHTML = image_html;
		}
		else{
			//if no alternative image has been supplied, display the following message within the flash container div
			document.getElementById("flash_movie").innerHTML = '<div class="body-text"><br><br>You will need to have the Adobe Flash Player installed on your PC in order to view this content.<br><br>This can be downloaded for free from <a class="pink-link" href="http://www.adobe.com" target="_blank">the Adobe website</a>.<br><br></div>';
		}
	}
}