if (document.images)
    {
      img1 = new Image(84,36);
      img1.src="images/mnu-home-on.png";
      img2 = new Image(84,36);
      img2.src="images/mnu-about-on.png";
      img3 = new Image(114,36);
      img3.src="images/mnu-performance-on.png";
      img4 = new Image(108,36);
      img4.src="images/mnu-global-on.png";
      img5 = new Image(241,36);
      img5.src="images/mnu-individual-on.png";
      img6 = new Image(215,36);
      img6.src="images/mnu-listed-on.png";
      img7 = new Image(107,36);
      img7.src="images/mnu-contact-on.png";
    }

function di(a){return document.getElementById(a)}
function dv(a){di(a).value=''}
function form_clear()
{dv('name');dv('company');dv('mail');dv('phone');dv('enquirytype');dv('enquiry');
}

function form_subscribe()
{
  if(di('txtMail').value=="")alert("Please enter your email id to subscribe.");
  else
  {
   var i,imgs=document.getElementsByTagName("img");
   for(i=0;i<imgs.length;i++)
    if(imgs[i].src.indexOf("btn-subscribe.png")>0)
     {
       var done=document.createElement("div");
       done.innerHTML="Subscription request sent.";
       done.style.color="black";
       (imgs[i].parentNode || imgs[i].parentElement).insertBefore(done,imgs[i]);
       imgs[i].style.display='none'
       sendAjaxRequest("/subscribe.php?mail="+di('txtMail').value);
       break;
     }
  }
}
function form_send()
{
  document.forms[0].submit();
}
function email_subscribe()
{}
function donot(imgid){
var url=document.location.href;
if(imgid=='menu-contact' && url.indexOf('contact.php')>0)return true;
if(imgid=='menu-performance' && url.indexOf('performance.php')>0)return true;
if(imgid=='menu-global' && url.indexOf('/global-')>0)return true;
if(imgid=='menu-individual' && url.indexOf('/individual-')>0)return true;
if(imgid=='menu-investment' && url.indexOf('/investment-')>0)return true;
if(imgid=='menu-about' && url.indexOf('/about-')>0 && url.indexOf('contact.php')<0)return true;
if(imgid=='menu-home' && (url.indexOf('index.php')>0 || url.indexOf('/',url.length-1,1)==0))return true;
return false;
}
var tmr,canbehidden=0,prevmenu=0;
function showmenu(id)
{
  if(di(id)!=prevmenu)
  {
  hidemenu();
  prevmenu=di(id);
  di(id).style.display=''
  if(tmr){clearTimeout(tmr);tmr=0}
  tmr=setTimeout(setcanhide,100);

  }
}

function setcanhide(){canbehidden=1}

function hidemenu(){
  if(prevmenu)
  {
  prevmenu.style.display='none';
    onmnuout(di(prevmenu.id.replace('drop-','')));
  prevmenu=0
  canbehidden=0
 // alert(di(prevmenu.id.replace('drop-','')))

  }
  }
function onmnuover(img)
{
  if(!donot(img.id) && img.src.indexOf('-on.png')<0)img.src=img.src.replace('.png','-on.png');
  if(prevmenu&&prevmenu.id!='drop-'+img.id)hidemenu();
  if(img.id=='menu-about')showmenu('drop-menu-about');
  else if(img.id=='menu-global')showmenu('drop-menu-global');
  else if(img.id=='menu-individual')showmenu('drop-menu-individual');
  else if(img.id=='menu-investment')showmenu('drop-menu-investment');
}
function onmnuout(img)
{
if(!donot(img.id) && !(di('drop-'+img.id) && di('drop-'+img.id).style.display==''))img.src=img.src.replace('-on.png','.png');
}
function setPermanent(id)
{
di(id).src=di(id).src.replace('.png','-on.png');
}

function g(a,b,c)
{ if(a)
  return '<div><a href="'+a+'-'+b+'.php'+ssn+'">'+c+'</a></div>'
  else return '<div><a href="'+b+'.php'+ssn+'">'+c+'</a></div>'  }

