

	function WebPageManagerLoadInfo()
		{ 
			var lstrSelectedValue = document.frmSubmit.SelectWebPageToEdit.value;
			document.frmSubmit.txtSelectedWebPageGuid.value = lstrSelectedValue;
			document.frmSubmit.txtAction.value = "LoadInfo";
			document.frmSubmit.submit();
		} 

	function WebPageManagerDeleteWebPage(pstrWebPageName)
	 {
		var bConfirmed = window.confirm('This action cannot be undone! All articles (content) on the page will be deleted along with the web page and can not be recovered!  Delete the ' + pstrWebPageName + ' web page?')
		if (bConfirmed) {
			var lstrSelectedValue = document.frmSubmit.SelectWebPageToEdit.value;
			document.frmSubmit.txtSelectedWebPageGuid.value = lstrSelectedValue;
			document.frmSubmit.txtAction.value = "DeleteWebPage";
			return true;
		}
		else {
			return false;
		}
	}

	function WebPageManagerSaveInfo(pstrWebPageName, pintTemplateId, pstrSessionGuid)
	 {
		var lstrSelectedValue = document.frmSubmit.SelectWebPageToEdit.value;
		document.frmSubmit.txtSelectedWebPageGuid.value = lstrSelectedValue;
		document.frmSubmit.txtAction.value = "SaveInfo";
	}

	function NewIpbnWebSite(pstrSessionGuid) 
	{ 
		var lstrContentFrame = "secure.aspx?FN=New_IPBN_Web_Site&FT=3&SS=38&Guid=" + pstrSessionGuid;
		var lobjContentFrame = parent.ifrmContent;
		lobjContentFrame.location.href=null;
		lobjContentFrame.location.href=lstrContentFrame;
		parent.scrollTo(0,0);
		return false;
	} 

	function NewWfwWebSite(pstrSessionGuid) 
	{ 
		var lstrContentFrame = "secure.aspx?FN=New_WFW_Web_Site&FT=3&SS=38&Guid=" + pstrSessionGuid;
		var lobjContentFrame = parent.ifrmContent;
		lobjContentFrame.location.href=null;
		lobjContentFrame.location.href=lstrContentFrame;
		parent.scrollTo(0,0);
		return false;
	} 

    function swallowenter()
		{
			if(event.keyCode==13){
				event.keyCode=null;
				window.document.getElementById('diidLiLogIn').click();
        }    
        return true;
    }
 
	function LinkWebSiteDocuments(editor,htmlmode,text,value)
        {
			//alert('LinkWebSitePages: ' + text + ' ' + value);
            editor.focus();
            sel = editor.document.selection.createRange();
            if (sel.text.length > 0){
				var lstrHref = "<A href=\"/FileMaster/Site/" + value + "\" target=\"_blank\">" + sel.text + "</A>";
			}
			else {
				var lstrHref = "<A href=\"/FileMaster/Site/" + value + "\" target=\"_blank\">" + text + "</A>";
			}
			sel.pasteHTML(lstrHref);
        }
	
	function LinkWebSitePages(editor,htmlmode,text,value)
        {
			//alert('LinkWebSitePages: ' + text + ' ' + value);
            editor.focus();
            sel = editor.document.selection.createRange();
            if (sel.text.length > 0){
				var lstrHref = "<A href=\"/secure.aspx?FN=" + value + "&FT=3&Guid=X\">" + sel.text + "</A>";
			}
			else {
				var lstrHref = "<A href=\"/secure.aspx?FN=" + value + "&FT=3&Guid=X\">" + text + "</A>";
			}
			sel.pasteHTML(lstrHref);
			//alert('lstrHref: ' + lstrHref);
        }

	function MenuItemOrderDetect(plngLowerArrayBoundry)	{
		document.frmSubmit.txtMenuItemOrder.value = document.frmSubmit.MenuItemOrder.selectedIndex + plngLowerArrayBoundry;
	} 

	function OnloadFunctions(pstrWebPageName, pintTemplateId, pstrSessionGuid, pintFunctionType) 
	{ 
		if(pstrWebPageName=='Themes'){
			var lobjElement = document.getElementById('currentTheme');
			var lobjPreviewImage = document.getElementById('previewImage');
			lobjPreviewImage.src=lobjElement.value;
		}
		
		if(pstrWebPageName=='Web_Page_Management'){
			//alert('pstrWebPageName: ' + pstrWebPageName + '  pintFunctionType: ' + pintFunctionType);
			var MenuFrame = parent.document.getElementById('ifrmMenu');
			MenuFrame.contentWindow.location.reload(true);
		}

		if(pintFunctionType==6){
			var lstrHeaderFrame = "secure.aspx?FN=" + pstrWebPageName + "&FT=0&SS=" + pintTemplateId + "&Guid=" + pstrSessionGuid;
				top.location.href = lstrHeaderFrame;
		}

		if(pstrWebPageName=='Article_Editor'){
		    //alert('pstrWebPageName: ' + pstrWebPageName + '  pintFunctionType: ' + pintFunctionType);
			LoadHeaderTitle(pstrWebPageName, pintTemplateId, pstrSessionGuid);
			parent.reSize();
			try { 
			// Workaround for IE6 3rd line display issue 
			if(navigator.userAgent.indexOf('MSIE 6')>=0) { 
				var range=OU812_x5.document.body.createTextRange(); 
				range.moveStart('textedit', range.text.length); 
				range.select(); 
				OU812_x5.document.body.innerHTML=OU812_x5.document.body.innerHTML; 
			} 
			} catch(e) {} 
		}

		else{
			LoadHeaderTitle(pstrWebPageName, pintTemplateId, pstrSessionGuid);
			parent.reSize();
		}
		parent.reSize();
	}


	function SetIFrameSource(pstrFrameId, pstrPageName, pstrSessionGuid) {
		var lobjFrame = document.getElementById(pstrFrameId);
		var lstrFrameSrc = pstrPageName + "&IF=" + pstrFrameId + "&Guid=" + pstrSessionGuid;
		//alert(lstrFrameSrc);
		lobjFrame.src=lstrFrameSrc;
		return false;
	}

	function DeleteGalleryImage(pstrImageName) {
		document.frmGallery.txtAction.value = pstrImageName;
	}

	function ShowGallery(pobjThis) {
		var lobjGalleryFrame = document.getElementById('gallery');
		var lstrGalleryFrameSrc = "ImageGallery.aspx";
		//document.getElementById('gallery').style.display = 'inline';
		lobjGalleryFrame.src=lstrGalleryFrameSrc;
		lobjGalleryFrame.style.display = 'inline';
		pobjThis.style.display = 'none';
		document.getElementById('hideButton').style.display = 'inline'; 
		parent.reSize();
		return false;
	}
	
	function HideGallery(pobjThis) {
		document.getElementById('gallery').style.display = 'none';
		pobjThis.style.display = 'none';document.getElementById('showButton').style.display = 'inline';
		parent.reSize();
		return false;
	}
	
	function NoAction() {
		return false;
	}

	function CheckCompanyInfo() {
		return true;
	}

	function SetAlignmentRight(editorIframe, isInHtmlMode) { 
	switch(editorIframe.document.selection.type.toUpperCase()) { 
	case 'CONTROL': 
	var oRange = editorIframe.document.selection.createRange(); 
	var oItem = oRange.item(oRange.length - 1); 
	if (oItem.nodeName.toUpperCase() == 'IMG') { 
	oItem.align = 'right'; 
	} else { 
	editorIframe.document.execCommand('JustifyRight'); 
	} 
	break; 
	default: 
	editorIframe.document.execCommand('JustifyRight'); 
	break; 
	} 
	} 

	function SetAlignmentCenter(editorIframe, isInHtmlMode) { 
	switch(editorIframe.document.selection.type.toUpperCase()) { 
	case 'CONTROL': 
	var oRange = editorIframe.document.selection.createRange(); 
	var oItem = oRange.item(oRange.length - 1); 
	if (oItem.nodeName.toUpperCase() == 'IMG') { 
	oItem.align = 'center'; 
	} else { 
	editorIframe.document.execCommand('JustifyCenter'); 
	} 
	break; 
	default: 
	editorIframe.document.execCommand('JustifyCenter'); 
	break; 
	} 
	} 

	function SetAlignmentLeft(editorIframe, isInHtmlMode) { 
	switch(editorIframe.document.selection.type.toUpperCase()) { 
	case 'CONTROL': 
	var oRange = editorIframe.document.selection.createRange(); 
	var oItem = oRange.item(oRange.length - 1); 
	if (oItem.nodeName.toUpperCase() == 'IMG') { 
	oItem.align = 'left'; 
	} else { 
	editorIframe.document.execCommand('JustifyLeft'); 
	} 
	break; 
	default: 
	editorIframe.document.execCommand('JustifyLeft'); 
	break; 
	} 
	} 

	function ArticleEditDeleteArticle() {
		var bConfirmed = window.confirm('This action cannot be undone! Delete this article?')
		if (bConfirmed) {
			document.frmEdit.txtAction.value = "DeleteArticle";
			return true;
		}
		else {
			return false;
		}
	}

	function ArticleEditSaveAndClose() {
		document.frmEdit.txtAction.value = "SaveAndClose";
	}

	function ColumnDetect()	{
		if(document.frmEdit.optColumn1.checked){
			document.frmEdit.txtColumn.value = 1;
		}
		if(document.frmEdit.optColumn2.checked){
			document.frmEdit.txtColumn.value = 2;
		}
	} 
		
	function OrderDetect()	{
		document.frmEdit.txtArticleOrder.value = document.frmEdit.ArticleOrder.selectedIndex + 1;
	} 


	function LoadArticleEditor(pintArticleId, pstrSessionGuid) 
	{ 
		var lstrContentFrame = "ArticleEditor.aspx?FN=Article_Editor&FT=9&AE=" + pintArticleId + "&Guid=" + pstrSessionGuid;
		//alert(lstrContentFrame)
		var lobjContentFrame = parent.ifrmContent;
		//lobjContentFrame.location.href=null;
		//alert('2: ' + lstrContentFrame)
		lobjContentFrame.location.href=lstrContentFrame;
		parent.scrollTo(0,0);
		return false;
	} 

	function CheckEnter(e){ 
		var characterCode;

		if(e && e.which){ //if which property of event object is supported (NN4)
			e = e;
			characterCode = e.which; //character code is contained in NN4's which property
		}
		else{
			e = event;
			characterCode = e.keyCode; //character code is contained in IE's keyCode property
		}

		if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			return LogInSubmit();
		}
		else{
			return true;
		}

	}

	function LoadHeaderTitle(pstrWebPageName, pintTemplateId, pstrSessionGuid)
	{ 
		var lstrHeaderFrame = "secure.aspx?FN=" + pstrWebPageName + "&FT=1&SS=" + pintTemplateId + "&Guid=" + pstrSessionGuid;
		var lobjHeaderFrame = parent.ifrmPageHeader;
		lobjHeaderFrame.location.href=null;
		lobjHeaderFrame.location.href=lstrHeaderFrame;
	}

	function FetchPasswordSubmit()
	{
		if (document.frmSubmit.txtUserName.value == '') {
			alert('Please enter a User Name.');
			return false;
		}
		else {
			return true;
			//document.frmSubmit.submit();
		}
	}

	function LogInSubmit()
	{
		if (document.frmSubmit.txtUserName.value == '') {
			alert('Please enter a User Name.');
			return false;
		}
		if (document.frmSubmit.txtPassword.value == '') {
			alert('Please enter a Password.');
			return false;
		}
		else {
			return true;
			//document.frmSubmit.submit();
		}
	}

	function LoadContentFromMenuItem(pobjElement, pstrWebPageName, pstrSessionGuid, pstrServer, pintSecurityLevel, pblnForceSsl, pblnInDevelopment) 
	{ 

		var lstrContentFrame = "/secure.aspx?FN=" + pstrWebPageName + "&FT=3&Guid=" + pstrSessionGuid;

		var lobjContentFrame = parent.ifrmContent;
		lobjContentFrame.location.href=null;
		lobjContentFrame.location.href=lstrContentFrame;

		//Expand/Collapse tree node
		var os = pobjElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.firstChild.firstChild;
		if (os != null) {
			if ((typeof os != "undefined") && (os.tagName == "IMG")) {
				var lensrc = (os.src.length - 8);
				var s = os.src.substr(lensrc, 8);
				if ((s == "inus.gif") || (s == "usik.gif")) {
					pobjElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.firstChild.firstChild.click();
				}
			}
			else {
				//ob_os(pobjElement.parentNode);
			}
		}

		parent.scrollTo(0,0);
	} 

	function ReLoadContentFromMenuItem(pstrWebPageName, pstrSessionGuid, pstrServer, pintSecurityLevel, pblnForceSsl, pblnInDevelopment)
	{ 
		if (pblnInDevelopment == "-1") {
			var lstrHref = "http://" + pstrServer + "/secure.aspx?FN=" + pstrWebPageName + "&FT=0&Guid=" + pstrSessionGuid;
		}
		else {
			if ((pintSecurityLevel == 0) && (pblnForceSsl == 0)) {
				//alert('Not Secure Server: ' + pstrServer + '  Page: ' + pstrWebPageName);
				var lstrHref = "http://" + pstrServer + "/secure.aspx?FN=" + pstrWebPageName + "&FT=0&Guid=" + pstrSessionGuid;
			}
			else {
				//alert('Secure Server: ' + pstrServer + '  Page: ' + pstrWebPageName);
				var lstrHref = "https://" + pstrServer + "/secure.aspx?FN=" + pstrWebPageName + "&FT=0&Guid=" + pstrSessionGuid;
			}
		}
		
		top.location.href = lstrHref;
	} 

	function loadTwo(pstrWebPageName, pintTemplateId, pstrSessionGuid) 
	{ 
		var lstrContentFrame = "secure.aspx?FN=" + pstrWebPageName + "&FT=3&SS=" + pintTemplateId + "&Guid=" + pstrSessionGuid;
		var lobjContentFrame = parent.ifrmContent;
		lobjContentFrame.location.href=null;
		lobjContentFrame.location.href=lstrContentFrame;
		parent.scrollTo(0,0);
	} 
	
	function LoadMenu(pstrWebPageName, pintTemplateId, pstrSessionGuid) 
	{ 
		var lstrMenuFrame = "secure.aspx?FN=" + pstrWebPageName + "&FT=2&SS=" + pintTemplateId + "&Guid=" + pstrSessionGuid;
		var lobjMenuFrame = parent.ifrmMenu;
		lobjMenuFrame.location.href=null;
		lobjMenuFrame.location.href=lstrMenuFrame;
	} 

	function Reload(pstrUrl) 
	{ 
		top.location.href = pstrUrl;
	} 

	function createHelpWindow(pstrUrl) {
		var lstrWindowName = "HelpWindow";
		var lstrFeatures = "width=400,height=200,resizable,scrollbars";
		
		var xWin = window.open(pstrUrl,lstrWindowName,lstrFeatures);
	}
	
	function createPopWindow(pstrUrl, pblnModal) {

		var lstrFilterValue = showModalDialog(pstrUrl,"Enter value to filter by:","dialogWidth:500px;dialogHeight:300px; help:yes; resizable:yes");
		if (lstrFilterValue == ""){
			return 1;    // user canceled search" & vbCrLf
		}
	}

	function PrintMe() {
		self.print();
	}

	function reSize()
		{
			try
				{	
					//Reset the height of the content frame...
					var oBody = ifrmContent.document.body;
					var oContentFrame = document.all("ifrmContent");
					var iContentFrameHeight = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight) + 50;
					oContentFrame.style.height = iContentFrameHeight;
					
					//Reset the top of the menu position...
					var iTop = window.tblContent.offsetTop + 60;
					
					FloatMenuToTop(iTop);
				}
				
				
			//An error is raised if the IFrame domain != its container's domain
			catch(e)
				{
					window.status =	'Error: ' + e.number + '; ' + e.description
				}



		}


