
<%

	Set Conn = Server.CreateObject("ADODB.Connection")
	Conn.Open Application("conn_string")
	
		Set RSAmenity = Server.CreateObject("ADODB.Recordset")
		SQLAmenity = "Select AP.[Amenity_ID], AP.[Group_ID], II.[Item_ID], AP.[Name], AP.[Description], ATT.[Att_Desc], E.[Name] as E_Name "
		SQLAmenity = SQLAmenity & "from Entity E "
		SQLAmenity = SQLAmenity & "Inner Join (Group_Entity_Map GEM "
		SQLAmenity = SQLAmenity & "Inner Join ([Group] G "
		SQLAmenity = SQLAmenity & "Inner Join (Attribute_Type ATT "
		SQLAmenity = SQLAmenity & "Inner Join (Inventory_Item II "
		SQLAmenity = SQLAmenity & "Inner Join Amenity_Package AP "
		SQLAmenity = SQLAmenity & "On II.Amenity_ID = AP.Amenity_ID) "
		SQLAmenity = SQLAmenity & "On ATT.Att_ID = II.Att_ID) "
		SQLAmenity = SQLAmenity & "On AP.Group_ID = G.Group_ID) " 
		SQLAmenity = SQLAmenity & "On GEM.Group_ID = G.Group_ID) " 
		SQLAmenity = SQLAmenity & "On E.Entity_ID = GEM.Entity_ID "
		SQLAmenity = SQLAmenity & "Where E.Entity_ID='" & Session("Entity_ID") & "' "
		SQLAmenity = SQLAmenity & "Order By ATT.Att_Desc_Detail"
		
		Set RSAmenity = Conn.Execute(SQLAmenity)
	
	
	Dim tmpArray1, transArray1
    tmpArray1 = Session("Itinerary_Items")

' Packages! :)

SQL = "[Avante].[dbo].[Get_Package_Items_No_Tax] @Package_ID='" & Session("Package_ID") & "', @Realm_ID='" & Session("Site_Realm") & "', @Date='" & Session("ArrivalDate") & "'"
Set RSPack = Conn.Execute(SQL)
                    
%>

<link rel="stylesheet" href="../Style-sheets/page-formatting.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline-large.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline-large.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/atrraction-set.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/attraction-set.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/emagineering.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/galley-text-indent.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/Lodging-display.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/input-form-small.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/page-formatting.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/Profile-layout.css" type="text/css">
<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];}
}
//-->
</script>

