//   xajax.callback.global.onRequest = function()
//   {
//     xajax.$('loadingMessage').style.display='block';
//     xajax.$('mainContentX').style.display='none';
//     xajax.$('mainContent').style.display='none';
//   }
//   xajax.callback.global.beforeResponseProcessing = function()
//   {
//     xajax.$('loadingMessage').style.display='none';
//     xajax.$('mainContentX').style.display='block';
//     xajax.$('mainContent').style.display='block';
//   }




function openPicture(imageName,imageWidth,imageHeight,windowH,opis)
{
  newWindow = window.open("","newWindow","width="+imageWidth+",height="+windowH+",left=50,top=50");
  newWindow.document.open();
  newWindow.document.write("<html>");
  newWindow.document.write("<head>");
  newWindow.document.write("<title>"+opis+"</title>");
  newWindow.document.write("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-2'>");
  newWindow.document.write("</head>");
  newWindow.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'>");
  newWindow.document.write("<img src='"+imageName+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+opis+"' border='0' onClick='self.close();' style='cursor:pointer;'>");
  newWindow.document.write("<br><font style='font-family: Verdana; font-size: 10px;'><center>"+opis+"</center></font> ");
  newWindow.document.write("</body></html>");
  newWindow.document.close();
  newWindow.focus();
}







function mail(user, domain){window.location = 'mailto:'+user+'@'+domain;}
function flip( rid ) {
document.getElementById(rid).style.display = document.getElementById(rid).style.display == 'none' ? 'block' : 'none'
}



// apply tagOpen/tagClose to selection in textarea,
// use sampleText instead of selection if there is none
// copied and adapted from phpBB
function insertTags(tagOpen, tagClose, sampleText, tt) {
        var txtarea;
        if (document.save) {
                txtarea = document.save.tt;
        } else {
                // some alternate form? take the first one we can find
                var areas = document.getElementsByTagName('textarea');
                txtarea = areas[0];
        }

        // IE
        if (document.selection  && !is_gecko) {
                var theSelection = document.selection.createRange().text;
                if (!theSelection) {
                        theSelection=sampleText;
                }
                txtarea.focus();
                if (theSelection.charAt(theSelection.length - 1) == " ") { // exclude ending space char, if any
                        theSelection = theSelection.substring(0, theSelection.length - 1);
                        document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
                } else {
                        document.selection.createRange().text = tagOpen + theSelection + tagClose;
                }

        // Mozilla
        } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
                var replaced = false;
                var startPos = txtarea.selectionStart;
                var endPos = txtarea.selectionEnd;
                if (endPos-startPos) {
                        replaced = true;
                }
                var scrollTop = txtarea.scrollTop;
                var myText = (txtarea.value).substring(startPos, endPos);
                if (!myText) {
                        myText=sampleText;
                }
                var subst;
                if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any
                        subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
                } else {
                        subst = tagOpen + myText + tagClose;
                }
                txtarea.value = txtarea.value.substring(0, startPos) + subst +
                        txtarea.value.substring(endPos, txtarea.value.length);
                txtarea.focus();
                //set new selection
                if (replaced) {
                        var cPos = startPos+(tagOpen.length+myText.length+tagClose.length);
                        txtarea.selectionStart = cPos;
                        txtarea.selectionEnd = cPos;
                } else {
                        txtarea.selectionStart = startPos+tagOpen.length;
                        txtarea.selectionEnd = startPos+tagOpen.length+myText.length;
                }
                txtarea.scrollTop = scrollTop;

        // All other browsers get no toolbar.
        // There was previously support for a crippled "help"
        // bar, but that caused more problems than it solved.
        }
        // reposition cursor if possible
        if (txtarea.createTextRange) {
                txtarea.caretPos = document.selection.createRange().duplicate();
        }
}
