<!--#include virtual="/includes/topofpage.asp"-->
<%
' Destination Target Creation

Dim Page
Page = "DestTargCreate"

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 And (Request("cont") = "1" Or Request("cont") = "2" Or Request("cont") = "3")) Then

	For each Item in Request.Form
		If Not LCase(Item) = "cont" And Not LCase(Item) = "page" And InStr(1, LCase(Item), "dest") = False  And Instr(1, LCase(Item), "type") = False Then
			If LCase(Mid(Item, 1, 9)) = "title_new" then
				Title = Trim(Replace(Request.Form("title_new"), "'", "''"))
				Dest = Replace(Request.Form("dest_new"), "'", "''")
				Dest_Cat_ID = Replace(Request.Form("type_new"), "'", "''")
				SQL = "Update_Dest_Content_Parent @Dest_ID = '" & Session("Admin_Dest_ID") & "', @Title = '" & Title & "', @Destination_ID = '" & Dest & "', @Dest_Cat_ID = '" & Dest_Cat_ID & "'"
				'Response.Write SQL
				If Not Trim(Title)="" Then Conn.Execute(SQL)
			ElseIf LCase(Mid(Item, 1, 4)) = "del_" then
				ID = Mid(Item, 5, len(Item))
				SQL = "Update_Dest_Content_Parent @Content_ID='" & ID & "', @Remove='1'"
				'Response.Write SQL
				Conn.Execute(SQL)
			Else
				ID = Mid(Item, 7, len(Item))
				Title = Trim(Replace(Request.Form("title_" & ID), "'", "''"))
				Dest = Replace(Request.Form("dest_" & ID), "'", "''")
				Dest_Cat_ID = Replace(Request.Form("type_" & ID), "'", "''")
				SQL = "Update_Dest_Content_Parent @Content_ID = '" & ID & "', @Dest_ID = '" & Session("Admin_Dest_ID") & "', @Title = '" & Title & "', @Destination_ID = '" & Dest & "', @Dest_Cat_ID = '" & Dest_Cat_ID & "'"
				'Response.Write SQL
				If Not Trim(Title)="" Then Conn.Execute(SQL)
			End If
		End If
	Next 

	If Request("cont") = "1" Then Response.Redirect(Session("default_page"))
	If Request("cont") = "2" Then Response.Redirect("destination-exclusion.asp")

Else
End If


SQL = "Get_Destination @Dest_ID='" & Session("Admin_Dest_ID") & "', @Realm_ID='" & Session("Admin_Realm") & "'"
Set Dest = Conn.Execute(SQL)
Target = Dest("Target")

%>
	<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();
}

//-->
</script>
<link rel="stylesheet" href="../Style-sheets/headline.css" type="text/css">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--


function Sub_Form (cont)
{

var errMsg='';

//if (document.form1.City.value=='') {errMsg+='Please Specify a City\n';}
//if (document.form1.State.value=='') {errMsg+='Please Specify a State\n';}
//if (document.form1.Country.value=='') {errMsg+='Please Specify a Country\n';}
//if (document.form1.Package_Name.value=='') {errMsg+='Please Specify a Package Name\n';}
//if (document.form1.Package_Type_ID.value=='') {errMsg+='Please Specify a Package Type\n';}
//if (document.form1.Package_Duration_ID.value=='') {errMsg+='Please Specify a Package Duration\n';}
//if (document.form1.Num_Adults.value=='') {errMsg+='Please Specify a Number of Adults\n';}
//if (document.form1.Num_Children.value=='') {errMsg+='Please Specify a Number of Children\n';}
//if (document.form1.Lodging.value=='' && document.form1.Tickets.value=='' && document.form1.Food_Bev.value=='' && document.form1.Transport.value=='') {errMsg+='Please sekect an item to work with.\n';}

if (errMsg) alert(errMsg);
else {
  form1.action = "";
  form1.cont.value=cont;
  form1.submit();
}
}

//-->
</SCRIPT>
</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="">
<input type="hidden" name="page" value="<%=Page%>">
<input type="hidden" name="cont" value="">

  <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">Parent Destination Content</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('this','default-destinations.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"><%IF Not Dest.EOF Then Response.Write(Dest("Name"))%></td>
    <td width="58">&nbsp;</td>
  </tr>
</table>
  <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td width="20">&nbsp;</td>
      <td width="217">&nbsp;</td>
      <td width="194">&nbsp;</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
<%
   Dim RSDestT
   Set RSDestT = Conn.Execute("Get_Dest_Content_Parent")

   If Not RSDestT.EOF Then
	Do Until RSDestT.EOF