function onmmove(e)
{
  if(prevmenu && canbehidden)
  {
     e=e||window.event;
     var maindiv=document.getElementById('mmdiv');
     var x,y,l,r,t,b;
     x=e.pageX || ( e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft);
     y=e.pageY || ( e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop);
     l=maindiv.offsetLeft+parseInt(prevmenu.style.left.substring(0,prevmenu.style.left.length-2));
     t=parseInt(prevmenu.style.top.substring(0,prevmenu.style.top.length-2))-35;
     r=l+prevmenu.offsetWidth;b=t+prevmenu.offsetHeight+35;

     if((x<l || x>r) || (y<t || y>b))
            hidemenu();
  }
}

function create_menu(){
document.body.onclick=function(){  if(tmr){clearTimeout(tmr)};hidemenu();}
document.body.onmousemove=onmmove;

var url=document.location.href;
var topval='200px';

    if(url.indexOf('contact.php')>0)
  {
    setPermanent('menu-contact');
  }
  else if(url.indexOf('performance.php')>0)
  {
    setPermanent('menu-performance');
  }
  else if(url.indexOf('/global-')>0)
  {
    setPermanent('menu-global');
  }
  else if(url.indexOf('/individual-')>0)
  {
    setPermanent('menu-individual');
  }
  else if(url.indexOf('/investment-')>0)
  {
    setPermanent('menu-investment');
  }
  else if(url.indexOf('/about-')>0)
  {
    setPermanent('menu-about');
  }
  else {
    setPermanent('menu-home');
    topval='261px';
  }

  var maindiv=document.getElementById('mmdiv');


  var dropAbout=document.createElement('div');dropAbout.id='drop-menu-about';dropAbout.className='dropdown';
  dropAbout.style.top=topval;dropAbout.style.left='83px';dropAbout.style.display='none';
  dropAbout.innerHTML=g('about','philosophy','Investment Philosophy')+g('about','reports','Reports & Research')+g('about','team','Team')+g('about','media','Media');
  maindiv.appendChild(dropAbout);

  var dropGlobal=document.createElement('div');dropGlobal.id='drop-menu-global';dropGlobal.className='dropdown';
  dropGlobal.style.top=topval;dropGlobal.style.left='281px';dropGlobal.style.display='none';
  dropGlobal.innerHTML=g('global','overview','Overview')+g('global','products','Product Discloser')+g(0,'performance','Performance')+g('global','fund-update','Fund Update');
  maindiv.appendChild(dropGlobal);

  var dropAbout=document.createElement('div');dropAbout.id='drop-menu-investment';dropAbout.className='dropdown';dropAbout.style.width='185px';
  dropAbout.style.top=topval;dropAbout.style.left='389px';dropAbout.style.display='none';
  dropAbout.innerHTML=g('investment','overview','Overview')+g('investment','announcements','Announcements')+g('investment','annual-report','Reports')+g(0,'performance','Performance')+g('investment','share-price','Current Share Price')+g('investment','directory','Directory')+g('investment','dividend','Dividend Reinvestment Plan');
  maindiv.appendChild(dropAbout);

  var dropAbout=document.createElement('div');dropAbout.id='drop-menu-individual';dropAbout.className='dropdown';dropAbout.style.width='210px';
  dropAbout.style.top=topval;dropAbout.style.left='605px';dropAbout.style.display='none';
  dropAbout.innerHTML=g('individual','overview','Overview')+g(0,'performance','Performance');
  maindiv.appendChild(dropAbout);
}



var xmlHttp; // The Ajax Object

//Sends the Ajax Response to the given URL
function sendAjaxRequest(url)
{
  try
  {
   xmlHttp=new XMLHttpRequest();
  }
  catch(e)
  { // indicates Internet Explorer prior to version 7
   try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e)
      {
       alert("Your browser does not support AJAX!");
       return false;
      }
    }
  }
 xmlHttp.onreadystatechange=getAjaxResponse;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
}

//Receives the Ajax Response
function getAjaxResponse() 
{ 
  if(xmlHttp.readyState==4) 
    {
   //   alert(xmlHttp.responseText);
    }
}