//****** MAIN NAVIGATION *******//
function RLinks(txt,url,hasChildren,parentId){
	this.txt = txt;
	this.url = url;
	this.hasChildren = hasChildren;
	this.parentId = parentId;
	this.children = new Array();
}
var _rlinks = new Array();
_rlinks[0]=new RLinks('El Agni Yoga',     'javascript:parent.location.href="ay_sp_info.html";',false,null);
_rlinks[1]=new RLinks('Contacto',         'javascript:parent.location.href="ay_sp_contact.html"',false,null);
_rlinks[2]=new RLinks('Grupos',           'javascript:parent.location.href="ay_sp_groups.html"',false,null);
_rlinks[3]=new RLinks('Compilaciones',    null,true,null);
_rlinks[4]=new RLinks('Compras',          'javascript:parent.location.href="ay_sp_booklist.html"',false,null);
_rlinks[5]=new RLinks('Descargar Archivos','javascript:parent.location.href="ay_sp_downloads.html"',false,null);
_rlinks[6]=new RLinks('Búsqueda',          'javascript:parent.location.href="search_sp.html"',false,null);


function writeRLinks(ndx,childNdx){
	var htmls = "<TABLE WIDTH='120px' BORDER=0 bordercolor=red ALIGN='LEFT' CELLPADDING='0' CELLSPACING='5'>";
	htmls += "\n\t<TR><TD ROWSPAN='3'>&nbsp;</TD><TD CLASS='common_text' VALIGN='TOP'>";
	htmls += "\n<DIV ALIGN='LEFT'><A HREF='javascript:parent.location.href=\"index.html\"'>";
	htmls += "\n<IMG SRC='../gifs/maitreya_small.gif' WIDTH='80' HEIGHT='86' ALIGN='MIDDLE' BORDER='0'></A></DIV>";
	htmls += "\n</TD></TR><TR><TD><BR></TD></TR><TR><TD CLASS='common_text' ALIGN=LEFT VALIGN='TOP' NOWRAP>";
	for(var i=0; i<_rlinks.length; i++){
		if(i==ndx){ /* selected */
			var prnt = _rlinks[i];
			if(prnt.children && prnt.children.length>0){
				if(childNdx!=null)
					htmls += "\n<A CLASS='ay' onMouseOver='return true;' HREF='"+prnt.url+"'>"+_rlinks[i].txt+"</A><BR>";
				else
					htmls += "\n<SPAN CLASS='ay_sel'>"+_rlinks[i].txt+"</SPAN><BR>";
				for(var j=0; j<prnt.children.length; j++){
					var child = prnt.children[j];
					if(childNdx!=null && childNdx==j){
						htmls += "\n<SPAN CLASS='ay_sel_submenu'>&nbsp;&nbsp;&nbsp;&nbsp;"+child.txt+"</SPAN><BR>";
					}else{
						htmls+="\n<A CLASS='ay_submenu' HREF='"+child.url+"' onMouseOver='return true;'>&nbsp;&nbsp;&nbsp;&nbsp;"+child.txt+"</A><BR>";
					}
				}
			}else{
				htmls += "\n<SPAN CLASS='ay_sel'>"+_rlinks[i].txt+"</SPAN><BR>";
			}
		}else{ /* not selected */
			if(_rlinks[i].url != null){
				htmls+="\n<A HREF='"+_rlinks[i].url+"' CLASS='ay' onMouseOver='return true;'>"+_rlinks[i].txt+"</A><BR>";
			}else{
				htmls+="<NOBR><SPAN CLASS='ay_sel'>"+_rlinks[i].txt+"</SPAN></NOBR><BR>";
			}
		}
	}
	htmls += "\n</TD></TR></TABLE>";
	document.write(htmls);
}
//****** END MAIN NAVIGATION *******//

//************ FOOTER ***********//
function writeFooter(){
	var footer="";
	footer += '<HR WIDTH="100%" ALIGN="CENTER" NOSHADE SIZE="1" CLASS="ay_hr">';
	footer += '<TABLE WIDTH="100%" BORDER="0" CELLPADDING="3" CELLSPACING="0" BGCOLOR="#666666">';
	footer += '<TR>';
	footer += '<TD CLASS="bottom_addrInTable" ALIGN="CENTER"> 319 West 107th Street, New York, NY 10025-2799<BR>';
	footer += 'phone (212)864-7752 &#149; fax (212)864-7704 &#149; e-mail: <A HREF="mailto:info@agniyoga.org" CLASS="bottom_addrInTable">info@agniyoga.org</A>';
	footer += '</TD>';
	footer += '</TR>';
	footer += '</TABLE>';
	document.write(footer);
}
//************ END FOOTER ***********//