<body bgcolor=transparent onLoad="MM_preloadImages('/images/planner/planner-temp-2_r2_c1.gif','/images/planner/planner-temp-2_r2_c2.gif','/images/planner/planner-temp-2_r2_c3.gif','/images/planner/planner-temp-2_r1_c1.gif','../images/delete.gif')">
<table border="0" cellspacing="0" cellpadding="0" width="200">
  <tr> 
    <td bgcolor="#2A2F88" width="2"><img src="/images/shim.gif" width="2" height="1"></td>
    <td width="197" align="right"> 
      <table width="196" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
        <tr height="7"> 
          <td width="200" class="itinerary-name" height="7"><%If Not Trim(Session("Itinerary_ID")) = "" Then 
		Response.Write "Active Itinerary:&nbsp;"
		If Not Trim(Session("Itinerary_Name")) = "" Then 
		Response.Write Session("Itinerary_Name")      
		Else Response.Write "Unnamed"
		End If
		End If%></td>
        </tr>
        <tr height="1"> 
          <td width="200" height="1" bgcolor="#2A2F88"><img src="/images/shim.gif" width="100%" height="1"></td>
        </tr>
        <tr> 
          <td width="200"> <%
          If LodgingExists(tmpArray1) Then%>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td colspan="2" class="planner-hotel-name" > </td>
              </tr>
              <tr bgcolor="#2A2F88"> 
                <td class="headline-ffffff-small" width="85%" align="center">Lodging 
                  Items</td>
                <td class="headline-ffffff-small" width="15%" align="center">Qty</td>
              </tr>
              <tr><td>
                  <span class="planner-instructions">
                  <img src="../images/delete-dim.gif" name="Image11" onMouseOut="MM_swapImgRestore()" onClick="MM_swapImage('Image11','','../images/delete.gif',1)" width="13" height="13"> 
                  </span><span class="planner-instructions">Click to remove a 
                  selection</span></td>
              </tr>
            </table>
            <%End If
            If Not (tmpArray1(1,0) = "" And UBound(tmpArray1, 2) = "0") Then
                    For j = tmpArray1(10, LBound(tmpArray1, 2)) to tmpArray1(10, UBound(tmpArray1, 2))
						transArray1 = GetRooms(tmpArray1, j)
						If Not GetFirstDateByID(tmpArray1, j) = "Merc" Then
                               %>
            <table width="197" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="88%" class="planner-hotel-name"><img src="../images/delete-dim.gif" name="Image1" alt="Click To Delete This Item" onClick="location.href('cleartrans.asp?Trans_ID=<%=j%>&URL=<%=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")%>')" width="13" height="13" style="{cursor: hand}">&nbsp;<%=GetFirstDateByID(tmpArray1, j) & "-" & GetLastDateByID(tmpArray1, j)%><br>
                  <%=GetEntityNameOnlyFromID(tmpArray1, transArray1(10, 0))%></td>
                <td width="12%" class="planner-hotel-name" align="right"><%=transArray1(2, 0)%> 
                  <br>
                </td>
              </tr>
            </table>
            <hr width="95%" color="#FFA218" size="1" noshade align="center">
            <%End If
                                Next
                                End If%>
            <%If Not RSAmenity.EOF Then %>
            <%
                    RSAmenity.MoveFirst()
                    Do While Not RSAmenity.EOF
                    %>
                    <FORM action="savearray.asp" method=POST id=saveform name=saveform>
            <div id=INV_<%=RSAmenity("Item_ID")%> style="{display:none}"> 
              <table width="197" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="88%" class="planner-hotel-name"><%=ArrivalDate & " - " & DateAdd("d", dayCount, ArrivalDate)%><br>
                    <%=RSAmenity("E_Name")%><br>
                    <%=RSAmenity("Att_Desc") & " - " & RSAmenity("Name")%></td>
                  <td width="12%" class="baseline" align="right"> 
                    <input size=1 align=center type="text" id=Qty_<%=RSAmenity("Item_ID")%> name=Qty_<%=RSAmenity("Item_ID")%> readonly style="border-style:none;background-color:transparent;font-family: Verdana, Arial, Helvetica; vertical-align:baseline; font-size: 10px; font-style: normal; line-height: normal; font-weight: bold; color: #2A2F88; text-decoration: none">
                    <br>
                  </td>
                </tr>
              </table>
              <hr width="95%" color="#FFA218" size="1" noshade align="center">
            </div>
            </FORM>
            <%RSAmenity.MoveNext()
                    Loop
                    RSAmenity.MoveFirst()
                    End If%>
                    <%If MercExists(tmpArray1) = True Then%>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="#2A2F88"> 
                <td class="headline-ffffff-small" width="85%" align="center">Additional 
                  Items</td>
                <td class="headline-ffffff-small" width="15%" align="center">Qty</td>
              </tr>
            </table>
            <%End If
                    For i = LBound(tmpArray1, 2) to UBound(tmpArray1, 2)
							If tmpArray1(4, i) = "2" Then
									Set RSItem = Server.CreateObject("ADODB.Recordset")
									SQLItem = "[Avante].[dbo].[Get_Merc_Detail_Single] '" & tmpArray1(1, i) & "'"
									RSItem.Open SQLItem, Conn
									If Not RSItem.EOF Then
                    %>
            <table width="196" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="88%" class="planner-hotel-name"><img src="../images/delete-dim.gif" name="Image1" alt="Click To Delete This Item" onClick="location.href('cleartrans.asp?Trans_ID=<%=tmpArray1(10, i)%>&URL=<%=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")%>')" width="13" height="13" style="{cursor: hand}">&nbsp;<%=RSItem("Name")%><br><%=RSItem("Description")%></td>
                <td width="12%" class="planner-hotel-name" align="right"><%=tmpArray1(2, i)%></td>
                <br>
              </tr>
            </table>
            <hr width="95%" color="#FFA218" size="1" noshade align="center">
            <%End If
                    RSItem.Close()
                    End If
                    Next
                    %>


<%		SQL = "[Avante].[dbo].[Get_Inv_Ticket_Details] @Group_ID='" & Session("Group_ID") & "'"
		Set RSItem = Conn.Execute(SQL)
		Do While Not RSItem.EOF
%>		  <div id=MERCH_<%=RSItem("Inventory_List_ID")%> style="{display:none}"> 
            <table width="196" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="88%" class="planner-hotel-name"><%=RSItem("Name")%><br><%=RSItem("Description")%></td>
                <td width="12%" class="planner-hotel-name" align="right"><input size=1 align=center type="text" id=Merch_<%=RSItem("Inventory_List_ID")%> name=Merch_<%=RSItem("Inventory_List_ID")%> readonly style="border-style:none;background-color:transparent;font-family: Verdana, Arial, Helvetica; vertical-align:baseline; font-size: 10px; font-style: normal; line-height: normal; font-weight: bold; color: #2A2F88; text-decoration: none"></td>
                <br>
              </tr>
            </table>
            <hr width="95%" color="#FFA218" size="1" noshade align="center">
          </div>
<%			RSItem.MoveNext
		Loop
