|
|
var ids = (ids) ? ids : {};
/**
* Contains methods for getting, setting, and detecting cookies.
*/
ids.cookie = {
get: function(name) {
var cookies = document.cookie.split(';');
for (var i = 0, c; c = cookies[i]; i++) {
c = c.replace(/^\s+/, ""); //trim the front of the string
if (c.indexOf(name) == 0) return c.substring(name.length + 1, c.length);
}
return null;
},
set: function(name, value, options) {
var options = options || {},
value = value || "",
expires = options.expires || '';
if (options.expires) {
date = new Date();
date.setTime(date.getTime() + (expires * 24 * 60 * 60 * 1000));
expires = '; expires=' + date.toGMTString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '; path=/',
domain = options.domain ? '; domain=' + options.domain : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain].join('');
return decodeURIComponent(value);
},
isSupported: function() {
if ( (this.set('check', '1') != '') && (document.cookie != '') ) {
this.set('check', '1', {expires: -1}); // delete cookie;
return true;
}
return false;
}
}
/**
* Contains common functions we use for detecting flash, and replacing content
*/
ids.flash = {
fo : [],
pluginType : "",
getVersion : function(){
// ie
try {
try {
// avoid fp6 minor version lookup issues
// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try { axo.AllowScriptAccess = 'always'; }
catch(e) { this.pluginType = "ax"; return '6,0,0'; }
} catch(e) {}
this.pluginType = "ax";
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1].split(',');
// other browsers
} catch(e) {
try {
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
this.pluginType = "na";
return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1].split(',');
}
} catch(e) {}
}
this.pluginType = null;
return null;
},
replace : function (id, opts) {
var elm = document.getElementById(id),
html = elm.innerHTML, // store the html in a var.
majorVersion = "",
optional = ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars"],
object;
elm.innerHTML = "";
if(ids.cookie.isSupported()) {
if (ids.cookie.get("flashVersion") && ids.cookie.get("pluginType")) {
majorVersion = parseInt(ids.cookie.get("flashVersion"));
this.pluginType = ids.cookie.get("pluginType");
} else {
majorVersion = parseInt(ids.cookie.set("flashVersion", this.getVersion()[0], {domain: window.location.hostname}) );
ids.cookie.set("pluginType", this.pluginType, {domain: window.location.hostname});
}
} else {
majorVersion = parseInt(this.getVersion()[0]);
}
if (majorVersion < opts.version) return elm.innerHTML = html; // put the html back.
if (this.pluginType == "ax") { //
var object = '
|