function _get(a){ return document.getElementById?document.getElementById(a):null}


galery_engine = function() {

    if (_get('sub') == null) return;

    li = _get('sub').childNodes;



for (i = 0; i < li.length; i++) {


    if(li[i].tagName == 'LI')
    {
            li[i].onmouseover = function() {

                this.className += 'here';


            }

            li[i].onmouseout = function() {

                this.className = this.className.replace('here', '');

            }
            li[i].onclick = function() {

                window.location = this.id;

            }


    }else if(li[i].tagName == 'DIV'){
        var div = li[i].childNodes;
        for(j = 0;j<div.length;j++) {

            if(div[j].tagName == 'DIV') {

                img = div[j].childNodes;

                for(m = 0;m<img.length;m++) {

                    if(img[m].tagName == 'A') {

                        link = img[m].childNodes;

                            for(k = 0;k<link.length;k++) {

                                if(link[k].tagName == 'IMG') {

                                    link[k].onmouseover = function() {

                                        if(this.className != 'im_foto_sel') {
                                            this.className = 'im_foto_hov';
                                        }

                                    }
                                    link[k].onmouseout = function() {
                                        if(this.className != 'im_foto_sel') {
                                            this.className = 'im_foto';
                                        }

                                    }

                                }

                            }

                    }

                }

            }

        }

    }

}
}


window.onload = galery_engine;


function Foto_ch(id,id1) {

   var foto = _get('foto_conteiner');
   var par = _get('picture');
   var foto_mini = _get('foto_'+id1);
   var sub = _get('sub');
   var refreshCC;


document.getElementById("foto_conteiner").innerHTML = '<div style="width: 500px; height: 500px; background: url(galery/'+id+') center no-repeat;">';

  var fotos =  sub.getElementsByTagName('IMG');


 for (i = 0; i < fotos.length; i++) {

        if(fotos[i].tagName == 'IMG') {

            fotos[i].className = 'im_foto';


        }


 }


   foto_mini.className = 'im_foto_sel';

 


if(_get('frame')) {
_get('frame').innerHTML =_get('frame').innerHTML;
}

}