﻿// JScript File

function activateDiv()
{
    if (getElement("adminmode")!=null)
    { 
        getElement("adminmode").value="true";
        showColor();
    }
}

function hideDiv()
{
    if (getElement("colorwindow")!=null)
    { 
	    if (document.getElementById) 
	    {
            getElement("colorwindow").style.visibility='hidden';
            getElement("colorwindow").style.display='none';
        }
        else if (document.all) 
        {
            getElement("colorwindow").style.display='none';
        }
        else
        {
            getElement("colorwindow").style.visibility='hidden';
        }
    }
}

function init()
{
    window.onresize = function() {positionColor();};
    bucketHeight();
}

function initSub()
{
   // window.onresize = function() {positionColor();};
   // containerHeight();
}


 function positionColor() 
 { 
    if (getElement("colorwindow")!=null)
    { 
        if (getElement("title")!=null)
        {
            getElement("colorwindow").style.left=findX(getElement("titlediv"))+"px"; 
            getElement("colorwindow").style.top=findY(getElement("titlediv"))+"px"; 
            getElement("colorwindow").style.width=getElement("contentdiv").offsetWidth+"px";
            getElement("colorwindow").style.height=getElement("contentdiv").offsetHeight+findY(getElement("contentdiv"))-findY(getElement("titlediv"))+"px";
        }
        else
        {
            getElement("colorwindow").style.left=findX(getElement("titlediv"))+"px"; 
            getElement("colorwindow").style.top=findY(getElement("titlediv"))+"px"; 
            getElement("colorwindow").style.width=getElement("contentdiv").offsetWidth+"px";
            getElement("colorwindow").style.height=getElement("contentdiv").offsetHeight+findY(getElement("contentdiv"))-findY(getElement("titlediv"))+"px";
        }
        

    }
 }

function showColor()
{
        if (getElement("adminmode")!=null)
        { 
            if (getElement("adminmode").value!="true")
            {
                return;
            }
        }
        if (getElement("colorwindow")!=null)
        { 
            if (document.getElementById) 
	        {
                getElement("colorwindow").style.visibility='visible';
                getElement("colorwindow").style.display='block';
            }
            else if (document.all) 
            {
                getElement("colorwindow").style.display='block';
            }
            else
            {
                getElement("colorwindow").style.visibility='visible';
            }
        }
}

function findX(objElement) {

	var lngLeft = 0;
	var isFirefox = ( navigator.userAgent.indexOf( "Firefox/" ) != -1 );

    if (objElement.offsetParent) {
		while (objElement.offsetParent) {
			lngLeft += objElement.offsetLeft;
			objElement = objElement.offsetParent;
		}
	} else if (objElement.x) {
		lngLeft += objElement.x;
	}
	return lngLeft;
}

function findY(objElement) {
	var lngTop = 0;
	var isFirefox = ( navigator.userAgent.indexOf( "Firefox/" ) != -1 );
	
 if (objElement.offsetParent) {
		while (objElement.offsetParent) {
			lngTop += objElement.offsetTop;
			objElement = objElement.offsetParent;
		}
	} else if (objElement.y) {
		lngTop += objElement.y;
	}
	return lngTop;
}
 

function getElement(strElement) {
	// XML-based browsers (IE 4+/Netscape 6+/Mozilla/Gecko)
	if (document.getElementById(strElement)) {
		return document.getElementById(strElement);
	// IE
	} else if (document.all) {
		return document.all[strElement];
	// Netscape
	} else if (document.layers) {
		return document[strElement];
	}
} 

function writeLoadingFlash()
{
         document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="110" height="120" id="OA" align="middle">');
         document.write('<param name="allowScriptAccess" value="sameDomain" />');
         document.write('<param name="movie" value="images/oa_loader.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="images/oa_loader.swf" quality="high" wmode="transparent" width="110" height="120" name="OA" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
         document.write('</object>');
}