jQuery(document).ready(function () {
	preloadImages('templates/bkz/images/menu/', '1-a.gif', '6-a.gif', '2-a.gif', '3-a.gif', '4-a.gif', '5-a.gif')
        if (showcasePreview = document.getElementById('showcase-preview')) {
            showcasePreview.style.overflow = 'hidden'
        }
});
 
 //
 function preloadImages(dir) { //прелоадер картинок, первый параметр фукнции -- путь до папки с картинками, остальное имена картинок
	var picture_gallery = new Array;

	for(var i = 1; i < preloadImages.arguments.length; i++)
	{
		picture_gallery[preloadImages.arguments[i]] = new Image();
		picture_gallery[preloadImages.arguments[i]].src = dir + preloadImages.arguments[i];
	}
 }
 
 function swapImage ( anchor, submenu, current ) {
        //
	active = /-a\.gif/
        //
	if (!anchor.childNodes[0].src.match(active)) {
                if (current != 1)
                     anchor.childNodes[0].src = anchor.childNodes[0].src.replace('.gif', '-a.gif')
	} else {
                if (current != 1)
                     anchor.childNodes[0].src = anchor.childNodes[0].src.replace('-a.gif', '.gif')
	}
	//
        if (submenu = document.getElementById(submenu)) {
            if (submenu.style.display != 'block') {
                submenu.style.display = 'block'
            } else {
                submenu.style.display = 'none'
            }
        }
 }
 
 function formInput ( element, text ) {
        if (element.value == '') {
		element.value = text
	} else {
            if (element.value == text) {
                    element.value = ''
            }
        }
	return false
 }
 
 function switchMenu ( element, anchor ) {
	if ( sub = document.getElementById ( element )) {
		if (sub.style.display == 'none') {
			sub.style.display = 'block'
                        anchor.title = anchor.title.toString().replace('Раскрыть', 'Скрыть')
		} else {
			sub.style.display = 'none'
                        anchor.title = anchor.title.toString().replace('Скрыть', 'Раскрыть')
		}
	}
	return false
 }

 function aboutCompany () {
     div = document.getElementById('about-company');
     //
     if (div.style.height != 'auto') {
         div.style.height = 'auto';
     } else {
         div.style.height = '0';
     }
     //
     return false;
 }

 function openWindow(url, width, height) {
    var left = Math.round((screen.width/2)-(width/2));
    var top = Math.round((screen.height/2)-(height/2));
    FormWin = window.open(url, '', "width="+width+", height="+height+", menubar=no, resizable=no, scrollbars=no, status=no, border=no, toolbar=no, left="+left+", top="+top);
    return FormWin
 }

 function maximize (input) {

 }

 function minimize (input) {

 }
