/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("about-us.jpg","new&events.jpg","officers.jpg","university.jpg","bos.jpg","head.jpg","library.jpg","tender.jpg","careeradd.gif","admin.jpg","contact.jpg","right.jpg","Intranet.jpg","cccp.jpg","Khedut.jpg","photogallery copy.jpg","feedback.gif");

overSources = new Array("about-us.jpg","new&events.jpg","officers.jpg","university.jpg","bos.jpg","head.jpg","library.jpg","tender.jpg","careeradd.gif","admin.jpg","contact.jpg","right.jpg","Intranet.jpg","cccp.jpg","Khedut.jpg","photogallery copy.jpg", "feedback.gif");


// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();
subInfo[16] = new Array();
subInfo[17] = new Array();



//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Mandate","mandate.asp","_self");
subInfo[1][2] = new Array("Vision & Mission","vision.asp","_self");
subInfo[1][3] = new Array("Vice Chancellor's Message","vcmessage.asp","_self");
subInfo[1][4] = new Array("Map of Univ. Jurisdiction","jurisdiction.asp","_self");
subInfo[1][5] = new Array("Campus Location","campus.asp","_self");

subInfo[3][1] = new Array("Vice chancellor","vc.asp","_self");
subInfo[3][2] = new Array("Director of Research & Dean PG","d_research_dean.asp","_self");
subInfo[3][3] = new Array("Director of Extension Education","d_extension.asp","_self");
subInfo[3][4] = new Array("Director of Information Technology","dit.asp","_self");
subInfo[3][5] = new Array("Director of Student Welfare","dr_student_welfare.asp","_self");
subInfo[3][6] = new Array("Dean faculty Agricultural Information Technology","dnfauclty_ag_it.asp","_self");
subInfo[3][7] = new Array("Dean Agriculture Faculty","dn_ag_faculty.asp","_self");
subInfo[3][8] = new Array("Dean Veterinary Faculty","dn_vet_faculty.asp","_self");
subInfo[3][9] = new Array("Dean Dairy Science Faculty","dn_ds_faculty.asp","_self");
subInfo[3][10] = new Array("Dean Faculty of Food Processing and Bio-energy","dn_fdprocess_faculty.asp","_self");
subInfo[3][11] = new Array("Registrar","registrar.asp","_self");
subInfo[3][12] = new Array("Comptrollor Cum Account Officer","comptroller.asp","_self");
subInfo[3][13] = new Array("Executive Engineer","exe_eng.asp","_self");
subInfo[3][14] = new Array("University Librarian ","librarian.asp","_self");



subInfo[4][1] = new Array("Board of Management","bom.asp","_self");
subInfo[4][2] = new Array("Academic Council","aca_council.asp","_self");
subInfo[4][3] = new Array("Agricultural Research Council","research_council.asp","_self");
subInfo[4][4] = new Array("Agricultural Extension Education Council","ext_council.asp","_self");

subInfo[5][1] = new Array("Faculty of Agriculture ","fc_agri.asp","_self");
subInfo[5][2] = new Array("Faculty of PG","fc_pg.asp","_self");
subInfo[5][3] = new Array("Faculty of Dairy Science ","fc_ds.asp","_self");
subInfo[5][4] = new Array("Faculty of Vet.sc and Animal Husbandry","fc_vet.asp","_self");
subInfo[5][5] = new Array("Faculty of Food Processing Tech. & Bio Energy","fc_fpt.asp","_self");

subInfo[15][1] = new Array("Khetiwadi ","Khedut Margdarshika Bhag 4/khetiwadi.pdf","_self");
subInfo[15][2] = new Array("Bagayat","Khedut Margdarshika Bhag 4/bagayat.pdf","_self");
subInfo[15][3] = new Array("Pashupalan","Khedut Margdarshika Bhag 4/pashupalan.pdf","_self");
subInfo[15][4] = new Array("Bij Nigam","Khedut Margdarshika Bhag 4/Bij Nigam.pdf","_self");
subInfo[15][5] = new Array("Bij Pramanan","Khedut Margdarshika Bhag 4/bij pramanan.pdf","_self");
subInfo[15][6] = new Array("Gujarat Agro","Khedut Margdarshika Bhag 4/Gujarat Agro.pdf","_self");
subInfo[15][7] = new Array("Fisheries ","Khedut Margdarshika Bhag 4/fisheries.pdf","_self");
subInfo[15][8] = new Array("Gau Seva","Khedut Margdarshika Bhag 4/Gau seva.pdf","_self");
subInfo[15][9] = new Array("Universities","Khedut Margdarshika Bhag 4/universities.pdf","_self");
subInfo[15][10] = new Array("Atma","Khedut Margdarshika Bhag 4/Atma.pdf","_self");
subInfo[15][11] = new Array("Chapter 15-19","Khedut Margdarshika Bhag 4/chapter 15-19.pdf","_self");

///*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 161;

var ySubOffset = 0;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
//var overSub = true;
var delay = 700;


totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
		
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		//document.write('<div id="submenu'+ (x+1) + '" class="psycho" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');
		document.write('<ul>');

		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
		document.write('<li>');
		document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
		document.write('target="' + subInfo[x+1][k+1][2] + '">');
		document.write( subInfo[x+1][k+1][0] + '</a>');
		
		document.write('</li>');
		}
		document.write('</ul>');
		

	}
	
	document.write('</div>');

}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();
