// ie ашч для лєйблов
if(window.iamIE)  {
    window.onload = function(){  
        var a = document.getElementsByTagName("label");
        for(var i=0,j=a.length;i<j;i++){
          if(a[i].hasChildNodes && a[i].childNodes.item(0).tagName == "IMG")          {
            a[i].childNodes.item(0).forid = a[i].htmlFor;
            a[i].childNodes.item(0).onclick = function(){
              var e = document.getElementById(this.forid);
              switch(e.type){
                case "radio": e.checked|=1;break;
                case "checkbox": e.checked=!e.checked;break;
                case "text": case "password": case "textarea": e.focus(); break;
              }
            }
          }
        }
  }
}

function handleFlashClick(banId) {
    //alert('You clicked on flash-banner with id=' + banId);
       
    var urlTo = $('.banner #' + banId + ' param[name="outerUrl"]').val();
    if ( urlTo && (urlTo != '' || urlTo != 'http://') )
        window.document.location = urlTo;
    
    return true;    
}

function open_popupVK (url){
    open_popup( url, 40 ,10, 920, 760, 1);
}

function open_popup(url, posx, posy, size_w, size_h, scroll) {
    if (window.iamIE) {
        msg=window.open(url,'jmd','scrollbars=1,status=0,toolbar=0,directories=0,menubar=0,location=1,resizable=0,width='+size_w+',height='+size_h+', left='+posx+', top='+posy+'');
    } else {
        msg=window.open(url,'jmd','scrollbars='+scroll+',status=0,toolbar=yes,chrome=yes,directories=0,menubar=1,location=0,resizable=0,width='+size_w+',height='+size_h+', left='+posx+', top='+posy+'');
    }
}
   
// объект для отработки перепрыгиваний
var layoutControl = {
    width: null
    , height: null
    , pos: 0
    // возможные изменения в лаяуте по высоте
    , layoutExs: {
        width: ['0', '1230', '1498']
        ,height: ['', '', '']
        ,exec: ['', '', '']
    }
    , setWidth: function (width){
        // width has been changed or not set
        if (width != this.width || width == null ) {                        
            val = 0;
            for (i=1; i < count(this.layoutExs.width); i++){
                if (this.layoutExs.width[i] < width)
                    val = i;
            }
            if (this.pos == val){
                
            }
            this.width = width;
            //alert(width);            
        }
    }
}   
    
$(function(){

    // Для IE6 фиксим фон у input в комбобоксе
    if (window.DD_belatedPNG) {
    }

    if (window.iamIE){
    }

    // Делаем аккордион фиксированной высоты
    $(window).bind('load', function(){
    });
    
    // при изменении размеров окна
    $(window).resize(function(){        
        layoutControl.setWidth($(window).width());    
    });
})
