/*flash embed*/

// Flash embed 26/03/07

/** bbcws library v1.11 */
var bbcws = {
    name: "bbcws",
    dom: false
};

// client information gathering
bbcws.Client = function() {
    if (document.getElementById) {
        bbcws.dom = {};
        bbcws.dom.w3c = true;
    } else {
        bbcws.dom.w3c = false;
    }
    // test for Error - a 'true' JavaScript 1.5 piece of functionality - Mac IE5 will return undefined for this.	
    if ( ! window.Error) {
        window.Error = "error";
    }
    if (window.Error != "error") {
        bbcws.true1_5 = true;
    } else {
        bbcws.true1_5 = false;
    }
    bbcws.global = {};
    bbcws.global.platform = "other";
    if (navigator.appVersion.indexOf("Windows") != -1) {
        bbcws.global.platform = "Windows";
    }
    if (window.ActiveXObject) {
        bbcws.global.hasActiveX = true;
    }
}

// make a client object in order to set global bbcws vars...
bbcws.clnt = new bbcws.Client();
bbcws.hasActiveX = function() {
    if (bbcws.global.hasActiveX) {
        return true;
    }
    return false;
}
bbcws.hasDOM = function() {
    if (bbcws.dom) {
        return true;
    }
    return false;
}
bbcws.isW3C = function() {
    if (bbcws.dom.w3c) {
        return true;
    }
    return false;
}
bbcws.getPlatform = function() {
    return bbcws.global.platform;
}
bbcws.getDomain = function() {
    return document.domain;
}
bbcws.getURL = function() {
    return window.location.href;
}


function trace() {};

bbcws.HTML = function() {}
bbcws.HTML.prototype = bbcws;
bbcws.html = new bbcws.HTML();
bbcws.HTML.Flash = function() {
    this.requiredVersion = 7;
    this.maxVersion =- 1;
    this.actualVersion = 0;
    this.hasRightVersion = false;
    this.jsVersion = 1.0;
    this.path = '';
    this.getString = "";
    ////////////////////////////
    this.flVersion = "00008";
    this.flName = "dev";
    //////////////////////
    this.flColor = "#FFFFFF";
    this.flWmode = "transparent";
    this.flWidth = "400";
    this.flHeight = "250";
    this.flQuality = "high";
    this.flScale = "noscale";
    this.flSalign = "tl";
    this.flGetFlashPlayerURL = "http://www.adobe.com/products/flashplayer/";
    
   this.noFlashContent = '<div id="no-flash"><p><strong>Flash plug-in required</strong></p>' + '<p>To view the advanced features of this page you need to have the Macromedia Flash plugin installed on your system.</p>' + '<p>The file is 466k in size and will take approximately 2 minutes to download with a 56k modem.</p>' + '<p><a href="http://www.macromedia.com/software/flashplayer/">Click here to download the Flash plugin from the Macromedia website</a></p></div>';
}

bbcws.HTML.Flash.prototype = bbcws;
bbcws.HTML.Flash.prototype.placeMovie = function(obj) {
    var arr = ['requiredVersion', 'maxVersion', 'jsVersion', 'path', 'getString', 'flVersion', 'flName', 'flColor', 'flWmode', 'flWidth', 'flHeight', 'flQuality', 'flScale', 'flSalign', 'flGetFlashPlayerURL', 'noFlashContent'];
    if (obj) {
        for (var i = 0; i < arr.length; i ++ ) {
            if (obj[arr[i]]) {
                this[arr[i]] = obj[arr[i]];
            }
        }
    }
    this.detectSettings();
    //document.write(this.doPlace());
    return this.doPlace();
    
}

