//Side menu

function collapse(val){
	for(var i=0;i<9;i++){
		if(val != i){
			document.getElementById('main'+i).innerHTML="";
		}
	}
}
	
function dosubMenu(subVal){
	obj1=document.getElementById("sub0");
	if(obj1.innerHTML==""){
		obj1.innerHTML="<table border=\"0\" id=\"sub1"+subVal+"\"><tr><td width=\"160\" class=\"subnav_link31\" onmouseover=\"this.className='subnav_link32'\" onmouseout=\"this.className='subnav_link31'\" onclick=\"window.location.href='ja_careers.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA Careers</td></tr><tr><td width=\"160\" class=\"subnav_link31\" onmouseover=\"this.className='subnav_link32'\" onmouseout=\"this.className='subnav_link31'\" onclick=\"window.location.href='ja_success_skills.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA Success Skills</td> </tr><tr><td width=\"160\" class=\"subnav_link31\" onmouseover=\"this.className='subnav_link32'\" onmouseout=\"this.className='subnav_link31'\" onclick=\"window.location.href='ja_inside_industry.jsp';\"> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;JA Inside Industry</td></tr><tr><td width=\"160\" class=\"subnav_link31\" onmouseover=\"this.className='subnav_link32'\" onmouseout=\"this.className='subnav_link31'\" onclick=\"window.location.href='volunteers.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JA BridgeIT</td> </tr><tr><td width=\"160\" class=\"subnav_link31\" onmouseover=\"this.className='subnav_link32'\" onmouseout=\"this.className='subnav_link31'\" onclick=\"window.location.href='volunteers.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JA More Than Money</td> </tr></table>";
	} else{
		obj1.innerHTML="";
	}
}

  function doMenu(item) { 
	obj=document.getElementById("main"+item); 
	if (obj.innerHTML=="") { 
		if(item==1){
		obj.innerHTML="<table border=\"0\" id=\"main1"+item+"\"><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='JaiNeed.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Why JA India</td></tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='JaiFoundersBoard.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Founders Board</td></tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='JaiVisionMission.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Vision & Mision</td> </tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='JaiSponsors.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Our Sponsors</td> </tr></table>";
		} else if(item==2){
		obj.innerHTML="<table border=\"0\" id=\"main1"+item+"\"><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='www.jaindia.net/events';\"> &nbsp;&nbsp;&nbsp;&nbsp;Program Search</td></tr></table>";
		} else if(item==3){
		obj.innerHTML="<table border=\"0\" id=\"main1"+item+"\"><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"javascript:dosubMenu('1');window.location.href='education.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Education</td></tr>"+"<tr><td><span id=\"sub0\"></span></td></tr>"+" <tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='entrepreneurship.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Entrepreneurship</td> </tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='partnerships.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Partnership</td> </tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='schools_served.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Schools Served</td> </tr></table>";
		} else if(item==4){
		obj.innerHTML="<table border=\"0\" id=\"main1"+item+"\"><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='special-announcements.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Special Announcements</td></tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='jaisupport.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Support</td></tr><tr><td width=\"160\" class=\"subnav_link21\" onmouseover=\"this.className='subnav_link22'\" onmouseout=\"this.className='subnav_link21'\" onclick=\"window.location.href='important-links.jsp';\"> &nbsp;&nbsp;&nbsp;&nbsp;Important Links</td> </tr></table>";
		}

		collapse(item);
	} else { 
		obj.innerHTML="";
	} 
  } 

//top menu

function displayMenu(e){

document.getElementById("menu1").style.display='block';
document.getElementById("menu2").style.top=e.clientY;
document.getElementById("menu3").style.left=e.clientX;

document.getElementById("menu2").style.display='block';
document.getElementById("menu2").style.top=e.clientY;
document.getElementById("menu2").style.left=e.clientX;

document.getElementById("menu3").style.display='block';
document.getElementById("menu3").style.top=e.clientY;
document.getElementById("menu3").style.left=e.clientX;

document.getElementById("menu4").style.display='block';
document.getElementById("menu4").style.top=e.clientY;
document.getElementById("menu4").style.left=e.clientX;

document.getElementById("menu5").style.display='block';
document.getElementById("menu5").style.top=e.clientY;
document.getElementById("menu5").style.left=e.clientX;

document.getElementById("menu6").style.display='block';
document.getElementById("menu6").style.top=e.clientY;
document.getElementById("menu6").style.left=e.clientX;

document.getElementById("menu7").style.display='block';
document.getElementById("menu7").style.top=e.clientY;
document.getElementById("menu7").style.left=e.clientX;

document.getElementById("menu8").style.display='block';
document.getElementById("menu8").style.top=e.clientY;
document.getElementById("menu8").style.left=e.clientX;

document.getElementById("menu9").style.display='block';
document.getElementById("menu9").style.top=e.clientY;
document.getElementById("menu9").style.left=e.clientX;

}

