$(document).ready(function(){
    //оформляем картинку в тексте уголками
    $('.imgText').each(function(){
        var wImg = $(this).width() + 10;
        var hImg = $(this).height() + 10;
        //alert(wImg+" "+hImg);
        if(wImg>150 && hImg>180){
            $(this).wrap('<p class="imgTextOut" style="width:'+wImg+'px;height:'+hImg+'px;"></p>')
                    .after('<img src="/img/corner1.png" alt="" class="iePNG" id="corner1"/>' +
                           '<img src="/img/corner2.png" alt="" class="iePNG" id="corner2"/>' +
                           '<img src="/img/corner3.png" alt="" class="iePNG" id="corner3"/>' +
                           '<img src="/img/corner4.png" alt="" class="iePNG" id="corner4"/>');
        }
    });

    //листаем страницы галереи
    $('#fotoPage span').click(function(){
        var numberPage = $(this).index('#fotoPage span');
        $('#foto div').css('top',numberPage*180*(-1));
        $('#fotoPage .act').removeClass('act');
        $(this).addClass('act');
    });

    //бронирование
    $('#armoring').click(function(){
        $('#formBron').css('display','block');
    });
    $('#close span').click(function(){
        $('#formBron').css('display','none');
        $('#formBron #sendok').css('display','none');
        $('#formBron form').css('display','block');
    });
    
    //выбор отеля
    $('#object').change(function(){
        valSel = $(this).val();
        if(valSel=='Отель «Любовь»'){            
            $('#div9').css('display','block');
            $('#div10').css('display','none');
        } else {                       
            $('#div9').css('display','none');
            $('#div10').css('display','block');
        }
    });
});

function show_form(){
    $('#formBron').css('display','block');
}

function show_sendok(){
    $('#formBron form').css('display','none');
    $('#formBron #sendok').css('display','block');
    $('#formBron').css('display','block');
}

/*min-width для ie*/
var d = document;
var winIE = (navigator.userAgent.indexOf('Opera')==-1 && (d.getElementById && d.documentElement.behaviorUrns)) ? true : false;

function bodySize(){
    if(winIE && d.documentElement.clientWidth) {
    sObj = d.getElementById('main').style;
    sObj2 = d.getElementById('footer').style;
        if(d.documentElement.clientWidth<1000) {
            sObj.width = '1000px';
            sObj2.width = '1000px';
        }
        else {
            sObj.width = '100%';
            sObj2.width = '100%';
        }
    }
}

function init(){
    if(winIE) { bodySize(); }
}
onload = init;
if(winIE) { onresize = bodySize; }
