$(function() {
    var lightBoxConf = {
        overlayBgColor: '#1f1f1f',
        overlayOpacity: 0.6,
        imageLoading: '../images/lightbox-ico-loading.gif',
        imageBtnClose: '../images/lightbox-btn-close.gif',
        imageBtnPrev: '../images/lightbox-btn-prev.png',
        imageBtnNext: '../images/lightbox-btn-next.png',
        containerResizeSpeed: 150,
        txtImage: 'Изображение',
        txtOf: 'из'
    };
	$('#photos a').lightBox(lightBoxConf);
    $("a[rel='lightbox']").lightBox(lightBoxConf);
    $("a[rel^='lightbox[']").lightBox(lightBoxConf);
});

// JavaScript Document
var last;
var disp;
function show_hide(x)
{
  last = document.getElementById(x);
  disp = last.style.display;
  if (disp == "block") disp = "none"
   else disp = "block";
  last.style.display = disp;
  return false;
}

var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1)&&(agt.indexOf('opera')==-1));

function MessNotIE(o) {
    if (!is_ie) {
        alert(o.title);
    }
    window.open(o.href,'','resizable=yes,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,fullscreen=no,dependent=no,status');
    return false;
}

function validForm(f) {
	var if_submit = true;
	if (f.news_title.value == '') {if_submit = false; alert("Вы не указали заголовок новости!");}
	if (f.news_content1.value == '') {if_submit = false; alert("Вы не указали содержимое новости!");}
	if (if_submit) f.submit() // Отправляем на сервер
}

/**
 * Displays an confirmation box before to submit a "DROP/DELETE/ALTER" query.
 * 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, theSqlQuery)
{
    // 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' + theSqlQuery);
    if (is_confirmed) {
        if ( typeof(theLink.href) != 'undefined' ) {
            theLink.href += '&is_js_confirmed=1';
        } else if ( typeof(theLink.form) != 'undefined' ) {
            theLink.form.action += '?is_js_confirmed=1';
        }
    }

    return is_confirmed;
} // end of the 'confirmLink()' function
