function replaceCharacters(strText)
{
	
	var strHold = strText.replace('&','&amp;');
	return strHold;
	
}

function refreshLeftMenu(lngID)
{
	ajaxDraw('HealthCenterLeft','/includes/InfoCenter/Ajax.asp?PageAction=RefreshLeftMenu&ID='+lngID);
	
}

function ajaxAddSubCat(lngID)
{
	ajaxDraw('healthCenterTool','/includes/InfoCenter/Ajax.asp?PageAction=AddSubCategory&ID='+lngID);
	slideDiv('healthCenterTool');		
}


function ajaxHealthCenterAddNewCat(lngID)
{
	ajaxDraw('healthCenterTool','/includes/InfoCenter/Ajax.asp?PageAction=AddNewCat&ID='+lngID);
	
	slideDiv('healthCenterTool');		
}

function ajaxSaveCategory(lngID,txtCatName,txtCatTitle,txtContent,txtKeywords)
{	
	var strTextField = document.getElementById(txtCatName).value;
	//First lets check if the name they are using is ok to use
	
	
	ajaxDraw('return','/includes/InfoCenter/Ajax.asp?PageAction=ValidateCategoryName&Name='+strTextField+'&ID='+lngID)
	
	pausecomp(2500);
	
	if(ajaxReturnHtml=='False')
	{
		new Effect.Shake('healthCenterTool');
		alert('The name you have entered is already being used, please enter a different name.')
		document.getElementById(txtCatName).focus();
		return;

	}
	
	var strTextField = document.getElementById(txtCatName).value;
	
	if(strTextField=='')
	{
		alert('Please enter a category name and try again.');
		document.getElementById(txtCatName).focus();
		return;
	}

	var strTextField2 = document.getElementById(txtCatTitle).value;
	
	if(strTextField2=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtCatTitle).focus();
		return;
	}
	
	var strTextField3 = document.getElementById(txtContent).value;
	
	if(strTextField3=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtContent).focus();
		return;
	}
	
	var strTextField4 = document.getElementById(txtKeywords).value;
	
	if(strTextField4=='')
	{
		alert('Please enter keywords for the category and try again.');
		document.getElementById(txtKeywords).focus();
		return;
	}
	
	
	ajaxDraw('healthCenterTool','/includes/InfoCenter/Ajax.asp?PageAction=SaveNewCat&ID='+lngID+'&strCatName='+replaceCharacters(strTextField)+'&strCatTitle='+replaceCharacters(strTextField2)+'&strCatContent='+strTextField3+'&strCatKeywords='+strTextField4);
	slideDiv('healthCenterTool');	

	refreshLeftMenu(lngID);

}

function ajaxSaveSubCategory(lngID,txtCatName,txtCatTitle,txtContent,txtKeywords,HealthCenters_ID)
{
	var strTextField = document.getElementById(txtCatName).value;
	
	if(strTextField=='')
	{
		alert('Please enter a category name and try again.');
		document.getElementById(txtCatName).focus();
		return;
	}

	var strTextField2 = document.getElementById(txtCatTitle).value;
	
	if(strTextField2=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtCatTitle).focus();
		return;
	}

	var strTextField3 = document.getElementById(txtContent).value;
	
	if(strTextField3=='')
	{
		alert('Please enter the description and try again.');
		document.getElementById(txtcontent).focus();
		return;
	}
		var strTextField4 = document.getElementById(txtKeywords).value;
	
	if(strTextField4=='')
	{
		alert('Please enter keywords for the category and try again.');
		document.getElementById(txtKeywords).focus();
		return;
	}
	
	
	ajaxDraw('healthCenterTool','/includes/InfoCenter/Ajax.asp?PageAction=SaveSubCategory&CatID='+lngID+'&strCatName='+strTextField+'&strCatTitle='+strTextField2+'&strCatContent='+strTextField3+'&strCatKeywords='+strTextField4+'&HealthCenters_ID='+HealthCenters_ID);
	slideDiv('healthCenterTool');	
	
}

function ajaxEditCat(lngID)
{
	ajaxDraw('HealthCenterCatContent','/includes/InfoCenter/Ajax.asp?PageAction=EditCat&lngID='+lngID);
	//slideDiv('healthCenterTool');	
}


