<!--
function preloadImages(docroot) {
		
		folder = docroot + 'images/leftmenu/';
        return;
		MM_preloadImages(folder + 'link1-over.gif', folder + 'link2-over.gif', folder + 'link3-over.gif', folder + 'link4-over.gif', folder + 'link5-over.gif');

}
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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 openwin(filename) {
	params='width='+750+',height='+580+',left=10,top=10,menubar=no,scrollbars=yes,resizable=no';
	newWin = window.open(filename, 'nextstep', params);
}

function opensizedwin(filename, width, height) {
	params='width='+width+',height='+height+',left=5,top=5,menubar=no,scrollbars=yes,resizable=no';
	newWin = window.open(filename, 'nextstep', params);
}

function openresizablewin(filename, width, height) {
	params='width='+width+',height='+height+',left=5,top=5,toolbar=yes,scrollbars=yes,resizable=yes, status=yes';
	newWin = window.open(filename, 'nextstep', params);
}

function openresizable(filename, width, height) {
	params='width='+width+',height='+height+',left=5,top=5,toolbar=no,scrollbars=yes,resizable=yes, status=yes';
	newWin = window.open(filename, 'nextstep', params);
}

function flyWin(filename, width, height) {
    var elem = document.getElementById('jpop');
    elem.style.width = width;
    elem.style.height = height;
    var elem2 = document.getElementById('jpop_inner');
    elem2.style.width = width;
    elem2.style.height = height;
    var elem3 = document.getElementById('jpop_iframe');
    elem3.style.width = width - 2;
    elem3.style.height = height -4 ;
    elem3.src = filename;
    
    flyInOnLoad();
}
*/
function send_form_once(formptr) {
	var result = 0;
	if (! form_submitted) {
		form_submitted = 1;
		formptr.submit();
		result = 1;
	}
	return result;
}

function noenter() {
	if (event.keyCode == 13) { event.returnValue = false;}
}

function make_float(amount) {
		amount = amount*100;
		amount = amount/100;
		return amount.toFixed(2);
}

function validDigits(fieldname) {
//document.write(event.keyCode);
	if (!(event.keyCode >= 48 && event.keyCode <= 57)) { event.returnValue = false;}

}

function validFloat(fieldname) {
//document.write(event.keyCode);
	if (!(event.keyCode >= 48 && event.keyCode <= 57 || event.keyCode==46)) { event.returnValue = false;}

}

function display_img(src, name, width, height) {
    hWnd = window.open(src, name, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + width + ',height=' + height);
    hWnd.document.write('<center><img src="' + src + '" border="0"><br><br>');
    hWnd.document.write('<a href="javascript:window.close()">Close</a></center>');
    return hWnd;
}

function operateCheckBoxes(e, the_form, elementname) {
	if (e.checked) {
		setCheckboxes(the_form, true, elementname); 
		return false;
	} else {
		setCheckboxes(the_form, false, elementname);
		return false;
	}
}

function setCheckboxes(the_form, do_check, elementname) {
    var items_to_delete			= document.forms[the_form].elements[elementname+'[]'];
    var items_to_delete_num  = items_to_delete.length;

    for (var i = 0; i < items_to_delete_num; i++) {
        items_to_delete[i].checked = do_check;
    } // end for

    return true;
} // end of the 'setCheckboxes()' function

function manageCheckBoxes(e) {
	if (e.value == 'yes') {
		document.regform.chk_vmb.disabled = false
		document.regform.chk_amex.disabled = false
		document.regform.chk_diners.disabled = false
		document.regform.chk_jcb.disabled = false

		if (document.regform.chk_vmb.checked == true) {
			document.regform.vmb_merch_acc.disabled = false
			document.regform.vmb_terminal_id.disabled = false
		}
		if (document.regform.chk_amex.checked == true) {
			document.regform.amex_merch_acc.disabled = false
			document.regform.amex_terminal_id.disabled = false
		}
		if (document.regform.chk_diners.checked == true) {
			document.regform.diners_merch_acc.disabled = false
			document.regform.diners_terminal_id.disabled = false
		}
		if (document.regform.chk_jcb.checked == true) {
			document.regform.jcb_merch_acc.disabled = false
			document.regform.jcb_terminal_id.disabled = false
		}

		document.regform.get_account[0].disabled = true
		document.regform.get_account[1].disabled = true
		document.regform.get_account[2].disabled = true
		document.regform.business.disabled = true
		document.regform.avgsalesize.disabled = true
		document.regform.salespermonth.disabled = true
		document.regform.businessplan[0].disabled = true
		document.regform.businessplan[1].disabled = true
		document.regform.business_description.disabled = true
		return false;
	} else {
		document.regform.chk_vmb.disabled = true
		document.regform.chk_amex.disabled = true
		document.regform.chk_diners.disabled = true
		document.regform.chk_jcb.disabled = true

		document.regform.vmb_merch_acc.disabled = true
		document.regform.vmb_terminal_id.disabled = true
		document.regform.amex_merch_acc.disabled = true
		document.regform.amex_terminal_id.disabled = true
		document.regform.diners_merch_acc.disabled = true
		document.regform.diners_terminal_id.disabled = true
		document.regform.jcb_merch_acc.disabled = true
		document.regform.jcb_terminal_id.disabled = true


		document.regform.get_account[0].disabled = false
		document.regform.get_account[1].disabled = false
		document.regform.get_account[2].disabled = false
		document.regform.business.disabled = false
		document.regform.avgsalesize.disabled = false
		document.regform.salespermonth.disabled = false
		document.regform.businessplan[0].disabled = false
		document.regform.businessplan[1].disabled = false
		document.regform.business_description.disabled = false
		return false;
	}
}

