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

Dim Page 
Page = "66"

Dim Num_Assign
Num_Assign = 5

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

    If Request.Form("cont") = "1" Then Response.Redirect "default.asp"
    If Request.Form("cont") = "2" Then Response.Redirect "package-create-8.asp"

End If


Function PCase(strInput)
    Dim iPosition 
    Dim iSpace 
    Dim strOutput 

    iPosition = 1

    Do While InStr(iPosition, strInput, " ", 1) <> 0
            iSpace = InStr(iPosition, strInput, " ", 1)
            strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
            strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition))
            iPosition = iSpace + 1
    Loop

    strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
    strOutput = strOutput & LCase(Mid(strInput, iPosition + 1))

    PCase = strOutput
End Function

Function FCurrency(Amount)

	Amount = Replace(Replace(FormatCurrency(Amount, 2, -1, 0, -1), "$", ""), ",", "")
	FCurrency = Amount

End Function

Dim SQLPNames, RSPNames
SQLPNames = "select Distinct Package_Name from Package_Package_Map PPM	Inner Join Package P On P.Package_ID = PPM.Package_ID_Child Order By [Package_Name]"
Set RSPNames = Conn.Execute(SQLPNames)

%>
<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 formatPerc(perc1) {
	var perc = perc1 * .01;
	return perc;
}

function formatPrice(value) {

    value = "" + value;
    var deci = 0;
    var precision = 2;

    if (value.substring(0, 1) == '.' || value.substring(0, 2) == '0.' || value.substring(0, 3) == '00.') deci = 1;

    var whole = "" + Math.round(value * Math.pow(10, precision));
    var decPoint = whole.length - precision;
    if(decPoint != 0) {
        result = whole.substring(0, decPoint);
        result += ".";
        result += whole.substring(decPoint, whole.length);
    } else  {
        result = whole;
    }
    
    if (deci == 1) result = "." + result;

    return result;
}

function markitup (itemtype, item, package) {

	var first = 'P' + package;
	var second = first + '_' + itemtype;
	var markup = second + '_Markup' + item;
	var total = second + '_Total' + item;
	var cost = second + '_Cost' + item;

	objitemtotal	= MM_findObj(total);
	objitemcost	= MM_findObj(cost);
	objitemmarkup	= MM_findObj(markup);

	var itemamount = parseFloat(objitemcost.value);
	var itemmarkup = parseFloat(formatPerc(objitemmarkup.value));

	var itemtotal = itemamount * itemmarkup;

	objitemtotal.value = formatPrice(itemamount + itemtotal);

}

function priceRefresh() {

  var i, args=priceRefresh.arguments; 

  var package = args[0];
  var markup;
  var itemobj;
  var subtotal = 0;
  var tax = 0;
  var total = 0;
  var nightly = 0;
  
  objsubtotal = MM_findObj('subtotal' + package);
  objtax = MM_findObj('tax' + package);
  objtotal = MM_findObj('total' + package);
  objnightly = MM_findObj('nightly' + package);
  
  var num_nights = parseInt(form1.Num_Nights.value);

  for (i=1; i<=(args.length -2); i+=2) {
	objitemtotal = MM_findObj(args[i]);
	objitemtaxrate = MM_findObj(args[i+1]);
	
	itemtotal = formatPrice(objitemtotal.value);
	itemtaxrate = parseFloat(objitemtaxrate.value);

	itemtax = formatPrice(parseFloat(itemtotal * itemtaxrate));
	tax = formatPrice(parseFloat(parseFloat(tax) + parseFloat(itemtax)));

	subtotal = formatPrice(parseFloat(parseFloat(subtotal) + parseFloat(itemtotal)));
  } 

  total = formatPrice(parseFloat(parseFloat(subtotal) + parseFloat(tax)));
  nightly = formatPrice(parseFloat(parseFloat(total) / num_nights));
	
  objsubtotal.value = subtotal;
  objtax.value = tax;
  objtotal.value = total;
  objnightly.value = nightly;

}

function toggle_div() {

	var argz=toggle_div.arguments;

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

 	var divID, divobj;

	for (i=1;i<=<%=Num_Assign%>;i++) {

		divID = 'div_' + cnt + '_' + i;
		divobj = MM_findObj(divID);
	
		if (divobj.style.display=='none') {
			divID = 'div_' + cnt + '_' + i;
			divobj = MM_findObj(divID);
			divobj.style.display='inline';

			if (override) {
			    divobj.style.display=override;
			}

			return true;
		}
	
	}

}

