
function expandFlash(d, nh, nw) {  
    document.getElementById(d).style.height = nh; // expanded height  
    document.getElementById(d).style.width = nw; // expanded width    
}

function collapseFlash(d, nh, nw) { 
    document.getElementById(d).style.height = nh; // normal height 
    document.getElementById(d).style.width = nw; // expanded width 	
} 


function runFlash(path, width, height){
    document.write('<object type="application/x-shockwave-flash" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  width="'+width+'" height="'+height+'">\n');
    document.write('<param name="movie" value="'+path+'" />\n');
    document.write('<param name="wmode" value="transparent" />\n');
    document.write('<param name="quality" value="high" />\n');
    document.write('<embed src="'+path+'" width="'+width+'" height="'+height+'" wmode="transparent"></embed>\n');
    document.write('</object>\n');
}


/***************************************************************************/
/******** Custom method added By EB to grey out background of page *********/
function fadeArea(vis, options) {
    
    // Pass true to gray out screen, false to ungray
    // options are optional. This is a JSON object with the following (optional) properties
    // opacity:0-100 // Lower number = less grayout higher = more of a blackout 
    // zindex: # // HTML elements with a higher zindex appear on top of the gray out
    // bgcolor: (#xxxxxx) // Standard RGB Hex color code
    // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
    // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
    // in any order. Pass only the properties you need to set.
    var options = options || {}; 
    var zindex = options.zindex || 50;
    var opacity = options.opacity || 70;
    var opaque = (opacity / 100);
    var bgcolor = options.bgcolor || '#000000';
    var darkElementId;
    if(options.darkElementId != null) {
        darkElementId = options.darkElementId;
    } else {
    darkElementId = 'body';
}        
var dark=document.getElementById('darkenScreenObject');
if (!dark) {
    
    // The dark layer doesn't exist, it's never been created. So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementById(darkElementId);
    var tnode = document.createElement('div'); // Create the layer.
    tnode.style.position='absolute'; // Position absolutely
    
    var coors = findPos(tbody);
    
    tnode.style.top=coors[1] + 'px'; // In the top
    tnode.style.left=coors[0] + 'px'; // Left corner of the page  
    
    tnode.style.overflow='hidden'; // Try to avoid making scroll bars 
    tnode.style.display='none'; // Start out Hidden
    tnode.id='darkenScreenObject'; // Name it so we can find it later
    tbody.appendChild(tnode); // Add it to the web page
    dark=document.getElementById('darkenScreenObject'); // Get the object.
}
if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
    var pageWidth = document.body.offsetWidth+'px';
    var pageHeight = document.body.offsetHeight+'px';
} else {
var pageWidth='100%';
var pageHeight='100%';
} 

//set the shader to cover the entire page and make it visible. 
dark.style.opacity=opaque; 
dark.style.MozOpacity=opaque; 
dark.style.filter='alpha(opacity='+opacity+')'; 
dark.style.zIndex=zindex; 
dark.style.backgroundColor=bgcolor;                 
dark.style.width= document.getElementById(darkElementId).offsetWidth+1+'px';
dark.style.height= document.getElementById(darkElementId).offsetHeight+1+'px';
dark.style.display='block'; 
} else {            
dark.style.display='none';
}
}

function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];
}

function overlayDropDown(value){
if(document.all)
  if(document.all.selectSearch)
    if(document.all.selectSearch.filters){              
       if(value){
         document.all.selectSearch.style.filter = "revealTrans";         
         document.all.selectSearch.filters[0].apply();         
         document.all.section.style.display = "none";
       }else{
         document.all.selectSearch.filters[0].enabled = false;
         document.all.section.style.display = "block";
       }
     }
    }
    
    var aniLoop = 0;
    function displayMessage(message, aniDiv){   
        var dotsNum = aniLoop%4;
        var dots = "";
        for(i=0; i<dotsNum; i++){
            dots+=".";
        }
        
        searchAni=document.getElementById(aniDiv); // Get the object.   
        searchAni.innerHTML="<p style='font-weight:bold; font-size: 16pt; padding-left:190px; padding-top: 25px;color: black;'>"+ message + dots + "</p>";
        
        aniLoop++;
    }
    
    function startSearchLogo(aniContainer){
        
        var tbody = document.getElementById(aniContainer);
        var tnode = document.createElement('div'); // Create the layer.
        tnode.style.position='absolute'; // Position absolutely
        
        var coors = findPos(tbody);
        tnode.style.top=coors[1] + 'px'; // In the top
        tnode.style.left=coors[0] + 'px'; // Left corner of the page 
        tnode.style.overflow='hidden'; // Try to avoid making scroll bars 
        tnode.style.display='block'; // Start out Hidden
        tnode.id='searchAniDiv'; // Name it so we can find it later
        tnode.style.zIndex=50; 
        tbody.appendChild(tnode); // Add it to the web page
        
        var func = "displayMessage('Searching','searchAniDiv');";
        setInterval(func, 400);      
    } 
    
    var lock = false;
    
    function startSearch(){
        if(!lock) {
            lock = true;
            document.getElementById('submitBtn').focus();
            overlayDropDown(true);
            fadeArea(true,{'opacity':'70', 'bgcolor':'#fff', 'zindex':'25', 'darkElementId':'search_form_container' });
            startSearchLogo('search_form_container');
        }
    }