<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request); 

  /* **************************************************************************
%name: WizBanner_js.jsp %
%version: 4 %
%date_modified: Mon Feb 24 10:01:10 2003 %
Copyright (c) 2001, 2002 Novell, Inc. All Rights Reserved.
THIS WORK IS AN UNPUBLISHED WORK AND CONTAINS CONFIDENTIAL PROPRIETARY
AND TRADE SECRET INFORMATION OF NOVELL, INC. ACCESS TO THIS WORK IS
RESTRICTED TO (I) NOVELL, INC. EMPLOYEES WHO HAVE A NEED TO KNOW HOW
TO PERFORM TASKS WITHIN THE SCOPE OF THEIR ASSIGNMENTS AND (II)
ENTITIES OTHER THAN NOVELL, INC. WHO HAVE ENTERED INTO APPROPRIATE
LICENSE AGREEMENTS. NO PART OF THIS WORK MAY BE USED, PRACTICED,
PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, TRANSFORMED
OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC. ANY USE
OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT THE
PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
***************************************************************************  */ 



  /* -----------------------------------------------------------------  */ 
  /* This file contains JavaScript specific to the wizard banner panel.  */ 
  /* -----------------------------------------------------------------  */ 

  /* The following object is used to track banner data so that we don"t  */ 
  /* update the banner panel unless it"s changing.                       */%> 
var	Wiz_BannerData = null;



<%/* ---------------------------------------------------------------  */ 
  /* Compares two banner data arrays returning true if they"re equal  */ 
  /* and false otherwise.                                             */ 
  /* ---------------------------------------------------------------  */%> 
function bannerDataEqual(
	aData1,	<%/* The first  banner data array to compare.  */%> 
	aData2)	<%/* The second banner data array to compare.  */%> 
{
	var	c1;
	var	c2;
	var	i;

	
	<%/* Do the banner data arrays contain the same number of items?  */%> 
	c1 = 0; for (i in aData1) c1 += 1;
	c2 = 0; for (i in aData2) c2 += 1;
	if (c1 != c2)
	{
		<%/* No!  Then they can"t be equal.  */%> 
		return( false );
	} <%/* if  */ 
	

	  /* Scan the banner data items in the first array...  */%> 	
	for (i in aData1)
	{
		<%/* Does the item from the first array exist in the second?  */%> 
		if ((!(isDefined( aData2[i] ))) ||
			(String( aData1[i] ).toLowerCase() != String( aData2[i] ).toLowerCase()))
		{
			<%/* No!  Then the banner data arrays aren"t equal.  */%> 
			return( false );
		} <%/* if  */%> 
	} <%/* for  */ 


	  /* If we get here, the banner data arrays are equal.  Return  */ 
	  /* true.                                                      */%> 
	return( true );
} <%/* bannerDataEqual  */ 



  /* -----------------------------------  */ 
  /* Initializes the Wizard banner panel.  */ 
  /* -----------------------------------  */%> 
