dom = (document.getElementById)? true : false;
nn4 = (document.layers)? true : false;
ie = (document.all)? true : false;
ie4 = (!dom && ie)? true : false;
var activeElem = null;



function findObject( id, doc )
{
    var i;

    if( doc == null )
        doc = document;

    if( dom )
        return doc.getElementById( id );
    else
        {
        if( ie4 )
        return doc.all[ id ];
        }

    for( i=0; i<doc.forms.length; i++ )
        for( j=0; j<doc.forms[i].elements.length; j++ )
        if( id == doc.forms[i].elements[j].name )
            return doc.forms[i].elements[j];

    for( i=0; i<doc.images.length; i++ )
        if( id == doc.images[i].name )
        return doc.images[i];

    if( doc.layers == null )
        return null;

    for( i=0; i<doc.layers.length; i++ )
        {
        if( id == doc.layers[i].name )
        return doc.layers[i];
        var x = findObject( id, doc.layers[i].document );
        if( x != null )
        return x;
        } 
    return null;
}

function showElem(elemId)
{
    if (dom)
        document.getElementById(elemId).style.visibility = "visible";
    else
        if (ie4)
        document.all[elemId].style.visibility = "visible";
        else
        if (nn4)
            document.layers[elemId].visibility = "show";
}

function hideElem(elemId)
{
    if (dom)
         document.getElementById(elemId).style.visibility = "hidden";
    else
        if (ie4)
        document.all[elemId].style.visibility = "hidden";
        else
        if (nn4) document.layers[elemId].visibility = "hide";
}

function turnElementOff( elemId )
{
    var elem = getElement( elemId );
    if( elem == null )
        return true;
    if( dom || ie4 )
        elem.style.display = "none";
    else
        {
        if( nn4 )
            elem.display = "none";
        }
}

function toggleElement( elemId, toggleActive )
{
    var elem = getElement( elemId );
    if( elem == null )
        return true;
    if( toggleElement.arguments.length == 1 )
        toggleActive = true;

    if( activeElem && toggleActive && (activeElem != elemId) )
        turnElementOff( activeElem );

    if( dom || ie4 )
        (elem.style.display == "none")?elem.style.display="":elem.style.display="none";
    else
        {
        if( nn4 )
            (elem.display == "none")?elem.display="":elem.display="none";
        }
    activeElem = elemId;
    return false;
}

function getElement( elemId )
{
    if (dom)
        return document.getElementById(elemId);
    else
        if (ie4)
            return document.all[elemId];
        else
            if (nn4)
                return document.layers[elemId];
    return null;
}

function hi()
{
    img = arguments[0];
    l = arguments[1];
    if( arguments.length >= 3 )
        pref = arguments[2];
    else
        pref = "m";
    if( arguments.length >= 4 )
        act = arguments[3];
    else
        act = "a";
    if( activeElem == img )
        return;
    var obj = findObject( img );

    if( obj )
        obj.src = l+"/" + pref + act + "_" + img + ".gif";
}                 


function low()
{
    img = arguments[0];
    l = arguments[1];
    if( arguments.length >= 3 )
        pref = arguments[2];
    else
        pref = "m";
    if( arguments.length >= 4 )
        act = arguments[3];
    else
        act = "";

    if( activeElem == img && low.arguments.length < 3 )
        return;
    var obj = findObject( img );
    if( obj )
        obj.src = l+"/" + pref + act + "_" + img + ".gif";
}

// This function writes HTML code into a layer
function Writelayer(layer,code,doc)
{
    if( doc == null )
        doc = "document";   
    if (nn4)
        {
        layer.document.open();
        layer.document.write( code );
        layer.document.close();
        }
    else
        if (ie4)
            {
        layer.innerHTML = code;
        }
        else
            if (dom)
                {
            layer.innerHTML = code;
            }
}

function anchorPosX(anchorPtr)
{
    if (document.layers)
        return anchorPtr.x;
    else if (document.getElementById || document.all)
        {
        var pos = anchorPtr.offsetLeft;
        while (anchorPtr.offsetParent != null)
            {
            anchorPtr = anchorPtr.offsetParent;
            pos += anchorPtr.offsetLeft;
            }
        return pos;
        }
    return 0;
}

