/*******************************************/
/*  Copyright 2001,2002,2003 - Jon Dunfee  */
/*  last updated: August 29, 2003          */
/*  Permission granted for unlimited use   */
/*  so far as the copyright notice above   */
/*  remains intact.                        */
/*******************************************/
/****************************************** NS4.x Resize Script */
if (document.layers)
{
   origWidth = innerWidth;
   origHeight = innerHeight;
}
function resizeDetected()
{
   if (document.layers)
   {
      if (innerWidth != origWidth || innerHeight != origHeight)
      {
         // location.reload();
   		location.href = location.href;
      }
   }
}
/****************************************** DHTML Common Scripts */
function divStyle(theDiv)
{
    if (document.getElementById) { return document.getElementById(theDiv).style; }
    return eval("document."+((document.all)?"all."+theDiv+".style":theDiv));
}
function moveDiv(thisDiv,L,T,Z)
{
    if(L != "relative") {(document.all)?divStyle(thisDiv).pixelLeft = L:divStyle(thisDiv).left = L;}
    if(T != "relative") {(document.all)?divStyle(thisDiv).pixelTop = T:divStyle(thisDiv).top = T;}
    if(Z) { divStyle(thisDiv).zIndex = Z; }
}
function clipDiv(thisDiv,cT,cR,cB,cL)
{
    if (navigator.appName.indexOf("Opera") == -1)
    {
        if (document.all || document.getElementById) { divStyle(thisDiv).clip = "rect("+cT+" "+cR+" "+cB+" "+cL+")"; }
        else
        {
            divStyle(thisDiv).clip.top = cT;
            divStyle(thisDiv).clip.bottom = cB;
            divStyle(thisDiv).clip.left = cL;
            divStyle(thisDiv).clip.right = cR;
        }
    }
}
function showDiv()
{ 
    for(var sDi=0;sDi<showDiv.arguments.length;sDi++)
    {
        if (document.getElementById) { node = document.getElementById(showDiv.arguments[sDi]).style.visibility='visible'; }
        else divStyle(showDiv.arguments[sDi]).visibility = "visible";
    }
}
function hideDiv()
{
    for(var hDi=0;hDi<hideDiv.arguments.length;hDi++)
    {
        if (document.getElementById) { node = document.getElementById(hideDiv.arguments[hDi]).style.visibility='hidden'; }
        else divStyle(hideDiv.arguments[hDi]).visibility=(document.all)?"hidden":"hide";
    }
}
/****************************************** DHTML Additional Scripts */
function transStyle(dur,trans)
{
    var navApp = navigator.appVersion;
    if(navApp.substring(navApp.indexOf("MSIE")+5,navApp.indexOf("MSIE")+8) >= 5.5 && dur)
    {
        if(trans < 24)
        {
            return "filter:revealTrans(duration="+dur+",transition="+trans+");";
        }
        else
        {
            return "filter:blendTrans(duration="+dur+");";
        }
    }
    return "";
}
function transDiv(thisDiv,dur,trans)
{
    var navApp = navigator.appVersion;
    if(navApp.substring(navApp.indexOf("MSIE")+5,navApp.indexOf("MSIE")+8) >= 5.5 && trans)
    {
        var theDiv = document.getElementById(thisDiv);
        hideDiv(thisDiv);
        if(theDiv.filters && trans == 24)
        {
            theDiv.filters.blendTrans.Duration=dur;
            theDiv.filters.blendTrans.stop();
            theDiv.filters.blendTrans.apply();
            showDiv(thisDiv);
            theDiv.filters.blendTrans.play();        
        }
        else if (theDiv.filters && trans < 24 && trans > 0)
        {
            theDiv.filters.revealTrans.Transition=((trans)?trans:23);
            theDiv.filters.revealTrans.Duration=dur;
            theDiv.filters.revealTrans.stop();
            theDiv.filters.revealTrans.apply();
            showDiv(thisDiv);
            theDiv.filters.revealTrans.play();        
        }
        else
        {
            showDiv(thisDiv);
        }
    }
    else
    {
        showDiv(thisDiv);
    }
}
function fadeDiv(theDiv,speed,show,alpha)
{
    var alpha = (alpha)?alpha+10:10;
    hideDiv(theDiv);
    if(document.all)
    {
        document.getElementById(theDiv).style.filter = "alpha(opacity="+((show)?alpha:100-alpha)+")";
    }
    showDiv(theDiv);
    if(alpha < 100)
    {
        setTimeout("fadeDiv('"+theDiv+"',"+speed+","+show+","+alpha+")",speed);
    }
    else if(!show)
    {
        hideDiv(theDiv);
    }
}
/****************************************** Object Attributes */
function findObj(item)
{
	if(document.all) return(document.all[item]);
	if(document.getElementById) return(document.getElementById(item));
    if(document.images[item]) return document.images[item];
    if(document.links[item]) return document.links[item];
	return(false);
}
function getExplorerVersion()
{
    var ieVers = parseFloat(navigator.appVersion);
    if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers;
    var tempVers = navigator.appVersion;
    var i = tempVers.indexOf( 'MSIE ' );
    if( i >= 0 )
    {
        tempVers = tempVers.substring( i+5 );
        ieVers = parseFloat( tempVers ); 
    }
    return ieVers;
}
function getObjX(x,item)
{ 
	if (!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = item;
		var lastOffset = 0;
		while(par){
			if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
			if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
			if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}
	} else if (item.x) x += item.x;
	return x;
}
function getObjY(y,item)
{ 
	if(!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = item;
		var lastOffset = 0;
		while(par){
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}		
	} else if (item.y >= 0) y += item.y;
	return y;
}
function getObjZ(z,item)
{ 
    if (!document.layers)
    {
        var obj = findObj(item);
        if(obj.style)
        {
            return (obj.style.zIndex)?(z + obj.style.zIndex):z;
        }
        else
        {
            return (obj.zIndex)?(z + obj.zIndex):z;
        }
    }
    else if(item.z) { z += item.z; }
    return z;
}
/****************************************** Simplified Document.Write */
function w(theText)
{
    document.write(theText);
}
function wl(theText)
{
    document.writeln(theText);
}
/****************************************** Image Manipulation */
function newImage(theImgLoc)
{
    if (document.images)
    {
        var theNewImg = new Image();
        theNewImg.src = theImgLoc;
        return theNewImg;
    }
}
function swapImg(theImg, theSrc, theDiv)
{
    if(theDiv)
    {
        if(document.getElementById)
        {
            eval("document.getElementById(theImg).src = "+theSrc+".src");
        }
        else
        {
            (document.all)?eval("document.images."+theImg+".src = "+theSrc+".src"):eval("document."+theDiv+".document.images."+theImg+".src = "+theSrc+".src");
        }
    }
    else
    {
        if(document.getElementById)
        {
            eval("document.getElementById(theImg).src = "+theSrc+".src");
        }
        else
        {
            eval("document.images."+theImg+".src = theSrc.src");
        }
    }
}
/****************************************** Additional Image Manipulation */
function transImg(thisImg,img,dur,trans,div)
{
    var div = (div)?div:false;
    var navApp = navigator.appVersion;
    if(navApp.substring(navApp.indexOf("MSIE")+5,navApp.indexOf("MSIE")+8) >= 5.5 && trans)
    {
        var theImg = document.getElementById(thisImg);
        if(theImg.filters && trans < 24 && trans > 0)
        {
            theImg.filters.revealTrans.Transition=((trans)?trans:23);
            theImg.filters.revealTrans.Duration=dur;
            theImg.filters.revealTrans.stop();
            theImg.filters.revealTrans.apply();
            swapImg(thisImg,img,div);
            theImg.filters.revealTrans.play();
        }
        else if(theImg.filters && trans == 24)
        {
            theImg.filters.blendTrans.Duration=dur;
            theImg.filters.blendTrans.stop();
            theImg.filters.blendTrans.apply();
            swapImg(thisImg,img,div);
            theImg.filters.blendTrans.play();
        }
        else
        {
            swapImg(thisImg,img,div);
        }
    }
    else
    {
        swapImg(thisImg,img,div);
    }
}

/*************************************************** Style Class Switcher */
function cs(obj,cls)
{
    obj.className = (cls)?cls:"";
}

