//***************************************
// File:     misc.js
// Author:   Pankaj Patel
// Email:    pankaj.patel@vis.co.uk
// Date:     14/10/2003
// Version:  1.0
// Copyright Copyright © 2000-2003, VIS Communications Ltd. All Rights Reserved.
// Comments:
//****************************************


	function PopUpWin(dFileName,WinName)
	
	{
			
			props=window.open(dFileName,WinName,"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=470,height=410, left = 409.5, top = 381.5");
			<!--props=window.open(dFileName,WinName,"toolbar=" +bToolbar + ",location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=470,height=110, left = 409.5, top = 381.5");-->
	}
	
	
	
	function ChkBoxAll(iindex, chkarray, Allbox) {
					
		var box = "";
		var stbox = eval("document.forms[" + iindex + "]." + Allbox);
						
		for (var i=0; i<chkarray.length; i++) {
			box = eval("document.forms[" + iindex + "]." + chkarray[i]);
			if (stbox.checked == true) {
				box.checked = true;
			} else { 
				box.checked = false; 
			}
		}
	}
	
	function ChkBoxAll2(iindex, chkarray, Allbox) {
						
		var box = "";
		var stbox = eval("document.forms[" + iindex + "]." + Allbox);
		box = eval("document.forms[" + iindex + "]." + chkarray);
		chkarray = box;
	
		for (var i=0; i<chkarray.length; i++) {
			
			if (stbox.checked == true) {
				box[i].checked = true;
			} else { 
				box[i].checked = false; 
			}
		}
		
	}
	
	function check(form) {
		searchqry = form.searchqry.value;
		
		if (searchqry == "" || searchqry == " ")  {
			alert ("\nSearch Failed.")
			return false;
		} else {
			return true;
		}
	}
	
	function confirm_delete(url) {
	
		if (confirm("Are you sure you want to delete this item ?")) {
		window.location = url;
		}
	}
	
	function menuOver(what){
		what.bgColor='#B2C2F1';
	}

	function menuOut(what){
		what.bgColor='#A2B2E1';
	}
	
	function submenuOver(what){
		what.bgColor='#C2D2FF';
	}
	
	function submenuOut(what){
		what.bgColor='#B2C2F1';
	}
	
	function toggle(n) {

		if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1 && navigator.appVersion.charAt(0)) { // MSIE 4 detected

			if (document.all) {

				if (document.all('id' + n).style.display == '') {
				document.all('id' + n).style.display = 'none';
				}
				else {
				document.all('id' + n).style.display = '';
				}
			}
		}
		else { // assume MSIE 4+ found

			if (document.getElementById) {					// getElementById is found in IE5+ and NS6+

				if (document.getElementById('id' + n).style.display == '') {
				document.getElementById('id' + n).style.display = 'none';
				}
				else {
				document.getElementById('id' + n).style.display = '';
				}
			}
		}

	} // -- ef


	function closeMenus(total_ids) {						// total_ids in navigation menu
		i = 1;								// number of the first id
		while (i <= total_ids) {						// number of ids in navigation

			if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1 && navigator.appVersion.charAt(0)) { // MSIE 4 detected
			document.all('id' + i).style.display = "none";			// close each menu loop
			}
			else {
			document.getElementById('id' + i).style.display = "none";		// close each menu loop
			}
		i++;								// increment counter
		}
	}


	function openMenu(menu_id) {						// menu_id is filled in by PHP from the $menu querystring variable
		if (menu_id) {

			if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1 && navigator.appVersion.charAt(0)) { // MSIE 4 detected
			document.all('id' + menu_id).style.display = "";			// close each menu loop
			}
			else {
			document.getElementById('id' + menu_id).style.display = '';	// open menu_id
			}
		}
	}
	function toggle_symbol() {

		// check if old skool dom
		if (document.all) {

			if (document.all.symbol.innerHTML == '+') {
			document.all.symbol.innerHTML = '–';
			}
			else {
			document.all.symbol.innerHTML = '+';
			}

		}
		// must be a new style dom
		else {

			if (document.getElementById('symbol').innerHTML == '+') {
			document.getElementById('symbol').innerHTML = '–';
			}
			else {
			document.getElementById('symbol').innerHTML = '+';
			}
		}

	} // -- ts