
<!--

//------------- BASE VERSION 1.42 - 22/04/2007 -------------- all javascript from common.inc
//------------- BASE VERSION 1.42A - 23/04/2007 ------------ BrowseImages()
//------------- BASE VERSION 1.45 - 18/08/2007 -------------- Passwidth runtime error loop overrun
//------------- BASE  VERSION 1.47 - 15/09/2007 ------------- Get XML Layout
//------------- BASE  VERSION 1.48 - 23/12/2007 --------------- New Block Box alignment
//------------- BASE  VERSION 1.51 - 07/06/2008 --------------- Firefox as well as IE support
//------------- BASE  VERSION 1.52 - 14/06/2008 --------------- PasteVal function
//------------- BASE  VERSION 1.53 - 22/06/2008 --------------- PostHTML function and do not refresh help pages if showbare=true
//------------- BASE  VERSION 1.56 - 18/07/2008 --------------- heading bar 2 rows
//------------- BASE  VERSION 1.57 - 02/08/2008 --------------- PasteVal not to close window
//------------- BASE  VERSION 1.58 - 06/08/2008 --------------- Movies openVideo size change
//------------- BASE  VERSION 1.59 - 22/08/2008 --------------- auto show category box on shopping cart blocks ShowBoxes
//------------- BASE  VERSION 1.60 - 13/09/2008 --------------- Admin + Firefox reloading page (selectedIndex error)
//------------- BASE  VERSION 1.61 - 30/09/2008 --------------- AdminID in setlogo()
//------------- BASE  VERSION 1.62 - 19/10/2008 --------------- return true removed from openpage()
//--------------BASE  VERSION 1.63 - 09/11/2008 --------------->  TransferProtx and showboxes gallery layout
//--------------BASE  VERSION 1.64 - 04/12/2008 --------------->  ShowAddEvent()
//--------------BASE  VERSION 1.65 - 04/12/2008 --------------->  ToggleToolBar remove return false
//--------------BASE  VERSION 1.69 - 23/01/2009 --------------->  SetNavigation correct setting of SSidebar
//------------- BASE  VERSION 1.70 - 09/02/2009 ---------------> Layout 18/19 iframe/text text/iframe
//------------- BASE  VERSION 1.71 - 11/02/2009 ---------------> FlipAll()
//------------- BASE  VERSION 1.78 - 16/04/2009 ---------------> InsertFontSize px
//------------- BASE  VERSION 2.0.31 - 29/04/2009 ---------------> Showboxes corrections .top & .left px in quotes
//------------- BASE  VERSION 2.0.37 - 05/04/2009 ---------------> Showboxes textarea cols
//------------- BASE  VERSION 2.0.38 - 07/05/2009 ---------------> resizeFrame display
//------------- BASE  VERSION 2.0.40 - 12/05/2009 ---------------> Block styles toolbar
//------------- BASE  VERSION 2.0.41 - 18/05/2009 ---------------> showboxes heading bar shows gstyle dropdown
//------------- BASE  VERSION 2.0.44 - 10/06/2009 ---------------> Separators height
//------------- BASE  VERSION 2.0.47 - 30/06/2009 ---------------> resizeFrame Firefox/book1.asp problem
//------------- BASE  VERSION 2.0.48 - 02/07/2009 ---------------> resizeFrame adjust default width for small frame
//------------- BASE  VERSION 2.0.50 - 07/07/2009 ---------------> W3C
//------------- BASE  VERSION 2.0.51 - 15/07/2009 ---------------> IFRAME
//------------- BASE  VERSION 2.0.54 - 21/07/2009 ---------------> Manage Mailing Lists overhaul (setAll, showManageLists)
//------------- BASE  VERSION 2.1.14 - 08/09/2009 ---------------> Revert to old  editor
//------------- BASE  VERSION 2.1.15 - 20/09/2009 ---------------> FlipAll + InsertList + InsertRoundSelection
//------------- BASE  VERSION 2.1.19 - 17/11/2009 ---------------> InsertFontSize reset selectedIndex to zero + font/algn show on textarea
//------------- BASE  VERSION 2.1.23 - 19/12/2009 ---------------> DispHeadingStyle firefox error
//------------- BASE  VERSION 2.1.25 - 15/02/2010 ---------------> ChangeTxtAlgn and Change TxtColor recoded to run on startup

//------------- VERSION 2.2.9 - 08/05/2010 ---------------> ShowHelp() to include showhelp=true in querystring (for web.asp)
//------------- VERSION 2.2.10 - 14/05/2010 ---------------> MoveLoginPanelS()
//------------- VERSION 2.2.18 - 02/06/2010 ---------------> NewClientButton()

// GLOBAL VARIABLES

var wdwname;

function FlipNewClient()
{
	NC = document.getElementById("NewClient")
	CID = document.getElementById("ClientID")
	AC = document.getElementById("AddClient")
	if (NC.style.display == 'none')
	{
		NC.style.display = '';
		CID.style.display = 'none';
		AC.value = 'Use Existing';
		CID.selectedIndex = 0;
	}
	else
	{
		NC.style.display = 'none';
		CID.style.display = '';
		AC.value = 'Add Client';
	}
}

function MoveLoginPanelS()
{
	LPS = document.getElementById("loginpanelS");
	//alert('MoveitL=' + LPS.style.left)
	if (LPS.style.right == '150px')
	{
		LPS.style.right = 'auto';
		LPS.style.left = '20px';
	}
	else
	{
		LPS.style.left = 'auto';
		LPS.style.right = '150px';
	}
}

function setOverlay(O)
{
	document.getElementById('Overlay').style.opacity = O
	if (O > 0)
	{
		document.getElementById('LargePic').style.display = 'block';
	}
	else
	{
		document.getElementById('LargePic').style.display = 'none';
	}
}