function MM_showHideLayer_toggle() { //v3.0
  var i,p,v,obj,args=MM_showHideLayer_toggle.arguments;
  for (i=0; i<(args.length); i+=1) if ((obj=MM_findObj(args[i]))!=null) { 
    v = obj.style.visibility;
    if (obj.style) { 
		obj=obj.style; 
		v=(v=='hidden')?'visible':(v='visible')?'hidden':v; 
		}
    obj.visibility=v; }
}

function upone() {

  var args=upone.arguments; 

  var theid = args[0];

  if (theid == '[object]') {
     theobj = theid;
  } else {
     theobj = MM_findObj(theid);
  }

  if (isNaN(theobj.value) || theobj.value == '') {
	theobj.value = '2';
  } else if (!isNaN(theobj.value)) {
	var val = parseFloat(theobj.value) + 2;
	theobj.value = val;
  }
}


//-->
</script>
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/arrivares.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-items.asp">
<INPUT type="hidden" id=page name=page value="<%=Page%>">
<INPUT type="hidden" id=cont name=cont value="">
<%
For Each item in Request.Form
  If Not UCase(item) = "PAGE" And Not UCase(item) = "CONT" Then
	For each value in Request.Form(item)
%>		<input type="hidden" name="<%=item%>" value="<%=value%>">
<%
	Next
  End If
Next
%>
<br>
<table width="525" border="0" cellspacing="0" cellpadding="2" align="center">
  <tr bgcolor="#5e5ebe">
    <td width="467" align="center" class="headline-ffffff" bgcolor="#5e5ebe">Package Layout</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.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>
  <tr bgcolor="#FFFFFF"> 
      <td width="467">&nbsp;</td>
      <td align="right" width="58">&nbsp;</td>
  </tr>
</table>

<%

	Dim Amount
	Dim Hotel_Group
	Dim Count, Item_Array
	Dim First_Run
	Dim Tax, Tax_Rate
	
	Count = 1
	Item_Array = ""

	For each Room_Item in Request.Form("Room_Items")
		Found = True
	Next

	
    If Not Found = True Then

		First_Run = True
		
		'Set Item Array to blank... fixes damn priceRefresh problem!! :)
		Item_Array = ""		

		Stay = Request.Form("pdurname" & Request.Form("Package_Duration_ID"))

%>
<input type="hidden" name="Packages" value="<%=Count%>">
<a name="<%=Count%>">
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
	<td width="1%"></td>
	<td width="14%"></td>
	<td width="20%"></td>
	<td width="30%"></td>
	<td width="35%"></td>
    </tr>
    <tr> 
      <td bgcolor="#5e5ebe">&nbsp;</td>
      <td colspan="4" class="headline-ffffff" bgcolor="#777799"><%= Request("Package_Name") %>: Package #<%= Count %></td>
    </tr>
    <tr bgcolor="#777799"> 
      <td colspan="5" height="2"><img src="images/shim.gif" size="2" height="2"></td>
    </tr>

    <tr bgcolor="#cccccc"> 
      <td></td>
      <td colspan="4" class="standard-input-form" height="13">&nbsp;<%= Request("Marketing_Headline") %> -</td>
    </tr>
