/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){

   $('ul#billboards li img').hover(

        function(){
            $(this).css({"border":"2px solid #F7BE15"})
        },

        function(){
            $(this).css({"border":"2px solid #FFFFFF"})
        }

    );

    $('div.good_pict_container div.good_picts').each(

        function(){

            $(this).find('img').hover(

                function(){
                    $(this).css({"border":"2px solid #F7BE15"})
                },

                function(){
                    $(this).css({"border":"2px solid #FFFFFF"})
                }
            );

        }

    )

    $('div.good_pict_container').each(

        function(){

            $(this).find('div.good_picts img').each(

                function(){//выделение рамок картинок при наведении

                    $(this).hover(

                        function(){
                            $(this).css({"border":"2px solid #F7BE15"})
                        },

                        function(){
                            $(this).css({"border":"2px solid #FFFFFF"})
                        }

                    );

                }

            );//$(this).find('div.good_picts img').each            

            var imgA = $(this).find('div.good_picts a.pict_sideA');
            var imgB = $(this).find('div.good_picts a.pict_sideB');

            $(this).find('div.sideA').find("a").click(

                function(){
                    imgB.attr({"style":"display:none"});
                    imgA.attr({"style":"display:inline"});
                    $(this).parent('div').addClass('pngA');
                    $(this).parent('div').siblings('div.sideB').removeClass('pngB');
                    $(this).parent('div').siblings('div.sideB').find('a').attr({"style":"display:inline"});
                    $(this).parent('div').siblings('div.sideB').find('span').attr({"style":"display:none"});
                    $(this).parent('div').find('a').attr({"style":"display:none"});
                    $(this).parent('div').find('span').attr({"style":"display:inline"});
                }

            );

            $(this).find('div.sideB').find("a").click(

                function(){
                    imgA.attr({"style":"display:none"});
                    imgB.attr({"style":"display:inline"});
                    $(this).parent('div').addClass('pngB');
                    $(this).parent('div').siblings('div.sideA').removeClass('pngA');
                    $(this).parent('div').siblings('div.sideA').find('a').attr({"style":"display:inline"});
                    $(this).parent('div').siblings('div.sideA').find('span').attr({"style":"display:none"});
                    $(this).parent('div').find('a').attr({"style":"display:none"});
                    $(this).parent('div').find('span').attr({"style":"display:inline"});
                }

            );

        });

});