function initializeBannerPanel()
{
	<%/* Build a banner data object for our current layout.  */%> 
	Wiz_BannerData = new Array();
	
	<% if ( c.def("Wiz_Header_Size")) { 
	         c.set("numRows", c.var("Wiz_Header_Size")); 
	   } else {    c.set("numRows", "0"); 
	   } %>
	Wiz_BannerData["Wiz_Header_Size"] = <%= c.var("numRows") %>;
	
	<% if (("".equals(c.var("Wiz_Banner_Text")) == false)) { %>
		Wiz_BannerData["Wiz_Banner_Text"] = "<%= c.var("Wiz_Banner_Text") %>";
	<% } 
	
	   if (((c.var("true").equals(c.var("Wiz_Banner_ShowHelp"))) || ("true".equals(c.var("Wiz_Banner_ShowHelp"))))) { %>
		Wiz_BannerData["Wiz_Banner_ShowHelp"] = true;
	<% } 
	
	   c.set("i", "0"); 
	   while (((c.lt(c.var("i"), c.var("numRows"))) && (c.lt(c.var("i"), "2")))) { 
		   c.set("bigName", c.plus("Wiz_Header_Big_", c.var("i")));         c.set("bigNameV", c.var(c.var("bigName"))); 
		   c.set("boldName", c.plus("Wiz_Header_Bold_", c.var("i")));        c.set("boldNameV", c.var(c.var("boldName"))); 
		   c.set("centerName", c.plus("Wiz_Header_Center_", c.var("i")));      c.set("centerNameV", c.var(c.var("centerName"))); 
		   c.set("iconName", c.plus("Wiz_Header_Icon_", c.var("i")));        c.set("iconNameV", c.var(c.var("iconName"))); 
		   c.set("itemName", c.plus("Wiz_Header_Item_", c.var("i")));        c.set("itemNameV", c.var(c.var("itemName"))); 
		   c.set("typeName", c.plus("Wiz_Header_Type_", c.var("i")));        c.set("typeNameV", c.var(c.var("typeName"))); 
		   c.set("unknownName", c.plus("Wiz_Header_Unknown_", c.var("i")));     c.set("unknownNameV", c.var(c.var("unknownName"))); 
		
		   if (((c.var("false").equals(c.var("bigNameV")) == false) && ("false".equals(c.var("bigNameV")) == false))) { %> Wiz_BannerData["<%= c.var("bigName") %>"]     = "<%= c.var("bigNameV") %>";<% } 
		   if (((c.var("false").equals(c.var("boldNameV")) == false) && ("false".equals(c.var("boldNameV")) == false))) { %> Wiz_BannerData["<%= c.var("boldName") %>"]    = "<%= c.var("boldNameV") %>";<% } 
		   if (((c.var("false").equals(c.var("centerNameV")) == false) && ("false".equals(c.var("centerNameV")) == false))) { %> Wiz_BannerData["<%= c.var("centerName") %>"]  = "<%= c.var("centerNameV") %>";<% } 
		   if (("".equals(c.var("iconNameV")) == false)) { %>                                    Wiz_BannerData["<%= c.var("iconName") %>"]    = "<%= c.var("iconNameV") %>";<% } 
		   if (("".equals(c.var("itemNameV")) == false)) { %>                                    Wiz_BannerData["<%= c.var("itemName") %>"]    = "<%= c.toScript(c.var("itemNameV")) %>";<% } 
		   if (("".equals(c.var("typeNameV")) == false)) { %>                                    Wiz_BannerData["<%= c.var("typeName") %>"]    = "<%= c.var("typeNameV") %>";<% } 
		   if (("".equals(c.var("unknownNameV")) == false)) { %>                                    Wiz_BannerData["<%= c.var("unknownName") %>"] = "<%= c.var("unknownNameV") %>";<% } 
		
		   c.inc("i"); 
	   } 
	
	
	  /* Tell the frameset that another frameset component has  */ 
	  /* loaded.                                                      */%> 
	parent.window.frameLoaded( "Wiz_BannerFrame" );
} <%/* initializeBannerPanel  */ 



  /* ----------------------------------------------------------------  */ 
  /* Forces the banner frame to update using new caption information.  */ 
  /* ----------------------------------------------------------------  */%> 
function updateCaption(
	aData)	<%/* Array containing the caption information for updating.  */%> 
{
	<%/* This function works on the Wizard banner form.  */%> 
	with (getBannerWizForm())
	{
		var	i;
		var	j;
		
		
		<%/* We"re we given an array of caption information?  */%> 
		if (null == aData)
		{
			<%/* No!  Default to no caption information.  */%> 
			aData = new Array();
		} <%/* if  */ 
		
		
		  /* If we"re updating the banner panel to contain the same  */ 
		  /* thing it"s already displaying...                        */%> 
		if (bannerDataEqual( aData, Wiz_BannerData ))
		{
			<%/* ...ignore the request.  */%> 
			return;
		} <%/* if  */%> 
		Wiz_BannerData = aData;
		

		<%/* Reset the hidden banner widgets so that only those items  */ 
		  /* in the caption information are put into effect.           */%> 
		Wiz_Banner_Text.value      = "";
		Wiz_Banner_ShowHelp.value  = false;
		Wiz_Header_Size.value      = 0;
		Wiz_Header_Center_0.value  = false;
		Wiz_Header_Center_1.value  = false;
		Wiz_Header_Big_0.value     = false;
		Wiz_Header_Big_1.value     = false;
		Wiz_Header_Bold_0.value    = false;
		Wiz_Header_Bold_1.value    = false;
		Wiz_Header_Icon_0.value    = "";
		Wiz_Header_Icon_1.value    = "";
		Wiz_Header_Item_0.value    = "";
		Wiz_Header_Item_1.value    = "";
		Wiz_Header_Type_0.value    = "";
		Wiz_Header_Type_1.value    = "";
		Wiz_Header_Unknown_0.value = "";
		Wiz_Header_Unknown_1.value = "";

			
		<%/* Scan the caption information...  */%> 
		for (i in aData)
		{
			<%/* ...copying each value to the appropriate widget.  */%> 
			for (j = 0; j < elements.length; j += 1) 
			{
				if (elements[j].name == String( i ))
				{
					elements[j].value = String( aData[i] );
					break;
				} <%/* if  */%> 
			} <%/* for  */%> 
		} <%/* for  */ 
		

		  /* Finally, submit the form to effect the update.  */%> 
		submit();
	} <%/* with  */%> 
} <%/* updateCaption  */ 



						     /* * * * * * *  */ 
                             /* End of File  */ 
                             /* * * * * * *  */%> 