%>

            <% ' Packages! %><%If PackageExists(tmpArray1) = True Then%>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="#2A2F88"> 
                <td class="headline-ffffff-small" width="85%" align="center">Packaged 
                  Items</td>
                <td class="headline-ffffff-small" width="15%" align="center">Qty</td>
              </tr>
            </table>
            <%End If 
            If Not RSPack.EOF Then %>
            <div id=INV_P<%=RSPack("Package_ID")%> style="{display:none}"> 
              <table width="197" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="88%" class="planner-hotel-name"><%=RSPack("Package_Name")%></td>
                  <td width="12%" class="planner-hotel-name" align="right">1</td>
                </tr>
              </table>
              <input type="hidden" name="Qty_P<%=RSPack("Package_ID")%>" value="1">
              <hr width="95%" color="#FFA218" size="1" noshade align="center">
              <% End If %>
            </div>
            <%
                    For i = LBound(tmpArray1, 2) to UBound(tmpArray1, 2)
							If tmpArray1(4, i) = "3" Then
									Set RSItem = Server.CreateObject("ADODB.Recordset")
									SQL = "[Avante].[dbo].[Get_Package_Items_No_Tax] @Package_ID='" & tmpArray1(1, i) & "'"
									RSItem.Open SQL, Conn
									If Not RSItem.EOF Then
                    %>
            <table width="197" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="88%" class="planner-hotel-name"><img src="../images/delete-dim.gif" name="Image1" alt="Click To Delete This Item" onClick="location.href('cleartrans.asp?Trans_ID=<%=tmpArray1(10, i)%>&URL=<%=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")%>')" width="13" height="13" style="{cursor: hand}"><%=RSItem("Package_Name")%></td>
                  <td width="12%" class="planner-hotel-name" align="right">1</td>
                </tr>
              </table>
              <hr width="95%" color="#FFA218" size="1" noshade align="center">
            
            <%End If
            RSItem.Close()
            End If
            Next  
            ' End of Packages! %>
            
            <table width="196" border="0" cellspacing="0" cellpadding="0">
            <%If LodgingExists(tmpArray1) = True Or MercExists(tmpArray1) = True Or PackageExists(tmpArray1) = True Then%>
            <%If Not Session("Itinerary_ID") = "" And Session("Itinerary_Name") = "" Then%>
            
              <tr> 
                <td class="manage-menu-bold-orange" align="center" width="200"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="80%" class="standard-input-formorange" height="23">Click 
                        to Name & Save Your Itinerary</td>
                      <td align="center" width="20%" height="23"><img src="/icons/icon-go-dot.gif" width="22" height="22" onClick="location.href='main-itinerary-create.asp';" style="{cursor:hand}"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <%ElseIf Not Session("Itinerary_ID") = "" And Not Session("Itinerary_Name") = "" Then%>
              <tr> 
                <td class="manage-menu-bold-orange" align="center" width="200"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="80%" class="standard-input-formorange" height="23">Click 
                        to Save in Active Itinerary: <%=Session("Itinerary_Name")%></td>
                      <td align="center" width="20%" height="23"><img src="/icons/icon-go-dot.gif" width="22" height="22" onClick="location.href='main-itinerary-edit.asp';" style="{cursor:hand}"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              
              <tr> 
                <td class="manage-menu-bold-orange" width="200"> 
                  <hr width="95%" color="#FFA218" size="1" noshade align="center">
                </td>
              </tr>
              <tr> 
                <td class="manage-menu-bold-orange" align="center" width="200"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="80%" class="standard-input-formorange" height="23">Click 
                        to Create a New Itinerary. </td>
                      <td align="center" width="20%" height="23"><img src="/icons/icon-go-dot.gif" width="22" height="22" onclick="location.href='newarray.asp?URL=<%=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")%>'" style="{cursor:hand}"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <%End If%>
              <%Else%>
              <tr> 
                <td class="planner-hotel-name" align="center" width="200"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="100%" class="planner-hotel-name" height="23">You have no items in your planner.</td>                      
                    </tr>
                  </table>
                </td>
              </tr>
              <%End If%>
              <%If Not IsNumeric(Session("UserID")) Or Session("UserID") = False Then%>
              <tr> 
                <td align="center" width="200"><a href="../main-account-new.asp"><img src="/images/signup-today-198.gif" border=0 width="196" height="63"></a>
                <FORM action="main-account-bounce.asp" method=POST id=Login name=Login>
                  <table border="0" cellspacing="0" cellpadding="0">
                    <tr align="center"> 
                      <td class="manage-menu-bold-orange">Account Login</td>
                    </tr>
                    <tr> 
                      <td height="11" align="center"><img src="/images/user-name.gif" width="54" height="11"><br>
                        <input type="text" name="UserName" size="12" class="standard-input-form-small">
                      </td>
                    </tr>
                    <tr> 
                      <td class="row-space-sm" align="center"> <img src="/images/password.gif" width="53" height="11"><br>
                        <input type="password" name="UserPass" size="12" class="standard-input-form-small">
                        <input type="hidden" name="URL" value="<%=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")%>">
                      </td>
                    </tr>
                    <tr> 
                      <td align="center"> 
                        <input type="image" src="/icons/icon-go-button.gif" width="30" height="20" border="0" onClick="Login.submit();" name="image">
                      </td>
                    </tr>
                  </table>
                  </Form>
                </td>
              </tr>
              <%End If%>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td bgcolor="#2A2F88" width="2"><img src="/images/shim.gif" width="2" height="1"></td>
  </tr>
  <tr> 
    <td colspan="3"><img src="/images/planner-footer.gif" width="200" height="7"></td>
  </tr>
</table>
