///////////////////////////////////////////////////////////////////////
//                                                                   //
//     JavaScripts Global Function used on every Page			     //
//                                                                   //
///////////////////////////////////////////////////////////////////////


function StatusMsg(msgStr) {
// To show the msgStr in the Status Bar

		status = msgStr;
		document.returnValue = true;
}

function Conf_Del(sText) {
// To check whether the user realy wants to delete the corresponding item
	
		if (confirm("Are you sure you want to " +  sText + "?")) {
			return true;
		}	
		else {
			return false;
		}
}

function SetFocus(frmName,fldName) {		
// To set the Cursor on the specified field Name

		document.forms(frmName).item(fldName).focus();
}


function PopUp(sURl, sName, sFeatures) {
// To open a new window

		var newBrowser;

		newBrowser = window.open(sURl, sName, sFeatures);
		newBrowser.focus();		
}

function ToggleScope(sScope) {
// To Show or Hide Tables 

		var imgPlus = new Image();
		var imgMinus = new Image();

		imgPlus.src = "../Images/Plus.gif";
		imgMinus.src = "../Images/Minus.gif";

		var oTable = document.all["tbl" + sScope];
		var oImg = document.all["Img" + sScope];
		
		if (oTable && oTable.className == "Show") {
			oImg.src = imgPlus.src;
			oTable.className = "Hide"
			
		}
		else {
			oImg.src = imgMinus.src;
			oTable.className = "Show"	
		}
}

function ShowCalendar(Server_ID,winName,frmName,setField,wsDate) {
// To show the Caledar Window

		var URl = "http://" + window.self.location.host + "/Local/Shared/Calendar.asp?Server_ID=" + 
				  Server_ID + "&wsDate=" + wsDate + "&frmName=" + frmName + "&setField=" + setField;
		//alert(URl)
		// Call the function PopUp to open new window 
		PopUp(URl,winName,"height=195,width=300,screenX=300,left=300,screenY=250,top=200,ScrollBars=No");
		
}

function ShowColony(Server_ID,winName,frmName,setField,LocationID,Colony,AMultiple) {
// To show the Colony Window
		var URl = "http://" + window.self.location.host + "/Local/Shared/ColonyList.asp?Server_ID=" + 
				  Server_ID + "&LocationID=" + LocationID + "&Colony=" + Colony  + "&frmName=" + 
				  frmName + "&setField=" + setField + "&winName=" + winName + "&AMultiple=" + AMultiple;

		// Call the function PopUp to open new window 
		PopUp(URl,winName,"height=550,width=750,screenX=3,left=3,screenY=3,top=3,ScrollBars=yes");
			
}

function QuickURl(sURl,ServerID) {
		var sLink;
		// Wll get the Base URL
		var URl = "http://" + window.self.location.host + "/Local/"
		switch (ServerID) {
			case "001":
				sLink = URl + "Intranet/"
				break;
			case "002":
				sLink = URl + "RExchange/"
				break;
			case "003":
				sLink = URl + "BExchange/"
				break;
			case "004":
				sLink = URl + "Internet/"
				break; 
			case "005":
				sLink = URl + "Corporates/"
				break;
			case "006":
				sLink = URl + "Embassy/"
				break;  
		}
	//	alert(sURl)
	// To Jump to a section of the website predefined in the Drop menu navigation
		if (sURl.selectedIndex == 1) {
			window.top.location.href = sLink + sURl.options[sURl.selectedIndex].value;			
		}
		else {
			window.location.href = sLink + sURl.options[sURl.selectedIndex].value;			
		}
}

function NavToggle(sScope) {
// To Show or Hide Tables 

		
		var oTableMain = document.all[sScope + "M"];
		var oTableSub = document.all[sScope + "S"];
		
		if (oTableMain && oTableMain.className == "NavShow") {
			oTableMain.className = "NavHide"
			oTableSub.className = "NavShow"
			
		}
		else {
			oTableMain.className = "NavShow"
			oTableSub.className = "NavHide"	
		}
}

function NavHideShowToggle() {
// To Show Or Hide Navigation bar

		var jMainNavTbl = document.all["oTableNavigation"];
		
		var jHideButton = document.all["HideNavColtbl"];
		var jShowButton = document.all["ShowNavColtbl"];
		
		if ( jMainNavTbl  && jMainNavTbl.className == "Show" ) {
			jMainNavTbl.className = "Hide";
			oColumnBlue.style.display = 'none';
			oColumnGrey.style.display = 'none';
			oColumnBackGround.style.display = 'none';
			
			jHideButton.className = "bNavHide";
			jShowButton.className = "bNavShow";
		}
		else {
			jMainNavTbl.className = "Show";
			oColumnBlue.style.display = 'inline';
			oColumnGrey.style.display = 'inline';
			oColumnBackGround.style.display = 'inline';
			
			jHideButton.className = "bNavShow";
			jShowButton.className = "bNavHide";
		}
}

function QuickPageURl(sURl,ServerID) {
		var sLink;
		// Wll get the Base URL
		var URl = "http://" + window.self.location.host + "/Local/"
		switch (ServerID) {
			case "001":
				sLink = URl + "Intranet/"
				break;
			case "002":
				sLink = URl + "RExchange/"
				break;
			case "003":
				sLink = URl + "BExchange/"
				break;
			case "004":
				sLink = URl + "Internet/"
				break; 
			case "005":
				sLink = URl + "Corporates/"
				break;
			case "006":
				sLink = URl + "Embassy/"
				break;  
		}
		
	// To Jump to a section of the website predefined in the Drop menu navigation
		if (sURl.selectedIndex == 1) {
			window.top.location.href = sLink + sURl.options[sURl.selectedIndex].value;
		}
		else {
			window.location.href = sLink + sURl.options[sURl.selectedIndex].value;			
		}
}		

function right(e) {
	if (navigator.appName == 'Netscape' && 
	(e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && 
	(event.button == 2 || event.button == 3)) {
		alert("Sorry, you do not have permission to right click.");
	return false;
	}
	return true;
	}
	
function makeRemote(sURl,sFeatures) 
{
//alert(sURl);
//alert(sFeatures);
	remote = window.open("","remotewin",sFeatures);
	remote.location.href = sURl;
	if (remote.opener == null)
		remote.opener = window;
		remote.opener.name = "opener";
 } 