function manageTxtBoxes(e) {
	var fullname = e.name.split('_');
	var prefix = fullname[1];
	if (e.checked == true) {
		document.regform.elements[prefix + '_merch_acc'].disabled = false
		document.regform.elements[prefix + '_terminal_id'].disabled = false
	} else {
		document.regform.elements[prefix + '_merch_acc'].disabled = true
		document.regform.elements[prefix + '_terminal_id'].disabled = true
	}
}

function contactSameAsPayee(chkbox) {
	var form = chkbox.form.name;
	var form_elements = document.forms[form].length;
	for(i =0; i<form_elements; i++) {
		pref_array = document.forms[form].elements[i].name.split("_");
		if (pref_array[0] == "payee") {
			if (chkbox.checked == true) {
				val = document.forms[form].elements[i].value;
				document.forms[form].elements["contact_" + pref_array[1]].value = val;
			}
			document.forms[form].elements["contact_" + pref_array[1]].disabled = chkbox.checked;
		}
	}
}

function winWid(){
	//define browser
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
   return (ns4||ns6) ? window.innerWidth : document.body.clientWidth;
}
function winHei(){
//define browser
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
   return (ns4||ns6) ? window.innerHeight : document.body.clientHeight;
}

/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;


/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function
/*
function flying_generate(popWidth, popHeight, url) {
    var browserWidth = winWid();
    var browserHeight = winHei();

    var ns4 = (document.layers) ? 1 : 0;
    var ie4 = (document.all) ? 1 : 0;
    var ns6 = (document.getElementById && !document.all) ? 1 : 0;
    popWidth = (popWidth>0) ? popWidth : 605;
    var frameWidth = popWidth - 2;
    if (popHeight <= 0) {
        if (browserHeight < 500) {
            var popHeight = 440;
            var scroll = 'yes';
        } else {
            var popHeight = 520;
            var scroll = 'no';
        }
        scroll = 'yes';
    }
    var frameHeight = popHeight - 4;

    var code = ("<div id='jpop' style='position:absolute;width: " + popWidth + "px;height: " + popHeight + "px; display: none;'>\n");
    code += ("  <div id='jpop_inner' style='position: absolute; width: " + popWidth + "px; height: " + popHeight + "px; overflow:hidden; background-color: white; border: 1px solid #D06C53;'>\n");
    code += ("    <iframe id='jpop_iframe' frameborder=0 border=0 style='position: absolute; border: none; width: " + frameWidth + "px;height: " + frameHeight + "px; top: 0px; left: 0px; padding:0; margin:0;' src='" + url + "' scrolling='" + scroll + "'></iframe>\n");
    code += ("  </div>\n");
    code += ("<div id='jpop_close' style='position: absolute; width: " + popWidth + "px; top: " + parseInt(frameHeight-20) + "px;' align=\"center\"><a href=\"javascript:flyInClose('jpop');\" onMouseOver=\"window.status='Затвори прозореца';return true;\" onMouseOut=\"window.status='';return true;\"><img src=\"images/close.gif\" width=\"15\" height=\"15\" border=\"0\" title=\"Close This Window\"></a>&nbsp;<a href=\"javascript:flyInClose('jpop');\" onMouseOver=\"window.status='Затвори прозореца';return true;\" onMouseOut=\"window.status='';return true;\">Затвори</a></div>\n");
    code += ("</div>\n");

    document.write(code);
}
*/
function manage_checkboxes(element) {
    var element = element;
    var the_form = element.form;

    if (element.checked) {
        set_checkboxes(the_form, true);
        return false;
    } else {
        set_checkboxes(the_form, false);
        return false;
    }
}

