// JavaScript Document


//http://www.featureblend.com/license.txt
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";


	var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
//alert(FlashDetect.installed);
var brw = BrowserDetect.browser + " " + BrowserDetect.version;
if((FlashDetect.installed && brw == "Explorer 8" && FlashDetect.minorAtLeast(10)) || !FlashDetect.installed ){
		if (confirm("Your Flash Version is: "+ FlashDetect.major +"\n "+brw+" needs Flash 10 in order to view this video correctly.\nDo you want to upgrade/install now?")){
			window.location = "http://get.adobe.com/flashplayer";}else{};     	
}


	document.write('<link type="text/css" href="http://www.digitalblack.com.au/clients/connecting-ireland/css/mainVideo.css" rel="stylesheet" />');
	document.write('<!--[if gte IE 7]><link type="text/css" href="http://www.digitalblack.com.au/clients/connecting-ireland/css/mainVideoIE.css" rel="stylesheet" /><![endif]-->');
	document.write('<!--[if IE 7]><link type="text/css" href="http://www.digitalblack.com.au/clients/connecting-ireland/css/mainVideoIE.css" rel="stylesheet" /><![endif]-->');
	document.write('<!--[if IE 6]><link type="text/css" href="http://www.digitalblack.com.au/clients/connecting-ireland/css/mainVideoIE6.css" rel="stylesheet" /><![endif]-->');
	
	var player;
    function playerReady(obj) {
		//alert('the videoplayer '+obj['id']+' has been instantiated');
		player = document.getElementById(obj['id']);
		player.addModelListener("STATE","stateTracker");		
		setTimeout("fillDesc()", 5000);
		//fillDesc();
	};
	
	
	function playVideoFroFlash(){
		playVideo(0);
	}	
	
	function playVideo(video){
		//document.getElementById('flashDiv').style.zindex= -1;
		
		pageTracker._trackEvent('ConnectingIreland', 'Play', player.getConfig().title);
		
		document.getElementById('flashDiv').style.display="none";	
		document.getElementById('flashDivEnd').style.display="none";	
		brw = BrowserDetect.browser + BrowserDetect.version;
		
		if(brw == "Explorer6"){
			document.getElementById('preview').style.display="block";	
		}
		else{
			document.getElementById('preview').style.visibility="visible";
			document.getElementById('preview').style.zindex=999;
		}
		player.sendEvent('ITEM',video);
		//document.getElementById('info').innerHTML = "<span style='color:#CCCCCC'>"+player.getPlaylist()[video].description+"</span>" ;		
	};
	var brw = BrowserDetect.browser + BrowserDetect.version;
	//alert (brw);
	
	if(brw == "Explorer8")
		setTimeout("fillDesc()", 5000);
	
	
	function fillDesc(){
		document.getElementById('flashDiv').innerHTML="<a href='#' onclick='playVideo(0);'><img border='0' src='http://www.digitalblack.com.au/clients/connecting-ireland/images/openPic.jpg' width='540' height='350'></a>";			
	}
	
	function stateTracker(obj){
		if(obj.newstate == "COMPLETED"){
			
			pageTracker._trackEvent('ConnectingIreland', 'Play Completed', player.getConfig().title);
			
		brw = BrowserDetect.browser + BrowserDetect.version;
		
		if(brw == "Explorer6")
			document.getElementById('preview').style.display="none";
		else
			document.getElementById('preview').style.visibility="visible";
			
		document.getElementById('flashDivEnd').style.display="block";
		document.getElementById('flashDivEnd').innerHTML="<img src='http://www.digitalblack.com.au/clients/connecting-ireland/images/closePic.jpg' width='540' height='350' border='0' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='18,302,132,331' href='http://www.connectingireland.com/register.aspx' target='_self' /><area shape='rect' coords='155,303,338,330' href='#' onclick='playVideo(0)' /></map>";
		}
	}
	
document.write('<div class="wrapperOut"><div id="preview">');

/** First write the HTML fallback to the page, so it'll be there even for devices that have poor JS support. **/
document.write("<div class='botrplayer ltas-ad' id='botr_01VWZc9l_LCqiYq1w_div'><a href=\"http://bitcast-b.bitgravity.com/botr/ZxSURTGX/videos/01VWZc9l-47607.mp4?e=1267064051&amp;h=9fb30ed85b0a9d94a9a22f3ca70fcbd8\" title=\"Enterprise Ireland\" style='display:block; width:540px; height:350px; background: #ffffff url(http://content.bitsontherun.com/thumbs/01VWZc9l-640.jpg) no-repeat center center;'><img src='http://content.bitsontherun.com/staticfiles/play.png' alt='Click to play video' style='display: block; padding: 145px 240px;' /></a></div>");




