var xmlPath = "assets/xml/" + ((window.location.search.indexOf("preview=1") != -1) ? "preview" : "live") + "/";

var cachebuster=Math.random()*10000000000000000;

//var xmlPath = "assets/xml/";
//console.log ("XML PATH =",xmlPath);

var params = {
	quality: "high",
	scale: "noscale",
	wmode: "window",
	allowscriptaccess: "always",
	bgcolor: "#FFFFFF"
};

var flashvars = {
	siteXML:"assets/xml/site.xml?nocache="+cachebuster,
	clientsXML: xmlPath + "clients.xml?nocache="+cachebuster,
	brandtailingXML: "assets/xml/brandtailing.xml?nocache="+cachebuster,
	speakingoutXML: xmlPath + "speaking.xml?nocache="+cachebuster,
	newsXML: xmlPath + "news.xml?nocache="+cachebuster,
	workXML: xmlPath + "whatson.xml?nocache="+cachebuster,
	peopleXML: xmlPath + "ourpeople.xml?nocache="+cachebuster,
	tickerXML: "/getDow.aspx"
};

var attributes = {
	id: "flashcontent",
	name: "flashcontent"
};

swfobject.embedSWF("main.swf", "flashcontent", "100%", "100%", "10.1.0", "expressInstall.swf", flashvars, params, attributes);

isIPad = function(agent) {
	agent = agent || navigator.userAgent.toLowerCase();
	return ( agent.match(/iP(ad)/i) !== null );
}

isIPhone = function(agent) {
	var _this = this;
	agent = agent || navigator.userAgent.toLowerCase();  
	return ( agent.match(/iP(hone|od)/i ) !== null);
}

isAndroid =  function(agent) {
	agent = agent || navigator.userAgent.toLowerCase();
	return ( agent.match(/android/i) !== null );
}

isBlackberry =  function(agent) {
	agent = agent || navigator.userAgent.toLowerCase();
	return ( agent.match(/blackberry/i) !== null );
}



if (!isIPad() && !isIPhone() && !isAndroid()) {
	
}
else if (isIPhone() || isAndroid()) {
	window.location="/m/";
}
else if (isBlackberry()) {
	window.location="/m/bb/"
}
else
{
	window.location="/t/";
}
