/* ===================================================
	Copyright (c) 2003-2005 Macromedia Inc.
	global JavaScript functions 
	$Revision: 1.39 $
==================================================== */
if( typeof com == "undefined" ) var com = new Object();
if( typeof com.adobe == "undefined" ) com.adobe = new Object();
if( typeof com.adobe.util == "undefined" ) com.adobe.util = new Object();
if (window.parent == self)
{
window.name = "MacromediaWindow";
window.focus();
}
var crosslinkWindow;
function openCrosslinkWindow ( url )
{
if (window.opener != null && !window.opener.closed) {
window.opener.location = url;
window.opener.focus();
} else if (typeof crosslinkWindow != "undefined" && crosslinkWindow != null && !crosslinkWindow.closed) {
crosslinkWindow.location = url;
crosslinkWindow.focus();
} else {
crosslinkWindow = window.open(url, "AdobeWindow");
crosslinkWindow.focus();
}
}
var mmWindow;
function openMMWindow ( url )
{
if (window.opener != null && !window.opener.closed) {
window.opener.location = url;
window.opener.focus();
} else if (typeof mmWindow != "undefined" && mmWindow != null && !mmWindow.closed) {
mmWindow.location = url;
mmWindow.focus();
} else {
mmWindow = window.open(url, "mm_window");
mmWindow.focus();
}
}
PNG = function (id,src,altsrc) {
var png = document.createElement('img');
png.setAttribute('id',id);
if (browser.ua.indexOf('msie 5.0') != -1) {
if (altsrc != null) png.src = altsrc;
else return;
} else if ((browser.appN.indexOf('microsoft') != -1) && (browser.ua.indexOf('mac') == -1)) {
png.src = '../images/blank.gif';
png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale');";
} else {
png.src = src;
}
return png;
}
if (typeof Array.prototype.push == "undefined") 
{
Array.prototype.push = function(i)
{
this[this.length] = i;
return this.length;
}
}
function removeElementFromDOM (id) {
var element = document.getElementById(id);
return element.parentNode.removeChild(element);
}
function resolveElemId(elem)
{
if(elem)
{
var id = elem.getAttribute('id');
if(!id) 
{			
var name = elem.nodeName.toLowerCase();
id = randomId(name);
elem.setAttribute('id', id);
}
return id;
}
return null;
}
function randomId(name)
{
var num = Math.floor(Math.random()*10000);
name = (name) ? name : 'rand';
var id = (name+num);
while(document.getElementById(id))
{
id = name+(num++);
}
return id;
}
var attrname = {"start":"(^| )","end":"( |$)"};
function getAttrValue(node, attr)
{
var output;
try
{
if(node[attr]) output = node[attr];
}
catch(err)
{
try
{
if(node.getAttribute(attr)) output = node.getAttribute(attr);
}
catch(err)
{
return null;
}
}
return output;
}
function normalizeObjectBoxModel(elem)
{
if(window.getComputedStyle)
{
var display = window.getComputedStyle(elem,'').getPropertyValue('display');
switch(display)
{
case "block": return;
break;
case "inline": 
elem.style.display="block";
break;
}
return
}
return
}
function getFirstTag(parent,tagname)
{
if(!parent) return null;
for(var i=0,child;child=parent.childNodes[i];i++)
{
if(child && child.nodeType == 1)
{
if(!tagname) return child;
else if(child.nodeName == tagname) return child;
else continue;	
}
}
return null;
}
function getChildTags(parent, tagname)
{
if(!parent) return null;
var output = new Array();
for(var i=0,child;child=parent.childNodes[i];i++)
{
if(child && child.nodeType == 1)
{
if(!tagname) output.push(child);
else if(child.nodeName == tagname) output.push(child);
else continue;
}
}
return output;
}
CSSFeatureTest = function()
{
this.els = [];
this.buildTest = function()
{
var i=0;
while(i<3)
{
var el = document.createElement('DIV');
el.id = "testelem"+i;
el.style.visibility = "hidden";
el.style.height = "0";
this.els[i] = el;
i++
}
this.els[0].appendChild(this.els[1]);
this.els[0].appendChild(this.els[2]);
document.body.appendChild(this.els[0]);
}
this._base = function()
{
return getElemStyle(this.els[0],'overflow') == 'hidden';
}
this._directchild = function()
{
return getElemStyle(this.els[1],'overflow') == 'hidden';
}
this._firstchild = function()
{
return getElemStyle(this.els[1],'cursor') == 'move';
}
this._layout = function()
{
return getElemStyle(this.els[0],'hasLayout') == true; 
}
this._lastchild = function()
{
return getElemStyle(this.els[2],'cursor') == 'move';
}
this._adjacent = function()
{
return getElemStyle(this.els[2],'clear') == 'right';
}
this._attribute = function()
{
return getElemStyle(this.els[0],'clear') == 'right';
}
this.test = function(feature)
{
var test = (test) ? test : this.buildTest();
var base = (base) ? base : this._base();
if(base == false) return null;
feature = "_"+feature;
if(!this[feature]) return null;
return (typeof this[feature] == "boolean") ? this[feature] : this[feature]();
}
return this;
}
var cssfeatures = new CSSFeatureTest();
function getElemStyle( elem, attrstyle, propstyle )
{
if(typeof elem == 'string') elem = document.getElementById(elem);
if(!elem) return "";
if(!propstyle) propstyle = attrstyle;
if (elem.style[propstyle]) 
{
return elem.style[propstyle];
}
else if(elem.currentStyle) 
{
return elem.currentStyle[propstyle];
}
else if(window.getComputedStyle) 
{
return window.getComputedStyle(elem,"").getPropertyValue(attrstyle);
}
else if (document.defaultView && document.defaultView.getComputedStyle) 
{
return document.defaultView.getComputedStyle(elem,"").getPropertyValue(attrstyle);
}
return "";
}
StyleEvent = function(elem)
{
this.elem = elem;
this.elem.styleEvent = this;
this.styles = new Object();
var styles = this.elem.className.split(' ');
for(var i=0, style; style=styles[i]; i++)
{
this.styles[style] = true;
}
this.add = function()
{
for(var i=0, argument; argument=arguments[i]; i++)
{
this.styles[argument] = (this.styles[argument]) ? true : false;
}
}
this.remove = function(stylename)
{
delete this.styles[stylename];
}
this.enable = function(stylename)
{
if(this.styles[stylename]) return;
this.styles[stylename] = true;
this.elem.className = this.compile();
return;
}
this.disable = function(stylename)
{
if(!this.styles[stylename]) return;
this.styles[stylename] = false;
this.elem.className = this.compile();
return;
}
this.toggle = function(newstyle, currstyle)
{
if(this.styles[newstyle]) return false;
this.styles[currstyle] = false;
this.styles[newstyle] = true;
this.elem.className = this.compile();
}
this.compile = function()
{
var output = "";
for(prop in this.styles)
{
if(this.styles[prop])
{
output += (prop+' ');
}
}
return output;
}
return this;
}	
var cookies;
function parseCookies() {
var cookiesHash = new Object();
var cookiesArray = document.cookie.split(';');
for (i=0; i < cookiesArray.length; i++) {
cookie = cookiesArray[i];
cookie = cookie.split('=');
cookiesHash[cookie[0]] = cookie[1];
}
return cookiesHash;
}
function getCookie (name) {
var value = null;
if (name != null) {
name = name.toUpperCase();
cookies = (cookies) ? cookies : parseCookies();
for (key in cookies) {
if (key.toUpperCase().match(name)) {
value = decodeURI(cookies[key]);
if (value.indexOf('%') != -1) value = unescape(value);
break;
}
}
}
return value;
}
function cookiesToString () { 
cookies = (cookies) ? cookies : parseCookies();
var fvString = new String();
if (arguments.length != 0) {
for (var i=0; i < arguments.length; i++) {
cookieName = arguments[i];
fvString += cookieName +'='+ getCookie(cookieName) +';';
}
} else {
for (cookie in cookies) {
fvString += cookie +'='+ cookies[cookie] +';';
}
}
return fvString;
}
function setCookie (name,value,msec,path,domain,secure) {
if (name != null) {
var now = new Date();
var exp_date = new Date(now.getTime()+(msec?msec:0));
var cookie = name+'='+escape(value)+';';
if (msec) cookie += 'expires='+exp_date.toUTCString()+';';
if (path) cookie += 'path='+path+';';
if (domain) cookie += 'domain='+domain+';';
if (secure) cookie += 'secure;';
document.cookie = cookie;
}
}
Dimensions = function (w,h) { 
this.width = w || 0;
this.height = h || 0;
return this;
}
XYCoords = function (x,y) { 
this.x = x || 0;
this.y = y || 0;	
return this;
}
BoxCoords = function (x1,y1,x2,y2) {
this.x1 = x1 || 0;
this.y1 = y1 || 0;
this.x2 = x2 || 0;
this.y2 = y2 || 0;
return this;
}
function getEventCoords (e) {
var coords = new XYCoords();
if (e.pageX && e.pageY) {
coords.x = e.pageX;
coords.y = e.pageY;
} else if (e.clientX && e.clientY) {
coords.x = e.clientX + document.body.scrollLeft;
coords.y = e.clientY + document.body.scrollTop;
}
return coords;
}
function getElementBoxCoords(domElement) {
this.element = domElement;
this.calculated_offset;
this.calcOffsetFrom = function (element,from,reset) {
if (reset != false) this.calculated_offset = 0;
if (element != null)	{
switch (from) {
case 'top': 
this.calculated_offset += element.offsetTop;
break;
case 'left': 
this.calculated_offset += element.offsetLeft;
break;
}
if ((element.offsetParent == document.body) || (element.offsetParent.tagName == ('HTML'||'BODY'))) {				
return this.calculated_offset;
} else {
return this.calcOffsetFrom(element.offsetParent,from,false);
}
}
}
this.w = this.element.offsetWidth;
this.h = this.element.offsetHeight;
var coords = new BoxCoords();
coords.x1 = this.calcOffsetFrom(this.element,'left',true);
coords.y1 = this.calcOffsetFrom(this.element,'top',true);
coords.x2 = coords.x1 + this.w;
coords.y2 = coords.y1 + this.h;
return coords;
}
function getElementBoxCoordsById(elementID) {
var element = document.getElementById(elementID);
if (element != null) {
return getElementBoxCoords(element);
}
}
function getWindowDimensions () {
var width = (window.innerWidth) ? window.innerWidth : document.body.clientWidth;
var height = (window.innerHeight) ? window.innerHeight : document.body.clientHeight;
return new Dimensions(width,height);
}
function getContentDimensions () {
var width = Math.max(document.body.offsetWidth,document.body.scrollWidth);
var height = Math.max(document.body.offsetHeight,document.body.scrollHeight);
return new Dimensions(width,height);
}
function getScrollPosition () {
var scrollPosition = new XYCoords();
if (window.scrollX && window.scrollY) {
scrollPosition.x = window.scrollX;
scrollPosition.y = window.scrollY;
} else {
var docBody = document.body;
var parent_scrollLeft = (docBody.parentNode.scrollLeft) ? docBody.parentNode.scrollLeft : 0;
var parent_scrollTop = (docBody.parentNode.scrollTop) ? docBody.parentNode.scrollTop : 0;
scrollPosition.x = Math.max(docBody.scrollLeft,parent_scrollLeft);
scrollPosition.y = Math.max(docBody.scrollTop,parent_scrollTop);
}
return scrollPosition;
}
function defineEventHandler (element,eventName,handler,capture) {
try {
if (document.addEventListener) {
element.addEventListener(eventName,handler,capture);
} else if (document.attachEvent) {
eventName = 'on'+eventName;
element.attachEvent(eventName,handler);
}
} catch (ex) {
return;
}
}
function removeEventHandler (element,eventName,handler,capture) {
try {
if (document.removeEventListener) {
element.removeEventListener(eventName,handler,capture);
} else if (document.detachEvent) {
element.detachEvent('on'+eventName,handler);
}	
} catch (ex) {
return;
}
}
var onload_queue = new Array();
function execute_onload () {
for (var i=0; i < onload_queue.length; i++) {
onload_queue[i]();
}
}
function registerOnLoadFunc () {
for (var i=0; i < arguments.length; i++) {
if (typeof arguments[i] == 'function') onload_queue[onload_queue.length] = arguments[i];
}
if (document.addEventListener || document.attachEvent) {
var domElement = (window.opera) ? document : window;
removeEventHandler(domElement,'load',execute_onload,false);
defineEventHandler(domElement,'load',execute_onload,false);
} else {
onload = execute_onload;
}
}
var unload_queue = new Array();
function execute_unload () {
for (var i=0; i < unload_queue.length; i++) {
unload_queue[i]();
}
}
function registerUnLoadFunc () {
for (var i=0; i < arguments.length; i++) {
if (typeof arguments[i] == 'function') unload_queue[unload_queue.length] = arguments[i];
}
if (document.addEventListener || document.attachEvent) {
var domElement = (window.opera) ? document : window;
defineEventHandler(domElement,'unload',execute_unload,false);
} else {
onunload = execute_unload;
}
}
BrowserDescription = function () {
this.appN = navigator.appName.toLowerCase();
this.appV = parseInt(navigator.appVersion);
this.ua = navigator.userAgent.toLowerCase();
this.plt = navigator.platform.toLowerCase();
if (this.ua.indexOf('opera/7') != -1 || this.ua.indexOf('opera 7') != -1) {
this.appV = 7;
}
this.isSafari = ( this.ua.indexOf('safari') != -1 );
return this;
}
var browser = new BrowserDescription();
if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject = function( obj ){
if (!document.createElement || !document.getElementById) return;
if( typeof obj.swf == "undefined" ) return;
var swf = obj.swf;
if( typeof obj.id == "undefined" ) return;
var id = obj.id;
if( typeof obj.w == "undefined" ) return;
var w = obj.w;
if( typeof obj.h == "undefined" ) return;
var h = obj.h;
var ver 		= ( typeof obj.ver == "undefined" ) ? "6" : obj.ver;
var c			= ( typeof obj.c == "undefined" ) ? "#ffffff" : obj.c;
var q			= ( typeof obj.q == "undefined" ) ? "high" : obj.q;
var useExpressInstall = ( typeof obj.useExpressInstall == "undefined" ) ? false : obj.useExpressInstall;
var xir 		= ( typeof obj.xiRedirectUrl == "undefined" ) ? window.location : obj.xiRedirectUrl;
var redirectUrl = ( typeof obj.redirectUrl == "undefined" ) ? "" : obj.redirectUrl;
var salign 		= ( typeof obj.salign == "undefined" ) ? "tl" : obj.salign;
var wmode 		= ( typeof obj.wmode == "undefined" ) ? "window" : obj.wmode;
var menu 		= ( typeof obj.menu == "undefined" ) ? "false" : obj.menu;
var onFailFunc 	= ( typeof obj.onFailFunc == "undefined" ) ? "" : obj.onFailFunc;
var objID 		= ( typeof obj.objID == "undefined" ) ? "" : obj.objID;
var embedID 	= ( typeof obj.embedID == "undefined" ) ? "" : obj.embedID;
var name 		= ( typeof obj.name == "undefined" ) ? "" : obj.name;
var pluginspage = ( typeof obj.pluginspage == "undefined" ) ? "" : obj.pluginspage;
this.DETECT_KEY = ( typeof obj.detectKey == "undefined" ) ? "detectflash" : obj.detectKey ;
this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params = new Object();
this.variables = new Object();
this.attributes = new Array();
this.useExpressInstall = useExpressInstall;
this.setAttribute( 'swf', swf );
this.setAttribute( 'id', id );
this.setAttribute( 'width', w );
this.setAttribute( 'height', h );
this.setAttribute( 'version', new com.deconcept.PlayerVersion(ver.toString().split(".")) );
this.installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
this.addParam( 'bgcolor', c );
this.addParam( 'quality', q );
this.setAttribute( 'redirectUrl', redirectUrl );
this.addParam( 'salign', salign );
this.addParam( 'wmode', wmode );
this.addParam( 'menu', menu );
this.setAttribute( 'onFailFunc', onFailFunc );
this.setAttribute( 'objID', objID );
this.setAttribute( 'embedID', embedID );
this.setAttribute( 'name', name );
if( pluginspage != "" )
this.addParam( 'pluginspage', pluginspage );
}
com.deconcept.FlashObject.prototype = {
setAttribute: function(name, value){
this.attributes[name] = value;
},
getAttribute: function(name){
return this.attributes[name];
},
addParam: function(name, value){
this.params[name] = value;
},
getParams: function(){
return this.params;
},
addVariable: function(name, value){
this.variables[name] = value;
},
getVariable: function(name){
return this.variables[name];
},
getVariables: function(){
return this.variables;
},
createParamTag: function(n, v){
var p = document.createElement('param');
p.setAttribute('name', n);
p.setAttribute('value', v);
return p;
},
getVariablePairs: function(){
var variablePairs = new Array();
var key;
var variables = this.getVariables();
for(key in variables){
variablePairs.push(key +"="+ variables[key]);
}
return variablePairs;
},
getFlashHTML: function() {
var flashNode = "";
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { 
var $ID = this.getAttribute( 'embedID' );
if( $ID == "" ) $ID = this.getAttribute( 'id' );
var $name = this.getAttribute( 'name' );
if( $name == "" ) $name = $ID;
if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
flashNode += '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
flashNode += ' id="'+ $ID +'" name="'+ $name +'" ';
var params = this.getParams();
for(var key in params){ flashNode += [key] +'="'+ params[key] +'" '; }
var pairs = this.getVariablePairs().join("&");
if (pairs.length > 0){ flashNode += 'flashvars="'+ pairs +'"'; }
flashNode += '/>';
} else { 
var $ID = this.getAttribute( 'objID' );
if( $ID == "" ) $ID = this.getAttribute( 'id' );
if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
flashNode += '<object id="'+ $ID +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
flashNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />"';
var params = this.getParams();
for(var key in params) {
flashNode += '<param name="'+ key +'" value="'+ params[key] +'">';
}
var pairs = this.getVariablePairs().join("&");
if(pairs.length > 0) flashNode += '<param name="flashvars" value="'+ pairs +'">';
flashNode += "</object>";
}
if( getQueryParamValue( 'alert' ) == "true" )
alert( "writing:\n"+flashNode);
return flashNode;
},
write: function(elementId){
var m = getQueryParamValue("m");
var nf = getQueryParamValue("nf");
if( getCookie( 'mediapref' ) == "gif" || m == 'g' || m=="gif" || nf == "1" )
return;
if(this.useExpressInstall) {
var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
this.setAttribute('doExpressInstall', true);
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
this.addVariable("MMdoctitle", document.title);
}
} else {
this.setAttribute('doExpressInstall', false);
}
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
n.innerHTML = this.getFlashHTML();
}else{
if(this.getAttribute('redirectUrl') != "") {
document.location.replace(this.getAttribute('redirectUrl'));
}
if( this.getAttribute('onFailFunc') != "" )
{
var func = this.getAttribute( 'onFailFunc' );
func();
}
}
}
}
com.deconcept.FlashObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins && navigator.mimeTypes.length){
var x = navigator.plugins["Shockwave Flash"];
if(x && x.description) {
PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
}
}else{
try{
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for (var i=3; axo!=null; i++) {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
PlayerVersion = new com.deconcept.PlayerVersion([i,0,0]);
}
}catch(e){}
if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; 
if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
try{
PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}
}
}
return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
this.major = parseInt(arrVersion[0]) || 0;
this.minor = parseInt(arrVersion[1]) || 0;
this.rev = parseInt(arrVersion[2]) || 0;
}
com.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;
}
com.deconcept.util = {
getRequestParameter: function(param){
var q = document.location.search || document.location.href.hash;
if(q){
var startIndex = q.indexOf(param +"=");
var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
if (q.length > 1 && startIndex > -1) {
return q.substring(q.indexOf("=", startIndex)+1, endIndex);
}
}
return "";
},
removeChildren: function(n){
while (n.hasChildNodes()) n.removeChild(n.firstChild);
}
}
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;
var FlashObjectUtil = com.deconcept.FlashObjectUtil;
