/*****************************************************
* ypSlideOutMenu
* http://ypslideoutmenus.sourceforge.net/
* 3/04/2001
*
* a nice little script to create exclusive, slide-out
* menus for ns4, ns6, mozilla, opera, ie4, ie5 on
* mac and win32. I've got no linux or unix to test on but
* it should(?) work...
*
* Licensed under AFL 2.0
* http://www.opensource.org/licenses/afl-2.0.php
*
* Revised:
* - 08/29/2002 : added .hideAll()
* - 04/15/2004 : added .writeCSS() to support more
* than 30 menus.
* - 10/20/2005 : Modified by SightWorks, Inc.
* --youngpup--
*****************************************************/
ypSlideOutMenu.Registry = []
ypSlideOutMenu.minCPUResolution = 10
// constructor
function ypSlideOutMenu(id, dir, left, top, width, height)
{
this.ie = document.all ? 1 : 0
this.ns4 = document.layers ? 1 : 0
this.dom = document.getElementById ? 1 : 0
this.css = "";
this.aniLen = 500
this.hideDelay = 150
if (this.ie || this.ns4 || this.dom) {
this.id = id
this.dir = dir
this.orientation = dir == "left" || dir == "right" ? "h" : "v"
this.dirType = dir == "right" || dir == "down" ? "-" : "+"
this.dim = this.orientation == "h" ? width : height
this.hideTimer = false
this.aniTimer = false
this.open = false
this.over = false
this.startTime = 0
// global reference to this object
this.gRef = "ypSlideOutMenu_"+id
eval(this.gRef+"=this")
// add this menu object to an internal list of all menus
ypSlideOutMenu.Registry[id] = this
var d = document
var strCSS = "";
strCSS += '#' + this.id + 'Container { visibility:hidden; '
//strCSS += 'display: none;';
strCSS += 'left:' + left + 'px; '
strCSS += 'top:' + top + 'px; '
strCSS += 'overflow:visible; z-index:10000; }'
strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
strCSS += 'width:' + width + 'px; '
//strCSS += 'height:' + height + 'px; '
//strCSS += 'height: 50; '
strCSS += 'display: block; '
strCSS += "background:transparent;";
if(this.ie)
{
strCSS += 'clip:rect(0 ' + width + ' auto 0); '
}
else
{
strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
}
//
strCSS += '}'
this.css = strCSS;
this.load()
}
}
ypSlideOutMenu.writeCSS = function() {
document.writeln('');
}
ypSlideOutMenu.prototype.load = function() {
var d = document
var lyrId1 = this.id + "Container"
var lyrId2 = this.id + "Content"
var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
var temp
if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
else {
this.container = obj1
this.menu = obj2
this.style = this.ns4 ? this.menu : this.menu.style
this.homePos = eval("0" + this.dirType + this.dim)
this.outPos = 0
this.accelConst = (this.outPos - this.homePos) / this.aniLen / this.aniLen
// set event handlers.
if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
//set initial state
this.endSlide()
}
}
ypSlideOutMenu.showMenu = function(id)
{
var reg = ypSlideOutMenu.Registry
var obj = ypSlideOutMenu.Registry[id]
if (obj.container) {
obj.over = true
// close other menus.
// for (menu in reg) if (id != menu) ypSlideOutMenu.hideMenu(menu)
// if this menu is scheduled to close, cancel it.
if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
// if this menu is closed, open it.
if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
}
}
ypSlideOutMenu.hideMenu = function(id)
{
// schedules the menu to close after ms, which
// gives the user time to cancel the action if they accidentally moused out
var obj = ypSlideOutMenu.Registry[id]
if (obj.container) {
if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", obj.hideDelay);
}
}
ypSlideOutMenu.hideAll = function()
{
var reg = ypSlideOutMenu.Registry
for (menu in reg) {
ypSlideOutMenu.hide(menu);
if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
}
}
ypSlideOutMenu.hide = function(id)
{
var obj = ypSlideOutMenu.Registry[id]
obj.over = false
if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
// flag that this scheduled event has occured.
obj.hideTimer = 0
// if this menu is open, close it.
if (obj.open && !obj.aniTimer) obj.startSlide(false)
}
ypSlideOutMenu.prototype.startSlide = function(open) {
this[open ? "onactivate" : "ondeactivate"]()
this.open = open
if (open) this.setVisibility(true)
this.startTime = (new Date()).getTime()
this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}
ypSlideOutMenu.prototype.slide = function() {
var elapsed = (new Date()).getTime() - this.startTime
if (elapsed > this.aniLen) this.endSlide()
else {
var d = Math.round(Math.pow(this.aniLen-elapsed, 2) * this.accelConst)
if (this.open && this.dirType == "-") d = -d
else if (this.open && this.dirType == "+") d = -d
else if (!this.open && this.dirType == "-") d = -this.dim + d
else d = this.dim + d
this.moveTo(d)
}
}
ypSlideOutMenu.prototype.endSlide = function() {
this.aniTimer = window.clearTimeout(this.aniTimer)
this.moveTo(this.open ? this.outPos : this.homePos)
if (!this.open) this.setVisibility(false)
if ((this.open && !this.over) || (!this.open && this.over)) {
this.startSlide(this.over)
}
}
ypSlideOutMenu.prototype.setVisibility = function(bShow) {
var s = this.ns4 ? this.container : this.container.style
s.visibility = bShow ? "visible" : "hidden";
//s.display = bShow ? "block" : "none";
}
ypSlideOutMenu.prototype.moveTo = function(p) {
this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
ypSlideOutMenu.prototype.getPos = function(c) {
return parseInt(this.style[c])
}
// events
ypSlideOutMenu.prototype.onactivate = function() { }
ypSlideOutMenu.prototype.ondeactivate = function() { }
////////////////////////////////////////////////////////////////////
// 2006 SightWorks, LLC. All Rights Reserved.
// This programming code is the property of SightWorks. LLC
// Reproduction and use of this code is by permission only.
// Removal of this text header is unlawful and forbidden.
// Contact Information: info@sightworks.com
////////////////////////////////////////////////////////////////////
/*
fieldFocus - forces input focus to the fieldName input element
*/
function fieldFocus(fieldName)
{
try
{
var oItem = document.getElementById(fieldName);
oItem.focus();
oItem.select();
}
catch(e)
{
}
}
function showLayer(layerID)
{
ShowLayer(layerID);
}
function hideLayer(layerID)
{
HideLayer(layerID);
}
/*
ShowLayer - Makes a hidden and/or non-displayed element visible and sets display to 'block'
*/
function ShowLayer(layerID)
{
var style_sheet = getStyleObject(layerID);
if (style_sheet)
{
//hideAll();
changeObjectVisibility(layerID, "visible");
changeObjectDisplay(layerID, "block");
}
else
{
status = "Layer not found: " + layerID;
}
}
/*
HideLayer - Makes a visible and/or displayed element hidden and sets display to 'none'
*/
function HideLayer(layerID)
{
var style_sheet = getStyleObject(layerID);
if (style_sheet)
{
//hideAll();
changeObjectVisibility(layerID, "hidden");
changeObjectDisplay(layerID, "none");
}
else
{
status = "Layer not found: " + layerID;
}
}
/*
getStyleObject - Get the style object for a given element, required for cross-browser compatability
*/
function getStyleObject(objectId) {
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId)) {
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
/*
getObject - Get the object for a given element, required for cross-browser compatability
*/
function getObject(objectId) {
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId);
}
else if (document.all && document.all(objectId)) {
return document.all(objectId);
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
function getPageObject(objectId)
{
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId);
}
else if (document.all && document.all(objectId)) {
return document.all(objectId);
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
function changeObjectVisibility(objectId, newVisibility) {
// first get the object's stylesheet
var styleObject = getStyleObject(objectId);
// then if we find a stylesheet, set its visibility
// as requested
//
if (styleObject) {
styleObject.visibility = newVisibility;
return true;
} else {
return false;
}
}
function changeObjectDisplay(objectId, newDisplay) {
// first get the object's stylesheet
var styleObject = getStyleObject(objectId);
if (styleObject) {
styleObject.display = newDisplay;
return true;
} else {
return false;
}
}
function moveLayer(objectId,x,y)
{
var styleObject = getStyleObject(objectId);
styleObject.top = y;
styleObject.left = x;
}
function showTip(layerID,x,y)
{
moveLayer(layerID,x,y);
ShowLayer(layerID);
}
function preloadImages() {
var d=document; if(d.images){ if(!d.p) d.p=new Array();
var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i= 4) { win.window.focus(); }
}
// HANDLE TABLE ROW HIGHLIGHT ON MOUSEOVER
function listMouseOver(layerID) {
if (document.layers) { document.layers[layerID].bgColor='#FFFF99'; }
else if (document.all) { document.getElementById(layerID).style.background='#FFFF99'; }
}
function listMouseOver2(layerID, color) {
if (document.layers) { document.layers[layerID].bgColor=color; }
else if (document.all) { document.getElementById(layerID).style.background=color; }
}
function listMouseOut(layerID, oldColor) {
if (document.layers) { document.layers[layerID].bgColor=oldColor; }
else if (document.all) { document.getElementById(layerID).style.background=oldColor; }
}
// LINK TO URL WHEN ROW IS CLICKED
function listClickRow(URL)
{
document.location = URL;
}
// SHOW HIDE LAYER
/*function showLayer(id) {
document.getElementById(id).style.visibility="visible";
document.getElementById(id).style.display="block";
}
// SHOW HIDE LAYER
function hideLayer(id) {
document.getElementById(id).style.visibility="hidden";
document.getElementById(id).style.display="none";
}
*/
// CENTERED POP UP WINDOW
function newWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize';
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// GET POPUP DATE SET CALENDAR
function fillDate(y, m, d)
{
function setselectbyvalue(theSelect,avalue)
{
for( var i=0,n=theSelect.options.length; i= startVal && oTween.curVal > endVal) ||
if ((dtNow - oTween.timeStart ) > oTween.time)
{
if(callBack != 'undefined')
{
eval(callBack + "(oTween);");
}
return;
}
else
{
var val = new Array(4);
if(prop == "clip")
{
for(i = 0; i < startVal.length; i++)
{
if(startVal[i] == "auto")
{
val[i] = "auto";
}
else
{
val[i] = Math.ceil(findTweenValue (parseInt(startVal[i]), parseInt(endVal[i]), oTween.timeStart,
dtNow, oTween.timeStart + oTween.time, animType,0,0) );
}
}
oTween.curVal = val;
status = oTween.curVal;
// alert("oStyle." + oTween.prop + "=\"rect(" + oTween.curVal[0] +oTween.valSuffix[0]+" " + oTween.curVal[1] +
// oTween.valSuffix[1]+" " +oTween.curVal[2] +oTween.valSuffix[2]+" " +oTween.curVal[3] +oTween.valSuffix[3]+ ")\";");
eval("oStyle." + oTween.prop + "=\"rect(" + oTween.curVal[0] +oTween.valSuffix[0]+" " + oTween.curVal[1] +
oTween.valSuffix[1]+" " +oTween.curVal[2] +oTween.valSuffix[2]+" " +oTween.curVal[3] +oTween.valSuffix[3]+ ")\";");
strTimeout = 'tweenProperty(\'' + layerID + '\',\''+ prop + '\',['+ startVal + '],['+ endVal + '],\''+ oTween.time +'\',\'' + animType + '\',\'' + valSuffix + '\',\'' + callBack +'\',\'' + extra1 +'\',\'' + extra2 + '\');';
}
else
{
var val = findTweenValue (parseInt(startVal), parseInt(endVal), oTween.timeStart,
dtNow, oTween.timeStart + oTween.time, animType,0,0) ;
// var val = parseInt(oTween.curVal) + parseInt(step);
//oTween.curVal = ;
//alert(val);
oTween.curVal = val;
eval("oStyle." + oTween.prop + "='" + oTween.curVal +oTween.valSuffix+ "';");
strTimeout = 'tweenProperty(\'' + layerID + '\',\''+ prop + '\',\''+ startVal + '\',\''+ endVal + '\',\''+ oTween.time +'\',\'' + animType + '\',\'' + valSuffix + '\',\'' + callBack +'\',\'' + extra1 +'\',\'' + extra2 + '\');';
}
//status = "oStyle." + oTween.prop + "=" + oTween.curVal + ";" + step +";" ;
//alert('tweenProperty(\'' + layerID + '\',\''+ prop + '\',\''+ startVal + '\',\''+ endVal + '\',\''+ oTween.time +'\',\'' + animType + '\',\'' + valSuffix + '\',\'' + callBack +'\',\'' + extra1 +'\',\'' + extra2 + '\');');
try{
//alert(strTimeout);
oTween.curTimer = setTimeout(strTimeout,10);
}
catch(e)
{
}
}
}
function findTweenValue (_propStart, _propDest, _timeStart, _timeNow, _timeDest, _animType, _extra1, _extra2) {
var t = _timeNow - _timeStart; // current time (frames, seconds)
var b = _propStart; // beginning value
var c = _propDest - _propStart; // change in value
var d = _timeDest - _timeStart; // duration (frames, seconds)
var a = _extra1; // amplitude (optional - used only on *elastic easing)
var p = _extra2; // period (optional - used only on *elastic easing)
var s = _extra1; // overshoot ammount (optional - used only on *back easing)
var val;
var foo = document.getElementById("debug");
//foo.innerHTML += "c=" + c + " : t=" + t + " : d=" + d + " : val=" + val + "anim=" + _animType + " ";
//status = "c=" + c + " : t=" + t + " : d=" + d + " : val=" + val + " ";
switch (_animType.toLowerCase()) {
case "linear":
// simple linear tweening - no easing
return c*t/d + b;
case "easeinquad":
// quadratic (t^2) easing in - accelerating from zero velocity
return c*(t/=d)*t + b;
case "easeoutquad":
// quadratic (t^2) easing out - decelerating to zero velocity
return -c *(t/=d)*(t-2) + b;
case "easeinoutquad":
// quadratic (t^2) easing in/out - acceleration until halfway, then deceleration
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
case "easeincubic":
// cubic (t^3) easing in - accelerating from zero velocity
return c*(t/=d)*t*t + b;
case "easeoutcubic":
// cubic (t^3) easing out - decelerating to zero velocity
return c*((t=t/d-1)*t*t + 1) + b;
case "easeinoutcubic":
// cubic (t^3) easing in/out - acceleration until halfway, then deceleration
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
case "easeinquart":
// quartic (t^4) easing in - accelerating from zero velocity
return c*(t/=d)*t*t*t + b;
case "easeoutquart":
// quartic (t^4) easing out - decelerating to zero velocity
return -c * ((t=t/d-1)*t*t*t - 1) + b;
case "easeinoutquart":
// quartic (t^4) easing in/out - acceleration until halfway, then deceleration
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
case "easeinquint":
// quintic (t^5) easing in - accelerating from zero velocity
return c*(t/=d)*t*t*t*t + b;
case "easeoutquint":
// quintic (t^5) easing out - decelerating to zero velocity
return c*((t=t/d-1)*t*t*t*t + 1) + b;
case "easeinoutquint":
// quintic (t^5) easing in/out - acceleration until halfway, then deceleration
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
case "easeinsine":
// sinusoidal (sin(t)) easing in - accelerating from zero velocity
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
case "easeoutsine":
// sinusoidal (sin(t)) easing out - decelerating to zero velocity
return c * Math.sin(t/d * (Math.PI/2)) + b;
case "easeinoutsine":
// sinusoidal (sin(t)) easing in/out - acceleration until halfway, then deceleration
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
case "easeinexpo":
// exponential (2^t) easing in - accelerating from zero velocity
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
case "easeoutexpo":
// exponential (2^t) easing out - decelerating to zero velocity
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
case "easeinoutexpo":
// exponential (2^t) easing in/out - acceleration until halfway, then deceleration
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
case "easeincirc":
// circular (sqrt(1-t^2)) easing in - accelerating from zero velocity
//foo.innerHTML += " " + t +" ";
val = -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
//foo.innerHTML += "b=" + b + " : c=" + c + " : t=" + t + " : d=" + d + " : val=" + val + "
";
return val;
case "easeoutcirc":
// circular (sqrt(1-t^2)) easing out - decelerating to zero velocity
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
case "easeinoutcirc":
// circular (sqrt(1-t^2)) easing in/out - acceleration until halfway, then deceleration
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
case "easeinelastic":
// elastic (exponentially decaying sine wave)
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
case "easeoutelastic":
// elastic (exponentially decaying sine wave)
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
case "easeinoutelastic":
// elastic (exponentially decaying sine wave)
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
// Robert Penner's explanation for the s parameter (overshoot ammount):
// s controls the amount of overshoot: higher s means greater overshoot
// s has a default value of 1.70158, which produces an overshoot of 10 percent
// s==0 produces cubic easing with no overshoot
case "easeinback":
// back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in - backtracking slightly, then reversing direction and moving to target
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
case "easeoutback":
// back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out - moving towards target, overshooting it slightly, then reversing and coming back to target
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
case "easeinoutback":
// back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out - backtracking slightly, then reversing direction and moving to target, then overshooting target, reversing, and finally coming back to target
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
// This were changed a bit by me (since I'm not using Penner's own Math.* functions)
// So I changed it to call findTweenValue() instead (with some different arguments)
case "easeinbounce":
// bounce (exponentially decaying parabolic bounce) easing in
return c - findTweenValue (0, c, 0, d-t, d, "easeOutBounce") + b;
case "easeoutbounce":
// bounce (exponentially decaying parabolic bounce) easing out
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
case "easeinoutbounce":
// bounce (exponentially decaying parabolic bounce) easing in/out
if (t < d/2) return findTweenValue (0, c, 0, t*2, d, "easeInBounce") * .5 + b;
return findTweenValue(0, c, 0, t*2-d, d, "easeOutBounce") * .5 + c*.5 + b;
}
return val;
}
//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted
//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false);
function AttachEvent(obj,evt,fnc,useCapture){
try
{
if (!obj) obj = {};
if (!useCapture) useCapture=false;
if (obj.addEventListener){
obj.addEventListener(evt,fnc,useCapture);
return true;
} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
else{
MyAttachEvent(obj,evt,fnc);
obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
}
}
catch(e)
{
}
}
//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc){
try
{
if (!obj.myEvents) obj.myEvents={};
if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
var evts = obj.myEvents[evt];
evts[evts.length]=fnc;
} catch (e) {}
}
function MyFireEvent(obj,evt){
try
{
if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
var evts = obj.myEvents[evt];
for (var i=0,len=evts.length;i 0) {
// loop over each sheet
for(var x = 0; x < sheets.length; x++) {
// grab stylesheet rules
var rules = sheets[x].cssRules;
if(rules.length > 0) {
// check each rule
for(var y = 0; y < rules.length; y++) {
var z = rules[y].style;
// selectorText broken in NS 6/Mozilla: see
// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
// ugly_selectorText_workaround();
if(allStyleRules) {
if(allStyleRules[y] == i) {
return z[p];
}
} else {
// use the native selectorText and style stuff
if(((z[p] != "") && (z[p] != null)) ||
(rules[y].selectorText == i)) {
return z[p];
}
}
}
}
}
}
return null;
}
// setStyleByClass: given an element type and a class selector,
// style property and value, apply the style.
// args:
// t - type of tag to check for (e.g., SPAN)
// c - class name
// p - CSS property
// v - value
var ie = (document.all) ? true : false;
function setStyleByClass(t,c,p,v){
var elements;
if(t == '*') {
// '*' not supported by IE/Win 5.5 and below
elements = (ie) ? document.all : document.getElementsByTagName('*');
} else {
elements = document.getElementsByTagName(t);
}
for(var i = 0; i < elements.length; i++){
var node = elements.item(i);
for(var j = 0; j < node.attributes.length; j++) {
if(node.attributes.item(j).nodeName == 'class') {
if(node.attributes.item(j).nodeValue == c) {
eval('node.style.' + p + " = '" +v + "'");
}
}
}
}
}
// getStyleByClass: given an element type, a class selector and a property,
// return the value of the property for that element type.
// args:
// t - element type
// c - class identifier
// p - CSS property
function getStyleByClass(t, c, p) {
// first loop over elements, because if they've been modified they
// will contain style data more recent than that in the stylesheet
var elements;
var length;
if(t == '*') {
// '*' not supported by IE/Win 5.5 and below
elements = (ie) ? document.all : document.getElementsByTagName('*');
} else {
elements = document.getElementsByTagName(t);
}
for(var i = 0; i < elements.length; i++){
var node = elements.item(i);
try {
length = node.attributes.length;
}
catch (e) { length = 0; }
for(var j = 0; j < length; j++) {
if(node.attributes.item(j).nodeName == 'class') {
if(node.attributes.item(j).nodeValue == c) {
var theStyle = eval('node.style.' + p);
if((theStyle != "") && (theStyle != null)) {
return theStyle;
}
}
}
}
}
// if we got here it's because we didn't find anything
// try styleSheets
var sheets = document.styleSheets;
if(sheets.length > 0) {
// loop over each sheet
for(var x = 0; x < sheets.length; x++) {
// grab stylesheet rules
var rules = sheets[x].cssRules;
try {
length = rules.length;
}
catch (e) { length = 0; }
if(length > 0) {
// check each rule
for(var y = 0; y < rules.length; y++) {
var z = rules[y].style;
// selectorText broken in NS 6/Mozilla: see
// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
//ugly_selectorText_workaround();
if(allStyleRules) {
if((allStyleRules[y] == c) ||
(allStyleRules[y] == (t + "." + c))) {
return z[p];
}
} else {
// use the native selectorText and style stuff
if(((z[p] != "") && (z[p] != null)) &&
((rules[y].selectorText == c) ||
(rules[y].selectorText == (t + "." + c)))) {
return z[p];
}
}
}
}
}
}
return null;
}
// setStyleByTag: given an element type, style property and
// value, and whether the property should override inline styles or
// just global stylesheet preferences, apply the style.
// args:
// e - element type or id
// p - property
// v - value
// g - boolean 0: modify global only; 1: modify all elements in document
function setStyleByTag(e, p, v, g) {
var length;
if(g) {
var elements = document.getElementsByTagName(e);
for(var i = 0; i < elements.length; i++) {
elements.item(i).style[p] = v;
}
} else {
var sheets = document.styleSheets;
try {
length = sheets.length;
}
catch (e) { length = 0; }
if(length > 0) {
for(var i = 0; i < sheets.length; i++) {
var rules = sheets[i].cssRules;
try {
length = rules.length;
}
catch (e) { length = 0; }
if(length > 0) {
for(var j = 0; j < rules.length; j++) {
var s = rules[j].style;
// selectorText broken in NS 6/Mozilla: see
// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
// ugly_selectorText_workaround();
if(allStyleRules) {
if(allStyleRules[j] == e) {
s[p] = v;
}
} else {
// use the native selectorText and style stuff
if(((s[p] != "") && (s[p] != null)) &&
(rules[j].selectorText == e)) {
s[p] = v;
}
}
}
}
}
}
}
}
// getStyleByTag: given an element type and style property, return
// the property's value
// args:
// e - element type
// p - property
function getStyleByTag(e, p) {
var sheets = document.styleSheets;
if(sheets.length > 0) {
for(var i = 0; i < sheets.length; i++) {
var rules = sheets[i].cssRules;
if(rules.length > 0) {
for(var j = 0; j < rules.length; j++) {
var s = rules[j].style;
// selectorText broken in NS 6/Mozilla: see
// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
// ugly_selectorText_workaround();
if(allStyleRules) {
if(allStyleRules[j] == e) {
return s[p];
}
} else {
// use the native selectorText and style stuff
if(((s[p] != "") && (s[p] != null)) &&
(rules[j].selectorText == e)) {
return s[p];
}
}
}
}
}
}
// if we don't find any style sheets, return the value for the first
// element of this type we encounter without a CLASS or STYLE attribute
var elements = document.getElementsByTagName(e);
var sawClassOrStyleAttribute = false;
for(var i = 0; i < elements.length; i++) {
var node = elements.item(i);
for(var j = 0; j < node.attributes.length; j++) {
if((node.attributes.item(j).nodeName == 'class') ||
(node.attributes.item(j).nodeName == 'style')){
sawClassOrStyleAttribute = true;
}
}
if(! sawClassOrStyleAttribute) {
return elements.item(i).style[p];
}
}
}
function getElementsByClassName(sTagName, sClassName)
{
var aElems = document.getElementsByTagName(sTagName);
var aRetElems = [];
for( var i = 0; i < aElems.length; i++ )
{
if( aElems[i].className == sClassName )
{
aRetElems.push(aElems[i]);
}
}
return aRetElems;
}
// Function to create page elements within a specified container element
function insertElement(oContainer,elementType, oAttributes)
{
var newElement = document.createElement(elementType);
for(att in oAttributes)
{
newElement.setAttribute(att,oAttributes[att]);
//
if(att == "style")
{
var aStyles = String(oAttributes[att]).split(";");
var oStyle = newElement.getAttribute("style");
for(i = 0; i < aStyles.length; i++)
{
var aParts = String(aStyles[i]).split(':');
try
{
newElement.style.setAttribute(aParts[0],aParts[1],0);
newElement.style[aParts[0]] = aParts[1];
// alert(aParts[0] + " " + aParts[1]);
} catch(e) {
// alert("ERROR " + aParts[0]);
}
//newElement.style.textOverflow = "hidden";
//newElement.style.overflowX = "hidden";
}
// showPagedObjectProperties(newElement.style)
//alert(att + " = " + newElement.getAttribute(att).width);
}
}
oContainer.appendChild(newElement);
return newElement;
}
function clearInnerHTML(obj) {
// so long as obj has children, remove them
while(obj.firstChild) obj.removeChild(obj.firstChild);
//Problematic
/*
// perform a shallow clone on obj
nObj = obj.cloneNode(false);
var tempID = obj.id;
// insert the cloned object into the DOM before the original one
obj.parentNode.insertBefore(nObj,obj);
// remove the original object
obj.parentNode.removeChild(obj);
nObj.setAttribute("id",obj.id);
*/
}
function toggleObjectClass(id,class1,class2)
{
var oElem = getObject(id);
if(oElem.className == class1)
{
oElem.className = class2
}
else
{
oElem.className = class1
}
}
/*
GetElement - Get the object for a given element, required for cross-browser compatability
*/
function GetElement(objectId) {
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId))
{
return document.getElementById(objectId);
}
else if (document.all && document.all(objectId))
{
return document.all(objectId);
}
else if (document.layers && document.layers[objectId])
{
return document.layers[objectId];
}
else
{
return false;
}
}
function ShowElements(aElementIDs)
{
if(!aElementIDs) return;
for(var i = 0; i < aElementIDs.length; i++)
{
ChangeObjectVisibility(aElementIDs[i], "visible")
ChangeObjectDisplay(aElementIDs[i], "block")
}
}
function HideElements(aElementIDs)
{
if(!aElementIDs) return;
for(var i = 0; i < aElementIDs.length; i++)
{
ChangeObjectVisibility(aElementIDs[i], "hidden")
ChangeObjectDisplay(aElementIDs[i], "none")
}
}
function ChangeObjectVisibility(objectId, newVisibility) {
// first get the object's stylesheet
var styleObject = GetStyleObject(objectId);
// then if we find a stylesheet, set its visibility
// as requested
//
if (styleObject) {
styleObject.visibility = newVisibility;
return true;
}
else
{
return false;
}
}
function ChangeObjectDisplay(objectId, newDisplay) {
// first get the object's stylesheet
var styleObject = GetStyleObject(objectId);
if (styleObject)
{
styleObject.display = newDisplay;
return true;
}
else
{
return false;
}
}
/*
GetStyleObject - Get the style object for a given element, required for cross-browser compatability
*/
function GetStyleObject(objectId) {
// checkW3C DOM, then MSIE 4, then NN 4.
//
if(document.getElementById && document.getElementById(objectId))
{
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId))
{
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId])
{
return document.layers[objectId];
}
else
{
return false;
}
}
var MAC=(navigator.userAgent.indexOf('Mac')!=-1)?1:0;
var IE=(document.all)?1:0;
var NS6=(document.getElementById&&!document.all)?1:0;
var flash_version=7;
var obj='ShockwaveFlash.ShockwaveFlash.'+eval(flash_version);
var NS6=(document.getElementById&&!document.all)?1:0; var nsv=0; if (NS6) nsv=navigator.vendorSub;
var MAC=(navigator.userAgent.indexOf('Mac')!=-1)?1:0; var SWF=0;
var VBS=' \n'; VBS+='on error resume next \n'; VBS+='SWF=IsObject(CreateObject(obj)) \n'; VBS+=' \n';
if (!MAC) {document.write(VBS);}
var plugin=(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0);
if (plugin&&parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=flash_version) {SWF=1;}
function flash_banner(src, oFlashVars, color, width, height, noflash) {
var EC;
//FlashVars are passed as an object in {key:value} form,
//and turned into a query string like "key=value", with url-encoding applied to values.
var sFlashVars='';
if(String(noflash).length <= 0)
{
noflash = '>';
}
for (key in oFlashVars) {
sFlashVars += key + '=' + escape(oFlashVars[key]) +'&'
}
if (SWF) {
EC='';
} else {
EC=noflash;
}
document.write(EC);
}
// #########################################
// PopOver Scripts.....
// #########################################
//Functions for handling modal layer pop over 'window'
var g_iPopOverStartHist = 0;
var g_iPopOverCurHist = 0;
var g_sPopOverStartURL = "";
var g_bIsPopOverInit = false;
function showPopOver(url)
{
//Fade("popOverWindow",0,100,5);
//changeOpac(0, "popOverWindow")
//opacity("popOverWindow",0,100 ,500);
//g_iPopOverStartHist = g_iPopOverCurHist = top.frames["popOverWindow_IFRAME"].history.length;
//alert("fg");
window.parent.g_bIsPopOverInit = true;
var popOver = window.parent.getStyleObject("popOverWindow");
var popOverObj = window.parent.getObject("popOverWindow");
var popOverMask = window.parent.getStyleObject("popOverWindowMask");
var x,y;
var oContentFrame = window.parent.getObject("popOverWindow_IFRAME");
if(window.parent.document.body.scrollHeight)
{
popOverMask.height = window.parent.document.body.scrollHeight + "px";
}
window.parent.viewport.getWinHeight();
window.parent.viewport.getScrollY();
popOver.top = window.parent.viewport.scrollY + 30+ "px";
popOverMask.display = "block";
popOver.display = "block";
window.parent.centerPopover("popOverWindow");
oContentFrame.src = url;
var str = "";
//var aHist = top.frames["popOverWindow_IFRAME"].history;
//top.frames["popOverWindow_IFRAME"].onbeforeunload = testit;
//showPagedObjectProperties(top.frames["popOverWindow_IFRAME"]);
//alert(aHist.current);
//clearHistory("popOverWindow_IFRAME");
//addHistoryItem("popOverWindow_IFRAME",url);
//
}
function testit()
{
if(window.parent.g_bIsPopOverInit == true)
{
window.parent.g_sPopOverStartURL = String(window.location);
window.parent.g_bIsPopOverInit = false;
}
try
{
document.onkeyup = popOverKeyUp;
document.onkeydown = popOverKeyDown;
}
catch(e)
{
}
window.onkeyup = popOverKeyUp;
window.onkeydown = popOverKeyDown;
//alert(window.parent.g_sPopOverStartURL +" == "+ top.frames["popOverWindow_IFRAME"].location);
}
function testit2()
{
//
}
AttachEvent(top.frames["popOverWindow_IFRAME"],"load",testit,false);
//AttachEvent(top.frames["popOverWindow_IFRAME"],"beforeunload",testit2,false);
function popOverGoBack()
{
//alert(String(window.parent.g_sPopOverStartURL) +" == "+ top.frames["popOverWindow_IFRAME"].location);
if(window.parent.g_sPopOverStartURL == top.frames["popOverWindow_IFRAME"].location)
{
hidePopOver();
}
else
{
top.frames["popOverWindow_IFRAME"].history.back();
}
}
function popOverKeyUp(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 8:
window.event.keyCode = 505; //An arbitrary code to prevent event bubbling
event.returnValue=false;
event.cancelBubble = true;
window.parent.popOverGoBack();
return false;
break;
}
}
function popOverKeyDown(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
//alert("KeyCheck" + KeyID);
switch(KeyID)
{
case 8:
window.event.keyCode = 505; //An arbitrary code to prevent event bubbling
event.returnValue=false;
event.cancelBubble = true;
return false;
break;
}
}
/**
*For now we will assume that this function is only ever invoked from within the IFRAME content
* itself.
*
**/
function hidePopOver()
{
try
{
var popOver = window.parent.getStyleObject("popOverWindow");
var popOverMask = window.parent.getStyleObject("popOverWindowMask");
var oContentFrame = window.parent.getObject("popOverWindow_IFRAME");
oContentFrame.src = window.parent.getPopOverLoadingPage();
popOverMask.display = "none";
popOver.display = "none";
}
catch (e)
{
logException(e);
}
}
function getPopOverLoadingPage()
{
return "javascript:'Loading...'";
}
/*************************************************************************
dw_viewport.js
version date Nov 2003
This code is from Dynamic Web Coding
at http://www.dyn-web.com/
Copyright 2003 by Sharon Paine
See Terms of Use at http://www.dyn-web.com/bus/terms.html
Permission granted to use this code
as long as this entire notice is included.
*************************************************************************/
var viewport = {
getWinWidth: function () {
this.width = 0;
if (window.innerWidth) this.width = window.innerWidth - 18;
else if (document.documentElement && document.documentElement.clientWidth)
this.width = document.documentElement.clientWidth;
else if (document.body && document.body.clientWidth)
this.width = document.body.clientWidth;
},
getWinHeight: function () {
this.height = 0;
if (window.innerHeight) this.height = window.innerHeight - 18;
else if (document.documentElement && document.documentElement.clientHeight)
this.height = document.documentElement.clientHeight;
else if (document.body && document.body.clientHeight)
this.height = document.body.clientHeight;
},
getScrollX: function () {
this.scrollX = 0;
if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
else if (document.documentElement && document.documentElement.scrollLeft)
this.scrollX = document.documentElement.scrollLeft;
else if (document.body && document.body.scrollLeft)
this.scrollX = document.body.scrollLeft;
else if (window.scrollX) this.scrollX = window.scrollX;
},
getScrollY: function () {
this.scrollY = 0;
if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
else if (document.documentElement && document.documentElement.scrollTop)
this.scrollY = document.documentElement.scrollTop;
else if (document.body && document.body.scrollTop)
this.scrollY = document.body.scrollTop;
else if (window.scrollY) this.scrollY = window.scrollY;
},
getAll: function () {
this.getWinWidth(); this.getWinHeight();
this.getScrollX(); this.getScrollY();
}
}
/****************** END VIEWPORT CODE *******************/
// PRINT IFRAME CONTENTS
function CheckIsIE()
{
if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')
{
return true;
}
else
{
return false;
}
}
function PrintThisPage()
{
if (CheckIsIE() == true)
{
document.popOverWindow_IFRAME.focus();
document.popOverWindow_IFRAME.print();
}
else
{
window.frames['popOverWindow_IFRAME'].focus();
window.frames['popOverWindow_IFRAME'].print();
}
}
function centerPopover(sLayerID)
{
var y1=50;
if (!document.all)
{
getStyleObject(sLayerID).top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1))
}
if (document.layers) {
document.layers[sLayerID].top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1))
}
if (document.all) {
document.all[sLayerID].style.top = document.body.scrollTop + (document.body.clientHeight - (document.body.clientHeight-y1));
}
if(getStyleObject(sLayerID).display != "none" && getStyleObject(sLayerID).visibility != "hidden")
{
window.setTimeout("centerPopover('" + sLayerID + "')", 300);
}
}
function toggleObjectClass(id,class1,class2)
{
var oElem = getObject(id);
if(oElem.className == class1)
{
oElem.className = class2
}
else if(oElem.className == class2)
{
oElem.className = class1
}
}
userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}