<!--
/* =====================================================================
© Copyright Core Laboratories All rights reserved.
This is a standard copyright header for all source code appearing
at www.corelab.com This application/class/script may be redistributed,
as long as the above copyright remains intact. 
========================================================================
This funtion change the font size in the document.
*/
function changeFont(){
if(document.body.style.fontSize == "" )
{
    document.body.style.fontSize = "11px";
}
if (document.body.style.fontSize == "11px"){
document.body.style.fontSize = "13px";
	}
	else{
	document.body.style.fontSize = "11px";
	}
}
/* =======================================================================
This function  opens a new window with a printable version of the current page
===============================================================================
*/
function printPage(){
window.print();
document.body.style.backgroundColor = "#FFFFFF";
document.body.style.backgroundImage = "url(images/shim.gif)";
}
/* =======================================================================
This function change the font family of the body of the document.
======================================================================= */
function changeFamily()
            {
            var family = document.body.style.fontFamily;
            if (family == "Arial")
            {
                document.body.style.fontFamily = "Verdana";          
            }
            else if (family == "Verdana")
            { 
               document.body.style.fontFamily = "Arial";
            }
            else{
            document.body.style.fontFamily = "Arial";            
            }
            }
/*============================================================================
* This function change the background color of the element.(x)
==============================================================================*/
function colorFocus(x)
{
    x.style.backgroundColor = "#FFFFFF";
}
function colorBlur(x)
{
    x.style.backgroundColor = "#F2F2F2";
}
/* =========================================================================
This function collapse and expand the left menu items at the left of the website
when the user clicks on the images
============================================================================
*/
    function collapseMenu(x)
    {
        var actDiv = document.getElementById(x);
        var actImg = x + "CollImg";
        var imgDoc = document.images[actImg];
        if(actDiv.style.display != "none")
        {
            actDiv.style.display = "none";
            imgDoc.src = "/corelab2_1/images/buttons/winPlus.gif";
            imgDoc.alt ="Expand " + x.replace('_', ' ');
            
                    }
        else
        {
           actDiv.style.display = "";
           imgDoc.src = "/corelab2_1/images/buttons/winMinus.gif";
           imgDoc.alt ="Collapse " + x.replace('_', ' ');
        }
  /* ==================================================================================
  the following funtion initiate the left menu depending of their business unit.
  ======================================================================================*/
        
    }
    function CollExpRD(d)
    {
    var rdTil = 'Reservoir Description';
    var rdId = rdTil.replace(" ", "_");
    var rdDiv = document.getElementById(rdId);
    var rdImg = document.images[rdId + 'CollImg'];
        if(d==0)
        {
            rdDiv.style.display = "none";
            rdImg.src = "/corelab2_1/images/buttons/winPlus.gif";
            rdImg.alt = "Expand " + rdTil;
        }
        else
        {
            rdDiv.style.display = "";
            rdImg.src = "/corelab2_1/images/buttons/winMinus.gif";
            rdImg.alt = "Collapse " + rdTil;
        }
    }
    function CollExpPE(e)
    {
    var peTil = 'Production Enhancement';
    var peId = peTil.replace(" ", "_");
    var peDiv = document.getElementById(peId);
    var peImg = document.images[peId + 'CollImg'];
        if(e==0)
        {
            peDiv.style.display = "none";
            peImg.src = "/corelab2_1/images/buttons/winPlus.gif";
            peImg.alt = "Expand " + peTil;
        }
        else
        {
            peDiv.style.display = "";
            peImg.src = "/corelab2_1/images/buttons/winMinus.gif";
            peImg.alt = "Collapse " + peTil;        
        }
    
    }
    
        function CollExpRM(f)
    {
    var rmTil = 'Reservoir Management';
    var rmId = rmTil.replace(" ", "_");
    var rmDiv = document.getElementById(rmId);
    var rmImg = document.images[rmId + 'CollImg'];
           if(f==0)
        {
            rmDiv.style.display = "none";
            rmImg.src = "/corelab2_1/images/buttons/winPlus.gif";
            rmImg.alt = "Expand " + rmTil;
        }
        else
        {
            rmDiv.style.display = "";
            rmImg.src = "/corelab2_1/images/buttons/winMinus.gif";
            rmImg.alt = "Collapse " + rmTil;        
        }
    
    }
    
    function showLavel2(n)
    {
                    var a = document.getElementById(n).getElementsByTagName("div");
                    var m = document.getElementById(n).getElementsByTagName("img");
            for(i=0; i< a.length; i++){
                    a[i].style.display = "none";
                                    }
           for (i=0; i< m.length; i++)
           {
            if(m[i].id.indexOf('CollImg') > 0)
            {
                m[i].src = "/corelab2_1/images/buttons/winPlus.gif";
                m[i].alt = "Expand"
           }
    }
    }
    
    function initiMenu(){
    if(document.getElementById("menuTitleDiv")){
    var winLoc = window.location.href;
    if(winLoc.indexOf("/rd/") != -1){         
        CollExpRD(1);
        CollExpRM(0);
        CollExpPE(0);
   
   }  
     else if(winLoc.indexOf("/pe/") != -1)
     {
            CollExpRM(0);
            CollExpPE(1);
            CollExpRD(0);
     }
     else if(winLoc.indexOf("/rm/") != -1)
     {
            CollExpRM(1);
            CollExpPE(0);
            CollExpRD(0);
     }
     else
     {
            CollExpRM(1);
            CollExpPE(1);
            CollExpRD(1);
            showLavel2('Reservoir_Description');
            showLavel2('Production_Enhancement');
            showLavel2('Reservoir_Management');
     }
     
     
     }
    }
//This function expands and collapse the menu control according to its current sitemap node.    
function displayMenu(x)
{
if(document.getElementById(x))
{
var thisNode = document.getElementById(x);
var parentDiv = thisNode.parentNode;
var thisDiv = thisNode.id.replace("_Link", "");
var t = document.getElementById("menuControlTable");
var a = t.getElementsByTagName("div");
var m = t.getElementsByTagName("img");
var f = "";
//Hide all the menus
    for(i=0; i< a.length; i++)
    {
        a[i].style.display = "none";
    }
    //Display the right buttons
    for (i=0; i< m.length; i++)
           {
            if(m[i].id.indexOf('CollImg') > 0)
            {
                m[i].src = "/corelab2_1/images/buttons/winPlus.gif";
                m[i].alt = "Expand"
           }
    }
    // Open the menu in the current node.
    if(document.getElementById(thisDiv))
    {
        document.getElementById(thisDiv).style.display = "";
        f = document.getElementById(thisDiv).id + "CollImg" ;
        if (document.images[f])
        {
            document.images[f].alt = "Collapse "
            document.images[f].src = "/corelab2_1/images/buttons/winMinus.gif";
        }
    }
    while (parentDiv.id != "menuControlTable" )
    {
        parentDiv.style.display = "";
        f = parentDiv.id + "CollImg" ;
        if (document.images[f])
        {
            document.images[f].alt = "Collapse "
            document.images[f].src = "/corelab2_1/images/buttons/winMinus.gif";
        }
        parentDiv = parentDiv.parentNode;
        
     }
    }
}
-->