function ajaxEditSaveCategory(lngID,txtCatTitle,txtContent,txtKeywords)
{
	
	var strTextField2 = document.getElementById(txtCatTitle).value;
	
	if(strTextField2=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtCatTitle).focus();
		return;
	}

	var strTextField3 = document.getElementById(txtContent).value;
	
	if(strTextField3=='')
	{
		alert('Please enter the description and try again.');
		document.getElementById(txtcontent).focus();
		return;
	}
		var strTextField4 = document.getElementById(txtKeywords).value;
	
	if(strTextField4=='')
	{
		alert('Please enter keywords for the category and try again.');
		document.getElementById(txtKeywords).focus();
		return;
	}
	
	
	ajaxDraw('HealthCenterCatContent','/includes/InfoCenter/Ajax.asp?PageAction=EditSaveCat&lngID='+lngID+'&strCatTitle='+strTextField2+'&strCatContent='+strTextField3+'&strCatKeywords='+strTextField4);
	//slideDiv('healthCenterTool');	
	
}

function ajaxDrawCatContent(lngID)
{
	ajaxDraw('HealthCenterCatContent','/includes/InfoCenter/Ajax.asp?PageAction=DrawCatContent&lngID='+lngID);
}

function ajaxEditSubCat(lngID)
{
	ajaxDraw('HealthCenterSubCatContent','/includes/InfoCenter/Ajax.asp?PageAction=EditSubCat&lngID='+lngID);
	
}


function ajaxEditSaveSubCat(lngID,txtCatTitle,txtContent,txtKeywords)
{
	
	var strTextField2 = document.getElementById(txtCatTitle).value;
	
	if(strTextField2=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtCatTitle).focus();
		return;
	}

	var strTextField3 = document.getElementById(txtContent).value;
	
	if(strTextField3=='')
	{
		alert('Please enter the description and try again.');
		document.getElementById(txtcontent).focus();
		return;
	}
		var strTextField4 = document.getElementById(txtKeywords).value;
	
	if(strTextField4=='')
	{
		alert('Please enter keywords for the category and try again.');
		document.getElementById(txtKeywords).focus();
		return;
	}
	
	ajaxDraw('HealthCenterSubCatContent','/includes/InfoCenter/Ajax.asp?PageAction=EditSaveSubCat&lngID='+lngID+'&strCatTitle='+strTextField2+'&strCatContent='+strTextField3+'&strCatKeywords='+strTextField4);

	
}

function ajaxEditHealthCenter(lngID)
{
	ajaxDraw('HealthCenterContent','/includes/InfoCenter/Ajax.asp?PageAction=EditHealthCenter&lngID='+lngID);
	//slideDiv('healthCenterTool');	
}


function ajaxEditSaveHealthCenter(lngID,txtTitle,txtShortDesc,txtLongDesc,txtKeywords)
{
	
	
	var strTextField2 = document.getElementById(txtTitle).value;
	
	if(strTextField2=='')
	{
		alert('Please enter a title and try again.');
		document.getElementById(txtTitle).focus();
		return;
	}

	var strTextField3 = document.getElementById(txtShortDesc).value;
	
	if(strTextField3=='')
	{
		alert('Please enter a short description and try again.');
		document.getElementById(txtShortDesc).focus();
		return;
	}
		var strTextField4 = document.getElementById(txtLongDesc).value;
	
	if(strTextField4=='')
	{
		alert('Please enter a long description and try again.');
		document.getElementById(txtLongDesc).focus();
		return;
	}
	
	var strTextField5= document.getElementById(txtKeywords).value;
	
	if(strTextField5=='')
	{
		alert('Please enter keywords for the health center and try again.');
		document.getElementById(txtKeywords).focus();
		return;
	}
	
	ajaxDraw('HealthCenterContent','/includes/InfoCenter/Ajax.asp?PageAction=EditSaveHealthCenter&lngID='+lngID+'&strTitle='+strTextField2+'&strShortDesc='+strTextField3+'&strLongDesc='+strTextField4+'&strKeywords='+strTextField5);

	
}

function ajaxDrawSubCatContent(lngID)
{
	ajaxDraw('HealthCenterSubCatContent','/includes/InfoCenter/Ajax.asp?PageAction=DrawSubCatContent&lngID='+lngID);
}

function ajaxDrawHealthCenterContent(lngID)
{
	ajaxDraw('HealthCenterContent','/includes/InfoCenter/Ajax.asp?PageAction=DrawHealthCenterContent&lngID='+lngID);
}


