Ext.onReady(function(){
    var ces = Ext.select('.content>.ce');
    var dw = Ext.getBody().getWidth();
    var newstyle = {};

    var viewportwidth;
     var viewportheight;

     // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

     if (typeof window.innerWidth != 'undefined')
     {
          viewportwidth = window.innerWidth,
          viewportheight = window.innerHeight
     }

    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

     else if (typeof document.documentElement != 'undefined'
         && typeof document.documentElement.clientWidth !=
         'undefined' && document.documentElement.clientWidth != 0)
     {
           viewportwidth = document.documentElement.clientWidth,
           viewportheight = document.documentElement.clientHeight
     }

     // older versions of IE

     else
     {
           viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
           viewportheight = document.getElementsByTagName('body')[0].clientHeight
     }


    var ct = ces.getCount();

    ces.each(function(a,b,c){
        if(c > 0 && !a.hasClass('pagecarousel_pi1')){
            a.select('>div').setStyle({
                width: a.getWidth() - 36 + 'px'
            });

            newstyle.width = dw - a.getX() + 'px';

            if(c == ct-1){
                newstyle.height = (a.getHeight() + (a.parent('.content').getBottom() - a.getBottom())) + 'px';
            }

            a.setStyle(newstyle);
        } else if(c > 0 && a.hasClass('pagecarousel_pi1')){
            var slides = a.select('div.tx-pagecarousel-slides').item(0);
            newstyle.width = dw - a.getX() + 'px';

            if(c == ct-1){
                newstyle.height = (slides.getHeight() + (a.parent('.content').getBottom() - slides.getBottom())) + 'px';
                a.setStyle({'padding-bottom': '0px'});
            }

            slides.setStyle(newstyle);
        }
    });
    
    var comboBoxRegistry = {};

    Ext.select('.corinor_form select').each(function(e){
    	var key = e.getAttribute('name');
    	
        var converted = new Ext.form.ComboBox({
            typeAhead: true,
            triggerAction: 'all',
            transform:e,
            width:e.getWidth(),
            forceSelection:true
        });
        
        comboBoxRegistry[key] = converted;
    });

    Ext.select('.footer .inner').each(function(e){
        if(e.getBottom() < viewportheight){
            e.setStyle({
                height: (e.getHeight() + (viewportheight - e.getBottom())) + 'px'
            });
        }
    });
    
    user_datepicker_fn(comboBoxRegistry);
});