function set_checkboxes(the_form, set) {
    var items = the_form.elements['items[]'];
    var subitems = the_form.elements['subitems[]'];

    if (items) {
        var items_num = items.length;

        if (items_num) {
            for (var i = 0; i < items_num; i++) {
                items[i].checked = set;
            }
        } else {
            items.checked = set; 
        }
    }

    if (subitems) {
        var subitems_num = subitems.length;

        if (subitems_num) {
            for (var i = 0; i < subitems_num; i++) {
                subitems[i].checked = set;
            }
        } else {
            subitems.checked = set; 
        }
    }

    return true;
}

function count_checkboxes(the_form, element) {
    if (!element) {
        els = new Array('items', 'subitems');
    } else {
        els = new Array(element);
    }

    num_checked=0;
    for(j=0;j<els.length;j++) {
        el = els[j];
        items = the_form.elements[el + '[]'];

        if (items) {
            var items_num = items.length;

            if (items_num) {
                for (var i = 0; i < items_num; i++) {
                    if (items[i].checked) {
                        num_checked=num_checked+1;
                    }
                }
            } else if (items) {
                num_checked = items.checked;
            }
        }
    }

    return num_checked;
}

/**
* adds items for the selections in the admin panel
*/
function addItem(btn) {
    var frm = btn.form;
    var type  = btn.id.replace(/^btn_add/, '').toLowerCase();
    var items = document.getElementById(type);

    var sel_items = '';
    var sel_items_count = 0;
    var sel_total_count = 0;
    for(var i=0; i<items.options.length; i++) {
        //check if any item was selected from the multiple select dropdown
        if (items.options[i].selected){
            sel_total_count++;

            var item_id = items.options[i].value;
            var text    = items.options[i].text;

            var regex = new RegExp(item_id);
            //check if the selected item wasn't already selected
            if (!regex.test(selected[type])){
                //increment the items selected for the type
                sel_items_count++;
                if (sel_items_count > 1)
                    sel_items += ', ';
                //add the id to the selected items
                sel_items += item_id;

                //add item
                var ids     = document.getElementById('ids_' + next_empty);
                var extra   = document.getElementById('extras_' + next_empty);
                var title   = document.getElementById('titles_' + next_empty);
                var enabled = document.getElementById('enabled_' + next_empty);
                var row     = document.getElementById('item_' + next_empty);

                switch (type) {
                case 'articles':
                    ids.value = 'a' + item_id;
                    extra.disabled = true;
                    extra.className = 'txtbox txtbox_disabled';
                    break;
                case 'lectures':
                    ids.value = 'l' + item_id;
                    extra.disabled = true;
                    extra.className = 'txtbox txtbox_disabled';
                    break;
                case 'prayers':
                    ids.value = 'pra' + item_id;
                    extra.disabled = true;
                    extra.className = 'txtbox txtbox_disabled';
                    break;
                case 'practices':
                    ids.value = 'prc' + item_id;
                    extra.disabled = true;
                    extra.className = 'txtbox txtbox_disabled';
                    break;
                case 'topics':
                    ids.value = 't' + item_id;
                    extra.className = 'txtbox';
                    break;
                }

                ids.readonly = true;
                title.value = text;
                enabled.checked = true;

                //display the table row (remove the class name that hides it)
                row.className = '';
                title.focus();

                //increment the total number of items
                next_empty++;

                //check if the max number of items has not been reached
                if (next_empty > max_items) {
                    break;
                }
            }
        }
    }

    if (!sel_items) {
        if (sel_total_count && !sel_items_count) {
            alert(alerts_already_added[type]);
        } else {
            alert(alerts_select_items[type]);
        }
    } else {
        if (selected[type]) {
            selected[type] = selected[type] + ', ' + sel_items;
        } else {
            selected[type] = sel_items;
        }
    }
}

function changeItemStatus(id) {
    var enabled  = document.getElementById('enabled_' + id);
    var item     = document.getElementById('item_' + id);

    if (enabled.checked) {
        item.className = '';
    } else {
        item.className = 'item_disabled';
    }
}

function popupWindow(location, width, height) {
    var user_width = screen.width;
    var user_height = screen.height;
    var x = (user_width - width) / 2;
    var y = (user_height - height) / 2;

    win = window.open(location, null,
    'height=' + height + ', width=' + width + ', toolbar=no, scrollbars=no, titlebar=no, status=yes, resizable = no, menubar=no, left=' + x + ',top=' + y);

    win.onclick = function() {
      win.close();
    }
}


/* HERE STARTS THE CODE FOR THE DROP DOWN MENU */
//Contents for menu 1, they are noy used from here
/*
var menu1=new Array()
menu1[0]='<a href="index.php?category=2">Репродукции</a>'
menu1[1]='<a href="index.php?category=5">Авторски картини</a>'
*/