bbcws.HTML.Flash.prototype.placeMovieLegacy = function(obj) {
    var arr = ['requiredVersion', 'maxVersion', 'jsVersion', 'path', 'getString', 'flVersion', 'flName', 'flColor', 'flWmode', 'flWidth', 'flHeight', 'flQuality', 'flScale', 'flSalign', 'flGetFlashPlayerURL', 'noFlashContent'];
    if (obj) {
        for (var i = 0; i < arr.length; i ++ ) {
            if (obj[arr[i]]) {
                this[arr[i]] = obj[arr[i]];
            }
        }
    }
    this.detectSettings();
    document.write(this.doPlace());
}


bbcws.HTML.Flash.prototype.detectSettings = function() {
    // if user of api doesn't set a max version, set it to 10 as a default...
    if (this.maxVersion ==- 1) {
        this.maxVersion = 10;
    }
    if (this.hasActiveX() && this.getPlatform() == "Windows") {
        var mv = this.maxVersion;
        var i = 2;
        while (i <= mv) {
            if (this.getversion(i)) {
                this.actualVersion = i;
            }
            i ++ ;
        }
    }
    if (navigator.plugins) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
            var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0": "";
            var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
            var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
            var i = 2;
            while (i <= this.maxVersion) {
                if (flashVersion == i) {
                    this.actualVersion = i
                }
                i ++ ;
            }
            if (flashVersion >= this.maxVersion) {
                this.actualVersion = this.maxVersion;
            }
        }
    }
    if (navigator.userAgent.indexOf("WebTV") != -1) {
        this.actualVersion = 3;
    }
    if (this.actualVersion >= this.requiredVersion) {
        this.hasRightVersion = true;
    }
}

bbcws.HTML.Flash.prototype.doPlace = function() {
    var last = this.path.substring((this.path.length - 1));
    if (last != "/" && last != "") {
        this.path += "/";
    }
    this.url = this.path + "" + this.flName;
    if (this.hasRightVersion) {
        return this.rightVersion();
    } else {
        return this.wrongVersion();
    }
}
//bbcws.HTML.Flash.prototype.wrongVersion=function(){return this.noFlashContent;}
bbcws.HTML.Flash.prototype.wrongVersion = function() {
    return false;
}

bbcws.HTML.Flash.prototype.rightVersion = function() {
    var content = '<OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="externalInterfaceObj" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="' + this.flWidth + '" HEIGHT="' + this.flHeight + '" id="externalInterfaceObj" ALIGN="">' + '<PARAM NAME=movie VALUE="' + this.url + '"><PARAM NAME=quality VALUE="' + this.flQuality + '"><PARAM NAME=bgcolor VALUE="' + this.flColor + '"><PARAM NAME=wmode VALUE="' + this.flWmode + '"><PARAM NAME=menu value=false /><param name="allowScriptAccess" value="always" /><PARAM NAME="scale" value="' + this.flScale + '" /><PARAM NAME="salign" value="' + this.flSalign + '" />' + '<EMBED src="' + this.url + '" quality="' + this.flQuality + '" scale="' + this.flScale + '" salign="' + this.flSalign + '" bgcolor="' + this.flColor + '" wmode="' + this.flWmode + '" WIDTH="' + this.flWidth + '" NAME="externalInterfaceObj" HEIGHT="' + this.flHeight + '" MENU="false" allowScriptAccess="always" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="' + this.flGetFlashPlayerURL + '"></EMBED>' + '</OBJECT>';
    return content;
}
bbcws.HTML.Flash.prototype.getversion = function(version) {
    this.sf = "ShockwaveFlash.ShockwaveFlash." + version;
    var f = "try{var ax=new ActiveXObject(this.sf);return true;}catch(e){return false;}";
    this.func = new Function(f);
    return this.func();
}
bbcws.html.flash = new bbcws.HTML.Flash();
/*flash embed*/