function hide(e){

document.getElementById("menu1").style.display='block';
var top=document.getElementById("menu1").style.top;
var left=document.getElementById("menu1").style.left;

document.getElementById("menu2").style.display='block';
var top=document.getElementById("menu2").style.top;
var left=document.getElementById("menu2").style.left;

document.getElementById("menu3").style.display='block';
var top=document.getElementById("menu3").style.top;
var left=document.getElementById("menu3").style.left;

document.getElementById("menu4").style.display='block';
var top=document.getElementById("menu4").style.top;
var left=document.getElementById("menu4").style.left;

document.getElementById("menu5").style.display='block';
var top=document.getElementById("menu5").style.top;
var left=document.getElementById("menu5").style.left;

document.getElementById("menu6").style.display='block';
var top=document.getElementById("menu6").style.top;
var left=document.getElementById("menu6").style.left;

document.getElementById("menu7").style.display='block';
var top=document.getElementById("menu7").style.top;
var left=document.getElementById("menu7").style.left;

document.getElementById("menu8").style.display='block';
var top=document.getElementById("menu8").style.top;
var left=document.getElementById("menu8").style.left;

document.getElementById("menu9").style.display='block';
var top=document.getElementById("menu9").style.top;
var left=document.getElementById("menu9").style.left;

var height=180;
var width=20;
top = top.substring(0,top.lastIndexOf("p"));
left = left.substring(0,left.lastIndexOf("p"));
var y = e.clientY;
var x = e.clientX;
//alert("xy"+x+"-"+y+",top-left"+top+"-"+left);
if(!(y > top && y < (top+height) && x > left && x < (left+width)))
	outdisplaymenu();
}

function outdisplaymenu(){

document.getElementById("menu1").style.display='none';

document.getElementById("menu2").style.display='none';

document.getElementById("menu3").style.display='none';

document.getElementById("menu4").style.display='none';

document.getElementById("menu5").style.display='none';

document.getElementById("menu6").style.display='none';

document.getElementById("menu7").style.display='none';

document.getElementById("menu8").style.display='none';

document.getElementById("menu9").style.display='none';

}

//Contents for menu 2, and so on

var menu1=new Array()
menu1[0]='<A HREF="JaiNeed.jsp"><FONT color="#833916">Why JA India</font></A>'
menu1[1]='<A HREF="JaiFoundersBoard.jsp"><FONT color="#833916">JAI Founders-Board</font></A>'
menu1[2]='<A HREF="JaiVisionMission.jsp"><FONT color="#833916">JAI Vision and Mission</font></A>'
menu1[3]='<A HREF="JaiSponsors.jsp"><FONT color="#833916">Our Sponsors</font></A>'


var menu2=new Array()
menu2[0]='<A HREF="education.jsp"><FONT color="#833916">Education</font></A>'
menu2[1]='<A HREF="PDF/JACWAP_Program_Structure_V4.pdf" target="_blank"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA Careers</font></A>'
menu2[2]='<A HREF="PDF/JASS_Program_Structure_V1.pdf" target="_blank"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA Success Skills</font></A>'
menu2[3]='<A HREF="PDF/JA_Inside_Industry_Program_Note_and_Structure_V2.pdf" target="_blank"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA Inside Industry</font></A>'
menu2[4]='<A HREF="PDF/EMC_India_COE_JA_MoU_India_release_02-09-08__2.pdf" target="_blank"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA BridgeIT</font></A>'
menu2[5]='<A HREF="PDF/JAMorethanMoney.pdf" target="_blank"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JA More Than Money</font></A>'
menu2[6]='<A HREF="entrepreneurship.jsp"><FONT color="#833916">Entrepreneurship</font></A>'
menu2[7]='<A HREF="partnerships.jsp"><FONT color="#833916">Partnership</font></A>'
menu2[8]='<A HREF="schools_served.jsp"><FONT color="#833916">Schools Served</font></A>'

var menu3=new Array()
menu3[0]='<A HREF="volunteers.jsp"><FONT color="#833916">JA Volunteer</font></A>'
menu3[1]='<A HREF="students.jsp"><FONT color="#833916">JA Student</font></A>'
menu3[2]='<A HREF="schools.jsp"><FONT color="#833916">JA Partner School</font></A>'
menu3[3]='<A HREF="Teacher.jsp"><FONT color="#833916">JA Teacher</font></A>'

