h1 = new Image();
h2 = new Image();
h1.src = "images/catalog_arrow1.gif";
h2.src = "images/catalog_arrow2.gif";
var confirmMsg = "Пожалуйста, подтвердите";
var ImageWindow = new Array();
var box_query_clicked = false;
var box_email_clicked = false;

// Code starts here {literal}
function PopUpWindow(url, xSize, ySize, idx) {
        var xOffset = (screen.width-xSize)/2;
        var yOffset = (screen.height-ySize)/2;
        ImageWindow[idx] = window.open(url,"ImageWindow"+idx,"width="+xSize+",height="+ySize+",screenX="+xOffset+",screenY="+yOffset+",top="+yOffset+",left="+xOffset+",toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,scrollbar=true");
        ImageWindow[idx].opener = self;
        ImageWindow[idx].focus();
}
function initForm() {
    return true;
}

function expand(id) {
        element = document.getElementById(id);
        if (element.style.display != "block") {
                element.style.display = "block";
                document.images["p" + id].src = h2.src;
        } else {
                element.style.display = "none";
                document.images["p" + id].src = h1.src;
        }
}

/**
 * Displays an confirmation box.
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   the sql query to submit
 *
 * @return  boolean  whether to run the query or not
 */
function confirmLink(theLink, theQuestion)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' :\n' + theQuestion);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
}

function email_entry() {
    if(!box_email_clicked) {
        document.forms.subscribeform.email.value = "";
        box_email_clicked=true;    
    }
}
function query_entry() {
    if(!box_query_clicked) {
        document.forms.searchform._query.value = "";
        box_query_clicked=true;
    }
}

// end of the file {/literal}