/** Define the botrObject library. **/
if (typeof(botrObject) == 'undefined') {
	var botrObject = {};
	botrObject.players = [];
	botrObject.isDomReady = function() {
		var d = document;
		if (d && d.getElementsByTagName && d.getElementById && d.body) {
			clearInterval(botrObject.domTimer);
			for(var i=0; i<botrObject.players.length; i++) {
				botrObject.writePlayer(i);
			}
			botrObject.domDone = true;
		}
	};
	botrObject.canPlayFlash = function () {
		var version = '0,0,0,0';
		try {
			try {
				var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
				try { axo.AllowScriptAccess = 'always'; }
				catch(e) { version = '6,0,0'; }
			} catch(e) {}
			version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable(
				'$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
		} catch(e) {
			try {
				if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
					version = (navigator.plugins["Shockwave Flash 2.0"] || 
						navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
				}
			} catch(e) {}
		}
		var major = parseInt(version.split(',')[0]);
		var minor = parseInt(version.split(',')[2]);
		if(major > 9 || (major == 9 && minor > 97)) {
			return true;
		} else {
			return false;
		}
	};
	botrObject.canPlayVideo = function () {
		try {
			return !!document.createElement('video').canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
		} catch (e) { 
			return false;
		}
	};
	botrObject.writePlayer = function(idx) {
		var elm = document.getElementById(botrObject.players[idx].container);
		if(botrObject.canPlayFlash()) {
			elm.innerHTML = botrObject.players[idx].getFlashHTML();
		} else if (botrObject.canPlayVideo()) {
			elm.innerHTML = botrObject.players[idx].getVideoHTML();
		} else {
			elm.innerHTML = botrObject.players[idx].getLinkHTML();
		}
	};
	botrObject.swf = function (src,btn,img,lnk,id,wth,hei) {
		if (!document.getElementById) { return; }
		this.source = src;
		this.button = btn;
		this.image = img;
		this.link = lnk;
		this.sources = [];
		this.id = id+'_swf';
		this.container = id+'_div';
		this.width = wth;
		this.height = hei;
		this.flashvars = {id:this.id};
		this.params = {
			'allowfullscreen':'true',
			'allowscriptaccess':'always',
			'bgcolor':'#000000',
			'wmode':'transparent'
		};
		botrObject.players.push(this);
		if (botrObject.domDone) {
			var len = botrObject.players.length-1;
			setTimeout(function(){botrObject.writePlayer(len)},50);
		}
	};
	botrObject.swf.prototype = {
		getFlashHTML:function() {
			var html = "";
			var fv = this.getVariables();
			if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
				html = '<embed type="application/x-shockwave-flash" src="'+ this.source +'" ';
				html += 'width="'+ this.width +'" height="'+ this.height +'"';
				html += ' id="'+ this.id +'" name="'+ this.id +'" ';
				for(var key in this.params) {
					html += [key] +'="'+ this.params[key] +'" ';
				}
				html += 'flashvars="'+ fv +'" />';
			} else {
				html = '<object id="'+ this.id +'" name="'+ this.id +'" width="'+ this.width + '" ';
				html += 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="'+ this.height +'">';
				html += '<param name="movie" value="'+ this.source +'" />';
				for(var key in this.params) { 
					html += '<param name="'+ key +'" value="'+ this.params[key] +'" />';
				}
				html += '<param name="flashvars" value="'+ fv +'" />';
				html += "</object>";
			}
			return html;
		},
		getVideoHTML:function() {
			var idx = 0;
			if(this.sources.length == 0) { 
				return this.getLinkHTML();
			}
			this.sources.sort(function(a,b){return a.width-b.width;});
			for(var i=0; i<this.sources.length; i++) {
				if(this.sources[i]['width'] > screen.width * 1.2 || this.sources[i]['width'] > 1000) {
					break;
				} else {
					idx = i;
				}
			}
			var html = "<video src='"+this.sources[idx].url+"' ";
			html += "width='"+this.width+"' ";
			html += "height='"+this.height+"' ";
			html += "poster='"+this.image+"' ";
			html += "style='margin: 0 auto; padding:0; border:0;' preload='none' ";
			html += "controls>"+this.flashvars.title+"</video>";
			return html;
		},
		getLinkHTML:function() {
			var html = "";
			html += "<a href='"+this.link+"' ";
			html += "title='"+this.flashvars.title+"' style='display:block; position:relative; ";
			html += "width:"+this.width+"px; ";
			html += "height:"+this.height+"px; ";
			html += "background: #000000 url("+this.image+") no-repeat center center;'>";
			if(this.link.substr(-4) != '.jpg') { 
				html += "<img src='"+this.button+"' alt='Click to play video' ";
				html += "style='position:absolute; top:"+(Math.round(this.height/2)-30)+"px; ";
				html += "left:"+(Math.round(this.width/2)-30)+"px; border:0;' />";
			}
			html += "</a>";
			return html;
		},
		addSource: function(url,wid) {
			this.sources.push({url:url,width:wid});
		},
		addVariable: function(name,value) {
			this.flashvars[name] = decodeURIComponent(value);
		},
		getVariables: function () {
			var pairs = new Array();
			for(var key in this.flashvars) {
				pairs[pairs.length] = key+"="+encodeURIComponent(this.flashvars[key]);
			}
			return pairs.join('&');
		}
	};
	botrObject.domTimer = setInterval(botrObject.isDomReady,50);
}