var menu4=new Array()
// menu4[0]='<A HREF="LoadCalendar.action"><FONT color="#833916">Calendar of Events</font></A>'
// menu4[1]='<A HREF="CalendarSearch.action"><FONT color="#833916">Search Events</font></A>'
menu4[0]='<A HREF="www.jaindia.net/events"><FONT color="#833916">Calendar of Events</font></A>'
menu4[1]='<A HREF="www.jaindia.net/events"><FONT color="#833916">Search Events</font></A>'

var menu5=new Array()
menu5[0]='<SPAN style="background-color:#CCCCCC;width: 100%;display: block;text-indent: 3px;border-bottom: 1px solid #999999;padding: 1px 0;text-decoration: none;font-weight: bold;"><FONT color="#190707">Admin Control</font></SPAN>'
menu5[1]='<A HREF="AdminAddUser.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;1. Add User</font></A>'
menu5[2]='<A HREF="AdminEditUser.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;2. Edit User</font></A>'
menu5[3]='<A HREF="AdminDeleteUser.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;3. Delete User</font></A>'
menu5[4]='<A HREF="AdminUsersList.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;4. Users List</font></A>'
menu5[5]='<SPAN style="background-color:#CCCCCC;width: 100%;display: block;text-indent: 3px;border-bottom: 1px solid #999999;padding: 1px 0;text-decoration: none;font-weight: bold;"><FONT color="#190707">Manage Program</font></SPAN>'
menu5[6]='<A HREF="AdminAddProgram.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;1. Add Program</font></A>'
menu5[7]='<SPAN style="background-color:#CCCCCC;width: 100%;display: block;text-indent: 3px;border-bottom: 1px solid #999999;padding: 1px 0;text-decoration: none;font-weight: bold;"><FONT color="#190707">Manage Event</font></SPAN>'
menu5[8]='<A HREF="AdminAddArea.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;1. Add Area</font></A>'
menu5[9]='<A HREF="EditEventDetails.action?clearFlag=true"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;2. Edit Events</font></A>'
menu5[10]='<A HREF="EventWithNoVolunteer.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;3. No-Voluteers</font></A>'
menu5[11]='<A HREF="NoSchoolAssign.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;4. No School-Assign</font></A>'
menu5[12]='<A HREF="DeleteEventDetails.action"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;5. Delete Events</font></A>'
menu5[13]='<SPAN style="background-color:#CCCCCC;width: 100%;display: block;text-indent: 3px;border-bottom: 1px solid #999999;padding: 1px 0;text-decoration: none;font-weight: bold;"><FONT color="#190707">Upload</font></SPAN>'
menu5[14]='<A HREF="AdminUploadFiles.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;1. Upload Photos/Videos</font></A>'
menu5[15]='<SPAN style="background-color:#CCCCCC;width: 100%;display: block;text-indent: 3px;border-bottom: 1px solid #999999;padding: 1px 0;text-decoration: none;font-weight: bold;"><FONT color="#190707">Program Details Report</font></SPAN>'
menu5[16]='<A HREF="ProgramAreaWise.action?programWise=program"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;1. Program Wise</font></A>'
menu5[17]='<A HREF="ProgramAreaWise.action?areaWise=area"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;2. Area Wise</font></A>'
menu5[18]='<A HREF="MonthWise.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;3. Month Wise</font></A>'
menu5[19]='<A HREF="NoOFStudentsWise.jsp"><FONT color="#833916">&nbsp;&nbsp;&nbsp;&nbsp;4. No. Of Students</font></A>'


var menu6=new Array()
menu6[0]='<A HREF="students.jsp"><FONT color="#833916">JA Student</font></A>'
menu6[1]='<A HREF="schools.jsp"><FONT color="#833916">JA Partner School</font></A>'

var menu7=new Array()
menu7[0]='<A HREF="volunteers.jsp"><FONT color="#833916">JA Volunteer</font></A>'
menu7[1]='<A HREF="schools.jsp"><FONT color="#833916">JA Partner School</font></A>'

var menu8=new Array()
menu8[0]='<A HREF="volunteers.jsp"><FONT color="#833916">JA Volunteer</font></A>'
menu8[1]='<A HREF="students.jsp"><FONT color="#833916">JA Student</font></A>'

var menu9=new Array()
menu9[0]='<A HREF="special-announcements.jsp"><FONT color="#833916">Special Announcements</font></A>'
menu9[1]='<A HREF="important-links.jsp"><FONT color="#833916">Important Links</font></A>'
menu9[2]='<A HREF="jaisupport.jsp"><FONT color="#833916">Support</font></A>'


var menuwidth='200px' //default menu width
var menubgcolor='white'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