bbcws.Utils=function(){}
bbcws.Utils.prototype=bbcws;
bbcws.Utils.prototype.Refresh=function(lapse){
x=this;
window.setInterval('refreshPage(x)',lapse)
}
bbcws.Utils.prototype._refreshPage=function(){
var loc=String(this.getURL());
loc=loc.replace(/news.bbc.co.uk/,"bbcwsmg.bbc.co.uk");
var url=String(this.getURL());
if(url.search(/\?refresh/i)==-1){location.href=loc+"?refresh";}else{location.href=loc;}
}
bbcws.utils=new bbcws.Utils();
function refreshPage(x){x._refreshPage();}
bbcws.Utils.AV=function(){}
bbcws.Utils.AV.prototype=bbcws;
bbcws.Utils.AV.prototype.launch=function(obj){
	if(!obj.el){return this._doLegacy(obj);}
	this.el=obj.el;
	o={name:"clickmain",
		height:410,
		width:671,
		url:this.el.href};
	if(this.el.href.search("asb=1")!=-1){o.height=600;}
	this._doLaunch(o);
	return false;
	}
bbcws.Utils.AV.prototype._doLegacy=function(obj){
	if(!obj.storyId){obj.storyId=0;}
	obj.storyId=Number(obj.storyId);
	if(!obj.returnString){obj.returnString=false;}
	if(!obj.preURL){obj.preURL="";}
	if(!obj.section){obj.section="";}
	if(!obj.bb){obj.bb=false;}
	if(!obj.fileLoc){obj.fileLoc="x";}
	if(!obj.height){obj.height=440;}
	if(!obj.width){obj.width=671;}
	if(!obj.name){obj.name="clickmain";}
	if(!obj.redirect){obj.redirect=obj.storyId;}
	if(!obj.nbram){obj.nbram=0;}
	if(!obj.bbram){obj.bbram=0;}
	if(!obj.nbwm){obj.nbwm=0;}
	if(!obj.bbwm){obj.bbwm=0;}
	if(!obj.site){obj.site=this.getSite(obj.storyId)}
	if(obj.edition=="ifs"){obj.bbwm=0;obj.bbrm=0;obj.nbwm=1;obj.nbrm=1;}
	if(!obj.url){
		if(obj.fileLoc.charAt(obj.fileLoc.length-1)=="/"){obj.fileLoc=obj.fileLoc.substring(0,(obj.fileLoc.length-1));}
		obj.url=obj.preURL+"http://www.bbc.co.uk/mediaselector/check"+obj.fileLoc;
		obj.url+="?"
		+"redirect="+obj.redirect+".stm"
		+"&"+"bbwm="+obj.bbwm
		+"&"+"bbram="+obj.bbram
		+"&"+"nbwm="+obj.nbwm
		+"&"+"nbram="+obj.nbram;
		obj.url+="&news=1";
		if(obj.section!=""){obj.url+="&"+"nol_index="+obj.section;}
		}
	return this._doLaunch(obj);
	}
bbcws.Utils.AV.prototype._doLaunch=function(o){
	if(!o.returnString){var console=eval(o.name+"=bbcws.window.popup(o)");return false;}else{return o.url;}
	if(console){console.focus();}
	return false;
	}
bbcws.Utils.AV.prototype.getFileLoc=function(storyId){
if(this.getSite()=="sport"){site="sol";}else{site="nol";}
var parentFolder=parseInt(storyId/10000)*10000;
var childFolder=parseInt(storyId/100)*100;
return "/player/"+site+"/bbcwsd_"+parentFolder+"/bbcwsd_"+childFolder;
}
bbcws.Utils.AV.prototype.getSite=function(){
if(this.getURL().search("co.uk/sport")!=-1||this.getURL().search("co.uk/sol")!=-1){return "sport";}
return "news";
}
bbcws.Utils.AV.prototype.openAggregation=function(){
if(bbcws.utils.av.getSite()=="sport"){bbcws.window.opener({url:"http://news.bbc.co.uk/sport1/hi/video_and_audio/default.stm"})}else{bbcws.window.opener({url:"http://news.bbc.co.uk/1/hi/video_and_audio/default.stm"})}
}

bbcws.utils.av=new bbcws.Utils.AV();