/** With the library defined, initialize the player and inject all sources and flashvars. **/

document.write("<div class='botrplayer' id='botr_01VWZc9l_LCqiYq1w_div'></div>");

var botr_01VWZc9l_LCqiYq1w = new botrObject.swf(
	"http://d2ciznq2rtdp7k.cloudfront.net/player.10849.swf",
	"http://content.bitsontherun.com/staticfiles/play.png",
	"http://content.bitsontherun.com/thumbs/01VWZc9l-320.jpg",
	"http://content.bitsontherun.com/videos/01VWZc9l-47607.mp4?exp=1283171686&amp;sig=efa88db0cc266fc5ca535d979ba2944a",
	"botr_01VWZc9l_LCqiYq1w",
	"540",
	"350");

botr_01VWZc9l_LCqiYq1w.addSource("http://content.bitsontherun.com/videos/01VWZc9l-47607.mp4?exp=1283171686&amp;sig=efa88db0cc266fc5ca535d979ba2944a","320");
botr_01VWZc9l_LCqiYq1w.addSource("http://content.bitsontherun.com/videos/01VWZc9l-47608.mp4?exp=1283171686&amp;sig=7c2aaf53d857601b76763fbacd59ef1b","720");

botr_01VWZc9l_LCqiYq1w.addVariable("backcolor","FFFFFF");
botr_01VWZc9l_LCqiYq1w.addVariable("playlist","none");
botr_01VWZc9l_LCqiYq1w.addVariable("repeat","none");
botr_01VWZc9l_LCqiYq1w.addVariable("displayclick","play");
botr_01VWZc9l_LCqiYq1w.addVariable("dock","false");
botr_01VWZc9l_LCqiYq1w.addVariable("frontcolor","000000");
botr_01VWZc9l_LCqiYq1w.addVariable("title","Enterprise Ireland");
botr_01VWZc9l_LCqiYq1w.addVariable("image","http://content.bitsontherun.com/thumbs/01VWZc9l-320.jpg");
botr_01VWZc9l_LCqiYq1w.addVariable("stretching","uniform");
botr_01VWZc9l_LCqiYq1w.addVariable("ping.script","http://content.bitsontherun.com/pings/");
botr_01VWZc9l_LCqiYq1w.addVariable("height","260");
botr_01VWZc9l_LCqiYq1w.addVariable("width","320");
botr_01VWZc9l_LCqiYq1w.addVariable("lightcolor","000000");
botr_01VWZc9l_LCqiYq1w.addVariable("file","http://content.bitsontherun.com/jwp/01VWZc9l.xml");
botr_01VWZc9l_LCqiYq1w.addVariable("autostart","false");
botr_01VWZc9l_LCqiYq1w.addVariable("skin","http://d1rhaz9gq9lm5b.cloudfront.net/wMnhpn8l.swf");
botr_01VWZc9l_LCqiYq1w.addVariable("playlistsize","200");

document.write('</div><div id="flashDiv"><img src="http://www.digitalblack.com.au/clients/connecting-ireland/images/loading_wh.gif" width="540" height="360" /></div><div id="flashDivEnd" style="display:none"></div></div>');
