// invoked when moving a product in the cart
function f_move2cart_form(pid) {
    window_move2cart = window.open('', 'win_move2cart', 'left=50,screenX=50,top=50,screenY=50,width=500,height=150,scrollbars=0');
    window_move2cart.focus();
    eval("this.document.add2cart_form_" + pid + ".target = 'win_move2cart';");
    eval("this.document.add2cart_form_" + pid + ".action.value = 'buy_only';");
    eval("this.document.add2cart_form_" + pid + ".submit();");
    return true;
}
// invoked when adding a product in the cart
function f_add2cart_form(pid) {
    eval("this.document.add2cart_form_" + pid + ".target = '';");
    eval("this.document.add2cart_form_" + pid + ".action.value = 'buy';");
    eval("this.document.add2cart_form_" + pid + ".submit();");
    return true;
}
// forward to location
function form_jumpbylocation(_location) {
    if (_location != '') { eval("parent.location='" + location_prefix + _location + "'"); }
}
// --- calendar ---------------------------------------------------------------
function useCalendar(url, dateAsTextField, dateAsTimeField) {
    targetDateAsTextField = dateAsTextField;
    targetDateAsTimeField = dateAsTimeField;
    if (dateAsTimeField != null) { url += '&date_as_time_selected=' + escape(dateAsTimeField.value); }
    if (dateAsTextField != null) { url += '&date_as_text_selected=' + escape(dateAsTextField.value); }
    calendarWindow = window.open(url, 'Calendar', 'left=50,screenX=50,top=50,screenY=50,width=250,height=250,scrollbars=0');
    calendarWindow.focus();
}
// --- cookies ----------------------------------------------------------------
function getCookie(name) {
    if (document.cookie.length > 0) {
        begin = document.cookie.indexOf(name + "=");
        if (begin != -1) {
            begin += name.length + 1;
            end = document.cookie.indexOf(";", begin);
            if (end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(begin, end));
        }
    }
    return null;
}
function setCookie(name, value, expiredays) {
    var expireDate = new Date();
    expireDate.setTime(expireDate.getTime() + (expiredays * 24 * 3600 * 1000));
    document.cookie = name + "=" + escape(value) + 
        ((expiredays == null) ? "" : "; expires=" + expireDate.toGMTString());
}
function setCookieAdvanced(name, value, expiredays, path, domain, secure) {
    var expireDate = new Date();
    expireDate.setTime(expireDate.getTime() + (expiredays * 24 * 3600 * 1000));
    var curCookie = name + "=" + escape(value) +
        ((expiredays != null) ? "; expires=" + expireDate.toGMTString() : "") +
        ((path != null) ? "; path=" + path : "") +
        ((domain != null) ? "; domain=" + domain : "") +
        ((secure != null) ? "; secure" : "");
    document.cookie = curCookie;
}
function delCookie(name) {
    if (getCookie(name)) { document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }
}