<!--    <tr bgcolor="#dddddd">
      <td></td>
      <td colspan="3" align="left" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Request("Marketing_Headline") %></font></td>
      <td colspan="1" class="standard-input-form"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rate&nbsp;Occ.:&nbsp;<%= Rate_Occupancy %>&nbsp;|&nbsp;Max&nbsp;Occ.:&nbsp;<%= Max_Occupancy %>&nbsp;&nbsp;&nbsp;</font></div></td>
    </tr>-->
    <tr bgcolor="#e7e7e7">
      <td height="13" align="right" colspan="5" class="manage-menu"><font size="1">&nbsp;&nbsp;Base Adult Count:&nbsp;<input type="text" class="standard-input-form" style="{ height:16; }" name="P<%=Count%>_Adults" size="1" onDblClick="upone(this);"><img src="/images/shim.gif" width="1" height="1"></font>&nbsp;&nbsp;&nbsp;<font size="1">Base Guest Count:&nbsp;<input type="text" class="standard-input-form" style="{ height:16; }" name="P<%=Count%>_Guests" size="1" onDblClick="upone(this);"><img src="/images/shim.gif" width="1" height="1"></font></td>
    </tr>
    <tr bgcolor="#e7e7e7">
      <td></td>
      <td colspan="3" class="standard-input-form" align="center"><select name="P<%=Count%>_Package_Type_ID" class="input-box">
		  <option value="" selected>Package Type</option>
		  <% 	
			Set RSType = Conn.Execute("Select * from Package_Type")
			 Do While Not RSType.EOF
			    Response.Write "<option value=""" & RSType("Package_Type_ID") & """>" & RSType("Type_Name") & "</option>" & chr(13)
			    If InStr(Add_to_it, "<input type=""hidden"" name=""ptypename" & RSType("Package_Type_ID") & """ value=""" & RSType("Type_Name") & """>") = 0 Then Add_to_it = Add_to_it & "<input type=""hidden"" name=""ptypename" & RSType("Package_Type_ID") & """ value=""" & RSType("Type_Name") & """>"
			    RSType.MoveNext
			 Loop
			Set RSType = Nothing
		  %>
	      </select>&nbsp;&nbsp;<select name="P<%=Count%>_Package_Duration_ID" class="input-box">
          <option value="" selected>Package Duration</option>
		  <% 	
			Set RSDuration = Conn.Execute("Select * from Package_Duration Order by Num_Days")
			 Do While Not RSDuration.EOF
			    Response.Write "<option value=""" & RSDuration("Package_Duration_ID") & """>" & RSDuration("Duration_Name") & "</option>" & chr(13)
			    RSDuration.MoveNext
			 Loop
			Set RSDuration = Nothing
		  %>
        </select></td>
      <td height="13" align="center" colspan="1" class="manage-menu"><a href="#<%=Count%>" onclick="return toggle_div('<%=Count%>');"><font size="1">Create a Package Attachment</font></a></td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>

    <tr> 
      <td colspan="5" bgcolor="#ffffff">

<% For i = 1 to Num_Assign %>

	<div name="div_<%=Count%>_<%=i%>" id="div_<%=Count%>_<%=i%>" style="{ width:100%;height:100%;display:none; }">
	  <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
	    <tr>	 
	      <td colspan="1" bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" class="manage-menu">Attachment #<%=i%></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu">People Package: <input type="radio" name="Attach_Map_Type_<%=Count%>_<%=i%>" size="1" value="1">&nbsp;&nbsp;Item Package: <input type="radio" name="Attach_Type_<%=Count%>_<%=i%>" size="1" value="2"></td>

	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Name:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<input type="text" name="Attach_Name_<%=Count%>_<%=i%>" size="30">&nbsp;<img src="images/down-button.gif" align="center" onClick="names_<%=Count%>_<%=i%>.style.left = window.event.x + document.body.scrollLeft; names_<%=Count%>_<%=i%>.style.top= window.event.y + document.body.scrollTop; MM_showHideLayer_toggle('names_<%=Count%>_<%=i%>')" style="{cursor:hand}">&nbsp;<font size="1"></font></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Headline:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<input type="text" name="Attach_Head_<%=Count%>_<%=i%>" size="35"></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Description:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<textarea name="Attach_Desc_<%=Count%>_<%=i%>" rows="2" cols="30"></textarea></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Package Type:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<select name="Attach_Package_Type_<%=Count%>_<%=i%>" class="input-box">
		  <option value="" selected>Package Type</option>
		  <% 	
			Set RSType = Conn.Execute("Select * from Package_Type")
			 Do While Not RSType.EOF
			    Response.Write "<option value=""" & RSType("Package_Type_ID") & """>" & RSType("Type_Name") & "</option>" & chr(13)
			    RSType.MoveNext
			 Loop
			Set RSType = Nothing
		  %>
        </select></td>
	    </tr>


<!--	    <tr>	 
	      <td colspan="1" bgcolor="#ffffff"></td>
	      <td colspan="4" bgcolor="#ffffff" class="manage-menu">&nbsp;</td>
	    </tr>
-->	  </table>
<br>
	</div>
<% Next 
%>

	</td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>

  </table>

<%

    Else

	For each Room_Item in Request.Form("Room_Items")
		'Death to Taxes
		Tax = 0
		Tax_Rate = 0
		Amount = 0
		First_Run = True
		
		'Set Item Array to blank... fixes damn priceRefresh problem!! :)
		Item_Array = ""		

		Hotel_Group = Request.Form("Room_Item_Group" & Room_Item)
		Rate_Occupancy = Int(Request.Form("Room_Item_ROcc" & Room_Item))
		Max_Occupancy = Int(Request.Form("Room_Item_MOcc" & Room_Item))
		Room_Name = Request.Form("Room_Item_Name" & Room_Item)
		Room_Quantity = Int(Request.Form("Num_Rooms"))

		Room_Cost = FCurrency(Request.Form("Room_Item_Cost" & Room_Item))
		'Room_Nights = Int(Request.Form("Num_Nights"))
		Room_Rate = FCurrency(Room_Cost * Room_Quantity * Room_Nights)		

		Lodging_Name = Request.Form("Lodging_Name" & Hotel_Group)
		Stay = Request.Form("pdurname" & Request.Form("Package_Duration_ID"))

%>
<input type="hidden" name="Packages" value="<%=Count%>">
<input type="hidden" name="P<%=Count%>_Room_Item" value="<%=Room_Item%>">
<a name="<%=Count%>">
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
	<td width="1%"></td>
	<td width="14%"></td>
	<td width="20%"></td>
	<td width="30%"></td>
	<td width="35%"></td>
    </tr>
    <tr> 
      <td bgcolor="#5e5ebe">&nbsp;</td>
      <td colspan="4" class="headline-ffffff" bgcolor="#777799"><%= Request("Package_Name") %>: Package #<%= Count %></td>
    </tr>
    <tr bgcolor="#777799"> 
      <td colspan="5" height="2"><img src="images/shim.gif" size="2" height="2"></td>
    </tr>
    <tr bgcolor="#cccccc"> 
      <td></td>
      <td colspan="4" class="standard-input-form" height="13">&nbsp;<%= PCase(Lodging_Name) %> -</td>
    </tr>
    <tr bgcolor="#dddddd">
      <td></td>
      <td colspan="3" align="left" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Room_Name %></font></td>
      <td colspan="1" class="standard-input-form"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rate&nbsp;Occ.:&nbsp;<%= Rate_Occupancy %>&nbsp;|&nbsp;Max&nbsp;Occ.:&nbsp;<%= Max_Occupancy %>&nbsp;&nbsp;&nbsp;</font></div></td>
    </tr>
    <tr bgcolor="#e7e7e7">
      <td height="13" align="right" colspan="5" class="manage-menu"><font size="1">&nbsp;&nbsp;Base Adult Count:&nbsp;<input type="text" class="standard-input-form" style="{ height:16; }" name="P<%=Count%>_Adults" size="1" onDblClick="upone(this);"><img src="/images/shim.gif" width="1" height="1"></font>&nbsp;&nbsp;&nbsp;<font size="1">Base Guest Count:&nbsp;<input type="text" class="standard-input-form" style="{ height:16; }" name="P<%=Count%>_Guests" size="1"  onDblClick="upone(this);"><img src="/images/shim.gif" width="1" height="1"></font></td>
    </tr>
    <tr bgcolor="#e7e7e7">
      <td></td>
      <td colspan="3" class="standard-input-form" align="center"><select name="P<%=Count%>_Package_Type_ID" class="input-box">
		  <option value="" selected>Package Type</option>
		  <% 	
			Set RSType = Conn.Execute("Select * from Package_Type")
			 Do While Not RSType.EOF
			    Response.Write "<option value=""" & RSType("Package_Type_ID") & """>" & RSType("Type_Name") & "</option>" & chr(13)
			    RSType.MoveNext
			 Loop
			Set RSType = Nothing
		  %>
	      </select>&nbsp;&nbsp;<select name="P<%=Count%>_Package_Duration_ID" class="input-box">
          <option value="" selected>Package Duration</option>
		  <% 	
			Set RSDuration = Conn.Execute("Select * from Package_Duration Order by Num_Days")
			 Do While Not RSDuration.EOF
			    Response.Write "<option value=""" & RSDuration("Package_Duration_ID") & """>" & RSDuration("Duration_Name") & "</option>" & chr(13)
			    RSDuration.MoveNext
			 Loop
			Set RSDuration = Nothing
		  %>
        </select></td>
      <td height="13" align="center" colspan="1" class="manage-menu"><a href="#<%=Count%>" onclick="return toggle_div('<%=Count%>');"><font size="1">Create a Package Attachment</font></a></td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>

    <tr> 
      <td colspan="5" bgcolor="#ffffff">

<% For i = 1 to Num_Assign %>
	<div name="div_<%=Count%>_<%=i%>" id="div_<%=Count%>_<%=i%>" style="{ width:100%;height:100%;display:none; }">
	  <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
	    <tr>	 
	      <td colspan="1" bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" class="manage-menu">Attachment #<%=i%></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu">People Package: <input type="radio" name="Attach_Type_<%=Count%>_<%=i%>" size="1" value="1" checked>&nbsp;&nbsp;Item Package: <input type="radio" name="Attach_Type_<%=Count%>_<%=i%>" size="1" value="2"></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Name:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<input type="text" name="Attach_Name_<%=Count%>_<%=i%>" size="30">&nbsp;<img src="images/down-button.gif" align="center" onClick="names_<%=Count%>_<%=i%>.style.left = window.event.x + document.body.scrollLeft; names_<%=Count%>_<%=i%>.style.top= window.event.y + document.body.scrollTop; MM_showHideLayer_toggle('names_<%=Count%>_<%=i%>')" style="{cursor:hand}">&nbsp;<font size="1"></font></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Headline:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<input type="text" name="Attach_Head_<%=Count%>_<%=i%>" size="35"></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Description:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<textarea name="Attach_Desc_<%=Count%>_<%=i%>" rows="2" cols="30"></textarea></td>
	    </tr>
	    <tr> 
	      <td bgcolor="#ffffff"></td>
	      <td colspan="2" bgcolor="#ffffff" align="right" class="manage-menu-bold">Attachment Type:</td>
	      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<select name="Attach_Package_Type_<%=Count%>_<%=i%>" class="input-box">
		  <option value="" selected>Package Type</option>
		  <% 	
			Set RSType = Conn.Execute("Select * from Package_Type")
			 Do While Not RSType.EOF
			    Response.Write "<option value=""" & RSType("Package_Type_ID") & """>" & RSType("Type_Name") & "</option>" & chr(13)
			    RSType.MoveNext
			 Loop
			Set RSType = Nothing
		  %>
	      </select></td>
	    </tr>
<!--	    <tr>	 
	      <td colspan="1" bgcolor="#ffffff"></td>
	      <td colspan="4" bgcolor="#ffffff" class="manage-menu">&nbsp;</td>
	    </tr>
-->	  </table>
<br>
	</div>

<% Next 
%>

	</td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>

  </table>

<%	Count = Count + 1
	Next
   End If
			Set RSType = Conn.Execute("Select * from Package_Type")
			 Do While Not RSType.EOF
			    Response.Write "<input type=""hidden"" name=""ptypename" & RSType("Package_Type_ID") & """ value=""" & RSType("Type_Name") & """>"
			    RSType.MoveNext
			 Loop
			Set RSType = Nothing
			Set RSDuration = Conn.Execute("Select * from Package_Duration Order by Num_Days")
			 Do While Not RSDuration.EOF
			    Response.Write "<input type=""hidden"" name=""pdurname" & RSDuration("Package_Duration_ID") & """ value=""" & RSDuration("Duration_Name") & """>"
			    Response.Write "<input type=""hidden"" name=""Num_Days" & RSDuration("Package_Duration_ID") & """ value=""" & RSDuration("Num_Days") & """>"
			    RSDuration.MoveNext
			 Loop
			Set RSDuration = Nothing

