function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function GotoLinks()
{
    var dropdown = document.getElementById('p_Footer_Sites_ddlSites');
    location.href = dropdown.options[dropdown.selectedIndex].value;

}

var adiv;
function desp(enlace){
    enlace = document.getElementById(enlace);
    if(enlace != null)
    {
        if(enlace.style.display=='none'){
            enlace.style.display='block';
            lscapa=enlace.getElementsByTagName('a');
            if(lscapa != null)
            {
                urllocat=window.location.href;
                for(i=0;i<lscapa.length;i++){
                    if(lscapa[i].href==urllocat){
                        lscapa[i].className='mrc';
                    }
                }
            }
        }
        else
        {
            enlace.style.display='none';
        }
    }
}

function maindesp(menu)
{
    menu = document.getElementById(menu);
    if(menu != null){
        lscapa=menu.getElementsByTagName('a');
        if(lscapa != null)
        {
            urllocat=window.location.href;
            for(i=1;i<lscapa.length;i++){
                if(urllocat.indexOf(lscapa[i].href) != -1){
                    lscapa[i].setAttribute("class", 'mrc');
                }
            }
            if(urllocat==lscapa[0].href)
                    lscapa[0].setAttribute("class", 'mrc');
        }
    }
}

function writeSubMenuComm(){
//know
    document.write('<div style="display:none;margin:0px 0px 10px 0px" id="know" >');      
    document.write('     <a href="/knowledge/advert_gallery.htm" target="_self" class="submenu">Advert gallery</a> ');
    document.write('     <a href="/knowledge/articles.htm" target="_self" class="submenu">Articles</a>');
    document.write('</div>');  
//services
    document.write('<div style="display:none;margin:0px 0px 10px 0px" id="services">');
    document.write('<span>');
    document.write('<a href="#" onclick="desp(\'trusteeship\')" id="truste" target="_self" class="submenu">Trusteeship</a>');
    document.write('<div style="display:none;margin:0px 0px 10px 10px" id="trusteeship">');
    document.write('<a href="/services/ongoing/" target="_self" class="submenu">Ongoing schemes</a>');
    document.write('<a href="/services/ongoing/closed.htm" target="_self" class="submenu">Closed schemes</a> ');
    document.write('</div>');
    document.write('</span>');
    document.write('<a href="/services/clearance/" target="_self" class="submenu">Support with clearance applications</a> ');
    document.write('<a href="/services/meditation/" target="_self" class="submenu">Mediation services</a> ');
    document.write('<a href="/services/internal/" target="_self" class="submenu">Internal controls &amp; governance reviews</a> ');
    document.write('<a href="/services/secretarial/" target="_self" class="submenu">Secretarial services</a> ');
    document.write('</div>');
//team
    document.write('<div style="display:none;margin:0px 0px 10px 0px" id="team">');           
    document.write('<a href="/team/overview.htm" target="_self" class="submenu">Company overview</a>');
    document.write('<a href="/team/" target="_self" class="submenu">Curricula Vitae</a> ');
    document.write('</div>');  
//contact
    document.write('<div style="display:none;margin:0px 0px 10px 0px" id="contactsform">');
    document.write('     <a href="/contacts/contact_form.aspx" target="_self" class="submenu">Contact Form</a> ');
    document.write('</div>');
//why
    document.write('<div style="display:none;margin:0px 0px 10px 0px" id="why">');
        document.write('     <a href="/why/benefits/" target="_self" class="submenu">The benefits</a> ');
    document.write('</div>');

    if(location.href.indexOf('/knowledge/')!=-1)
        desp('know');
    if(location.href.indexOf('/why/')!=-1)
        desp('why');
    //if(location.href.indexOf('/cases/')!=-1)
    //    desp(document.getElementById('cases'));
    if(location.href.indexOf('/team/')!=-1)
        desp('team');
    if(location.href.indexOf('/services/')!=-1)
        desp('services');
    if(location.href.indexOf('/ongoing/')!=-1)
        desp('trusteeship');
    if(location.href.indexOf('/contacts/')!=-1)
        desp('contactsform');
}

function writeMenuComm(){
 document.write('<a href="/" target="_self"'+((location.href=='http://'+document.domain+'/')?' ':'')+'>Home</a> | ');
 document.write('<a href="/why/" target="_self"'+((location.href.indexOf('/why/')!=-1)?' ':'')+'>Why PSITL?</a> | ');
 document.write('<a href="/services/" target="_self"'+((location.href.indexOf('/services/')!=-1)?' ':'')+'>Our Services</a> | ');
 
 /*
 document.write('<div style="display:none;margin:0px 0px 10px 10px">');

document.write('<span>');
document.write('     <a href="#" onclick="desp(this)" id="truste" target="_self">Trusteeship</a>');

document.write('<div style="display:none;margin:0px 0px 10px 10px">');

document.write('     <a href="/services/ongoing/" target="_self">Ongoing schemes</a>');
document.write('     <a href="/services/ongoing/closed.htm" target="_self">Closed schemes</a> ');

document.write('           </div>');
document.write('</span>');

document.write('     <a href="/services/clearance/" target="_self">Support with clearance applications</a> ');
document.write('     <a href="/services/meditation/" target="_self">Mediation services</a> ');
document.write('     <a href="/services/internal/" target="_self">Internal controls &amp; governance reviews</a> ');
document.write('     <a href="/services/secretarial/" target="_self">Secretarial services</a> ');

document.write('           </div>');
 */
 
 document.write('<a href="/need/" target="_self"'+((location.href.indexOf('/need/')!=-1)?' ':'')+'>The Need For A Professional Trustee</a> | ');
 document.write('<a href="/team/" target="_self" onclick="desp(this)">Our Team</a> | ');
 
 /*
document.write('<div style="display:none;margin:0px 0px 10px 10px">');
            
document.write('     <a href="/team/overview.htm" target="_self">Company overview</a>');
document.write('     <a href="/team/" target="_self">Curricula Vitae</a> ');

document.write('           </div>');            
            */

 document.write('<a href="/knowledge/" onclick="desp(this)" target="_self">Knowledge Centre</a> | ');
/*                              
document.write('     <a href="/knowledge/advert_gallery.htm" target="_self">Advert gallery</a> ');
document.write('     <a href="/knowledge/articles.htm" target="_self">Articles ');

document.write('           </div>');    
*/   
                               
 document.write('<a href="/contacts/" target="_self"'+((location.href.indexOf('/contacts/')!=-1)?' ':'')+'>Contact Us</a>');
 
 /*
 document.write('<div style="display:none;margin:0px 0px 10px 10px">');

document.write('     <a href="/contacts/contact_form.aspx" target="_self">Contact Form</a> ');

document.write('           </div>');
 */
 maindesp('mainmenu');
}
