// JavaScript Document
	
	var root_url_part = "smimer.suratmunicipal";
	var root_url = "/smimercollege/";
	var root_url = "/";
	
	// Constants Start
	// These values are so-called constants, please do not modify their values at runtime.
	var MNU_LinkLevel = 0;
	var MNU_LinkShortCaption = 1;
	var MNU_LinkLongCaption = 2;
	var MNU_LinkURL = 3;
	var MNU_LinkTarget = 4;
	var MNU_ParentMenuRef = 5;
	var MNU_HaveSubmenu = 6;
	var MNU_UniqueIndex = 7;
	var MNU_MenuVisibility = 8;
	var MNU_SeparatorAfterwards = 9;
	var MNU_SitemapVisibility = 10;
	var MNU_IconImageURL = 11;
	var MNU_ChildrenCountForSiteMap = 12;
	var MNU_SearchTags = 13;
	
	var div_main_menu_id = "DivMenu", div_submenu_id_prefix = "DivSubMenu";
	
	var div_mini_sitemap_tree_id = "DivMiniSiteMapTree";
	var span_mini_sitemap_tree_link_id = "SPANMiniSiteMapTreeLink", preferred_mini_sitemap_tree_height=200;
	
	var div_sitemap_search_id = "DivSiteMapSearch", div_sitemap_search_results_id = "DivSiteMapSearchResults";
	var span_sitemap_search_id = "SPANSiteMapSearch", txt_sitemap_search_id = "TxtSiteMapSearch", preferred_search_panel_height=200;
	
	var td_container_id = "TDPageContentTest", div_poup_menu_id = "DivPopupMenu";
	
	var hide_all_time = 2000;
	
	var div_sitemap_id = "DivSitemapLink";
	var div_page_heading = "SMIMER_Heading";
	var page_url = window.location.href;
	var page_url_file_name = "";
	// Contants Over
	
	// Variables Start
	var arr_menu = new Array();
	var parent_menu = new Array();
	var arr_interval_show = new Array(), arr_interval_hide = new Array();
	var arr_interval_menu_item = new Array();
	var arr_interval_hide_all, arr_interval_hide_quickpanel, arr_interval_hide_search, arr_interval_searching;
	var current_menu_level = 0;
	var current_menu_index = 0;
	var sitemap_top_links_count = 0;
	
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	// Variables Start
	
	function CreateMenu() {
		var args = arguments ? arguments : CreateMenu.arguments;
				/*	args[0]  --> Link Level
						[1]  --> Link Short Caption
						[2]  --> Link Long Caption
						[3]  --> Link URL
						[4]  --> Link Target
						[5]  --> Parent Menu Ref. Variable (Auto)
						[6]  --> Have Submenu
						[7]  --> Menu Unique Index
						[8]  --> Menu Visibility
						[9]  --> Separator Afterwards
						[10] --> Sitemap Visibility
						[11] --> Icon Image URL
						[12] --> Children Count Only for Sitemap
						[13] --> Search Tags
				*/
		var new_i;
		
		if(args.length > 7) {
			new_i = arr_menu.length;
			arr_menu[new_i] = args;
			if(args[MNU_LinkLevel] > 0) {
				if(typeof(parent_menu[args[MNU_LinkLevel]-1]) != "undefined") {
					arr_menu[new_i][MNU_ParentMenuRef] = parent_menu[args[MNU_LinkLevel]-1];
					if(isNaN(parent_menu[args[MNU_LinkLevel]-1][MNU_ChildrenCountForSiteMap])) {
						parent_menu[args[MNU_LinkLevel]-1][MNU_ChildrenCountForSiteMap] = 0;
					}
					if(args[MNU_SitemapVisibility]) {
						parent_menu[args[MNU_LinkLevel]-1][MNU_ChildrenCountForSiteMap] += 1;
					}
				}
			}
			if(args[MNU_LinkLevel] == 0 && args[MNU_SitemapVisibility]) {
				sitemap_top_links_count++;
			}
			arr_menu[new_i][MNU_UniqueIndex] = new_i;
			parent_menu[args[MNU_LinkLevel]] = arr_menu[new_i];
		}
	}
	
	function InitMenus() {
		var tmp_menu, tmp_menu2, tmp_menu3;
		try {
			CreateMenu(-1, 'HOME', 'HOME', 'default.aspx', '_self', null, false, null, false, null, false, "home.gif", 0, " home smimer surat municipal institute ");
			CreateMenu(0, 'SMIMER Introduction', 'SMIMER Introduction', 'content/college/smimer-introduction.shtml', '_self', null, false, null, false, null, true, "introduction.gif", 0, " home smimer intro introduction surat municipal institute ");
			
			CreateMenu(0, 'The College', 'The College', 'content/college/main.shtml', '_self', null, true, null, true, null, true, "college.gif", 0, " about college dean message course courses undergraduate postgraduate graduate ");
			CreateMenu(1, ':: About College', 'About College', 'content/college/about.shtml', '_self', null, false, null, true, null, true, null, 0, " about college ");
			CreateMenu(1, ':: Dean Message', 'Dean Message', 'content/college/dean-message.shtml', '_self', null, false, null, true, null, true, null, 0, " dean message ");
			CreateMenu(1, ':: Overview', 'Overview', 'content/college/overview.shtml', '_self', null, false, null, true, null, true, null, 0, " overview ");
			CreateMenu(1, ':: Courses', 'Courses', 'content/college/courses.shtml', '_self', null, true, null, true, null, true, null, 0, " course courses ");
			CreateMenu(2, ':: Under Graduate', 'Under Graduate', 'content/college/courses.shtml#undergraduate', '_self', null, false, null, true, null, true, null, 0, " undergraduate graduate ");
			CreateMenu(2, ':: Post Graduate', 'Post Graduate', 'content/college/courses.shtml#postgraduate', '_self', null, false, null, true, null, true, null, 0, " postgraduate graduate ");
			CreateMenu(2, ':: Fee Structure', 'Fee Structure', 'content/college/courses.shtml#feestructure', '_self', null, false, null, true, null, true, null, 0, " fee structure ");
			
			CreateMenu(0, 'Affiliation', 'Affiliation & Recognition', 'content/affiliation/main.shtml', '_self', null, false, null, true, null, true, "affiliation.gif", 0, " affiliation recognition ");
			
			CreateMenu(0, 'Students', 'Students', 'content/students/main.shtml', '_self', null, true, null, true, null, true, "students.gif", 0, " students student pupil admission admissions result results rule rules regulation activity activities ");
			CreateMenu(1, ':: Admission', 'Admission', 'content/students/admission.shtml', '_self', null, false, null, true, null, true, null, 0, " admission admissions ");
			CreateMenu(1, ':: Result', 'Result', 'content/students/result.shtml', '_self', null, false, null, true, true, true, null, 0, " result results ");
			CreateMenu(2, ':: Result Of UG Degree Course', 'Result Of UG Degree Course', 'content/students/result-ug.shtml', '_self', null, false, null, true, true, true, null, 0, " result results ug ");
			CreateMenu(2, ':: Result Of PG Degree Course', 'Result Of PG Degree Course', 'content/students/result-pg.shtml', '_self', null, false, null, true, true, true, null, 0, " result results pg ");
			CreateMenu(1, ':: Rules & Regulation', 'Rules & Regulation', 'content/students/rules.shtml', '_self', null, false, null, true, null, true, null, 0, " rule rules regulation ");
			CreateMenu(1, ':: Activities', 'Activities', 'content/students/activities.shtml', '_self', null, false, null, true, null, true, null, 0, " activity activities ");
			//CreateMenu(1, ':: Merit Search', 'Merit Search', 'content/students/MeritSearch.aspx', '_self', null, false, null, true, null, true, null, 0, " merit search ");
			
			CreateMenu(0, 'Departments', 'Departments', 'content/departments/main.shtml', '_self', null, true, null, true, null, true, "departments.gif", 0, " department departments anatomy physiology biochemistry pathology pharmacology microbiology forensic medicine toxicology preventive social medicine general medicine tb chest skin vd psychiatry anesthesiology surgery orthopedics ophthalmology ent obst gynecology peadiatric radiodiagnosis dentistry casualty ");
			CreateMenu(1, 'Department of Anatomy', 'Department of Anatomy', 'content/departments/dept-anatomy.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments anatomy ");
			CreateMenu(1, 'Department of Physiology', 'Department of Physiology', 'content/departments/dept-physiology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments physiology ");
			CreateMenu(1, 'Department of Biochemistry', 'Department of Biochemistry', 'content/departments/dept-biochemistry.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments biochemistry ");
			CreateMenu(1, 'Department of Pathology', 'Department of Pathology', 'content/departments/dept-pathology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments pathology ");
			CreateMenu(1, 'Department of Pharmacology', 'Department of Pharmacology', 'content/departments/dept-pharmacology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments pharmacology ");
			CreateMenu(1, 'Department of Microbiology', 'Department of Microbiology', 'content/departments/dept-microbiology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments microbiology ");
			CreateMenu(1, 'Department of Forensic Medicine &amp; Toxicology', 'Department of Forensic Medicine &amp; Toxicology', 'content/departments/dept-forensic-medicine-toxicology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments forensic medicine toxicology ");
			CreateMenu(1, 'Department of Preventive &amp; Social Medicine', 'Department of Preventive &amp; Social Medicine', 'content/departments/dept-preventive-social-medicine.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments preventive social medicine ");
			CreateMenu(1, 'Department of General Medicine', 'Department of General Medicine', 'content/departments/dept-general-medicine.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments general medicine ");
			CreateMenu(1, 'Department of T. B. &amp; Chest', 'Department of T. B. &amp; Chest', 'content/departments/dept-tb-chest.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments tb chest ");
			CreateMenu(1, 'Department of Skin &amp; V. D.', 'Department of Skin &amp; V. D.', 'content/departments/dept-skin-vd.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments skin vd ");
			CreateMenu(1, 'Department of Psychiatry', 'Department of Psychiatry', 'content/departments/dept-psychiatry.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments psychiatry ");
			CreateMenu(1, 'Department of Anesthesiology', 'Department of Anesthesiology', 'content/departments/dept-anesthesiology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments anesthesiology ");
			CreateMenu(1, 'Department of Surgery', 'Department of Surgery', 'content/departments/dept-surgery.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments surgery ");
			CreateMenu(1, 'Department of Orthopedics', 'Department of Orthopedics', 'content/departments/dept-orthopedics.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments orthopedics ");
			CreateMenu(1, 'Department of Ophthalmology', 'Department of Ophthalmology', 'content/departments/dept-ophthalmology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments ophthalmology ");
			CreateMenu(1, 'Department of E. N. T.', 'Department of E. N. T.', 'content/departments/dept-ent.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments orthopedics ent ");
			CreateMenu(1, 'Department of Obst &amp; Gynecology', 'Department of Obst &amp; Gynecology', 'content/departments/dept-obst-gynecology.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments obst gynecology ");
			CreateMenu(1, 'Department of Peadiatric', 'Department of Peadiatric', 'content/departments/dept-peadiatric.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments peadiatric ");
			CreateMenu(1, 'Department of Radiodiagnosis', 'Department of Radiodiagnosis', 'content/departments/dept-radiodiagnosis.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments radiodiagnosis ");
			CreateMenu(1, 'Department of Dentistry', 'Department of Dentistry', 'content/departments/dept-dentistry.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments dentistry ");
			CreateMenu(1, 'Department of Casualty', 'Department of Casualty', 'content/departments/dept-casualty.shtml', '_self', null, false, null, false, null, true, null, 0, " department departments casualty ");
			CreateMenu(1, 'Other Sections', 'Other Sections', 'http://smimer.suratmunicipal.gov.in/content/departments/other-dept.pdf', '_blank', null, false, null, true, null, true, null, 0, " department departments other ");
			
			CreateMenu(0, 'Facilities', 'Facilities', 'content/facilities/main.shtml', '_self', null, true, null, true, null, true, "facilities.gif", 0, " facility facilities library hostel rule rules charges charge students student counseling ");
			CreateMenu(1, ':: Library', 'Library', 'content/facilities/library.shtml', '_self', null, false, null, true, null, true, "library.gif", 0, " library book books ");
			CreateMenu(1, ':: Hostel', 'Hostel', 'content/facilities/hostel.shtml', '_self', null, false, null, true, null, true, null, 0, " hostel ");
			//CreateMenu(2, ':: Overview', 'Overview', 'content/facilities/hostel.shtml#overview', '_self', null, false, null, true, null, true, null, 0, "");
			//CreateMenu(2, ':: Rules', 'Rules', 'content/facilities/hostel-rules.shtml', '_self', null, false, null, true, null, true, null, 0, " rule rules ");
			//CreateMenu(2, ':: Charges', 'Charges', 'content/facilities/hostel-charges.shtml', '_self', null, false, null, true, null, true, null, 0, " charges charge ");
			//CreateMenu(1, ':: Recreation', 'Recreation', 'content/facilities/recreation.shtml', '_self', null, false, null, true, null, true, null, 0, " recreation ");
			CreateMenu(1, ':: Student Counseling', 'Student Counseling', 'content/facilities/student-counseling.shtml', '_self', null, false, null, true, null, true, null, 0, " students student counseling ");
			
			CreateMenu(0, 'Administration', 'Administration', 'content/administration/main.shtml', '_self', null, true, null, true, null, true, "administration.gif", 0, " administration administrative officers executive council college council committee gymkhana committee ethical committee ");
			CreateMenu(1, ':: Administrative Officers', 'Administrative Officers', 'content/administration/administrative-officers.shtml', '_self', null, false, null, true, null, true, null, 0, " administrative officers ");
			//CreateMenu(1, ':: Executive Council', 'Executive Council', 'content/administration/executive-council.shtml', '_self', null, false, null, true, null, true, null, 0, " executive council ");
			CreateMenu(1, ':: College Council', 'College Council', 'content/administration/college-council.shtml', '_self', null, false, null, true, true, true, null, 0, " college council ");
			//CreateMenu(1, ':: Anti Ragging Committee', 'Anti Ragging Committee', 'content/administration/anti-ragging-committee.shtml', '_self', null, false, null, true, null, true, null, 0, " ragging antiragging committee ");
			CreateMenu(1, ':: Gymkhana Committee', 'Gymkhana Committee', 'content/administration/gymkhana-committee.shtml', '_self', null, false, null, true, null, true, null, 0, " gymkhana committee ");
			CreateMenu(1, ':: Ethical Committee', 'Ethical Committee', 'content/administration/ethical-committee.shtml', '_self', null, false, null, true, null, true, null, 0, " ethical committee ");
			CreateMenu(1, ':: RTI- Proactive Disclosure (link)', 'RTI- Proactive disclosure (link)', 'http://www.suratmunicipal.gov.in/content/rtiact/Disc_DepartmentWise/SMIMER_RTI%20Disclosure.pdf', '_blank', null, false, null, true, null, true, null, 0, " proactive disclosure ");
			
			CreateMenu(0, 'Research', 'Research & Development', 'content/research/main.shtml', '_self', null, true, null, true, null, true, "research.gif", 0, " research develop development medical education unit ");
			CreateMenu(1, ':: Research & Development', 'Research & Development', 'content/research/research_development.shtml', '_self', null, false, null, true, null, true, null, 0, " research development ");
			CreateMenu(1, ':: Medical Education Unit', 'Medical Education Unit', 'content/research/medical-education-unit.shtml', '_self', null, false, null, true, null, true, null, 0, " medical education unit ");
			
			CreateMenu(0, 'Anti Ragging', 'Anti Ragging', 'content/administration/anti-ragging.shtml', '_self', null, true, null, false, null, true, null, 0, " antiragging anti ragging help ");
			CreateMenu(1, '24 X 7 Helpline', '24 X 7 Helpline', 'content/administration/anti-ragging-helpline.shtml', '_self', null, false, null, false, null, true, null, 0, " anti ragging help helpline");
			
			CreateMenu(0, 'Hospital', 'Hospital', 'http://www.suratmunicipal.gov.in/content/smimer/introduction.shtml', '_blank', null, false, null, true, null, true, "hospital.gif", 0, " hospital ");
			
			CreateMenu(0, 'Events Org', 'Events Org. &amp; Award / Prize', 'content/events/main.shtml', '_self', null, false, null, false, null, true, null, 0, " event org award prize achievement ");
			
			CreateMenu(0, 'Search', 'Search', 'content/others/search.shtml', '_self', null, false, null, false, null, true, "search.gif", 0, " search ");
			CreateMenu(0, 'Contact Us', 'Contact Us', 'content/others/contactus.shtml', '_self', null, false, null, false, null, true, "contact-us.gif", 0, " contact us ");
			CreateMenu(0, 'Disclaimer', 'Disclaimer', 'content/others/disclaimer.shtml', '_self', null, false, null, false, null, true, "disclaimer.gif", 0, " disclaimer ");
			
			CreateMenu(0, 'SMIMER Database DEC-10', 'SMIMER Database DEC-10', 'content/others/smimer_db.shtml', '_self', null, false, null, false, null, true, null, 0, " smimer database ");
			
			CreateMenu(0, 'Site map', 'Site map', 'content/others/sitemap.shtml', '_self', null, false, null, false, null, false, null, 0, " sitemap site map ");
			CreateMenu(0, 'Whole Site map', 'Whole Site map', 'content/others/sitemap-all.shtml', '_self', null, false, null, false, null, false, null, 0, " sitemap site map ");
			CreateMenu(0, 'Template Page', 'Template Page', 'content/template/template-inner.shtml', '_self', null, false, null, false, null, false, null, 0, " template ");
			
			return true;
		} catch(ex) {
			//alert(ex);
			return false;
		}
	}
	
	function GenerateSubMenuItem(div_id, i, index) {
		if(current_menu_index == index && document.getElementById(div_id)) {
			obj_a = document.createElement("a");
			obj_a.id = "Menu" + i;
			obj_a.tabindex = i;
			obj_a.innerHTML = arr_menu[i][MNU_LinkShortCaption];
			if(arr_menu[i][MNU_LinkShortCaption].length < arr_menu[i][MNU_LinkLongCaption].length) {
				obj_a.title = arr_menu[i][MNU_LinkLongCaption];
			}
			setAnchorLink(obj_a, i, 0);
			/*if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
			} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
				obj_a.target = arr_menu[i][MNU_LinkTarget];
			} else {
				obj_a.href = "javascript:OpenPage('" + arr_menu[i][MNU_LinkURL] + "', '" + arr_menu[i][MNU_LinkTarget] + "');";
			}*/
			obj_a.tag = i;
			if(arr_menu[i][MNU_HaveSubmenu]) {
				obj_a.className = "tree";
				obj_a.onmouseover = function() {
					window.clearTimeout(arr_interval_hide[arr_menu[this.tag][MNU_ParentMenuRef][MNU_LinkLevel]]);
					arr_interval_show[arr_menu[this.tag][MNU_LinkLevel]] = window.setTimeout("GenerateSubMenu(" + this.tag + ")", 110);
					
					window.clearTimeout(arr_interval_hide_all);
					arr_interval_hide_all = window.setTimeout("DestroyAllSubMenus()", hide_all_time);
				};
				obj_a.onfocus = obj_a.onmouseover;
				obj_a.onmouseout = function() {
					arr_interval_hide[arr_menu[this.tag][MNU_LinkLevel]] = window.setTimeout("DestroySubMenu(" + this.tag + ")", 100);
				};
			} else {
				obj_a.className = "item";
				obj_a.onmouseover = function() {
					//arr_interval_hide[arr_menu[this.tag][MNU_LinkLevel]]
					//arr_interval_hide[current_menu_level]
					window.clearTimeout(arr_interval_hide[arr_menu[this.tag][MNU_ParentMenuRef][MNU_LinkLevel]]);
					window.clearTimeout(arr_interval_hide_all);
					arr_interval_hide_all = window.setTimeout("DestroyAllSubMenus()", hide_all_time);
				};
			}
			document.getElementById(div_id).appendChild(obj_a);
			
			if(arr_menu[i][MNU_SeparatorAfterwards]) {
				obj_sep = document.createElement("div");
				obj_sep.className = "sep";
				document.getElementById(div_id).appendChild(obj_sep);
			}
		}
	}
	
	function GenerateSubMenu(index) {
		var obj_div;
		var max_length=0;
		
		current_menu_index = index;
		if(typeof(arr_menu[index]) != "undefined") {
			current_menu_level = arr_menu[index][MNU_LinkLevel];
			
			obj_div = document.getElementById(div_submenu_id_prefix + current_menu_level);
			if(obj_div) {
				obj_div.innerHTML = "";
				obj_div.className = "submenu";
				if(document.all) {
					if(arr_menu[index][MNU_LinkLevel] == 0) {
						obj_div.style.left = (getAbsoluteLeft("Menu" + index))  + "px";
						if(getAbsoluteTop("Menu" + index) + 26 < 250) {
							obj_div.style.top = getAbsoluteTop("Menu" + index) + 27 + "px";
						} else {
							obj_div.style.top = "244px";
						}
					} else {
						obj_div.style.left = (getAbsoluteLeft("Menu" + index) + getAbsoluteWidth("Menu" + index) + 4)  + "px";
						obj_div.style.top = (getAbsoluteTop("Menu" + index) - 3) + "px";
					}
				} else {
					if(arr_menu[index][MNU_LinkLevel] == 0) {
						obj_div.style.left = (getAbsoluteLeft("Menu" + index)) + "px";
						obj_div.style.top = getAbsoluteTop("Menu" + index) + 26 + "px";
					} else {
						obj_div.style.left = (getAbsoluteLeft("Menu" + index) + getAbsoluteWidth("Menu" + index) + 5)  + "px";
						obj_div.style.top = (getAbsoluteTop("Menu" + index) - 2) + "px";
					}
				}
				obj_div.tag = index;
				
				var k=0;
				for(var i=0; i<arr_menu.length; i++) {
					if(arr_menu[i][MNU_ParentMenuRef] == arr_menu[index] && arr_menu[i][MNU_MenuVisibility]) {
						//window.setTimeout("GenerateSubMenuItem('" + div_submenu_id_prefix + current_menu_level + "', " + i + ", " + index + ")", 50 * k);
						if(arr_interval_menu_item[i] != null) {
							if(arr_interval_menu_item[i] != "") {
								window.clearTimeout(arr_interval_menu_item[i]);
							}
						}
						if(max_length < arr_menu[i][MNU_LinkShortCaption].length)
							max_length = arr_menu[i][MNU_LinkShortCaption].length;
						arr_interval_menu_item[i] = window.setTimeout("GenerateSubMenuItem('" + div_submenu_id_prefix + current_menu_level + "', " + i + ", " + index + ")", 50 * k);
						k++;
					}
				}
				obj_div.style.display = "block";
				//obj_div.style.width = (max_length * 8) + "px";
				
				var j = current_menu_level + 1;
				while(document.getElementById(div_submenu_id_prefix + j)) {
					document.getElementById(div_submenu_id_prefix + j).style.display = "none";
					j++;
				}
			}
			window.clearTimeout(arr_interval_hide_all);
			arr_interval_hide_all = window.setTimeout("DestroyAllSubMenus()", hide_all_time);
		}
	}
	
	function DestroySubMenu(index) {
		if(typeof(arr_menu[index]) != "undefined") {
			if(document.getElementById(div_submenu_id_prefix + + arr_menu[index][MNU_LinkLevel])) {
				document.getElementById(div_submenu_id_prefix + arr_menu[index][MNU_LinkLevel]).innerHTML = "";
				document.getElementById(div_submenu_id_prefix + arr_menu[index][MNU_LinkLevel]).style.display = "none";
			}
		}
	}
	
	function DestroyAllSubMenus() {
		for(var i=0; i<10; i++) {
			if(!document.getElementById(div_submenu_id_prefix + i)) { return; }
			document.getElementById(div_submenu_id_prefix + i).innerHTML = "";
			document.getElementById(div_submenu_id_prefix + i).style.display = "none";
		}
	}
	
	function PrepareMenus() {
		var obj_table, obj_tr, obj_td;
		var obj_a, obj_img;
		var flg_extra = false;
		
		if(!InitMenus()) {
			//alert("noi");
			if(document.getElementById(div_main_menu_id)) {
				document.getElementById(div_main_menu_id).innerHTML = " Error in generating menus. Please report to System Administrator. ";
			}
			return;
		}
		
		if(navigator.appName == "Microsoft Internet Explorer") {
			//alert(navigator.appVersion.search("MSIE 8.0;") + "|" + navigator.appVersion.search("MSIE 7.0;"));
			if(navigator.appVersion.search("MSIE 8.0;") == -1 && (navigator.appVersion.search("MSIE 7.0;") > 0 || navigator.appVersion.search("MSIE 6.0;") > 0)) {
				flg_extra = true;
			}
		}
		
		if(document.getElementById(div_main_menu_id)) {
			for(var i=0; i<arr_menu.length; i++) {
				if(arr_menu[i][MNU_LinkLevel] == 0 && arr_menu[i][MNU_MenuVisibility]) {
					obj_a = document.createElement("a");
					obj_a.id = "Menu" + i;
					obj_a.tabindex = i;
					obj_a.innerHTML += arr_menu[i][MNU_LinkShortCaption];
					if(arr_menu[i][MNU_LinkShortCaption].length < arr_menu[i][MNU_LinkLongCaption].length) {
						obj_a.title = arr_menu[i][MNU_LinkLongCaption];
					}
					
					if(flg_extra) {
						obj_img = document.createElement("img");
						obj_img.src = root_url + "images/spacer.gif";
						obj_img.border = 0;
						obj_img.style.width = "1px";
						obj_img.style.height = "24px";
						obj_img.style.visibility = "hidden";
						obj_img.align = "texttop";
						obj_img.style.verticalAlign="middle";
						obj_a.appendChild(obj_img);
					}
					
					setAnchorLink(obj_a, i, 0);
					/*if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
						obj_a.href = arr_menu[i][MNU_LinkURL];
					} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
						obj_a.href = arr_menu[i][MNU_LinkURL];
						obj_a.target = arr_menu[i][MNU_LinkTarget];
					} else {
						obj_a.href = "javascript:OpenPage('" + arr_menu[i][MNU_LinkURL] + "', '" + arr_menu[i][MNU_LinkTarget] + "');";
					}*/
					obj_a.tag = i;
					if(arr_menu[i][MNU_HaveSubmenu]) {
						obj_a.className = "tree";
						obj_a.onmouseover = function() {
							//GenerateSubMenu(this.tag);
							HideMiniSitemapTree();
							HideSitemapSearch();
							HidePopup();
							arr_interval_show[arr_menu[this.tag][MNU_LinkLevel]] = window.setTimeout("GenerateSubMenu(" + this.tag + ")", 100);
						};
						obj_a.onfocus = obj_a.onmouseover;
						obj_a.onmouseout = function() {
							arr_interval_hide[arr_menu[this.tag][MNU_LinkLevel]] = window.setTimeout("DestroySubMenu(" + this.tag + ")", 100);
							//alert(arr_interval_hide[arr_menu[this.tag][MNU_LinkLevel]]);
						};
					} else {
						obj_a.className = "item";
					}
					document.getElementById(div_main_menu_id).appendChild(obj_a);
				}
			}
			
			if(document.all) {
				setAbsoluteHeight(div_main_menu_id, 24);
			} else {
				setAbsoluteHeight(div_main_menu_id, 24);
			}
		}
	}
	
	function setAnchorLink(obj_a, i, is_sitemap_link) {
		try {
			if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
				obj_a.href = "javascript:;";
				obj_a.c_href = arr_menu[i][MNU_LinkURL];
				obj_a.onmousedown =  function() {
					setTimeout(obj_a.c_href, 0);
				}
			} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
				if(is_sitemap_link == 1) {
					obj_a.target = "_blank";
				} else {
					obj_a.target = arr_menu[i][MNU_LinkTarget];
				}
			} else {
				/*obj_a.href = "javascript:;";
				obj_a.c_href = arr_menu[i][MNU_LinkURL];
				if(is_sitemap_link == 1) {
					obj_a.c_target = "_blank";
				} else {
					obj_a.c_target = arr_menu[i][MNU_LinkTarget];
				}
				obj_a.onmousedown =  function(e) {
					var event_obj = typeof(e) == "undefined" ? event : e;
					if(event_obj.button == 0 || event_obj.button == 1)
						OpenPage(this.c_href, this.c_target);
				}*/
				obj_a.href = root_url + arr_menu[i][MNU_LinkURL];
				if(is_sitemap_link == 1) {
					obj_a.target = "_blank";
				} else {
					obj_a.target = arr_menu[i][MNU_LinkTarget];
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	
	
	//////////////////////////////////////////////////////// Site map functions ////////////////////////////////////////////////////////
	function GenerateSitemapHomeNode(div_id) {
		var obj_div_a, obj_a;
		if(document.getElementById(div_id)) {
			obj_div_a = document.createElement("div");
			
			obj_img = document.createElement("img");
			obj_img.id = "ImgHomeSitemapIcon"
			obj_img.src = root_url + "images/layout/menu_icons/home-big.gif";
			obj_img.hspace = 2;
			if(document.all) {
				obj_img.align = "middle";
			} else {
				obj_img.align = "top";
			}
			obj_div_a.appendChild(obj_img);
			
			obj_div_a.style.paddingBottom = "8px";
			obj_a = document.createElement("a");
			obj_a.id = "NodeHome";
			obj_a.innerHTML = "SMIMER Home";
			obj_a.href = "javascript:OpenPage('default.aspx');";
			obj_a.tag = -1;
			obj_a.className = "tree";
			obj_div_a.appendChild(obj_a);
			document.getElementById(div_id).appendChild(obj_div_a);
		}
	}
	
	function GenerateSitemapNode(div_id, i, level, k) {
		if(document.getElementById(div_id)) {
			obj_div_a = document.createElement("div");
			obj_div_a.id = "DivSiteNode" + i;
			if(level == 0 && k >= -1) {
				obj_div_a.style.marginLeft = "15px";
			}
			
			if(k >= 0) {
				obj_img = document.createElement("img");
				obj_div_a.className = "item";
				obj_img.src = root_url + "images/layout/sitemap/sitemap-03.gif";
				if(arr_menu[i][MNU_ParentMenuRef] == null && k == sitemap_top_links_count - 1) {
					obj_img.src = root_url + "images/layout/sitemap/sitemap-01.gif";
					obj_div_a.className = "itemlast";
				} else if(arr_menu[i][MNU_ParentMenuRef] != null) {
					if(arr_menu[i][MNU_ParentMenuRef][MNU_ChildrenCountForSiteMap] == k+1) {
						obj_img.src = root_url + "images/layout/sitemap/sitemap-01.gif";
						obj_div_a.className = "itemlast";
					}
				}
				obj_img.align = "middle";
				obj_div_a.appendChild(obj_img);
			} else if(k == -1){
				obj_div_a.style.paddingBottom = "8px";
			}
			
			
			if(k >= -1) {
				if(arr_menu[i][MNU_IconImageURL] != null) {
					if(arr_menu[i][MNU_IconImageURL].length > 0) {
						obj_img = document.createElement("img");
						obj_img.id = "ImgSitemapItemIcon" + i
						//obj_img.src = root_url + "images/layout/menu_icons/blank.gif";
						obj_img.src = root_url + "images/layout/menu_icons/" + arr_menu[i][MNU_IconImageURL];
						obj_img.hspace = 2;
						if(document.all) {
							obj_img.align = "middle";
						} else {
							obj_img.align = "top";
						}
						obj_div_a.appendChild(obj_img);
					}
				}
			}
			
			obj_a = document.createElement("a");
			obj_a.id = "Node" + i;
			obj_a.innerHTML = " " + arr_menu[i][MNU_LinkLongCaption];
			setAnchorLink(obj_a, i, 1);
			/*if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
			} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
				obj_a.target = arr_menu[i][MNU_LinkTarget];
			} else {
				obj_a.href = "javascript:OpenPage('" + arr_menu[i][MNU_LinkURL] + "', '" + arr_menu[i][MNU_LinkTarget] + "');";
			}*/
			obj_a.tag = i;
			if(arr_menu[i][MNU_HaveSubmenu]) {
				obj_a.className = "tree";
			}
			
			obj_div_a.appendChild(obj_a);
			document.getElementById(div_id).appendChild(obj_div_a);
			return obj_div_a.id;
		}
		return "";
	}
	
	function GenerateSitemapTree(div_id, parent_div_id, parent, level) {
		var obj_div_tmp, obj_new_parent_id, k;
		try {
			if(document.getElementById(div_id) && level>=0 && parent_div_id == "") {
				// root
				document.getElementById(div_id).innerHTML = "";
				if(parent == null) {
					GenerateSitemapHomeNode(div_id);
				} else if(parent != null && level == 0) {
					//alert("definitely yes");
					obj_new_parent_id = GenerateSitemapNode(div_id, parent[MNU_UniqueIndex], level, -1);
				}
			} else if(document.getElementById(parent_div_id)){
				// child tree node
				obj_div_tmp = document.createElement("div");
				obj_div_tmp.id = div_id;
				obj_div_tmp.style.paddingLeft = "45px";
				document.getElementById(parent_div_id).appendChild(obj_div_tmp);
			}
			if(arr_menu.length > 0) {
				k = 0;
				for(var i=0; i<arr_menu.length; i++) {
					if(arr_menu[i][MNU_ParentMenuRef] == parent && arr_menu[i][MNU_SitemapVisibility]) {
						obj_new_parent_id = GenerateSitemapNode(div_id, i, level, k++);
						//if(arr_menu[i][MNU_HaveSubmenu]) {
						if(arr_menu[i][MNU_ChildrenCountForSiteMap] > 0) {
							GenerateSitemapTree('DivSitemapSubTree' + i, obj_new_parent_id, arr_menu[i], level+1);
						}
					}
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	
	function GenerateSitemapLink() {
		var obj_div_a, obj_span;
		var obj_a = new Array(), tot_links=0;
		var page_url_menu_index = -1;
		var current_level;
		var tmp_page_url = "";
		
		tmp_page_url = page_url;
		tmp_page_url = tmp_page_url.substr(tmp_page_url.search(root_url_part) + root_url_part.length);
		tmp_page_url = tmp_page_url.substr(tmp_page_url.search("/") + 1);
		if(tmp_page_url.search("#") > 0) {
			tmp_page_url = tmp_page_url.substr(0, tmp_page_url.search("#"));
		}
		tmp_page_url = tmp_page_url.replace("smimercollege/", "");
		if(page_url_file_name.length == 0)
			page_url_file_name = tmp_page_url;
		//alert(page_url_file_name + ":" + page_url);
		//alert(10);
		obj_div_a = document.getElementById(div_sitemap_id);
		if(obj_div_a) {
			if(page_url_file_name.length > 0) {
				for(var i=0; i<arr_menu.length; i++) {
					if(arr_menu[i][MNU_LinkURL] == page_url_file_name) {
						page_url_menu_index = i;
						break;
					}
				}
				
				//alert(page_url_menu_index);
				if(page_url_menu_index > 0) {
					var j=page_url_menu_index;
					if(document.getElementById(div_page_heading)) {
						if(document.getElementById(div_page_heading).innerHTML.length == 0)
							document.getElementById(div_page_heading).innerHTML = arr_menu[j][MNU_LinkLongCaption];
					}
					while(1) {
						//alert(arr_menu[j][MNU_LinkLongCaption]);
						obj_a[tot_links] = document.createElement("a");
						obj_a[tot_links].innerHTML = arr_menu[j][MNU_LinkLongCaption];
						if(arr_menu[j][MNU_LinkURL].substr(0,11) == "javascript:")
							obj_a[tot_links].href = arr_menu[j][MNU_LinkURL];
						else
							obj_a[tot_links].href = "javascript:OpenPage('" + arr_menu[j][MNU_LinkURL] + "');";
						tot_links++;
						current_level = arr_menu[j][MNU_LinkLevel];
						if(arr_menu[j][MNU_ParentMenuRef] == null || current_level == 0) {
							break;
						}
						j = arr_menu[j][MNU_ParentMenuRef][MNU_UniqueIndex];
					}
					//if(document.title.length == 0)
					document.title = arr_menu[j][MNU_LinkLongCaption] + " : Surat Municipal Institute of Medical Education & Research";
				}
			}
			
			obj_a[tot_links] = document.createElement("a");
			obj_a[tot_links].innerHTML = "Home";
			obj_a[tot_links].href = "javascript:OpenPage('default.aspx')";
			tot_links++;
			//obj_div_a.appendChild(obj_a[0]);
			
			for(var i=tot_links-1; i>=0; i--) {
				if(i > 0) {
					obj_a[i].className = "parent";
				}
				obj_div_a.appendChild(obj_a[i]);
			}
			
			if(document.getElementById(span_mini_sitemap_tree_link_id) && document.getElementById(div_mini_sitemap_tree_id)) {
				if(tot_links > 1) {
					document.getElementById(span_mini_sitemap_tree_link_id).tag = j
					document.getElementById(span_mini_sitemap_tree_link_id).innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;";
					document.getElementById(span_mini_sitemap_tree_link_id).title = " Click to show / hide Quick Access panel";
					//document.getElementById(span_mini_sitemap_tree_link_id).style.display = "inherit";
					document.getElementById(span_mini_sitemap_tree_link_id).onclick = function() {
						//alert(this.tag);
						//document.getElementById(div_mini_sitemap_tree_id)
						ShowHideMiniSitemapTree(this.tag);
					}
				} else {
					document.getElementById(span_mini_sitemap_tree_link_id).style.display = "none";
				}
			}
			
			if(document.getElementById(span_sitemap_search_id) && document.getElementById(div_sitemap_search_id)) {
				document.getElementById(span_sitemap_search_id).innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;";
				document.getElementById(span_sitemap_search_id).title = " Click to show / hide Search";
				//document.getElementById(span_sitemap_search_id).style.display = "inherit";
				document.getElementById(span_sitemap_search_id).onclick = function() {
					ShowHideSitemapSearch();
				}
			}
		}
	}
	
	function ShowHideMiniSitemapTree(index) {
		if(document.getElementById(div_mini_sitemap_tree_id).style.display == "block") {
			document.getElementById(div_mini_sitemap_tree_id).style.display = "none";
			window.clearTimeout(arr_interval_hide_quickpanel);
		} else {
			DestroyAllSubMenus();
			HideSitemapSearch();
			HidePopup();
			if(document.getElementById(div_mini_sitemap_tree_id).innerHTML.trim() == "") {
				GenerateSitemapTree(div_mini_sitemap_tree_id, "", arr_menu[index], 0);
			}
			document.getElementById(div_mini_sitemap_tree_id).style.display = "block";
			if(document.all) {
				setAbsoluteLeft(div_mini_sitemap_tree_id, getAbsoluteLeft(div_sitemap_id) + getAbsoluteWidth(div_sitemap_id) - getAbsoluteWidth(div_mini_sitemap_tree_id) + 1);
				setAbsoluteTop(div_mini_sitemap_tree_id, getAbsoluteTop(div_sitemap_id) + 22);
			} else {
				setAbsoluteLeft(div_mini_sitemap_tree_id, getAbsoluteLeft(div_sitemap_id) + getAbsoluteWidth(div_sitemap_id) - getAbsoluteWidth(div_mini_sitemap_tree_id) + 2);
				setAbsoluteTop(div_mini_sitemap_tree_id, getAbsoluteTop(div_sitemap_id) + 22);
			}
			if(getAbsoluteHeight(div_mini_sitemap_tree_id) > preferred_mini_sitemap_tree_height) {
				setAbsoluteHeight(div_mini_sitemap_tree_id, preferred_mini_sitemap_tree_height);
			}
			arr_interval_hide_quickpanel = window.setTimeout("ShowHideMiniSitemapTree(" + index + ")", 10000);
		}
	}
	
	function HideMiniSitemapTree() {
		if(document.getElementById(div_mini_sitemap_tree_id)) {
			document.getElementById(div_mini_sitemap_tree_id).style.display = "none";
			window.clearTimeout(arr_interval_hide_quickpanel);
		}
	}
	
	function ShowHideSitemapSearch() {
		if(document.getElementById(div_sitemap_search_id).style.display == "block") {
			document.getElementById(div_sitemap_search_id).style.display = "none";
			window.clearTimeout(arr_interval_hide_search);
		} else {
			DestroyAllSubMenus();
			HideMiniSitemapTree();
			document.getElementById(div_sitemap_search_id).style.display = "block";
			if(document.all) {
				setAbsoluteLeft(div_sitemap_search_id, getAbsoluteLeft(div_sitemap_id) + getAbsoluteWidth(div_sitemap_id) - getAbsoluteWidth(div_sitemap_search_id) + 1);
				setAbsoluteTop(div_sitemap_search_id, getAbsoluteTop(div_sitemap_id) + 22);
			} else {
				setAbsoluteLeft(div_sitemap_search_id, getAbsoluteLeft(div_sitemap_id) + getAbsoluteWidth(div_sitemap_id) - getAbsoluteWidth(div_sitemap_search_id) + 2);
				setAbsoluteTop(div_sitemap_search_id, getAbsoluteTop(div_sitemap_id) + 22);
			}
			if(document.getElementById(txt_sitemap_search_id))
				document.getElementById(txt_sitemap_search_id).focus();
		}
	}
	
	function HideSitemapSearch() {
		if(document.getElementById(div_sitemap_search_id)) {
			document.getElementById(div_sitemap_search_id).style.display = "none";
			window.clearTimeout(arr_interval_hide_search);
		}
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	/////////////////////////////////////////////////////// Advanced Site map //////////////////////////////////////////////////////////
	function GenerateAdvancedSitemapHomeNode(div_id) {
		var obj_div_a, obj_a;
		if(document.getElementById(div_id)) {
			obj_div_a = document.createElement("div");
			
			obj_img = document.createElement("img");
			obj_img.id = "ImgHomeSitemapIcon"
			obj_img.src = root_url + "images/layout/menu_icons/home-big.gif";
			obj_img.hspace = 2;
			if(document.all) {
				obj_img.align = "middle";
			} else {
				obj_img.align = "top";
			}
			obj_div_a.appendChild(obj_img);
			
			obj_div_a.style.paddingBottom = "3px";
			obj_a = document.createElement("a");
			obj_a.id = "NodeHome";
			obj_a.innerHTML = "SMIMER Home";
			obj_a.href = "javascript:OpenPage('default.aspx');";
			obj_a.tag = -1;
			obj_a.className = "tree";
			
			obj_div_a.appendChild(obj_a);
			document.getElementById(div_id).appendChild(obj_div_a);
		}
	}
	
	function GenerateAdvancedSitemapNode(div_id, i, level, k) {
		if(document.getElementById(div_id)) {
			obj_div_a = document.createElement("div");
			obj_div_a.id = "DivSiteNode" + i;
			if(level == 0 && k >= -1) {
				obj_div_a.style.marginLeft = "15px";
			}
			
			if(k >= 0) {
				obj_div_a.className = "itemadv";
				obj_img = document.createElement("img");
				obj_img.id = "ImgSitemapNode" + i
				obj_img.className = "sitemap";
				obj_img.src = root_url + "images/layout/sitemap/blank.gif";
				obj_img.tag = i;
				//if(arr_menu[i][MNU_HaveSubmenu]) {
				if(arr_menu[i][MNU_ChildrenCountForSiteMap] > 0) {
					obj_img.src = root_url + "images/layout/sitemap/expand_f.gif";
					obj_img.onmouseup = function() {
						if(document.getElementById("DivSitemapSubTree" + this.tag)) {
							if(document.getElementById("DivSitemapSubTree" + this.tag).style.display == "block") {
								document.getElementById("DivSitemapSubTree" + this.tag).style.display = "none";
								if(document.getElementById("ImgSitemapNode" + i)) {
									document.getElementById("ImgSitemapNode" + i).src = root_url + "images/layout/sitemap/expand_f.gif";
								}
								if(arr_menu[i][MNU_IconImageURL] == null) {
									if(document.getElementById("ImgSitemapItemIcon" + i)) {
										document.getElementById("ImgSitemapItemIcon" + i).src = root_url + "images/layout/menu_icons/web-folder.gif";
									}
								} else {
									if(document.getElementById("ImgSitemapItemIcon" + i)) {
										document.getElementById("ImgSitemapItemIcon" + i).src = root_url + "images/layout/menu_icons/" + arr_menu[i][MNU_IconImageURL];
									}
								}
							} else {
								document.getElementById("DivSitemapSubTree" + this.tag).style.display = "block";
								if(document.getElementById("ImgSitemapNode" + i)) {
									document.getElementById("ImgSitemapNode" + i).src = root_url + "images/layout/sitemap/expand_uf.gif";
								}
								if(arr_menu[i][MNU_IconImageURL] == null) {
									if(document.getElementById("ImgSitemapItemIcon" + i)) {
										//document.getElementById("ImgSitemapItemIcon" + i).src = root_url + "images/layout/sitemap/file_uf.gif";
										document.getElementById("ImgSitemapItemIcon" + i).src = root_url + "images/layout/menu_icons/web-folder-open.gif";
									}
								} else {
									if(document.getElementById("ImgSitemapItemIcon" + i)) {
										document.getElementById("ImgSitemapItemIcon" + i).src = root_url + "images/layout/menu_icons/" + arr_menu[i][MNU_IconImageURL].replace(".gif", "-open.gif");
									}
								}
							}
						}
					}
				}
				if(arr_menu[i][MNU_ParentMenuRef] == null && k == sitemap_top_links_count - 1) {
					obj_div_a.className = "itemlastadv";
				} else if(arr_menu[i][MNU_ParentMenuRef] != null) {
					if(arr_menu[i][MNU_ParentMenuRef][MNU_ChildrenCountForSiteMap] == k+1) {
						obj_div_a.className = "itemlastadv";
					}
				}
				obj_img.align = "middle";
				obj_div_a.appendChild(obj_img);
			}
			
			obj_img = document.createElement("img");
			obj_img.id = "ImgSitemapItemIcon" + i
			//if(arr_menu[i][MNU_HaveSubmenu]) {
			if(arr_menu[i][MNU_ChildrenCountForSiteMap] > 0) {
				//obj_img.src = root_url + "images/layout/sitemap/file_f.gif";
				obj_img.src = root_url + "images/layout/menu_icons/web-folder.gif";
			} else {
				//obj_img.src = root_url + "images/layout/sitemap/file_c.gif";
				obj_img.src = root_url + "images/layout/menu_icons/web-page.gif";
			}
			if(arr_menu[i][MNU_IconImageURL] != null) {
				if(arr_menu[i][MNU_IconImageURL].length > 0) {
					obj_img.src = root_url + "images/layout/menu_icons/" + arr_menu[i][MNU_IconImageURL];
				}
			}
			obj_img.hspace = 2;
			if(document.all) {
				obj_img.align = "middle";
			} else {
				obj_img.align = "top";
			}
			obj_div_a.appendChild(obj_img);
			
			obj_a = document.createElement("a");
			obj_a.id = "Node" + i;
			obj_a.innerHTML = arr_menu[i][MNU_LinkLongCaption];
			setAnchorLink(obj_a, i, 1);
			/*if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
			} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
				obj_a.href = arr_menu[i][MNU_LinkURL];
				obj_a.target = arr_menu[i][MNU_LinkTarget];
			} else {
				obj_a.href = "javascript:OpenPage('" + arr_menu[i][MNU_LinkURL] + "', '" + arr_menu[i][MNU_LinkTarget] + "');";
			}*/
			obj_a.tag = i;
			/*if(!document.all) {
				//obj_a.style.background = "#454545";
				//obj_a.style.marginTop = "15px";
				//obj_a.style.float = "right";
			}*/
			obj_div_a.appendChild(obj_a);
			
			
			document.getElementById(div_id).appendChild(obj_div_a);
			return obj_div_a.id;
		}
		return "";
	}
	
	function GenerateAdvancedSitemapTree(div_id, parent_div_id, parent, level) {
		var obj_div_tmp, obj_new_parent_id, k;
		try {
			if(document.getElementById(div_id) && level>=0 && parent_div_id == "") {
				// root
				document.getElementById(div_id).innerHTML = "";
				if(parent == null) {
					GenerateAdvancedSitemapHomeNode(div_id);
				} else if(parent != null && level == 0) {
					//alert("definitely yes");
					obj_new_parent_id = GenerateAdvancedSitemapNode(div_id, parent[MNU_UniqueIndex], level, -1);
				}
			} else if(document.getElementById(parent_div_id)){
				// child tree node
				obj_div_tmp = document.createElement("div");
				obj_div_tmp.id = div_id;
				obj_div_tmp.style.paddingLeft = "20px";
				obj_div_tmp.style.display = "none";
				document.getElementById(parent_div_id).appendChild(obj_div_tmp);
			}
			if(arr_menu.length > 0) {
				k = 0;
				for(var i=0; i<arr_menu.length; i++) {
					if(arr_menu[i][MNU_ParentMenuRef] == parent && arr_menu[i][MNU_SitemapVisibility]) {
						obj_new_parent_id = GenerateAdvancedSitemapNode(div_id, i, level, k++);
						//if(arr_menu[i][MNU_HaveSubmenu]) {
						if(arr_menu[i][MNU_ChildrenCountForSiteMap] > 0) {
							GenerateAdvancedSitemapTree('DivSitemapSubTree' + i, obj_new_parent_id, arr_menu[i], level+1);
						}
					}
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	//////////////////////////////////////////////////////// Other functions ///////////////////////////////////////////////////////////
	function OpenPage(page_name, target) {
		if(typeof(target) == "undefined")
			target = "_self";
		window.open(root_url + page_name, target);
	}
	
	function SearchPages(e) {
		var search_str = "";
		var obj_txt_search = document.getElementById(txt_sitemap_search_id);
		var obj_div_result = document.getElementById(div_sitemap_search_results_id);
		var keyCode = (window.event) ? e.keyCode : e.which;
		
		try {
			if(keyCode == 27) {
				HideSitemapSearch();
				return;
			}
			if(obj_txt_search && obj_div_result) {
				search_str = obj_txt_search.value;
				if(search_str.length > 1) {
					obj_div_result.innerHTML = "Searching ...";
					obj_div_result.style.display = "block";
					
					window.clearInterval(arr_interval_searching);
					arr_interval_searching = window.setTimeout("GetSearchResult()", 100);
				} else {
					obj_div_result.innerHTML = "";
					obj_div_result.style.display = "none";
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	
	function GetSearchResult() {
		var obj_txt_search = document.getElementById(txt_sitemap_search_id);
		var obj_div_result = document.getElementById(div_sitemap_search_results_id);
		var k=0;
		
		try {
			search_str = obj_txt_search.value;
			if(search_str.length > 1) {
				//for(var i=0; i<3; i++) {
				for(var i=0; i<arr_menu.length; i++) {
					if(arr_menu[i][MNU_SearchTags] != null && arr_menu[i][MNU_LinkURL]!="javascript:;") {
						if(arr_menu[i][MNU_SearchTags].search(" " + search_str.toLowerCase() + " ") >= 0) {
							if(k == 0) {
								obj_div_result.innerHTML = "";
							}
							GenerateSitemapNode(div_sitemap_search_results_id, i, 0, -2)
							k++;
						}
					}
				}
				if(getAbsoluteHeight(div_sitemap_search_results_id) > preferred_search_panel_height) {
					setAbsoluteHeight(div_sitemap_search_results_id, preferred_search_panel_height);
				}
				if(k == 0) {
					obj_div_result.innerHTML = "";
					obj_div_result.style.display = "none";
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


	//////////////////////////////////////////////////////////// Popup Function ////////////////////////////////////////////////////////
	function InitPopupSettings() {
		//onmousedown="return ShowPopup(event)" oncontextmenu="return false;" onclick="return HidePopup(event)"
		var obj_div_poup_menu_id
		try {
			if(document.getElementById(td_container_id)) {
				obj_div_poup_menu_id = document.createElement("div");
				obj_div_poup_menu_id.id = div_poup_menu_id;
				obj_div_poup_menu_id.className = "submenu";
				obj_div_poup_menu_id.style.display = "none";
				document.getElementById(td_container_id).appendChild(obj_div_poup_menu_id);
				
				if(getAbsoluteHeight(td_container_id) < 285) {
					setAbsoluteHeight(td_container_id, 285);
					document.getElementById(td_container_id).vAlign = "top";
				}
				
				document.getElementById(td_container_id).onmousedown = function(e) {
					if(typeof(e) != "undefined")
						return ShowHidePopup(e, true);
					else
						return ShowHidePopup(event, true);
				}
				document.getElementById(td_container_id).oncontextmenu = function() {
					return false;
				}
				
				document.documentElement.onclick = function(e) {
					if(typeof(e) != "undefined")
						ShowHidePopup(e, false);
					else
						ShowHidePopup(event, false);
					return true;
				}
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	
	var popup_left, popup_top;
	function ShowHidePopup(e, flg) {
		try {
			if(getMouseXY(e)) {
				if(e.button == 2 && document.getElementById(div_poup_menu_id) && flg) {
					// Show Popup
					GeneratePopup(null, 0);
					
					popup_left = tempX;
					popup_top = tempY;
					//alert(popup_left  + ":" + getAbsoluteLeft(td_container_id) + ":" + getAbsoluteWidth(div_poup_menu_id));
					if(popup_left > getAbsoluteLeft(td_container_id) + getAbsoluteWidth(td_container_id) - getAbsoluteWidth(div_poup_menu_id)) {
						popup_left -= getAbsoluteWidth(div_poup_menu_id);
						if(popup_left < 0) {
							popup_left = 0;
						}
					}
					if(popup_top > getAbsoluteTop(td_container_id) + getAbsoluteHeight(td_container_id) - getAbsoluteHeight(div_poup_menu_id)) {
						popup_top -= getAbsoluteHeight(div_poup_menu_id);
						if(popup_top < 0) {
							popup_top = 0;
						}
					}
					
					setAbsoluteLeft(div_poup_menu_id, popup_left);
					setAbsoluteTop(div_poup_menu_id, popup_top);
					
					document.getElementById(div_poup_menu_id).style.display = "block";
					
					/*document.getElementById(div_poup_menu_id).style.overflow = "auto";
					document.getElementById(div_poup_menu_id).style.height = "260px";*/
				} else {
					// Try to hide Popup
					if(tempX < getAbsoluteLeft(div_poup_menu_id) || tempX > getAbsoluteLeft(div_poup_menu_id) + getAbsoluteWidth(div_poup_menu_id) || tempY < getAbsoluteTop(div_poup_menu_id) || tempY > getAbsoluteTop(div_poup_menu_id) + getAbsoluteHeight(div_poup_menu_id))
						HidePopup();
				}
			} else {
				HidePopup();
			}
			return false;
		} catch(ex) {
			//alert(ex);
			return true;
		}
	}
	
	function HidePopup() {
		try {
			if(document.getElementById(div_poup_menu_id)) {
				document.getElementById(div_poup_menu_id).style.display = "none";
				DestroyAllSubMenus();
			}
		} catch(ex) {
			//alert(ex);
		}
	}
	
	var tempX, tempY;
	function getMouseXY(e) {
		if (document.all) {
			// grab the x-y pos.s if browser is IE
			//tempX = event.clientX + document.body.scrollLeft;
			//tempY = event.clientY + document.body.scrollTop;
			tempX = event.clientX + document.documentElement.scrollLeft;
			tempY = event.clientY + document.documentElement.scrollTop;
		} else {
			// grab the x-y pos.s if browser is NS
			tempX = e.pageX;
			tempY = e.pageY;
		}  
		if (tempX < 0){tempX = 0;}
		if (tempY < 0){tempY = 0;}  
		return true;
	}
	
	function GeneratePopup(parent_id, level, physical_obj_id) {
		var obj_table, obj_tr, obj_td;
		var obj_a, obj_img;
		var flg_extra = false;
		
		var current_div_popup_menu_id = div_poup_menu_id;
		if(level > 0) {
			current_div_popup_menu_id = div_submenu_id_prefix + parseInt(level-1);
			//alert(current_div_popup_menu_id);
			document.getElementById(current_div_popup_menu_id).style.display = "block";
			document.getElementById(current_div_popup_menu_id).className = "submenu";
			
			for(var k=level; k<6; k++) {
				if(document.getElementById(div_submenu_id_prefix + k)) {
					document.getElementById(div_submenu_id_prefix + k).style.display = "none";
				}
			}
		} else {
			HideMiniSitemapTree();
			HideSitemapSearch();
			DestroyAllSubMenus();
		}
		
		if(document.getElementById(current_div_popup_menu_id)) {
			ChangeInnerHTML(current_div_popup_menu_id, "");
			
			for(var i=0; i<arr_menu.length; i++) {
				if(arr_menu[i][MNU_LinkLevel] == level && arr_menu[i][MNU_ParentMenuRef] == arr_menu[parent_id] && arr_menu[i][MNU_MenuVisibility]) {
					obj_a = document.createElement("a");
					obj_a.id = "PopUpMenu" + i;
					obj_a.tabindex = i;
					
					// MNU_IconImageURL
					//if(level == 0) {
					obj_img = document.createElement("img");
					if(arr_menu[i][MNU_IconImageURL] != null) {
						obj_img.src = root_url + "images/layout/menu_icons/" + arr_menu[i][MNU_IconImageURL];
					} else {
						if(arr_menu[i][MNU_HaveSubmenu]) {
							obj_img.src = root_url + "images/layout/menu_icons/web-folder.gif";
						} else {
							obj_img.src = root_url + "images/layout/menu_icons/web-page.gif";
						}
					}
					obj_img.border = 0;
					//obj_img.style.width = "1px";
					//obj_img.style.height = "24px";
					//obj_img.style.visibility = "hidden";
					obj_img.align = "middle";
					obj_img.style.verticalAlign="middle";
					obj_img.style.paddingRight = "5px";
					obj_a.appendChild(obj_img);
				
					obj_a.innerHTML += arr_menu[i][MNU_LinkLongCaption];
					/*if(arr_menu[i][MNU_LinkShortCaption].length < arr_menu[i][MNU_LinkLongCaption].length) {
						obj_a.title = arr_menu[i][MNU_LinkLongCaption];
					}*/
					
					setAnchorLink(obj_a, i, 1);
					/*if(arr_menu[i][MNU_LinkURL].substr(0,11) == "javascript:") {
						obj_a.href = "javascript:;";
						obj_a.c_href = arr_menu[i][MNU_LinkURL];
						obj_a.onmousedown =  function() {
							setTimeout(obj_a.c_href, 0);
						}
					} else if(arr_menu[i][MNU_LinkURL].substr(0,7) == "http://") {
						obj_a.href = arr_menu[i][MNU_LinkURL];
						obj_a.target = arr_menu[i][MNU_LinkTarget];
					} else {
						//obj_a.href = "javascript:OpenPage('" + arr_menu[i][MNU_LinkURL] + "', '" + arr_menu[i][MNU_LinkTarget] + "');";
						obj_a.href = "javascript:;";
						obj_a.c_href = arr_menu[i][MNU_LinkURL];
						obj_a.c_target = arr_menu[i][MNU_LinkTarget];
						obj_a.onmousedown =  function(e) {
							var event_obj = typeof(e) == "undefined" ? event : e;
							if(event_obj.button == 0 || event_obj.button == 1)
								OpenPage(this.c_href, this.c_target);
						}
					}*/
					obj_a.tag = i;
					obj_a.level = level;
					if(arr_menu[i][MNU_HaveSubmenu]) {
						obj_a.className = "tree";
						obj_a.onmouseover = function() {
							//GenerateSubMenu(this.tag);
							arr_interval_show[arr_menu[this.tag][MNU_LinkLevel]] = window.setTimeout("GeneratePopup('" + this.tag + "', " + (this.level + 1) + ", '" + this.id + "')", 100);
						};
						obj_a.onfocus = obj_a.onmouseover;
					} else {
						obj_a.onmouseover = function() {
							for(var k=this.level; k<6; k++) {
								if(document.getElementById(div_submenu_id_prefix + k)) {
									document.getElementById(div_submenu_id_prefix + k).style.display = "none";
								}
							}
						}
					}
					document.getElementById(current_div_popup_menu_id).appendChild(obj_a);
					
					if(arr_menu[i][MNU_SeparatorAfterwards]) {
						obj_sep = document.createElement("div");
						obj_sep.className = "sep";
						document.getElementById(current_div_popup_menu_id).appendChild(obj_sep);
					}
				}
			}
			
			document.getElementById(current_div_popup_menu_id).style.width = "auto";
			document.getElementById(current_div_popup_menu_id).style.zIndex = parseInt(level) + 1000;
			
			if(level > 0 && document.getElementById(physical_obj_id)) {
				if(getAbsoluteLeft(physical_obj_id) < getAbsoluteLeft(td_container_id) + (getAbsoluteWidth(td_container_id) * 1/2)) {
					setAbsoluteLeft(current_div_popup_menu_id, getAbsoluteLeft(physical_obj_id) + getAbsoluteWidth(physical_obj_id) + 5);
				} else {
					setAbsoluteLeft(current_div_popup_menu_id, getAbsoluteLeft(physical_obj_id) - getAbsoluteWidth(current_div_popup_menu_id));
				}
				if(document.all) {
					setAbsoluteTop(current_div_popup_menu_id, getAbsoluteTop(physical_obj_id) - 3);
				} else {
					setAbsoluteTop(current_div_popup_menu_id, getAbsoluteTop(physical_obj_id) - 2);
				}
			}
		}
	}
	
	function TestCallIt() {
		alert("Well you called it !!!");
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

