function addtotripSubmit(doc, cat_id, sid)
{
var o = xGetElementById('addtotrip_tid');
var tid = o.options[o.selectedIndex].value.split(",")[0];
if (doc=="ADDTOTRIP")
{
o = xGetElementById('addtotrip_day');
window.top.location.href = "/dailyview.jsp?tid=" + tid + "&tday=" + o.options[o.selectedIndex].value + "&cat_id=" + cat_id + "&sid=" + sid;
}
else if (doc=="ADDTOTRIP_UNSCHEDULED")
{
o = xGetElementById('addtotrip_day');
var query = "s_id=" + sid +
"&cat_id=" + cat_id +
"&tid=" + tid +
"&tday=" + o.options[o.selectedIndex].value;
o = xGetElementById('popupaddtotrip_block');
xGetElementById("popupaddtotrip_wait").style.display="inline";
xGetElementById("popupaddtotrip_block").style.display="none";
xlocationmenu.onOpen(xWidth(xGetElementById("tb001")), xHeight(xGetElementById("tb001")), xlocationmenu.triggerObj(), xlocationmenu.getCurrentDisp());
setTimeout(function() { makeRequest('/com/addtotrip.jsp', addtotripHandler, query);  },800);
}
}
function addtotripHandler()
{
try
{
if (ajax_abort || http_request.readyState == 4)
{
if(!ajax_abort && http_request.status == 200 && http_request.responseText != null && http_request.responseText.replace(/(^\s*)|(\s*$)/g, "") != "")
{
var ids = http_request.responseText.replace(/(^\s*)|(\s*$)/g, "").split(",");
xGetElementById("popupaddtotrip_block").innerHTML = "<div class='required_field' style='width:150px!important;'>This spot has been added to your trip." +
"<br><br><a target='_top' href='/dailyview.jsp?did=" + ids[0] + "&eid=" + ids[1] + "'>View and edit this event</a></div>" +
"<div class='required_field' align='right' style='padding-top:8px;'><a class='photo' href='javascript:xlocationmenu.onClose(); void(0);'><img class='noborder' src='/images/icons/close.png' align='absmiddle' width='13' height='13'></a> <a href='javascript:xlocationmenu.onClose(); void(0);'>Close</a></div>";
//xlocationmenu.delayedClose(4);
return;
}
alert("##CANNOT_EXECUTE##");
}
}
finally
{
xGetElementById("popupaddtotrip_wait").style.display="none";
xGetElementById("popupaddtotrip_block").style.display="inline";
xlocationmenu.onOpen(xWidth(xGetElementById("tb001")), xHeight(xGetElementById("tb001")), xlocationmenu.triggerObj(), xlocationmenu.getCurrentDisp());
http_request = null;
}
}
function initDayList()
{
var weekday = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var month = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var o = xGetElementById('addtotrip_tid');
var a = o.options[o.selectedIndex].value.split(",");
var tid = a[0];
var daycount = a[1];
var startdate = a[2];
var d = null;
if (startdate!="")
{
d = new Date();
var dd = startdate.split("-");
d.setYear(dd[0]);
d.setMonth(eval(dd[1]-1));
d.setDate(dd[2]);
}
o = xGetElementById('addtotrip_day');
o.options.length=0;
var s;
for (var k=0; k<daycount; k++)
{
s = "Day ##X##".replace("##X##", eval(k + 1));
if (d!=null)
{
s += ", " + d.getDate() + " " + month[d.getMonth()] + " " + d.getFullYear() + " (" + weekday[d.getDay()] + ")";
d.setDate(d.getDate() + 1);
}
o.options.add(new Option(s, eval(k + 1)));
}
}
