function getBrowserWidth ( ) {
    if ( window.innerWidth ) { return window.innerWidth; }
    else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }
    else if ( document.body ) { return document.body.clientWidth; }
    return 0;
}
function dynamicLayout(){
  var browserWidth = getBrowserWidth();
  if (browserWidth<1024){
    changeLayout("peque");
  }
 if ((browserWidth>=1024) && (browserWidth<=1280)){
    changeLayout("normal");
  }
  if (browserWidth>1280){
    changeLayout("grande");
  }
}
function changeLayout(newLayout) {
  document.body.className = newLayout;
}
function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}
  addEvent(window, 'load', dynamicLayout);
  addEvent(window, 'resize', dynamicLayout);  
  