//************ ay_nav.js ***********//
function BookLink(url, txt, img){
	this.url = url;
	this.txt = txt;
	this.img = img;
}
var _links = new Array();
_links[0]  = new BookLink("ay_sp_lomg1.html"    ,     "Hojas del Jardín de Morya I",       "leaves_of_moryas_1924_i.gif");
_links[1]  = new BookLink("ay_sp_lomg2.html"    ,     "Hojas del Jardín de Morya II",      "leaves_of_moryas_1925_i.gif");
_links[2]  = new BookLink("ay_sp_community.html",     "Comunidad de la Nueva Era",         "new_era_community_1926_i.gif");
_links[3]  = new BookLink("ay_sp_agniyoga.html" ,     "Agni Yoga",                         "agni_yoga_1929_i.gif");
_links[4]  = new BookLink("ay_sp_infinity1.html",     "Infinito I",                        "infinity_1930_i.jpg");
_links[5]  = new BookLink("ay_sp_infinity2.html",     "Infinito II",                       "infinity_1930_i.jpg");
_links[6]  = new BookLink("ay_sp_hierarchy.html",     "Jerarquía",                         "hierarchy_1931_i.gif");
_links[7]  = new BookLink("ay_sp_heart.html",         "Corazón",                           "heart_1932_i.gif");
_links[8]  = new BookLink("ay_sp_fw1.html",           "Mundo Ardiente I",                  "fiery_world_1933_i.gif");
_links[9]  = new BookLink("ay_sp_fw2.html",           "Mundo Ardiente II",                 "fiery_world_1934_i.gif");
_links[10] = new BookLink("",                         "Mundo Ardiente III",                "fiery_world_1935_i.gif");
_links[11] = new BookLink("ay_sp_aum.html",           "Aum",                               "aum_1936_i.gif");
_links[12] = new BookLink("ay_sp_broth.html",         "Hermandad",                         "brotherhood_1937_i.gif");
_links[13] = new BookLink("ay_sp_supm1.html",         "Supramundano I",                    "supermundane_I_i.gif");
_links[14] = new BookLink("ay_sp_supm2.html",         "Supramundano II",                   "supermundane_II_i.gif");
_links[15] = new BookLink("ay_sp_supm3.html",         "Supramundano III",                  "supermundane_III_i.gif");
_links[16] = new BookLink("",                         "Supramundano IV",                   "supermundane_IV_i.gif");

_links[17] = new BookLink("ay_sp_lohr1.html",         "Cartas de Helena Roerich, Vol. I",  "lohr1_i.gif");
_links[18] = new BookLink("",                         "Cartas de Helena Roerich, Vol. II", "lohr2_i.gif");
_links[19] = new BookLink("ay_sp_crossroads.html",    "En Las Encrucijadas de Oriente",    "crossroads_i.gif");
_links[20] = new BookLink("ay_sp_fob.html",           "Fundamentos del Budismo",           "FoB_i.gif");
_links[21] = new BookLink("",                         "Glosario Agni Yoga",                "glossary_i.gif");

function writeImg(ndx){
	var s="<IMG SRC='ay_book_images/"+_links[ndx].img+"' BORDER=1>";
	document.write(s);
}
function writeLinks(ndx){
	var s="";
	for(var i=0; i<_links.length; i++){
		if(i==17) s+="<IMG SRC=\"../gifs/type_emb4.gif\"></IMG><BR>";
		if(i!=ndx)
			s+="\n<NOBR><A HREF='javascript:parent.document.location.href=\""+_links[i].url+"\"' CLASS='sideBookList' onMouseOver='status=\"\"; return true;' onMouseOut=''>"+_links[i].txt+"</A></NOBR><BR>";
		else
			s+="\n<NOBR><SPAN CLASS='sideBookListSel'>"+_links[i].txt+"</SPAN></NOBR><BR>";
	}
	document.write(s);
}
//************ end ay_nav.js ***********//


