////////////////////////////////////////////////////////////////////////////////
//  tablarahul.com javascripts
//  Author: Sanjeev Nayak
//  Copyright (C) 2008 tablarahul.com. All rights reserved.
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
//  Generic scripts
////////////////////////////////////////////////////////////////////////////////


//  This will write the top menu bar. The piece of html written by this script  
//  was being repeated on every page, so made it into a script to avoid code
//  duplication. 
function write_top_menubar() {

	// write the top menu bar inside a table row 
    document.write("<tr><td width='100%' height='30' align='right' valign='middle' class='navlinks'>")
    document.write("<a class='navlinks' href='index.html'>home</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='biodata.html'>biodata</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='photos.html'>photos</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='videos.html'>videos</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='concerts.html'>concerts</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='lessons.html'>tabla lessons</a>&nbsp;&nbsp;|&nbsp;&nbsp;")
    document.write("<a class='navlinks' href='contact.html'>contact</a>")
    document.write("</td></tr>")
}

// this will write the footer at the bottom
function write_footer(text) {

    // did the caller not pass any argument?
    if (typeof(text) == "undefined"){
	    text = "";
	}
	
	// write the footer inside a table row 
    document.write("<tr><td height='30' align='left' valign='middle' class='footer'>");
    document.write(text);
	document.write("</td></tr>");
}

// pre-loads the images when the page is loaded - will ensure that images are not
// loaded when mouse is moved over them but loaded upfront.
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];}}
}

// restores the original image - used on the mouse out event
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;
}

// find object with the specified id
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;
}

// swap the image - used with mouse over event
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];}
}

// pops up a new browser window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