function FormSubmit()
{
	document.webform.Preview.value = 'Preview';
	document.webform.submit();
	document.webform.Preview.value = '';
}

function FlipAll(FName)
{
	fld = document.getElementsByName(FName)
	for (i = 0 ; i < fld.length ; i++)
	{
		if (fld[i].style.visibility == 'hidden')
		{
			fld[i].style.visibility = 'visible'
		}
		else
		{
			fld[i].style.visibility = 'hidden'
		}
	}
}

function ResetBanner()
{
	AdminID = document.getElementById("AAdminID").value
	window.location = 'banner.asp?AdminID=' + AdminID
}

function RadioVal(FForm, Button)
{
	RVal = ''
	for (x = 0 ; x < document.forms[FForm].elements.length ; x++)
	{
		FE = document.forms[FForm].elements[x]
		if (FE.type == 'radio')
		{
			if (FE.name == Button)
			{
				if (FE.checked)
				{
					RVal = FE.value
				}
			}
		}
	}
	return RVal ;
}

function ShowAddEvent()
{
	AE = document.getElementById('AddEvent')
	AE.style.display = 'inline'
	AE.style.visibility = 'visible'
}

function TransferProtx()
{

	document.forms["VSPForm"].submit();

}

function showManageLists()
{
	ML = document.getElementById('ManageLists')
	Man = document.ManageForm.Manage
	DA = document.anchors
	if (ML.style.display == 'none')
	{
		//ML.style.visibility = 'visible'
		ML.style.display = ''
		for (i =0 ; i < Man.length ; i++)
		{
			Man[i].style.visibility = 'visible'
			Man[i].style.display = 'inline'
		}
		//alert("VH=" + VH.length)
		for (i =0 ; i < DA.length ; i++)
		{
			//alert("i=" + i)
			if (DA[i].id == 'ViewHref' || DA[i].id == 'DeleteHref')
			{
				DA[i].style.visibility = 'hidden'
				DA[i].style.display = 'none'
			}
		}
	}
	else
	{
		//ML.style.visibility = 'hidden'
		ML.style.display = 'none'
		for (i =0 ; i < Man.length ; i++)
		{
			Man[i].style.visibility = 'hidden'
			Man[i].style.display = 'none'
		}
		for (i =0 ; i < DA.length ; i++)
		{
			//alert("i=" + i)
			if (DA[i].id == 'ViewHref' || DA[i].id == 'DeleteHref')
			{
				DA[i].style.visibility = 'visible'
				DA[i].style.display = 'inline'
			}
		}
	}
}

function setAll(fld, val)
{
	for (i = 0 ; i < fld.length ; i++)
	{
		fld[i].checked = val
	}
}


// This function is for iframe inclusion in a Text block
// CODE IN BLOCK :
// <iframe src="price.asp?showbare=true" width="100%" frameborder=false scrolling="no"  onload="resizeFrame(this)" >...LOADING...</iframe>

function resizeFrame(f) {
f.style.display = 'block' ;
f.style.visibility = 'visible' ;
//f.style.height = f.document.frames[f.id].document.body.scrollHeight + "px";
var actual_height = f.contentWindow.document.body.scrollHeight ;
if (actual_height != 0)
{
	f.style.height = actual_height + "px" ;
}
else
{
	if (f.style.width == '600px')
	{
		f.style.width = "620px";
	}
	else
	{
		f.style.width = "220px";
	}
}
//f.style.width = f.contentWindow.document.body.scrollWidth + "px";
//alert("actual_height=" + actual_height + " h=" + f.style.height + " w=" + f.style.width + " s=" + f.scrolling) ;
}

function InstallScheme(SID, SNam)
{
	Inst = confirm('This will install the Scheme ' + SNam + ' on your website')
	if (Inst == true)
	{
	//alert('SID=' + SID)
		document.schemeform.SSchemeID.value = SID
		document.schemeform.submit() ;
	}
}

function ColourPanel(c)
{
	CS = RadioVal('ColourForm', 'ColourSelect')
	if (CS != '')
	{
		CV = document.getElementById('S' + CS)
		if (c == '')
		{
			c = CV.value
		}
		CP = document.getElementById('N' + CS)
		CP.style.backgroundColor = c
	}
}

function SetStyles(pref)
{
	AdminID = document.getElementById("AAdminID").value
	if (pref == 'S')
	// Preview
	{
		SchemeID = window.document.getElementById("SSchemeID").value
		AdminID = window.document.getElementById("AAdminID").value
		SFontFamily = window.document.getElementById("SFontFamily").value
		SHeadingStyle = RadioVal('StylesForm', 'SHeadingStyle')
		openPage('web.asp?title=*home&Webview=YES&PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PFontFamily=' + SFontFamily + '&PHeadingStyle=' + SHeadingStyle, '800', '600')
	}
	else
	// Reset
	{
		window.location = 'styles.asp?AdminID=' + AdminID
	}
}

function SetFontFamily()
{
	SchemeID = document.getElementById("SSchemeID").value
	AdminID = document.getElementById("AAdminID").value
	SFontFamily = document.getElementById("SFontFamily").value

	window.location = 'styles.asp?PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PFontFamily=' + SFontFamily
}

function SetBackground()
{
	SchemeID = document.getElementById("SSchemeID").value
	AdminID = document.getElementById("AAdminID").value
	//alert('B=' + b)
	BL = document.getElementById("SBackgroundLogo")
	BA = document.getElementById("SBackgroundAttachment")
	BR = document.getElementById("SBackgroundRepeat")
	SBackgroundLogo = BL.value
	SBackgroundAttachment = BA.options[BA.selectedIndex].value
	SBackgroundRepeat = BR.options[BR.selectedIndex].value

	window.location = 'background.asp?PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PBackgroundLogo=' + SBackgroundLogo + '&PBackgroundAttachment=' + SBackgroundAttachment + '&PBackgroundRepeat=' + SBackgroundRepeat
}