//Contents for menu 3, and so on


//var menu3=new Array()
//menu3[0]='<a href="http://cnn.com">CNN</a>'
//menu3[1]='<a href="http://msnbc.com">MSNBC</a>'
//menu3[2]='<a href="http://news.bbc.co.uk">BBC News</a>'



//var menuwidth='160px' //default menu width - 160px
//var menubgcolor='lightyellow'  //menu bgcolor
//var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
//var hidemenu_onclick="yes" //hide menu when user clicks within menu?



/////No further editting needed
/*
var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+'!important;background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ 
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-1-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu;
*/
/* HERE ENDS THE CODE FOR THE DROP DOWN MENU */

//used for the page menu2 in the front-end
function submitform(page) {
  document.getElementById('products_page').value = page;
  document.forms['pagemenu_form'].submit();
}

//used for the page menu2 in the front-end
function submitsearchform(page) {
  document.getElementById('search_page').value = page;
  document.forms['search_form'].submit();
}

//now create the event handler function to process the event
function alertkey(e) {
  if( !e ) {
    //if the browser did not pass the event information to the
    //function, we will have to obtain it from the event register
    if( window.event ) {
      //Internet Explorer
      e = window.event;
    } else {
      //total failure, we have no way of referencing the event
      return;
    }
  }
  if( typeof( e.keyCode ) == 'number'  ) {
    //DOM
    e = e.keyCode;
  } else if( typeof( e.which ) == 'number' ) {
    //NS 4 compatible
    e = e.which;
  } else if( typeof( e.charCode ) == 'number'  ) {
    //also NS 6+, Mozilla 0.9+
    e = e.charCode;
  } else {
    //total failure, we have no way of obtaining the key code
    return;
  }
  window.alert('The key pressed has keycode ' + e +
    ' and is key ' + String.fromCharCode( e ) );
}

function entersearch(e) {
  if( !e ) {
    //if the browser did not pass the event information to the
    //function, we will have to obtain it from the event register
    if( window.event ) {
      //Internet Explorer
      e = window.event;
    } else {
      //total failure, we have no way of referencing the event
      return;
    }
  }
  if( typeof( e.keyCode ) == 'number'  ) {
    //DOM
    e = e.keyCode;
  } else if( typeof( e.which ) == 'number' ) {
    //NS 4 compatible
    e = e.which;
  } else if( typeof( e.charCode ) == 'number'  ) {
    //also NS 6+, Mozilla 0.9+
    e = e.charCode;
  } else {
    //total failure, we have no way of obtaining the key code
    return;
  }

  if ( e == 13) {
    document.forms['search_form'].submit();
  }

}

	show_form : function(num)
	{
		var self = this;
		var imag = new Image;
		if (num < 0 || num >= self._imgs.length) return;
		var loading = document.getElementById('loadingImage');

		var effect = document.getElementById('effectImage');
		self._open = num; // set opened image number
		self._set_size(false); // calc and set wrapper size
		self._toggle_wrap(true);
		if (loading) loading.style.display = 'inline';
		imag.onload = function() {
			if (self._imgs[self._open].w == -1)
			{ // store original image width and height
				self._imgs[self._open].w = imag.width;
				self._imgs[self._open].h = imag.height;
			}
			if (effect)
			{
				effect.style.display = (!effect.className || self._imgs[self._open].cls == effect.className)
					? 'block' : 'none';
			}
			if (caption)
				try { caption.innerHTML = self._imgs[self._open].title; } catch(e) {}
			self._set_photo_size(); // calc and set lightbox size
			self._hide_action();
			self._box.style.display = "block";
			self._img.src = imag.src;
			self._img.setAttribute('title',self._imgs[self._open].title);
			self._timer = window.setInterval( function() { self._set_size(true) } , 100);
			if (loading) loading.style.display = 'none';
			if (self._imgs[self._open].set != 'lightbox')
			{
				var set = self._imgs[self._open].set;
				if (self._sets[set].length > 1) self._openedset = set;
				if (!self._prev || !self._next) self._openedset = null;
			}
		};
		self._expandable = false;
		self._expanded = false;
		imag.src = self._imgs[self._open].src;
	}

function showRequest() {
  if (document.getElementById('contactform_tr').style.display=='block') {
    document.getElementById('contactform_tr').style.display='none'; 
    document.getElementById('requestButton').blur(); 
  } else if (document.getElementById('contactform_tr').style.display == 'none') {
    document.getElementById('contactform_tr').style.display='block'; 
    document.getElementById('requestButton').blur();
  }
}


//-->