/*
 * QTObject embed
 * http://blog.deconcept.com/2005/01/26/web-standards-compliant-javascript-quicktime-detect-and-embed/
 *
 * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/)
 *
 * v1.0.2 - 02-16-2005
 * v1.1.0 - 04-26-2006 by Jeffery To (jeffery.to@ionglobal.com)
 *
 * Embeds a quicktime movie to the page, includes plugin detection
 *
 */

if(typeof deconcept=="undefined"){
var deconcept=new Object();
}
if(typeof deconcept.util=="undefined"){
deconcept.util=new Object();
}
if(typeof deconcept.QTObjectUtil=="undefined"){
deconcept.QTObjectUtil=new Object();
}
deconcept.QTObject=function(_1,id,w,h,_5,c,_7,_8,_9){
if(!document.createElement||!document.getElementById){
return;
}
this.DETECT_KEY=_9?_9:"detectqt";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){
this.setAttribute("mov",_1);
}
if(id){
this.setAttribute("id",id);
}
if(w){
this.setAttribute("width",w);
}
if(h){
this.setAttribute("height",h);
}
this.setAttribute("version",new deconcept.PlayerVersion([1,0,0]));
if(_5){
this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));
}
this.installedVer=deconcept.QTObjectUtil.getPlayerVersion();
if(c){
this.addParam("bgcolor",c);
}
if(_7){
this.setAttribute("mov",_7);
this.addParam("href",_1);
this.addParam("target","myself");
this.addParam("controller","false");
}
this.setAttribute("redirectUrl","");
if(_8){
this.setAttribute("redirectUrl",_8);
}
};
deconcept.QTObject.prototype={setAttribute:function(_a,_b){
this.attributes[_a]=_b;
},getAttribute:function(_c){
return this.attributes[_c];
},addParam:function(_d,_e){
this.params[_d]=_e;
},getParams:function(){
return this.params;
},addVariable:function(_f,_10){
this.variables[_f]=_10;
},getVariable:function(_11){
return this.variables[_11];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _12=new Array();
var key;
var _14=this.getVariables();
for(key in _14){
_12.push(key+"="+_14[key]);
}
return _12;
},getQTHTML:function(){
var _15="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
_15="<embed type=\"video/quicktime\" src=\""+this.getAttribute("mov")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_15+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _16=this.getParams();
for(var key in _16){
_15+=[key]+"=\""+_16[key]+"\" ";
}
_15+="/>";
}else{
_15="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_15+="<param name=\"src\" value=\""+this.getAttribute("mov")+"\" />";
var _18=this.getParams();
for(var key in _18){
_15+="<param name=\""+key+"\" value=\""+_18[key]+"\" />";
}
_15+="</object>";
}
return _15;
},write:function(_1a){
if(this.skipDetect||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _1a=="string")?document.getElementById(_1a):_1a;
n.innerHTML=this.getQTHTML();
n.style.display = "block";
n.style.visibility = "visible";
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){
document.location.replace(this.getAttribute("redirectUrl"));
} else {var n=(typeof _1a=="string")?document.getElementById(_1a):_1a; n.style.display = "block"; n.style.visibility = "visible";}
}
return false;
}};
deconcept.QTObjectUtil.getPlayerVersion=function(){
var _1c=new deconcept.PlayerVersion([0,0,0]);
var _1d;
if(navigator.plugins&&navigator.mimeTypes.length){
for(var i=0;i<navigator.plugins.length;i++){
var x=navigator.plugins[i];
if(x.name.indexOf("QuickTime")>-1){
if(!_1d){
_1c=new deconcept.PlayerVersion([1,0,0]);
}
_1d=new deconcept.PlayerVersion(x.name.replace(/([a-z]|[A-Z]|-|\s)+/,"").split("."));
if(_1d.versionIsValid(_1c)){
_1c=_1d;
}
}
}
}else{
var axo=null;
try{
axo=new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1");
}
catch(e){
axo=null;
}
if(axo){
_1c=new deconcept.PlayerVersion([1,0,0]);
if(axo.QuickTimeVersion){
var v=axo.QuickTimeVersion>>16;
_1c=new deconcept.PlayerVersion([(v&3840)>>8,(v&240)>>4,v&15]);
}
}
}
return _1c;
};
deconcept.PlayerVersion=function(_22){
this.major=parseInt(_22[0])!=null?parseInt(_22[0]):0;
this.minor=parseInt(_22[1])||0;
this.rev=parseInt(_22[2])||0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){
return false;
}
if(this.major>fv.major){
return true;
}
if(this.minor<fv.minor){
return false;
}
if(this.minor>fv.minor){
return true;
}
if(this.rev<fv.rev){
return false;
}
return true;
};
deconcept.util={getRequestParameter:function(_24){
var q=document.location.search||document.location.hash;
if(q){
var _26=q.indexOf(_24+"=");
var _27=(q.indexOf("&",_26)>-1)?q.indexOf("&",_26):q.length;
if(q.length>1&&_26>-1){
return q.substring(q.indexOf("=",_26)+1,_27);
}
}
return "";
}};
if(Array.prototype.push==null){
Array.prototype.push=function(_28){
this[this.length]=_28;
return this.length;
};
}
var getQueryParamValue=deconcept.util.getRequestParameter;
var QTObject=deconcept.QTObject;