function SetBorders(pref)
{
	AdminID = document.getElementById("AAdminID").value
	if (pref == 'S')
	// Preview
	{
		BL = RadioVal('BackgroundForm', 'SBorderL')
		if (BL != '')
		{
			SchemeID = document.getElementById("SSchemeID").value
			AdminID = document.getElementById("AAdminID").value
			SBorderL = BL
			SBorderR = BL.replace(/L.gif/, "R.gif")

			openPage('web.asp?title=*home&Webview=YES&PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PBorderL=' + SBorderL + '&PBorderR=' + SBorderR, '800', '600')
		}
	}
	else
	// Reset
	{
		window.location = 'background.asp?AdminID=' + AdminID
	}
}

function SetNavigation(pref)
{
	AdminID = document.getElementById("AAdminID").value
	if (pref == 'S')
	// Preview
	{
		SchemeID = document.getElementById("SSchemeID").value
		AdminID = document.getElementById("AAdminID").value
		TP = document.getElementById("STabPosition")
		STabPosition = TP.options[TP.selectedIndex].value
		STabs = -1
		if (STabPosition.length == 0)
		{
			STabs= 0
		}
		STabMax = document.getElementById("STabMax").value
		SP = document.getElementById("SSidebarPosition")
		SSidebarPosition = SP.options[SP.selectedIndex].value
		SSidebar = document.getElementById("SSidebar").checked
		SN = document.getElementById("SNewsPageID")
		SNewsPageID = SN.options[SN.selectedIndex].value
		SSidebarWidth = document.getElementById("SSidebarWidth").value

		openPage('web.asp?title=*home&Webview=YES&PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PTabs=' + STabs + '&PTabPosition=' + STabPosition + '&PTabMax=' + STabMax + '&PSidebar=' + SSidebar + '&PSidebarPosition=' + SSidebarPosition + '&PNewsPageID=' + SNewsPageID + '&PSidebarWidth=' + SSidebarWidth, '800', '600')
	}
	else
	// Reset
	{
		window.location = 'navigation.asp?AdminID=' + AdminID
	}
}

function SwitchColor(Fld, c)
{
	for (x = 0 ; x < document.ColourForm.elements.length ; x++)
	{
		FE = document.ColourForm.elements[x]
		if (FE.type == 'radio')
		{
			if ('S' + FE.value == Fld)
			{
				FE.checked = true
			}
		}
	}
	SetColor(c)
}

function SetColor(c)
{
	CS = RadioVal('ColourForm', 'ColourSelect')
	if (CS != '')
	{
		document.getElementById('S' + CS).value = c
		document.getElementById('N' + CS).style.backgroundColor = c
	}
}

function SetColors(pref)
{
	AdminID = document.getElementById("AAdminID").value
	if (pref == 'S')
	// Preview
	{
		CS = RadioVal('ColourForm', 'ColourSelect')
		if (CS != '')
		{
			SchemeID = document.getElementById("SSchemeID").value
			BodyBG = right(document.getElementById("SBodyBG").value, 6)
			BodyColor = right(document.getElementById('SBodyColor').value, 6)
			BannerBG = right(document.getElementById('SBannerBG').value, 6)
			BannerColor = right(document.getElementById('SBannerColor').value, 6)
			NavigationBG = right(document.getElementById('SNavigationBG').value, 6)
			NavigationColor = right(document.getElementById('SNavigationColor').value, 6)
			BorderBG = right(document.getElementById('SBorderBG').value, 6)
			openPage('web.asp?title=*home&Webview=YES&SSchemeID=' + SchemeID + '&PSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PBodyBG=' + BodyBG + '&PBodyColor=' + BodyColor + '&PBannerBG=' + BannerBG + '&PBannerColor=' + BannerColor + '&PNavigationBG=' + NavigationBG + '&PNavigationColor=' + NavigationColor + '&PBorderBG=' + BorderBG, '800', '600')
		}
	}
	else
	// Reset
	{
		window.location = 'colour.asp?AdminID=' + AdminID + '&AAdminID=' + AdminID
	}
}

function SaveColours()
{
	SchemeID = document.getElementById("SSchemeID").value
	BodyBG = right(document.getElementById("SBodyBG").value, 6)
	BodyColor = right(document.getElementById('SBodyColor').value, 6)
	BannerBG = right(document.getElementById('SBannerBG').value, 6)
	BannerColor = right(document.getElementById('SBannerColor').value, 6)
	NavigationBG = right(document.getElementById('SNavigationBG').value, 6)
	NavigationColor = right(document.getElementById('SNavigationColor').value, 6)
	BorderBG = right(document.getElementById('SBorderBG').value, 6)
	window.opener.document.forms['EditForm'].elements['SBodyBG'].value = BodyBG
	window.opener.document.forms['EditForm'].elements['SBodyColor'].value = BodyColor
	window.opener.document.forms['EditForm'].elements['SBannerBG'].value = BannerBG
	window.opener.document.forms['EditForm'].elements['SBannerColor'].value = BannerColor
	window.opener.document.forms['EditForm'].elements['SNavigationBG'].value = NavigationBG
	window.opener.document.forms['EditForm'].elements['SNavigationColor'].value = NavigationColor
	window.opener.document.forms['EditForm'].elements['SBorderBG'].value = BorderBG
	window.close()
}

