
if(screen.width==800){
	scrSize='small';
}else if(screen.width==1024){
	scrSize='big';
}

	
function linker(lName, lHref, isActive, subMenu){
	this.lName=lName;		// name to display
	this.lHref=lHref;		// url of page to point
	this.isActive=isActive;		// active? 1=yes, 0=no
	this.subMenu=subMenu;		// submenu as array (or) null if no sub menu
}

var currentSel=0; //currently selected menu 

var cMenu0=document.all.menu0.style ; 
var cMenu1=document.all.menu1.style ;
var cMenu2=document.all.menu2.style ;

var cCall=document.all.call.style ;

var menuItemHeight=20;  // height of each menu item in menu
var menu0Width=130;	// width of first level sub menu

  // set positions ..

if(scrSize=='big'){
	var menu0Indent=new Array(150,230,335,450,540,640);
	var menu0Top=270;	// the top position of first level submenu

}else if(scrSize=='small'){
	var menu0Indent=new Array(35,112,227,330,426,522);
	var menu0Top=270;	// the top position of first level submenu

}

// define all menu items as arrays...
// define sub menus prior to referencing them in the actual menus

var  Plasticsurgery =new Array(
	new linker("Junior College", "pros_jr.htm", 1, null),
	new linker("Senior College", "pros_sr.htm", 1, null),
	new linker("YCMOU Courses", "pros_blib.htm", 1, null)	
		
);

var cosmeticsurgery=new Array(
	new linker("Founder", "founder.htm", 1, null),
	new linker("Management", "management.htm", 1, null),
	new linker("Principal", "principal.htm", 1, null)
);

var beautytreat=new Array(
	new linker("H.S.C. Board", "merit_jr.htm", 1, null),
	new linker("University", "merit_sr.htm", 1, null)
	
);


var photogallery=new Array(
	new linker("Educational", "act_edu.htm", 1, null),
	new linker("Sports", "act_sports.htm", 1, null),
	new linker("N.C.C.", "act_ncc.htm", 1, null),
	new linker("N.S.S.", "act_nss.htm", 1, null),
	new linker("Cultural", "act_cul.htm", 1, null)
	
);
var lasersurgery=new Array(
	new linker("Arts", "dept_arts.htm", 1, null),
	new linker("Commerce", "dept_comm.htm", 1, null),
	new linker("Science", "dept_science.htm", 1, null)
	
);

var photo=new Array(
	new linker("Scholarship", "fac_scho.htm", 1, null),
	new linker("Library", "fac_lib.htm", 1, null),
	new linker("Hostel", "fac_hostel.htm", 1, null),
	new linker("Others", "fac_others.htm", 1, null)
	
);

//describe the level 1 submenu..

var menu0Items=new Array(
cosmeticsurgery, lasersurgery, Plasticsurgery, beautytreat, photogallery, photo
);

// displays the menu items

function show(subMenuIndex, showIndex){

//alert("showing "+subMenuIndex+", "+showIndex)
	obj=eval('cMenu'+subMenuIndex);

//position
	switch (subMenuIndex){
		case 0:  // first level
		currentSel=showIndex;
		hideAllMenus();
		obj.left=menu0Indent[showIndex];
		obj.top=menu0Top;
		
//write menu items on layer
		writeMenuItems(subMenuIndex, menu0Items[showIndex]);
		break;
		case 1: // second level
		if(currentSel>3){
			obj.left=menu0Indent[currentSel]-menu0Width;
			
		}else{
			obj.left=menu0Indent[currentSel]+menu0Width;
			
		}
		obj.top=menu0Top+((menuItemHeight+1)*showIndex);
	//write menu items on layer
		writeMenuItems(subMenuIndex, menu0Items[currentSel][showIndex].subMenu);
		
		break;
	}
//make visible
	obj.visibility='visible';
}

function hide(subMenuIndex){
	eval('cMenu'+subMenuIndex).visibility='hidden';
}

function hideAllMenus(){
	for(cnt=0;cnt<3;cnt++){
		eval('cMenu'+cnt).visibility='hidden';		
	}
}