%>
    <tr bgcolor="#e7e7e7"> 
      <td class="manage-menu" rowspan="3">&nbsp;<b>ID:</b>&nbsp;<%=RSDestT("Content_ID")%><br><br>&nbsp;Remove?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="del_<%=RSDestT("Content_ID")%>" value="<%=RSDestT("Content_ID")%>"></td>
      <td class="manage-menu" colspan="2">Type:&nbsp;&nbsp;&nbsp;<select name="Type_<%=RSDestT("Content_ID")%>">
<%	
	Set GDest = Conn.Execute("Get_Destination_Category_Parent @Realm_ID='" & Session("Admin_Realm") & "'")
	If Not GDest.EOF Then 
        Do until GDest.EOF %>
			<OPTION value="<%=GDest("Dest_Cat_ID")%>" <% If RSDestT("Dest_Cat_ID") = GDest("Dest_Cat_ID") Then Response.Write("selected")%>><%=GDest("Dest_Cat_Name")%></OPTION>
      <% 	GDest.MoveNext
		Loop
	Else %>
	No Destination Parent Categories Defined
    <% End If %>
    
      </select>
      </td>
    </tr>
    </tr>
    <tr bgcolor="#e7e7e7">
		<td colspan="2" class="manage-menu">Title:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="Title_<%=RSDestT("Content_ID")%>" value="<%=Trim(RSDestT("Title"))%>" size="25"></td>
    </tr>
    <tr bgcolor="#e7e7e7">
		<td colspan="2" class="manage-menu">Select:&nbsp;<select name="Dest_<%=RSDestT("Content_ID")%>">
<%	
	Response.Write ("Get_Destination @Realm_ID='" & Session("Admin_Realm") & "', @Dest_ID_Parent='" & Session("Admin_Dest_ID") & "', @Map_Type='2'")
	Set GDest = Conn.Execute("Get_Destination @Realm_ID='" & Session("Admin_Realm") & "', @Dest_ID_Parent='" & Session("Admin_Dest_ID") & "', @Map_Type='2'")
	If Not GDest.EOF Then 
        Do until GDest.EOF %>
			<OPTION value="<%=GDest("Dest_ID")%>" <% If RSDestT("Destination_ID") = GDest("Dest_ID") Then Response.Write("selected")%>><%=GDest("Name")%></OPTION>
      <% 	GDest.MoveNext
		Loop
	Else %>
	No Target Destinations Defined for Parent
    <% End If %>
    
      </select></td>
    </td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
<%
       RSDestT.MoveNext
    Loop
%>
<tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
<%
   Else
%>
    <tr> 
      <td align="center" colspan="3">&nbsp;</td>
    </tr>
<%
   End If 
%>        
    <tr> 
      <td class="manage-menu-bold"> New&nbsp;&nbsp;&nbsp;</td>
      <td class="manage-menu" colspan="2">Type:&nbsp;&nbsp;&nbsp;<select name="type_new">
<%	
	Set GDest = Conn.Execute("Get_Destination_Category_Parent @Realm_ID='" & Session("Admin_Realm") & "'")
	If Not GDest.EOF Then 
        Do until GDest.EOF %>
			<OPTION value="<%=GDest("Dest_Cat_ID")%>"><%=GDest("Dest_Cat_Name")%></OPTION>
      <% 	GDest.MoveNext
		Loop
	Else %>
	No Destination Parent Categories Defined
    <% End If %>
    
      </select>
      </td>
	</tr>
	<tr>      
      <td class="manage-menu">&nbsp;&nbsp;&nbsp;</td>
      <td class="manage-menu" colspan="2">Title:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="title_new" size="25"></td>
    </tr>
    <tr>
      <td class="manage-menu">&nbsp;&nbsp;&nbsp;</td>
      <td class="manage-menu" colspan="2">Select:&nbsp;<select name="dest_new">
<%	
	Set GDest = Conn.Execute("Get_Destination @Realm_ID='" & Session("Admin_Realm") & "', @Dest_ID_Parent='" & Session("Admin_Dest_ID") & "', @Map_Type='2'")
	If Not GDest.EOF Then 
        Do until GDest.EOF %>
			<OPTION value="<%=GDest("Dest_ID")%>"><%=GDest("Name")%></OPTION>
      <% 	GDest.MoveNext
		Loop
	Else %>
	No Target Destinations Defined
    <% End If %>
    
      </select></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td colspan="3" align="center"><a href="javascript:Sub_Form('3')" class="manage-menu">Add another content link</a></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
<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)"><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>
