//------------------------------------------------------------------------------
// Class:  Customize Footer
//------------------------------------------------------------------------------
// Author:  CL
// Date:  2008/01/30
// Description:  This class defines the functions used by the customize footer section.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function CustomizeFooter()
{	
	//--------------------------------------------------------------------------
	// Methods:
	this.resetToDefault = resetToDefault;
	this.save = save;
	this.preview = preview;
	this.imgLibraryOpen = imgLibraryOpen;
	this.imgLibPopup = new Object();
	this.openDivPopupWin = openDivPopupWin;
	this.closeDivPopupWin = closeDivPopupWin;
	this.closeDivPopupDivWin = closeDivPopupDivWin;
	this.selectAllCheckBoxes = selectAllCheckBoxes;
	
	//--------------------------------------------------------------------------
	
	function resetToDefault(URL)
	{
		document.frmFooterCustomization.isSave.value = 0;
		document.frmFooterCustomization.isResetToDefault.value = 1;
		document.frmFooterCustomization.isPreviewFooter.value = 0;
		document.frmFooterCustomization.target = 'parent';
		document.frmFooterCustomization.action = URL;
		document.frmFooterCustomization.submit();
	}

	//--------------------------------------------------------------------------
	
	function save(URL)
	{
		document.frmFooterCustomization.isResetToDefault.value = 0;
		document.frmFooterCustomization.isSave.value = 1;
		document.frmFooterCustomization.isPreviewFooter.value = 0;
		document.frmFooterCustomization.target = 'parent';
		document.frmFooterCustomization.action = URL;
		document.frmFooterCustomization.submit();
	}
	
	//--------------------------------------------------------------------------

	function preview(URL,intType)
	{					
		var popUp = dhtmlwindow.open("Preview", "iframe", "about:blank", "Preview Footer Customization", "width=950px,height=600px,resize=1,scrolling=1,center=1", "recal");
		document.frmFooterCustomization.isPreviewFooter.value = 1;
		document.frmFooterCustomization.isPreviewFooterType.value = intType;
		document.frmFooterCustomization.isResetToDefault.value = 0;
		document.frmFooterCustomization.isSave.value = 0;
		document.frmFooterCustomization.target = '_iframe-Preview';
		document.frmFooterCustomization.action = URL;
		document.frmFooterCustomization.submit();
		popUp.focus();

	}
	
	//--------------------------------------------------------------------------
	
	function imgLibraryOpen(URL,sTitle,iHeight)
	{
		var sStyle = "width=750px,height="+ iHeight + ",resize=1,scrolling=1,center=1";
		this.imgLibPopup = dhtmlwindow.open("galleryadmin", "iframe", URL, sTitle, sStyle, "recal");
	}
	
	//--------------------------------------------------------------------------
	
	function openDivPopupWin(URL,sTitle,iWidth,iHeight,winType)
	{
		if(!winType)
		{
			var winType = "iframe";
		}
		var sStyle = "width=" + iWidth + ",height="+ iHeight + ",resize=0,scrolling=1,center=1";
		var popup = dhtmlwindow.open("galleryadmin", winType, URL, sTitle, sStyle, "recal");
	}
	
	//--------------------------------------------------------------------------
		
	function closeDivPopupWin()
	{
		parent.document.getElementById('galleryadmin').style.display='none';
		parent.window.frames["_iframe-galleryadmin"].location.replace('about:blank');
	}
	
	//--------------------------------------------------------------------------
		
	function closeDivPopupDivWin()
	{
		parent.document.getElementById('galleryadmin').style.display='none';
	}
	
	//--------------------------------------------------------------------------
	
	function selectAllCheckBoxes(formName, fieldName, checkValue)
	{
		if(!document.forms[formName])
			return;
		
		var objCheckBoxes = document.forms[formName].elements[fieldName];
		if(!objCheckBoxes)
			return;
		
		var countCheckBoxes = objCheckBoxes.length;
		if(!countCheckBoxes)
			objCheckBoxes.checked = checkValue;
		else
		{
			for(var i=0; i < countCheckBoxes; i++)
			{
				if(objCheckBoxes[i].disabled)
				{
					objCheckBoxes[i].checked = 0;
				}
				else
				{
					objCheckBoxes[i].checked = checkValue;
				}
			}
		}
	}
	
}

// Create Object
oCustomizeFooter = new CustomizeFooter();

//--------------------------------------------------------------------------