function writeMenuItems(subMenuIndex, items){

// create menu string
	toWrite="<table  bgcolor=white cellpadding=2 cellspacing=1 width="+menu0Width+"px bgcolor=#D2D7DD border=0>";
	
	for(cnt=0;cnt<items.length;cnt++){
		if(items[cnt].isActive==1){
			if(items[cnt].subMenu==null){
				toWrite=toWrite+"<tr height=20px><td ID='go"+subMenuIndex+"_"+cnt+"' onmouseover=highlight('go"+subMenuIndex+"_"+cnt+"') bgcolor='#D2D7DD'><a class=active style='text-decoration: none' onmouseover='hide("+(subMenuIndex+1)+")' href='"+items[cnt].lHref+"'><font face='Verdana' color='#111111' size='1'>"+processStr(items[cnt].lName)+"</font></a></TD></TR>";
			}else{
				toWrite=toWrite+"<tr height=20px><td ID='go"+subMenuIndex+"_"+cnt+"' onmouseover=highlight('go"+subMenuIndex+"_"+cnt+"');show("+(subMenuIndex+1)+","+cnt+") bgcolor='#D2D7DD'><a class=active style='text-decoration: none' onmouseover='show("+(subMenuIndex+1)+","+cnt+")' href=#><font face='Verdana' color='#FFFFFF' size='1'>"+processStr(items[cnt].lName+"...")+"</font></A></TD></a></TR>";
			}
		}else{
			if(items[cnt].subMenu==null){
				toWrite=toWrite+"<tr height=20px><td ID='go"+subMenuIndex+"_"+cnt+"' onmouseover=highlight('go"+subMenuIndex+"_"+cnt+"') bgcolor='#D2D7DD'><b class=inactive ><font face='Verdana' color='#111111' size='1'>"+processStr(items[cnt].lName)+"</font></b></TD></TR>";
			}else{
				toWrite=toWrite+"<tr height=20px><td ID='go"+subMenuIndex+"_"+cnt+"' onmouseover=highlight('go"+subMenuIndex+"_"+cnt+"');show("+(subMenuIndex+1)+","+cnt+") bgcolor='#D2D7DD'><b class=inactive  ><font face='Verdana' color='#111111'  size='1'>"+processStr(items[cnt].lName+"...")+" </font> </b></TD></a></TR>";
			}
		}

	}
	toWrite=toWrite+"</TABLE>";
	
// write menu on layer	
	eval('menu'+subMenuIndex).innerHTML=toWrite;
}

var currHighlight='null';
var back='';

function highlight(toHighlight){

	if(document.all[currHighlight] && document.all[toHighlight] ){
		document.all[currHighlight].style.background='#D2D7DD';
		if(currHighlight.indexOf('0_')>0 && toHighlight.indexOf('1_')>0){
			document.all[currHighlight].style.background='#2689FC';
			back=currHighlight;
		}else if(currHighlight.indexOf('1_')>0 && toHighlight.indexOf('0_')>0){
			if(document.all[back])
				document.all[back].style.background='#BFDFFF';
		}
	}
	document.all[toHighlight].style.background='#667586';
	currHighlight=toHighlight;
}

/*
adds extra white spaces to small menu items.. 
lets the user click anywhere in the table cell.
*/
function processStr(inStr){
	
	stdLength=22; // standard length of menu items..

	strLength=inStr.length;
	if(strLength<15){
		for(count=strLength;count<stdLength;count++){
			inStr=inStr+"&nbsp;";
		}
	}
	return inStr;
}

var xIndentOfCallOut=0;
var yIndentOfCallOut=0
var messages = new Array(
"Discrepancy can be resolved by<br> either Administrator or Super User",
"N Not Initiated<br>P Partially Completed<br>C Completed",
"Status of Marks Entry",
"Update screen is accessible to <b>Super User </b> alone",
"Original Marks Card can be printed only once"

);

function showCallOut(coordX, coordY, mssgIndex){
//	alert(coordX+", "+coordY);
	yIndentOfCallOut=coordY;	
	xIndentOfCallOut=coordX;
	call.innerHTML=callOut(messages[mssgIndex]);
	moveCallOut(event);
	cCall.visibility='visible';
}
function hideCallOut(){
	cCall.visibility='hidden';
	yIndentOfCallOut=0;
	xIndentOfCallOut=0;
}
function callOut(mssg){
	returnStr = "<table border=1 bgcolor=yellow cellpadding=4 cellspacing=0 bordercolor=#000000><tr><td align=left valign=middle>";
	returnStr = returnStr+"< STYLE='font-family:thoma;font-size:5pt;font-weight:bold;color:black'>"
	returnStr = returnStr+mssg;
	returnStr = returnStr+"</td></tr></table>"
//	alert(returnStr);
	return returnStr;
}

function moveCallOut(e){
	cCall.top=e.clientY-yIndentOfCallOut;
	cCall.left=e.clientX-xIndentOfCallOut;
}