function left(str, n)
{
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function right(str, n)
{
    if (n <= 0)
       return "";
    else if (n >= String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function SetLogo()
{
	SchemeID = document.getElementById("SSchemeID").value
	SLogo = document.getElementById("SLogo").value
	AdminID = document.getElementById("AAdminID").value

	window.location = 'banner.asp?PSchemeID=' + SchemeID + '&SSchemeID=' + SchemeID + '&AdminID=' + AdminID + '&AAdminID=' + AdminID + '&PLogo=' + SLogo
}

function SetSiteTitle(t)
{
	ST = document.getElementById("SiteTitle")
	if (left(t, 1) == "*")
	{
		t = ""
	}
	ST.innerHTML = t
}

function SetSiteWording(w)
{
	SW = document.getElementById("SiteWording")
	SW.innerHTML = w
}

function MoveBannerPosition(x,y)
{
	BP = document.getElementById('BannerPosition')
//alert('MBP1 ' + BP.style.left)
	//ST = getElementById("BannerSiteTitle")
	//SW = getElementById("BannerSiteWording")
	BP.style.left = parseInt(BP.style.left)+x+"px"
	BP.style.top = parseInt(BP.style.top)+y+"px"
//alert('MBP2 ' + BP.style.left)
	BX = document.getElementById('SBannerOffsetX')
	BY = document.getElementById('SBannerOffsetY')
	BX.value = parseInt(BP.style.left)
	BY.value = parseInt(BP.style.top)
}

function SetBannerPosition()
{
	BP = document.getElementById('BannerPosition')
	BX = document.getElementById('SBannerOffsetX').value
	BY = document.getElementById('SBannerOffsetY').value
	BP.style.left = BX+"px"
	BP.style.top = BY+"px"
}

function ChangeBannerTitleFontSize(x)
{
	ST = document.getElementById("BannerSiteTitle")
	ST.size = String(parseInt(ST.size) + x)
//alert('MST ' + ST.size)
	TF = document.getElementById('SBannerTitleFontSize')
	TF.value = ST.size
}

function ChangeBannerWordingFontSize(x)
{
	SW = document.getElementById("BannerSiteWording")
	SW.size = String(parseInt(SW.size) + x)
//alert('MSW ' + SW.size)
	WF = document.getElementById('SBannerWordingFontSize')
	WF.value = SW.size
}

function ChangeBannerAlign(a)
{
	BP = document.getElementById('BannerPosition')
	BP.style.textAlign = a
	BA = document.getElementById('SBannerAlign')
	BA.value = BP.style.textAlign
}

function ChangeBannerFont()
{
	BP = document.getElementById('BannerPosition')
	BF = document.getElementById('BannerFontSelect')
	BP.style.fontFamily = BF.options[BF.selectedIndex].value
	BF = document.getElementById('SBannerFont')
	BF.value = BP.style.fontFamily
}

function SetBannerFont(f)
{
	BP = document.getElementById('BannerPosition')
	BP.style.fontFamily = f
}

function SaveBanner()
{
	BP = document.getElementById('BannerPosition')
	ST = document.getElementById("BannerSiteTitle")
	SW = document.getElementById("BannerSiteWording")
	FS = document.getElementById('BannerFontSelect')
	BX = parseInt(BP.style.left)
	BY = parseInt(BP.style.top)
	FT = parseInt(ST.size)
	FW = parseInt(SW.size)
	BA = BP.style.textAlign
	BF = FS.value
	//alert('BX=' + BX + ' BY=' + BY + ' FT=' + FT + ' FW=' + FW + ' BA=' + BA)
	window.opener.document.forms['EditForm'].elements['SBannerOffsetX'].value = BX
	window.opener.document.forms['EditForm'].elements['SBannerOffsetY'].value = BY
	window.opener.document.forms['EditForm'].elements['SBannerTitleFontSize'].value = FT
	window.opener.document.forms['EditForm'].elements['SBannerWordingFontSize'].value = FW
	window.opener.document.forms['EditForm'].elements['SBannerAlign'].value = BA
	window.opener.document.forms['EditForm'].elements['SBannerFont'].value = BF
	window.close()
}

function mOvrTAB(src)
{
	src.style.link='#FFFFFF';
	src.style.vlink='#FFFFFF';
}
function mOutTAB(src)
{
	src.style.link='';
	src.style.vlink='';
}

function PrintPage(NextASP)
{
	replie=confirm("A new browser window will open - popups must not be blocked on this site. Click OK to see both text and pictures. Click Cancel to see text only");
	if (replie)
	{
		wdwname =
		window.open(NextASP + "PrintPage=true&PrintPix=true","PrintFriendly","dependent=yes,toolbar=yes,menubar=yes,status=no,directories=no,width=640,height=350,resizable=yes,scrollbars=yes");wdwname.focus();
	}
	else
	{
		wdwname =
		window.open(NextASP + "PrintPage=true&PrintPix=false","PrintFriendly","dependent=yes,toolbar=yes,menubar=yes,status=no,directories=no,width=650,height=450,resizable=yes,scrollbars=yes");wdwname.focus();
	}
}

function openPage(URL, wd, ht)
{
	if (wdwname)
	{
		wdwname.close();
	}
	PageName = "Page"
	if (URL.indexOf('browsepix.asp') >= 0)
	{
		PageName = "Pix"
	}
	wdwname =
window.open(URL  ,PageName, "location=yes,dependent=yes,toolbar=yes,menubar=yes,status=no,directories=no,width=" + wd + ",height=" + ht + ",resizable=yes,scrollbars=yes");
wdwname.focus();
	//return true
}

function openPhoto(URL)
{
	wdwname =
window.open("blowup.asp?URL="+URL,"BigPhoto","dependent=yes,toolbar=yes,menubar=yes,status=no,directories=no,width=552,height=404,resizable=yes,scrollbars=yes");
wdwname.focus();
}

function openVideo(URL)
{
	wdwname =
window.open("blowup.asp?URL="+URL,"Video","dependent=yes,toolbar=no,menubar=no,status=no,directories=no,width=320,height=270,resizable=no,scrollbars=no");wdwname.focus();
}

function ShowHelp(QS)
{
	wdwname =
window.open("http://www.zest-leisure.com/cgi-bin/web.asp?showbare=true&showhelp=true&" + QS  ,"Help","dependent=no,toolbar=no,menubar=yes,status=no,directories=no,width=670,height=450,resizable=yes,scrollbars=yes");wdwname.focus();
}

function testHelp()
{
	wname = window.name;
	if (wname == 'Help')
	{
		href = window.location.href;
		if (href.indexOf('showbare=true') < 0)
		{
			href = href + '&showbare=true';
			window.location.href = href
		}
	}
	else if ((wname != 'Page') && (wname != 'Pix'))
	{
		href = window.location.href;
		if (href.indexOf('showbare=true') >= 0)
		{
			href = href.replace('?showbare=true', '');
			href = href.replace('&showbare=true', '');
			window.location.href = href
		}
	}
}

var myimages=new Array()
function preloadimages()
{
	for (i=0;i<preloadimages.arguments.length;i++)
	{
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

function MyPrompt(Txt, Def)
{
	P = window.open("","URLPrompt","dependent=yes,toolbar=no,menubar=no,status=no,directories=no,width=300,height=100,resizable=no,scrollbars=no,top=200, left=200");

	Txt = '<html><head><title>Enter Link URL </title></head><body style="border : 0; width : 100%; height : 100%; align : center; background-color : #C0C0C0; font-family : Arial;"><form name="URLForm" method="GET" action="">' + Txt + ' <input name="URL" size=40 value="' + Def + '"><br><input type="button" value="Enter" onClick="return(document.URLForm.URL.value);"></form></body></html>'

	P.document.write(Txt);
	P.focus();
}

function InsertBold(TxtFld)
{
	InsertRoundSelection(document.forms['webform'].elements[TxtFld], '<b>', '</b> ');
}

function InsertUnderline(TxtFld)
{
	InsertRoundSelection(document.forms['webform'].elements[TxtFld], '<u>', '</u> ');
}

function InsertItalic(TxtFld)
{
	InsertRoundSelection(document.forms['webform'].elements[TxtFld], '<i>', '</i> ');
}

function InsertListLI(TxtFld)
{
	InsertRoundSelection(document.forms['webform'].elements[TxtFld], '<li>', '</li> ');
}

function InsertList(TxtFld)
{

	myField = document.forms['webform'].elements[TxtFld]
    //IE support
  	if (document.selection)
  	{
//alert ("IE");
		myField.focus();
		sel = document.selection.createRange();
		Txt = sel.text;
		Txt = Txt.replace(/\n/g,'</li>\n<li>');
		sel.text = Txt;
		sel.moveStart('character', -Txt.length);
		//sel.moveEnd('character', -endValue.length);
		sel.select();
  	}
	// Firefox support
	else if (typeof myField.selectionStart != 'undefined')
	{
//alert ("FF");
		before  = myField.value.substr(0, myField.selectionStart);
		Txt  = myField.value.substr(myField.selectionStart, myField.selectionEnd - myField.selectionStart);
		after  = myField.value.substr(myField.selectionEnd, myField.value.length);
		Txt = Txt.replace(/\n/g,'</li>\n<li>');
		myField.value = before + Txt + after;
		myField.selectionStart = before.length;
		myField.selectionEnd = before.length + Txt.length;
		myField.focus();
	}
  	else
  	{
//alert ("ELSE");
		myField.value += startValue + endValue;
  	}

	InsertRoundSelection(document.forms['webform'].elements[TxtFld], '<ul><li>', '</li></ul> ');
}

function InsertFontSize(TxtFld, FontSize)
{
	InsertRoundSelection(document.forms['webform'].elements[TxtFld], "<span style='font-size:" + FontSize + "px ; line-height:1.2em ; '>", "</span> ") ;
	//var FontFld = TxtFld.replace('Txt', 'SelTxt') ;
	//alert('FontFld=' + FontFld);
	document.forms['webform'].elements['Sel' + TxtFld].selectedIndex = 0 ; //13px
}

function ChangeTxtAlgn(TxtFld)
{
	AlgnSel = document.forms['webform'].elements['BAlgn' + TxtFld]
	//alert(AlgnSel.value);
	AlgnVal = AlgnSel.options[AlgnSel.selectedIndex].value;
	//alert('TxtFld=' + TxtFld + ' AlgnVal=' + AlgnVal);
	document.forms['webform'].elements[TxtFld].style.textAlign = AlgnVal ;
}

function ChangeTxtColor(TxtFld)
{
	var ColorArray = new Array() ;
	ColorArray[0] = 'body';
	ColorArray[1] = 'revbody';
	ColorArray[2] = 'navigation';
	ColorArray[3] = 'revnavigation';
	ColorArray[4] = 'banner';
	ColorArray[5] = 'revbanner';
	ColorArray[6] = 'border';
	ColorArray[7] = 'revborder';

	ColorSel = document.forms['webform'].elements['BClass' + TxtFld]
	//alert(ColorSel.value);
	ColorVal = ColorSel.options[ColorSel.selectedIndex].value;

	//alert('TxtFld=' + TxtFld + ' ColorVal=' + ColorVal + ' ColorArray=' + ColorArray[ColorVal]);
	document.forms['webform'].elements[TxtFld].className = ColorArray[ColorVal] ;
}

function InsertRoundSelection(myField, startValue, endValue)
{
    //IE support
  	if (document.selection)
  	{
		myField.focus();
		sel = document.selection.createRange();
		Txt = sel.text;
		Txt = startValue + Txt + endValue;
		sel.text = Txt;
		sel.moveStart('character', -Txt.length);
		//sel.moveEnd('character', endValue.length);
		sel.select();
  	}
	// Firefox support
	else if (typeof myField.selectionStart != 'undefined')
	{
		before  = myField.value.substr(0, myField.selectionStart);
		Txt  = myField.value.substr(myField.selectionStart, myField.selectionEnd - myField.selectionStart);
		after  = myField.value.substr(myField.selectionEnd, myField.value.length);
		Txt = startValue + Txt + endValue;
		myField.value = before + Txt + after;
		myField.selectionStart = before.length;
		myField.selectionEnd = before.length + Txt.length;
		myField.focus();
	}
  	else
  	{
		myField.value += startValue + endValue;
  	}
}

function InsertLink(TxtFld)
{
	URL = prompt("Enter the URL to which you wish to link", "http://")
	//URL = MyPrompt("Enter the URL to which you wish to link", "http://")
	if (URL != null)
	{
		if (URL.substr(0,4) == 'www.')
		{
			URL = 'http://' + URL
		}
		Txt = GetSelection(document.forms['webform'].elements[TxtFld]);
		Txt = prompt("Enter the text of the link", Txt)
		InsertAtCursor(document.forms['webform'].elements[TxtFld], '<a href="' + URL + '">' + Txt + '</a> ');
	}
}

function GetSelection(myField)
{
  	//IE support
	if (document.selection)
  	{
	  	myField.focus();
	  	sel = document.selection.createRange();
	  	Txt = sel.text;
		return(Txt);
  	}
	// Firefox support
	else if (typeof myField.selectionStart != 'undefined')
	{
		Txt  = myField.value.substr(myField.selectionStart, myField.selectionEnd - myField.selectionStart);
		return(Txt);
	}
}

function InsertAtCursor(myField, myValue)
{
  	//IE support
  	if (document.selection)
  	{
		myField.focus();
		sel = document.selection.createRange();
		InsertAtCursor = sel.text;
		sel.text = myValue;
		sel.moveStart('character', 0);
		sel.moveEnd('character', 0);
		sel.select();
  	}
	// Firefox support
	else if (typeof myField.selectionStart != 'undefined')
	{
		before  = myField.value.substr(0, myField.selectionStart);
		after  = myField.value.substr(myField.selectionEnd, myField.value.length);
		myField.value = before + myValue + after;
		myField.selectionStart = before.length;
		myField.selectionEnd = before.length + myValue.length;
		myField.focus();
	}
	else
	{
    myField.value += myValue;
  }
}

function ShowBoxes(BlockNo, Layout)
{
//alert('B=' + BlockNo + ' L=' + Layout);

	SectionTable = document.getElementById('SectionTable')
	TextBoxes = document.getElementById('TextBoxes' + BlockNo);
	ImageURLBoxes = document.getElementById('ImageURLBoxes' + BlockNo);
	Txt = document.forms['webform'].elements['Txt' + BlockNo];
	Anchor = document.getElementById('Anchor' + BlockNo);
	PicURLs = document.getElementById('PicURLs' + BlockNo);
	PicURLLabel = document.getElementById('PicURLLabel' + BlockNo);
	PicURL1 = document.forms['webform'].elements['PicURL1' + BlockNo];
	PicURL2 = document.forms['webform'].elements['PicURL2' + BlockNo];
	PicURL3 = document.forms['webform'].elements['PicURL3' + BlockNo];
	Button1 = document.forms['webform'].elements['Button1' + BlockNo];
	Button2 = document.forms['webform'].elements['Button2' + BlockNo];
	Button3 = document.forms['webform'].elements['Button3' + BlockNo];
	ImageWidthLabel = document.getElementById('ImageWidthLabel' + BlockNo);
	Width  = document.forms['webform'].elements['Width' + BlockNo];
	Layt = document.forms['webform'].elements['Layout' + BlockNo];
	Seq = document.forms['webform'].elements['Seq' + BlockNo];
	CategoryTag = document.getElementById('CategoryTag' + BlockNo);
	CategoryID = document.forms['webform'].elements['CategoryID' + BlockNo];

	Toolbar = document.getElementById('ToolbarTxt' + BlockNo);
	ToolbarFont = document.getElementById('ToolbarFontTxt' + BlockNo);
	ToolbarAlgn = document.getElementById('ToolbarAlgnTxt' + BlockNo);
	ToolbarClass = document.getElementById('ToolbarClassTxt' + BlockNo);
	ToolbarHStyle = document.getElementById('ToolbarHStyleTxt' + BlockNo);
	ToolbarGStyle = document.getElementById('ToolbarGStyleTxt' + BlockNo);

	// Hide all boxes

	TextBoxes.style.visibility = 'hidden';
	TextBoxes.style.display = 'none';
	TextBoxes.style.position = 'relative';
	TextBoxes.style.left = '0';
	TextBoxes.style.top = '0';
	ImageURLBoxes.style.visibility = 'hidden';
	ImageURLBoxes.style.display = 'none';
	ImageURLBoxes.style.position = 'relative';
	ImageURLBoxes.style.left = '0';
	ImageURLBoxes.style.top = '0';

	CategoryTag.style.visibility = 'hidden';
	CategoryTag.style.display = 'none';
	CategoryID.style.visibility = 'hidden';
	CategoryID.style.display = 'none';

	// set boxes visible where req for layout
	Txt.style.fontWeight = 'normal';
	Txt.style.fontSize = '13px';

	PicURLs.style.visibility = 'visible';
	PicURLs.style.display = 'inline';
	PicURLLabel.innerHTML = 'Image URL'
	ImageWidthLabel.innerHTML = 'Image Width'
	PicURL1.size = 30;
	Button1.style.visibility = 'visible';
	Button1.style.display = 'inline';

	ToolbarFont.style.visibility = 'hidden';
	ToolbarFont.style.display = 'none';
	ToolbarAlgn.style.visibility = 'hidden';
	ToolbarAlgn.style.display = 'none';
	ToolbarClass.style.visibility = 'hidden';
	ToolbarClass.style.display = 'none';
	ToolbarHStyle.style.visibility = 'hidden';
	ToolbarHStyle.style.display = 'none';
	ToolbarGStyle.style.visibility = 'hidden';
	ToolbarGStyle.style.display = 'none';
	Toolbar.style.visibility = 'hidden';
	Toolbar.style.display = 'none';

	if (Layout == 0)
	{
		TextBoxes.style.visibility = 'visible';
		TextBoxes.style.display = 'block';
		TextBoxes.style.width = '98%';

		Txt.rows = 2;
		//Txt.cols = 75;
		Txt.style.fontWeight = 'bold';
		Txt.style.width = '100%';

		Toolbar.style.visibility = 'visible';
		Toolbar.style.display = 'block';
		ToolbarHStyle.style.visibility = 'visible';
		ToolbarHStyle.style.display = 'inline';
	}
	else if ((Layout == 1) || (Layout == 15) || (Layout == 16)) // FW Text OR GetXML or Gallery
	{
		TextBoxes.style.visibility = 'visible';
		TextBoxes.style.display = 'block';
		//TextBoxes.style.position = 'relative';
		//TextBoxes.style.left = 0;
		TextBoxes.style.cssFloat = 'left';
		TextBoxes.style.styleFloat = 'left';
		TextBoxes.style.width = '98%';

		Txt.rows = 8;
		//Txt.cols = 75;
		Txt.style.width = '100%';

		if (Layout == 1)
		{
			Toolbar.style.visibility = 'visible';
			Toolbar.style.display = 'block';
			ToolbarFont.style.visibility = 'visible';
			ToolbarFont.style.display = 'inline';
			ToolbarAlgn.style.visibility = 'visible';
			ToolbarAlgn.style.display = 'inline';
			ToolbarClass.style.visibility = 'visible';
			ToolbarClass.style.display = 'inline';
		}

		if (Layout == 16) // Gallery
		{
				Toolbar.style.visibility = 'visible';
				Toolbar.style.display = 'block';
				ToolbarGStyle.style.visibility = 'visible';
				ToolbarGStyle.style.display = 'inline';
		}

		if ((Layout == 16) && (Txt.value.length == 0))
		{
			Txt.value = 'Thumbnail, Large picture, Title text'
		}

	}
	else if ((Layout == 2 ) || (Layout == 18 ))  // Pic/text - Iframe/text
	{
		TextBoxes.style.visibility = 'visible';
		TextBoxes.style.display = 'block';
		//TextBoxes.style.position = 'relative';
		//TextBoxes.style.left = '300px';
		TextBoxes.style.cssFloat = 'right';
		TextBoxes.style.styleFloat = 'right';
		TextBoxes.style.width = '50%';

		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';
		ImageURLBoxes.style.width = '45%';
		//ImageURLBoxes.style.position = 'relative';
		//ImageURLBoxes.style.top = '-135px';
		//ImageURLBoxes.style.left ='0';

		if (Layout == 18)
		{
			PicURLLabel.innerHTML = 'Iframe URL'
			ImageWidthLabel.innerHTML = 'Iframe Width'
			PicURL1.size = 30;
			Button1.style.visibility = 'hidden';
			Button1.style.display = 'none';
		}

		Txt.rows = 8;
		//Txt.cols = 38;
		Txt.style.width = '100%';

		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'hidden';
		PicURL2.style.display = 'none';
		PicURL3.style.visibility = 'hidden';
		PicURL3.style.display = 'none';

		Button2.style.visibility = 'hidden';
		Button2.style.display = 'none';
		Button3.style.visibility = 'hidden';
		Button3.style.display = 'none';

		if (Layout == 2)
		{
			Toolbar.style.visibility = 'visible';
			Toolbar.style.display = 'block';
			ToolbarFont.style.visibility = 'visible';
			ToolbarFont.style.display = 'inline';
			ToolbarAlgn.style.visibility = 'visible';
			ToolbarAlgn.style.display = 'inline';
			ToolbarClass.style.visibility = 'visible';
			ToolbarClass.style.display = 'inline';
		}

	}
	else if (Layout == 3) // Pic / pic
	{
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.width = '90%';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';

		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'visible';
		PicURL2.style.display = 'inline';
		PicURL3.style.visibility = 'hidden';
		PicURL3.style.display = 'none';

		PicURL1.size = 20;
		PicURL2.size = 20;

		Button1.style.visibility = 'visible';
		Button1.style.display = 'inline';
		Button2.style.visibility = 'visible';
		Button2.style.display = 'inline';
		Button3.style.visibility = 'hidden';
		Button3.style.display = 'none';

	}
	else if ((Layout == 4 ) || (Layout == 19 ))  //  Text / pic - Text / Iframe
	{
		TextBoxes.style.visibility = 'visible';
		TextBoxes.style.display = 'block';
		TextBoxes.style.position = 'relative';
		TextBoxes.style.left = 0;
		TextBoxes.style.cssFloat = 'left';
		TextBoxes.style.styleFloat = 'left';
		TextBoxes.style.width = '50%';

		Txt.rows = 8;
		///Txt.cols = 38;
		Txt.style.width = '100%';

		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		//ImageURLBoxes.style.position = 'relative';
		//ImageURLBoxes.style.top = '-130px';
		//ImageURLBoxes.style.left = '320px';
		ImageURLBoxes.style.cssFloat = 'right';
		ImageURLBoxes.style.styleFloat = 'right';
		ImageURLBoxes.style.width = '45%';

		if (Layout == 19)
		{
			PicURLLabel.innerHTML = 'Iframe URL'
			ImageWidthLabel.innerHTML = 'Iframe Width'
			PicURL1.size = 30;
			Button1.style.visibility = 'hidden';
			Button1.style.display = 'none';
		}

		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'hidden';
		PicURL2.style.display = 'none';
		PicURL3.style.visibility = 'hidden';
		PicURL3.style.display = 'none';

		Button2.style.visibility = 'hidden';
		Button2.style.display = 'none';
		Button3.style.visibility = 'hidden';
		Button3.style.display = 'none';

		if (Layout == 4)
		{
			Toolbar.style.visibility = 'visible';
			Toolbar.style.display = 'block';
			ToolbarFont.style.visibility = 'visible';
			ToolbarFont.style.display = 'inline';
			ToolbarAlgn.style.visibility = 'visible';
			ToolbarAlgn.style.display = 'inline';
			ToolbarClass.style.visibility = 'visible';
			ToolbarClass.style.display = 'inline';
		}

	}
	else if ((Layout == 5 ) || (Layout == 6 ) || (Layout == 20 ))  //  L D and B Separators
	{
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';
		ImageURLBoxes.style.width = '30%';
		PicURLs.style.visibility = 'hidden'
		PicURLs.style.display = 'none'
		ImageWidthLabel.innerHTML = 'Height'
	}
	else if (Layout == 7) // FW Pic
	{
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';
		ImageURLBoxes.style.width = '30%';

		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'hidden';
		PicURL2.style.display = 'none';
		PicURL3.style.visibility = 'hidden';
		PicURL3.style.display = 'none';

		PicURL1.size = 20;

		Button1.style.visibility = 'visible';
		Button1.style.display = 'inline';
		Button2.style.visibility = 'hidden';
		Button2.style.display = 'none';
		Button3.style.visibility = 'hidden';
		Button3.style.display = 'none';

	}
	else if (Layout == 8) // Search Products
	{
	}
	else if (Layout == 9) // Online Shop
	{
		CategoryTag.style.visibility = 'visible';
		CategoryTag.style.display = 'inline';
		CategoryID.style.visibility = 'visible';
		CategoryID.style.display = 'inline';
	}
	else if (Layout == 11) // Pic / pic / pic
	{
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.width = '90%';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';

		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'visible';
		PicURL2.style.display = 'inline';
		PicURL3.style.visibility = 'visible';
		PicURL3.style.display = 'inline';

		PicURL1.size = 20;
		PicURL2.size = 20;
		PicURL3.size = 20;

		Button1.style.visibility = 'visible';
		Button1.style.display = 'inline';
		Button2.style.visibility = 'visible';
		Button2.style.display = 'inline';
		Button3.style.visibility = 'visible';
		Button3.style.display = 'inline';
	}
	else if (Layout == 17) // FW IFrame
	{
		ImageURLBoxes.style.visibility = 'visible';
		ImageURLBoxes.style.display = 'block';
		ImageURLBoxes.style.width = '50%';
		ImageURLBoxes.style.cssFloat = 'left';
		ImageURLBoxes.style.styleFloat = 'left';
		PicURLLabel.innerHTML = 'Iframe URL'
		ImageWidthLabel.innerHTML = 'Iframe Width'
		PicURL1.style.visibility = 'visible';
		PicURL1.style.display = 'inline';
		PicURL2.style.visibility = 'hidden';
		PicURL2.style.display = 'none';
		PicURL3.style.visibility = 'hidden';
		PicURL3.style.display = 'none';

		Button2.style.visibility = 'hidden';
		Button2.style.display = 'none';
		Button3.style.visibility = 'hidden';
		Button3.style.display = 'none';

		PicURL1.size = 30;
		Button1.style.visibility = 'hidden';
		Button1.style.display = 'none';
	}
}

function CopyField(FName)
{
	fld = document.getElementById(FName);
	//fld.focus();
	//fld.select();
	textRange = fld.createTextRange();
	textRange.execCommand("Copy");
}

function PasteVal(FVal, FName, FForm)
{
	//alert("FForm=" + FForm + " FVal = " + FVal + " FName=" + FName)
	fld = window.opener.document.forms[FForm].elements[FName];
	fld.value = FVal;
	fld.select();
}

function PublishHTML(SecureScript, PageID)
{

	allhtml = document.getElementById("ALLHTML");

	allhtml = allhtml.innerHTML;

	//alert(allhtml);

	//href = window.location.href;

	//href = SecureScript + '/cgi-bin/publishHTML.asp?PageID=' + PageID +  '&HTML=' + allhtml;

	//window.location.href = href;

	//alert(href);

	document.forms["PublishHTML"].elements["PageID"].value = PageID;
	document.forms["PublishHTML"].elements["HTML"].value = allhtml;
	document.forms["PublishHTML"].submit();

}

function DispHeadingStyle(Fld, FForm)
{


	HS = document.forms[FForm].elements[Fld]
	HStyl = HS.options[HS.selectedIndex].value
	//alert('DHS'+HStyl);
	for (var yy = 0; (yy <= 5); yy++)
	{
		tab = document.getElementById("TableHead" + yy);
		tab.style.visibility = "hidden";
		tab.style.display = "none";
		if (yy == HStyl)
		{
	//alert('yy'+yy);
			tab.style.visibility = "visible";
			tab.style.display = "inline";
		}
	}
}

-->
