var popupsignin_redirect=null;
function popupsigninSubmit()
{
xlocationmenu.onClose();
xGetElementById("popupsigninerror").style.display="none";
xGetElementById("popupsigninformtable").style.display="none";
xGetElementById("popupsigninwait").style.display="block";
xlocationmenu.onOpen(xWidth(xGetElementById("popupsignintable")), xHeight(xGetElementById("popupsignintable")), xlocationmenu.triggerObj(), xlocationmenu.getCurrentDisp());
setCookie("email", document.popupsigninform.email.value, !document.popupsigninform.save_user.checked);
var query = "email=" + document.popupsigninform.email.value +
"&password=" + document.popupsigninform.password.value +
"&lang=" + document.popupsigninform.lang.value;
setTimeout(function() { makeRequest('/com/popupsignin.jsp', popupsigninSubmitHandler, query);  },1100);
}
function popupsigninSubmitHandler()
{
try
{
if (ajax_abort || http_request.readyState == 4)
{
xlocationmenu.onClose();
if(!ajax_abort && http_request.status == 200)
{
var rtn = http_request.responseText.replace(/(^\s*)|(\s*$)/g, "");
if (rtn.indexOf("-")==-1)
{
setSessionCookie("otinerisession", rtn);
setCookie("dvvs", "", true);
if (xtriggerobj.id=="create_spot_link" || xtriggerobj.id=="create_spot_link_banner")
{
window.location.href = "/spotedit.jsp";
return;
}
else if (xtriggerobj.id=="create_trip_link" || xtriggerobj.id=="create_trip_button")
{
window.location.href = "/tripcreate.jsp";
return;
}
if (window.location.href.indexOf("/signout.jsp")!=-1 || window.location.href.indexOf("/register.jsp")!=-1 ||
window.location.href.indexOf("/signin.jsp")!=-1 || window.location.href.match(".com/$"))
window.location.href = "/userfp.jsp";
else if (popupsignin_redirect!=null)
{
window.location.href = popupsignin_redirect;
}
else
{
if (window.location.href.indexOf("#")==-1)
window.location.href = window.location.href;
else
window.location.href = window.location.href.substring(0, window.location.href.indexOf("#"));
}
return;
}
else
{
xGetElementById("popupsigninerror").style.display="block";
xGetElementById("popupsigninformtable").style.display="block";
xGetElementById("popupsigninwait").style.display="none";
xlocationmenu.onOpen(xWidth(xGetElementById("popupsignintable")), xHeight(xGetElementById("popupsignintable")), xlocationmenu.triggerObj(), xlocationmenu.getCurrentDisp());
return;
}
}
alert("Cannot execute request, please try again later.");
}
}
finally
{
http_request=null;
}
}
function popupsigninToggle(langid, triggerobj, displacement, isshow)
{
if ((xlocationmenu.triggerObj()!=triggerobj) ||
(!xlocationmenu.isOpen()) || isshow)
{
initMenu(null, triggerobj, null, displacement, null);
makeRequest('/com/popupsignin.jsp?lang=' + langid, popupsigninToggleHandler);
}
else
xlocationmenu.onClose();
}
function popupsigninToggleHandler()
{
try
{
if (ajax_abort || http_request.readyState == 4)
{
xlocationmenu.onClose();
if(!ajax_abort && http_request.status == 200)
{
xGetElementById("locationmenu").innerHTML = http_request.responseText.replace(/(^\s*)|(\s*$)/g, "");
xlocationmenu.onOpen(xWidth(xGetElementById("popupsignintable")), xHeight(xGetElementById("popupsignintable")), xlocationmenu.triggerObj(), xlocationmenu.getCurrentDisp());
document.popupsigninform.email.value = getCookie("email");
if (document.popupsigninform.email.value!="") document.popupsigninform.save_user.checked = true;
return;
}
window.location.href = "/signin.jsp";
//alert("Cannot execute request, please try again later.");
}
}
finally
{
http_request=null;
}
}