function subcat(){
	document.forms['ItemMaint'].subcatAction.value = "subcat";
	document.getElementById('ItemMaint').submit();
}

function confirmCriteriaSubmit()
{
	if(confirm("Are you sure you want to Delete the item?"))
	{	
	 	document.forms['ItemMaint'].action.value = "Delete";
		document.getElementById('ItemMaint').submit();
        return true;
        		
	}
	
}


function confirmCriteriaSubmitHelp()
{
	if(confirm("Are you sure you want to Delete the item?"))
	{	
	 	document.forms['HelpMaint'].action.value = "Delete";
		document.getElementById('HelpMaint').submit();
		self.close();
		self.opener.location.reload(true);
        return true;
        		
	}
	
}

function CatEdit() {		
			document.forms['ItemMaint'].action.value="save";
			document.getElementById('ItemMaint').submit()
			editUrl = "/categorymaintenance.do"
			openWin(editUrl,690,450);	
			
		}


function IntroEdit(url){
			document.forms['ItemMaint'].action.value = "editor";
			document.getElementById('ItemMaint').submit()
			openWin(url,690,450);
			}

function notesEdit(url){
			document.forms['dirMaint'].action.value = "editor";
			document.getElementById('dirMaint').submit()				
			openWin(url,690,450);					
}

function submit1(url, usr){

		if(usr=="true"){
			document.forms['NavMaint'].nav.value="changeParentUser";
		}else{
			document.forms['NavMaint'].nav.value="changeParent";		
		}	
		
		document.getElementById('NavMaint').submit();	
}

function submitNavChange(url,usr){
		
		if(usr=="true"){
			document.forms['NavMaint'].nav.value="changeParentUser";
		}else{
			document.forms['NavMaint'].nav.value="changeParent";
		}
			document.forms['NavMaint'].level.value="three";
			document.getElementById('NavMaint').submit();	
		
			
}

function MessageEditHelpForm(url,indx){

			document.forms['HelpMaint'].action.value = "saveContent";
			document.forms['HelpMaint'].indexId.value=indx;
			document.getElementById('HelpMaint').submit();
			window.open(url, "newwin4", "height=450,width=550,toolbar=no,scrollbars="+scroll+",menubar=no");

			
			//self.opener.document.forms[0].submit();
		   // openWin(url,690,450);			
		} 
function funClose() {
	self.close();
}	
function edithelpSubmit(indx){

	document.getElementById('HelpMaint').submit();

}
function helpSubmit(indx){

	document.getElementById('HelpMaint').submit();
	self.opener.location.reload(true);
//	self.opener.location=self.opener.location.href;
 
	self.close();
	
}

function MessageEditHelp(url){

			document.forms['HelpMaint'].action.value = "edit";
			document.getElementById('HelpMaint').submit();
		    openWin(url,690,450);
			
		}     
		
function AddCatEdit() {		
			document.forms['AddItemMaint'].update.value="save";
			document.getElementById('AddItemMaint').submit()
			editUrl = "/categorymaintenance.do"
			openWin(editUrl,690,450);			
		}

function confirmSubmit()
{
	if(confirm("Are you sure you want to Delete the item?"))
	{	
	 	document.forms['dirMaint'].action.value = "Delete";
		document.getElementById('dirMaint').submit()
        return true;        		
}}

function AddSubCatEdit(url) {		

			document.forms['AddItemMaint'].update.value="save";
			document.getElementById('AddItemMaint').submit()
			openWin(url,690,450);			
		}
		
function subCatEdit(url) {		

			document.forms['ItemMaint'].action.value="save";
			document.getElementById('ItemMaint').submit()
			openWin(url,690,450);			
		}


function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_preloadImages() { 
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}




function WinCloseReload()
{
self.opener.location.reload(true);
self.close()
}

/* Function that hides the print button on the "Printer Friendly" page and then prints the page. */
function PrintFriendly()
{
browserName = navigator.appName;

	if(browserName == "Netscape" )
		{
			document.PrintPageButton.style.display="none";
			document.CloseButton.style.display="none";
			window.print();
			setTimeout("NetShowButtons()",2000);
		}
		else
		{
			document.PrintPageButton.style.display = "none";
			document.CloseButton.style.display = "none";
			window.print();
			document.PrintPageButton.style.display = "";
			document.CloseButton.style.display = "";
		}
}

function NetShowButtons()
{
			document.PrintPageButton.style.display="";
			document.CloseButton.style.display="";
}

function WinClose()
{
window.close()
}



/*--------------------------------------------------------*/
function popit(name,url,wid,hgt,lt,tp) {	
	window[name] = open(url,name,'width='+700+',height='+500+',left='+lt+',top='+tp+',resizable,scrollbars');
	if (window[name] && !window[name].closed) window[name].focus();
}


/* ----------- BROWSER DETECTION ----------- */

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);


if((browserName == "Netscape" && browserVer >=3)||(browserName == "Microsoft Internet Explorer" && browserVer >=4))
{
	browser = "ver3";

}else{

 browser = "ver2";
}


/* ----------- POPUP WINDOW FUNCTIONS ----------- */
var newWin
function closeWin()
{
	if(newWin && !newWin.closed)
	{
		newWin.close()
	}
}

function openWin(obj,wt,ht)
{
	
	if ((browser == "ver3") && (browserName == "Microsoft Internet Explorer" && navigator.platform != "MacPPC"))
	{
		itsNav3(obj,wt,ht)
	}
	else if (browser == "ver2")
		{
			ie3(obj,wt,ht)
		}
		else
		{
			ie2(obj,wt,ht)
		}
}


function itsNav3(obj,wt,ht)
{

	if(newWin == null || newWin.closed)
	{		
		newWin = window.open(obj, "name1", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=" + wt + ",height=" + ht + ",top=150,left=150")
		//alert("window opening1 = "+obj)
	}
	else
	{
		newWin.close()
		newWin = window.open(obj, "name2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + wt + ",height=" + ht + ",top=150,left=150")
	}
}

function ie3(obj,wt,ht)
{
	//alert("window opening2 = "+obj)
	if(newWin == null || newWin.closed)
	{
		newWin = window.open(obj, 'newWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + wt + ',height=' + ht + ',top=150,left=150')
	}
	else
	{
		newWin = window.open(obj, 'newWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + wt + ',height=' + ht + ',top=150,left=150')
	}
}

function ie2(obj,wt,ht)
{
		//alert("window opening3 = "+obj)
		newWin = window.open(obj, "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + wt + ",height=" + ht + ",top=150,left=150")
}