function anchorPosY(anchorPtr)
{
    if (document.layers)
        return anchorPtr.y;
    else if (document.getElementById || document.all)
        {
        var pos = anchorPtr.offsetTop;
        while (anchorPtr.offsetParent != null)
            {
            anchorPtr = anchorPtr.offsetParent;
            pos += anchorPtr.offsetTop;
            }
        return pos;
        }
    return 0;
}
        
function him( id, masrc, mabackn, isrbg )
{
    if ( isrbg )
    {
        var td = findObject( 'mtd'+id );
        if( td )
            td.style.cssText = "background-image: url(/img/ma_back" + mabackn + ".gif); background-repeat: repeat-x;";
    }

    var mi = findObject( 'mi'+id );
    if( mi )
        mi.src = masrc;
}

function lom( id, msrc )
{
    var td = findObject( 'mtd'+id );
    if( td )
        td.style.cssText = "";

    var mi = findObject( 'mi'+id );
    if( mi )
        mi.src = msrc;
}	
	
function embedFlash (width, height, name, align, movie, bgcolor, flashvar) 
{
	
	if (flashvar=="undefined") flashvar="";	
	
	document.write(
	'< object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+
	' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+
	' width=' + width + 
	' height=' + height + 
	' id=' + id + 
	' align=' + align +'>'	+
	'<param name="allowScriptAccess" value="sameDomain" />' + 
	'<param name="movie" value=' + movie + 	' />'+
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value=' + bgcolor + ' />'+	
	'<param name="flashvars" value="'+ flashvar +'"  />'+
	'<param name="menu" value="false" />'+
	'<embed src="' + path + '"'+
	' quality="high" '+
	' bgcolor="' + bgcolor + '" '+
	' width="' + width + '" '+
	' height="' + height + '"'+
	' name="' + id + '" '+
	' align="' + align + '" '+
	' wmode="'+ trans + '"'+
	' FlashVars="'+ flashvar +'" '+
	' menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	
}	


var flash_installed = "false";
var flash_version = 0; 

var VB = "false";

if (navigator.plugins && navigator.plugins.length)
	{
	if (navigator.plugins["Shockwave Flash"])
		{
		flash_installed = 'true';
		flash_version = 2;
		flash_version =navigator.plugins["Shockwave Flash"].description.charAt(navigator.plugins["Shockwave Flash"].description.indexOf('.')-2) + navigator.plugins["Shockwave Flash"].description.charAt(navigator.plugins["Shockwave Flash"].description.indexOf('.')-1);
		}
	}
else
	{
	VB = "true";
	}
	
	
	
function embedFlash (width, height, name, align, movie, bgcolor, flashvar) 
{
	
	if (flashvar=="undefined") flashvar="";	
	
	document.write(
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+
	' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+
	' width=' + width + 
	' height=' + height + 
	' id=' + name + 
	' align=' + align +'>'	+
	'<param name="allowScriptAccess" value="sameDomain" />' + 
	'<param name="movie" value=' + movie + 	' />'+
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value=' + bgcolor + ' />'+	
	'<param name="flashvars" value="'+ flashvar +'"  />'+
	'<param name="menu" value="false" />'+
	'<embed id="flash_movie" src="' + movie + '"'+
	' quality="high" '+
	' bgcolor="' + bgcolor + '" '+
	' width="' + width + '" '+
	' height="' + height + '"'+
	' name="' + name + '" '+
	' align="' + align + '" '+
	' flashvars="'+ flashvar +'" '+
	' menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	
}	

function show_gallery( url )
{
    var imageWin;
    imageWin = window.open( url, 'image', 'width=770,height=610,directories=no,toolbar=no,resizable=yes,menubar=no,scrollbars=no' ); 
    if( imageWin.focus )
        imageWin.focus();

}



function show_url( url )
{
    var imageWin;
    imageWin = window.open( url, 'image', 'width=900, height=700, directories=no,toolbar=no,resizable=yes,menubar=no,scrollbars=yes' ); 
    if( imageWin.focus )
        imageWin.focus();

}



