//<!-- Hide from old browsers
// New window popup for realplayer links
function openWILAVHelpWindow(file){
                popupWILAVHelpWin = window.open(file, 'popup', 'scrollbars=yes,status=0,menubar=no,resizable=yes,width=618,height=450');
                myTimer=setTimeout("popupWILAVHelpWin.focus()",1000);
}

//-----------------------------------------------------------------------------------------
//-------JS to change EMP playlist links targets to direct towards embedded EMP------------
//-----------------------------------------------------------------------------------------


	//include core Glow JS File
	include_file('http://www.bbc.co.uk/glow/1.5.1/core/core.js');
	 
	
	//-------------------------------------- Functions ---------------------------------------
	
	//function used to insert <script> element in HTML to effectively include an external file
	
	function include_file(file) {
		
		var js;
		var html_doc = document.getElementsByTagName('head')[0];
		js = document.createElement('script');
		js.setAttribute('type', 'text/javascript');
		js.setAttribute('src', file);
		js.setAttribute('id', 'emp_js_import');
		html_doc.appendChild(js);
					
					
					// Check if JS file has been imported correctly (IE Only)
		js.onreadystatechange = function () {
			if (js.readyState == 'complete') {
													import_Success();
			} else if (js.readyState == 'loaded') {
													import_Success();
									}
		}
					
					// Check if JS file has been imported correctly (FireFox etc. compatable)
		js.onload = function () {
			import_Success();
		}
					
		return false;
	}
	
	//function called when Glow JS core file has been loaded.
	
	function import_Success(){
					if (window.glow) {
									glow.ready(function() {
													//check if EMP links to Audio content - if so align right, else align center.
													check_Audio_EMP();
									});
					}
	}
	 
	// Following Code checks for Media Player within the page and right-aligns if it plays audio
	
	function check_Audio_EMP(){
	
					var dom_id = "#emp1";
					
					if(glow.dom.get("#emp1").length > 0){
						
						//probe EMP object to see if displaymode is audio
						if(emp.so.variables.config_settings_displayMode == 'audio'){
										//center the EMP if audio (FireFox, Chrome, Safari, Opera etc...)
										glow.dom.get("#emp1").attr("style", "text-align: right; margin-top: 10px;");
										
										//center the EMP if audio (IE)
										glow.dom.create('<style type="text/css">#emp1{text-align: right; float: right; margin-left: 10px;}</style>').insertAfter('#emp1');
						} else {
										//center the EMP if video (FireFox, Chrome, Safari, Opera etc...)
										glow.dom.get("#emp1").attr("style", "text-align: center; margin-top: 10px;");
									   
										//center the EMP if video (IE)
										glow.dom.create('<style type="text/css">#emp1{text-align: center; margin-top: 10px;}</style>').insertAfter('#emp1');   
						}
					
					}
	}

//-----------------------------------------------------------------------------------------
//-------EMP LINK JAVASCRIPT END ----------------------------------------------------------


