<!--#include virtual="/includes/topofpage.asp"-->
<!--#include file="includes/Pagefunctions.asp"-->
<%

Dim Page 
Page = "50"

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")

If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = Page) Then


End If

On Error Resume Next

%>
<html>
<STYLE>
BODY {SCROLLBAR-FACE-COLOR: #5e5ebe; SCROLLBAR-HIGHLIGHT-COLOR: #5e5ebe; SCROLLBAR-SHADOW-COLOR: #5e5ebe; SCROLLBAR-3DLIGHT-COLOR: #5e5ebe; SCROLLBAR-ARROW-COLOR:  #6666CC; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }
</STYLE>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function Sub_Form (cont)
{
  form1.cont.value=cont;
  form1.submit();
}

function subref (cont)
{
  form1.action='';
  form1.cont.value=cont;
  form1.submit();
}

function toggle_div() {

	var argz=toggle_div.arguments;

	var divID = argz[0];
	var override = argz[1];

	var divobj = MM_findObj(divID);

	if (divobj.style.display=='inline') {
	    divobj.style.display='none';
	} else if (divobj.style.display=='none') {
	    divobj.style.display='inline';
	}

	if (override) {
	    divobj.style.display=override;
	}
	return true;
}
//-->
</script>
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/icon-return-to-main-2.gif','images/icon-submit-changes-2.gif','images/icon-continue-wizard-2.gif')">
<form name="form1" method="post" action="package-create-merch.asp">
<INPUT type="hidden" id=page name=page value="<%=Page%>">
<INPUT type="hidden" id=cont name=cont value="">

<%

ReDim Lodging_Group_Arr(Request.Form("Room_Items").Count)
Dim i, Dont_Do_It
i = 0

For Each item in Request.Form
  If Not UCase(item) = "PAGE" And Not UCase(item) = "CONT" And Not UCase(item) = "LODGING_GROUP" And Not Mid(UCase(item), 1, 12) = "LODGING_NAME"  And Not Mid(UCase(item), 1, 15) = "ROOM_ITEM_GROUP" And Not Mid(UCase(item), 1, 13) = "ROOM_ITEM_OCC" And Not Mid(UCase(item), 1, 14) = "ROOM_ITEM_COST" And Not Mid(UCase(item), 1, 14) = "ROOM_ITEM_NAME" Then
  'If Not UCase(item) = "PAGE" And Not UCase(item) = "CONT" And Not Mid(UCase(item), 1, 15) = "ROOM_ITEM_GROUP" And Not item="Limit_Display" Then
	If UCase(Item) = "ROOM_ITEMS" Then
		For each value in Request.Form(item)
			Item_Group_ID = Request.Form("Room_Item_Group" & value)
%>			<input type="hidden" name="<%=item%>" value="<%=value%>">
			<input type="hidden" name="Room_Item_Group<%=value%>" value="<%=Item_Group_ID%>">
			<input type="hidden" name="Room_Item_Occ<%=value%>" value="<%=Request.Form("Room_Item_Occ" & value)%>">
			<input type="hidden" name="Room_Item_Cost<%=value%>" value="<%=Request.Form("Room_Item_Cost" & value)%>">
			<input type="hidden" name="Room_Item_Name<%=value%>" value="<%=Request.Form("Room_Item_Name" & value)%>">
<%
			Dont_Do_It = False
			For j = 0 to UBound(Lodging_Group_Arr) -1
				If Item_Group_ID = Lodging_Group_Arr(j) Then
					Dont_Do_It = True
				End If
			Next

			If Dont_Do_it = False Then
%>				<input type="hidden" name="Lodging_Group" value="<%=Item_Group_ID%>">
				<input type="hidden" name="Lodging_Name<%=Item_Group_ID%>" value="<%=Request.Form("Lodging_Name" & Item_Group_ID)%>">
<%			End If
			Lodging_Group_Arr(i) = Item_Group_ID
			i = i + 1
		Next
	Else
  	   If Not UCase(Mid(Item, 1, 4)) = "ATT_" And Not UCase(Mid(Item, 1, 5)) = "LIMIT" Then
		For each value in Request.Form(item)
%>			<input type="hidden" name="<%=item%>" value="<%=value%>">
<%
		Next
	   End If
	End If
  End If
Next
%>
<table width="525" border="0" cellspacing="0" cellpadding="2" align="center">
  <tr bgcolor="#FFFFFF"> 
    <td width="467">&nbsp;</td>
    <td align="right" width="58">&nbsp;</td>
  </tr>
  <tr bgcolor="#5e5ebe">
    <td width="467" align="center" class="headline-ffffff">Select Package Attraction/Excursion 
      Items</td>
    <td bgcolor="#5e5ebe" align="right" width="58"><a href="javascript:;" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','images/icon-return-to-main-2.gif',1)" onClick="MM_goToURL('parent','default-lodging.asp');return document.MM_returnValue"><img src="images/icon-return-to-main.gif" width="75" height="17" usemap="#returntomain" border="0" name="Image1"></a></td>
  </tr>
  <tr> 
    <td width="467" class="sm-hdln"><%= Request("Package_Name") & " - " & Request("Package_Type") %></td>
    <td width="58" class="sm-hdln">&nbsp;</td>
  </tr>
</table>

<% If Not Request("Tickets") = "" Then %>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr align="center"> 
      <td colspan="3" align="right" class="standard-input-form">Limit to City: <input type="radio" name="Limit_Display" value="checked" onClick="subref('3');" <%= Request("Limit_Display")%>> Limit to Inventory: <input type="radio" name="Limit_Display" value="" onClick="subref('3');" <% If Request("Limit_Display") = "" Then response.write("checked")%>></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr align="center"> 
      <td width="350" class="standard-input-form">Available Attractions:</td>
      <td width="59" class="standard-input-form">Cost</td>
      <td width="91" class="standard-input-form">Include</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
<%
	SQLInv = "Select ilm.Item_ID, ipm.Inventory_List_ID, g.Group_ID, g.[Name], ilm.[Name] ""Item_Name"", ipm.Description, ipm.Cost from Inventory_List_Merchandise ILM "
	SQLInv = SQLInv & "inner join Inventory_Price_Merchandise IPM on ILM.Item_ID = IPM.Item_ID "
	SQLInv = SQLInv & "inner join [Group] G On G.Group_ID = IPM.Group_ID "
	SQLInv = SQLInv & "inner join [Group_Entity_Map] GEM On GEM.Group_ID = G.Group_ID "
	SQLInv = SQLInv & "inner join [Entity] E On E.Entity_ID = GEM.Entity_ID "
	SQLInv = SQLInv & "inner join [Entity_Detail] ED On ED.Entity_ID = E.Entity_ID "
	SQLInv = SQLInv & "inner join Inventory_Realm_Map IRM On IRM.Inventory_List_ID = IPM.Inventory_List_ID "
	SQLInv = SQLInv & "Where Merchandise_Type_ID = '1' And IRM.Inventory_Type_ID = '2' And IRM.Realm='" & Session("Admin_Realm") & "' "
If Request("Limit_Display") = "checked" Then
	SQLInv = SQLInv & " And ED.State = '" & Request("State") & "' And (ED.City like '" & Request("City") & "' "

	SQL4 = "Get_Combo_City @State_Abbr='" & Request("State") & "', @Child_City= '" & Request("City") & "', @Realm_ID='" & Session("Admin_Realm") & "'"
'	Response.Write SQL4
	Set RS4=Conn.Execute(SQL4)
	While Not RS4.EOF
		SQLInv = SQLInv & "Or ED.City like '" & RS4("Parent_City") & "' "
		RS4.MoveNext
	Wend
	Set RS4 = Nothing

	SQLInv = SQLInv & ")"
End If
'	For Each Grp in Request("Lodging_Group")
'		SQLInv = SQLInv & " And Not G.Group_ID = '" & Grp & "'"
'	Next
	
	SQLInv = SQLInv & " Order By G.Name, ilm.Name, ipm.Description, ipm.Cost"
	
	Dim RSInv
	Set RSInv = Conn.Execute(SQLInv)
	
	Dim First_Run, Prev_Name
	First_Run = True
	
	Do While Not RSInv.EOF
	If Not RSInv("Item_Name") = "" Then
%>
<% If Not Ucase(RSInv("Name")) = UCase(Prev_Name) Then %>
<% If Not First_Run = True Then %>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
</table>
</div>
</td></tr>
<% End If %>
    <tr> 
      <td class="manage-menu" valign="bottom" colspan="3"><a class="manage-menu" onclick="return toggle_div('div<%=RSInv("Group_ID")%>');" href="#"><font size="1"><b><%=RSInv("Name")%></b></font></a></td>
	</tr>
<tr><td colspan="3" valign="bottom" class="manage-menu">
<div id="div<%=RSInv("Group_ID")%>" name="div<%=RSInv("Group_ID")%>" style="{ width:100%;height:100%;display:none; }">
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr align="center"> 
      <td width="350"></td>
      <td width="59"></td>
      <td width="91"></td>
    </tr>
<%	End If	%>
    <tr> 
      <td class="manage-menu" valign="bottom"><font size="1">&nbsp;&nbsp; - <%= RSInv("Item_Name")%>: <%= RSInv("Description")%></font></td>
      <td class="input-box" align="center" valign="bottom"><%= FCurrency(RSInv("Cost"), 3) %></td>
      <td class="input-box" align="center" valign="bottom">
        <input type="hidden" name="Att_Items" value="<%=RSInv("Inventory_List_ID")%>">
        <input type="hidden" name="Att_Group<%=RSInv("Inventory_List_ID")%>" value="<%=RSInv("Group_ID")%>">
        <input type="hidden" name="Att_Name<%=RSInv("Inventory_List_ID")%>" value="<%=RSInv("Name")%>">
        <input type="hidden" name="Att_Cost<%=RSInv("Inventory_List_ID")%>" value="<%=RSInv("Cost")%>">
        <input type="hidden" name="Att_ItemName<%=RSInv("Inventory_List_ID")%>" value="<%= RSInv("Item_Name")%>: <%= RSInv("Description")%>">
        <input type="checkbox" name="Att_Quantity<%=RSInv("Inventory_List_ID")%>" size="2" class="input-box" value="1"></td>
    </tr>

    <%
	Prev_Name = RSInv("Name")
	End If
	If First_Run = True Then First_Run = False
	RSInv.MoveNext
	Loop
%>
</table>
</div>
</td></tr>

    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
<% Else %>
<div align="center" class="manage-menu"><br>No tickets included. Please continue.<br><br></div>
<% End If %>

<table width="525" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr bgcolor="#5e5ebe">
    <td align="right" width="49%" height="18"><a href="javascript:Sub_Form('1');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('submitchanges','','images/icon-submit-changes-2.gif',1)"><img src="images/icon-submit-changes.gif" width="200" height="15" name="submitchanges" border="0"></a></td>
    <td width="51%" height="18"><a href="javascript:Sub_Form('2');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','images/icon-continue-wizard-2.gif',1)" target="content"><img src="images/icon-continue-wizard.gif" width="150" height="15" usemap="#continue" border="0" name="Image2"></a></td>
  </tr>
  <tr> 
    <td width="49%">&nbsp;</td>
    <td width="51%">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