bbcws.Window = function(){}
bbcws.Window.prototype = bbcws;
bbcws.Window.prototype.popup=function(obj){
	if(!obj.url){obj.url="";}
	if(!obj.toolbar){obj.toolbar=0;}
	if(!obj.scrollbars){obj.scrollbars=0;}
	if(!obj.location){obj.location=0;}
	if(!obj.status){obj.status=0;}
	if(!obj.menubar){obj.menubar=0;}
	if(!obj.resizable){obj.resizable=0;}
	if(!obj.top){obj.top=100;}
	if(!obj.left){obj.left=100;}
	if(!obj.width){obj.width=671;}
	if(!obj.height){obj.height=373;}
	if(!obj.name){obj.name="win"+new Date().getTime();}
	if(!obj.parameters){obj.parameters="toolbar="+obj.toolbar+",scrollbars="+obj.scrollbars+",location="+obj.location+",status="+obj.status+",menubar="+obj.menubar+",resizable="+obj.resizable+",width="+obj.width+",height="+obj.height+",top="+obj.top+",left="+obj.left;}
	return window.open(obj.url,obj.name,obj.parameters);
	}
bbcws.Window.prototype.resizeTo=function(obj){
window.resizeTo(obj.x,obj.y);
}
bbcws.Window.prototype.href=function(obj){
if(obj.url){window.location.href=obj.url;return;}
return;
}
bbcws.Window.prototype.opener=function(obj){
if(obj.url){window.open(obj.url);return;}
return;
}
bbcws.window=new bbcws.Window();

/*### UTILS #*/

var tc__get_el_by_id = function(el_id) {
    if (document.getElementById) {
        return document.getElementById(el_id);
    } 
	else if (document.all) {
        return document.all[el_id];
    } 
	else if (document.layers) {
        return document.layers[el_id];
    } 
	else {
        return false;
    }
}

var tc__get_els_by_class = function (obj, tag, class_name) {
    var array_els = (tag == "*" && obj.all)? obj.all : obj.getElementsByTagName(tag);
   	var array_rtn_els = new Array();
    class_name = class_name.replace(/\-/g, "\\-");
   	var o_reg_exp = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
    var o_el;
   	for (var i in array_els) {
       	o_el = array_els[i];
        if (o_reg_exp.test(o_el.className)) {
   	        array_rtn_els.push(o_el);
       	}   
    }
   	return array_rtn_els;
}	

var tc__copy_href_to_onclick_fn_by_class = function(mod_class,fn_name,target_name) {
	var class_mods_arr = tc__get_els_by_class(document,"*", mod_class);
	for (var i in class_mods_arr) {
		class_mods_arr[i].onclick = function() {eval(fn_name + "(this.href);"); return false;}
		if (target_name) {
			class_mods_arr[i].target = target_name;
		}
	}
}

var tc__is_node = function(el) {
    if (el.nodeType == 1) {
        return true;
    }
    return false;
}

var tc__toggle_el = function(el) {
    if (tc__is_node(el)) {
        el.style.display = (el.style.display == "block") ? "none": "block";
    }
}

var tc__close_el = function(el) {
    if (tc__is_node(el)) {
        el.style.display = "none";
    }
}

var tc__open_el = function(el) {
    if (tc__is_node(el)) {
        el.style.display = "block";
    }
}

var tc__toggle_id = function(el_id) {
    if (toggle = tc__get_el_by_id(el_id)) {
        toggle.style.display = (toggle.style.display == "block") ? "none": "block";
    }
}

var tc__close_id = function(el_id) {
    if (toggle = tc__get_el_by_id(el_id)) {
        toggle.style.display = "none";
    }
}

var tc__open_id = function(el_id) {
    if (toggle = tc__get_el_by_id(el_id)) {
        toggle.style.display = "block";
    }
}

var tcav__service = 'arabic'; // default/first service

/*####gen abv*/