For C = 1 to Count - 1 
	For i = 1 to Num_Assign
		If Not RSPNames.EOF Then 
%>

<div name="names_<%=C%>_<%=i%>" id="names_<%=C%>_<%=i%>" onload="alert('sup!');" align="center" style="position:absolute;width:301; height:100%; z-index:3; top: 45px; overflow: auto; visibility: hidden;">
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#ececec" align="center">
<tr bgcolor="#f7f7f7">
    <td class="sub-heard" align="right" valign="top"><img src="images/click-button.gif" onClick="MM_showHideLayer_toggle('names_<%=C%>_<%=i%>')" style="{cursor:hand}"></td>
</tr>
<tr>
    <td align="center"><table border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" width="98%" height="98%"><tr><td><% 
   Do While Not RSPNames.EOF %>
	<% If Not RSPNames("Package_Name") = "" Then %>
		<a onclick="form1.Attach_Name_<%=C%>_<%=i%>.value='<%=RSPNames("Package_Name")%>';MM_showHideLayer_toggle('names_<%=C%>_<%=i%>');" class="manage-menu" style="{cursor:hand}"><font size="1">&nbsp;- <%=RSPNames("Package_Name")%></font></a><br>
<%	   End If
 	RSPNames.MoveNext
   Loop
%></td></tr></table></td>
</tr><tr><td bgcolor="#ececec" height="2"><img src="images/shim.gif" height="2" width="1"></td></tr></table></div>

<%
		RSPNames.MoveFirst
	    End If 
	Next
Next
%>

<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>
