
//----------------------------------------------------------
//    DOM HTML
//    Ver 0.9.4
//----------------------------------------------------------
//  Get elements by class name
document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className.split(" ");
for (var j = 0; j < classes.length; j++) {
var className = classes[j];
if (className == cl) {
retnode.push(elem[i]);
}
}
}
return retnode;
}

var DomHTML = {

//-------------------------------------------------------
//    Document width
//-------------------------------------------------------
getDocumentWidth: function (_document) {
if (!_document) { _document = document;}
if(_document.body) {
if(_document.body.scrollWidth || _document.body.scrollWidth == 0) {
return _document.body.scrollWidth;
}
if(_document.documentElement) {
return _document.documentElement.offsetWidth;
}
return _document.body.offsetWidth;
}

if(_document.width || _document.width == 0) {
return _document.width;
}
return 0;
},


//-------------------------------------------------------
//    Get scroll top
//-------------------------------------------------------
getScrollTop: function() {
if(window.scrollY) { return window.scrollY;}
if(window.pageYOffset) { return window.pageYOffset;}
if(document.documentElement && document.documentElement.scrollTop){
return document.documentElement.scrollTop;
} else if(document.body && document.body.scrollTop) {
return document.body.scrollTop;
}
return 0;
},


//-------------------------------------------------------
//    Document height
//-------------------------------------------------------
getDocumentHeight: function () {
if(document.body) {
if(document.body.scrollHeight || document.body.scrollHeight == 0) {
return document.body.scrollHeight;
}
if(document.documentElement) {
return document.documentElement.offsetHeight;
}
return document.body.offsetHeight;
}
if(document.height || document.height == 0) {
return document.height;
}
return 0;
},


//-------------------------------------------------------
//    Effects
//-------------------------------------------------------
effects: {

//-----------------------
//  Set width
//-----------------------
width: function(_target, _width, _fade) {
var current = _target.offsetWidth;
if (!_fade) {
var width = _width;
} else {
var width = current + ((_width - current) / _fade);
if (width != current) {
setTimeout(function() { DomHTML.effects.width(_target, _width, _fade / 1.25)}, 50);
}
}
_target.style.width = width + "px";
},

//-----------------------
//  Set opacity
//-----------------------
opacity: function(_target, _opacity, _fade, _fadetype) {
var current = _target.style.opacity * 100;
if (!_fade) {
var opacity = _opacity;
} else {
var opacity = Math.round(current + ((_opacity - current) / _fade));
if (opacity != current) {
setTimeout(function() { DomHTML.effects.opacity(_target, _opacity, _fade / 1.25)}, 50);
}
}
_target.style.zoom = 1;
_target.style.filter = 'alpha(opacity=' + (opacity) + ')';
_target.style.MozOpacity = opacity / 100;
_target.style.opacity = opacity / 100;
}
},


//-------------------------------------------------------
//    Add event
//-------------------------------------------------------
addEvent: function(elemObj, eventType, funcName, useCapture) {
if (!elemObj) { return false;}
if (elemObj.addEventListener){
elemObj.addEventListener(eventType, funcName, useCapture);
} else if (elemObj.attachEvent){
elemObj.attachEvent("on"+eventType, funcName);
} else {
return false;
}
return true;
}

};

//  Embed Flash ver 0.91
//----------------------------------------------------------
var embedPress = {

//  Properties
//-------------------------------------------------------
pass: "",
width: "",
height: "",
quality: "",
wmode: "",
bgcolor: "",
scale: "",


//  Constructor
//-------------------------------------------------------
start: function() {
embedPress.pass = "/scripts/../docs/press.swf?dir=/scripts/../docs/press/" + viewPress + "/";
embedPress.width = 800;
embedPress.height = 560;
embedPress.quality = "high";
embedPress.wmode = "transparent";
embedPress.bgcolor = "#000000";
embedPress.scase = "showall";
embedPress.embed();
},


//  Embed
//-------------------------------------------------------
embed: function() {
var html = "";
html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + embedPress.width + "' height='" + embedPress.height + "' align='middle'>";
html += "<param name='allowScriptAccess' value='sameDomain'>\n";
html += "<param name='movie' value='" + embedPress.pass + "'>\n";
html += "<param name='quality' value='" + embedPress.quality + "'>\n";
html += "<param name='wmode' value='" + embedPress.wmode + "'>\n";
html += "<param name='bgcolor' value='" + embedPress.bgcolor + "'>\n";
html += "<param name='scale' value='" + embedPress.scale + "'>\n";
html += "<embed";
html += " src='" + embedPress.pass + "' ";
html += " quality='" + embedPress.quality + "' ";
html += " wmode='" + embedPress.wmode + "' ";
html += " bgcolor='" + embedPress.bgcolor + "' ";
html += " width='" + embedPress.width + "' height='" + embedPress.height + "' ";
html += " scale='" + embedPress.scale + "' ";
html += " align='middle' ";
html += " allowScriptAccess='sameDomain' ";
html += " type='application/x-shockwave-flash' ";
html += " pluginspage='http://www.macromedia.com/go/getflashplayer'>\n";
html += "</embed>\n";
html += "</object>\n";
document.getElementById("viewer").innerHTML = html;
}
}

function page_load() {

switch (document.body.id) {
case "press":
embedPress.start();
break;
}

}
DomHTML.addEvent (window, "load", page_load);
