
function sTextField(v){
  SElement.call(this);
  if (v) this.setValue(v); 
}

_p = sExtend(sTextField, SElement, "sTextField");
_p.tagName = "input";

_p.create = function(){
  this._element = this._DOC.createElement(this.tagName);
  this._element.setAttribute("type", "text");
  
  this._event = new sEvent(this._element);
}

_p.getValue = function(){ return this._element.value; }
_p.setValue = function(v){ this._element.value = v; }

function sCheckBox(v){
  SElement.call(this);
  
  if (v) this.setText(v);
  
  var _this = this;
}

_cb = sExtend(sCheckBox, SElement, "sCheckBox");
_cb.tagName = "div";

_cb.create = function(){
  this._element = this._DOC.createElement(this.tagName);
  
  this._input = document.createElement("input");
  this._input.type = "checkbox";
  this._input.className = "s_checkbox";
  this._input.id = "s_checkbox_"+_sID++;
  this.setHeight(15);
  this._element.appendChild(this._input);
  this._input.checked = true;
  
  this._event = new sEvent(this._element);
}
_cb._checkBox = function(){ return this._input; }
_cb.setChecked = function(v){ this._input.checked = v; }
_cb.getChecked = function(){ return this._input.checked; }

_cb.setText = function(v){
  this._text = v;
  this._label = document.createElement("label");
  this._label.setAttribute("for", this._input.id);
  this._label.innerHTML += v;
  this._element.appendChild(this._label);
}

_cb.getText = function(){ return this._text; }
_cb.setValue = function(v){ this._input.vallue = v; }
_cb.getValue = function(){ return this._input.vallue; }

function sRadio(v, n){
  sCheckBox.call(this);
  
  this._input = sBrowser.ie ? document.createElement("<input name=\""+n+"\">") : this._input = document.createElement("input");
  this._input.type = "radio";
  this._input.id = "s_radio_"+_sID++;
  this._input.className = "s_checkbox";
  this.setHeight(15);
  this._element.appendChild(this._input);
  this._input.checked = true;
  
  if (n) this.setName(n);
  if (v) this.setText(v);
  
}

_r = sExtend(sRadio, sCheckBox, "sRadio");
_r.tagName = "div";

_r.create = function(){
  this._element = this._DOC.createElement(this.tagName);
  this._event = new sEvent(this._element);
}

_r.setName = function(v){ 
  this._input.name = v; 
}
_r.getName = function(){ 
  return this._input.name; 
}

function sTextArea(){
  sTextField.call(this);
}

_ta = sExtend(sTextArea, sTextField, "sTextArea");
_ta.tagName = "textarea";

_ta.create = function(){
  this._element = this._DOC.createElement(this.tagName);
  if (sBrowser.ie)
    this._element.style.overflow = "auto";
    
  this._event = new sEvent(this._element);
}

function sButton(v){
  SElement.call(this);
  
  this.setCssClassName("s_button");
  
  this._leftElement.className = "s_cell s_button-left";
  this._contentElement.className = "s_cell s_button-content";
  this._rightElement.className = "s_cell s_button-right";
  
  this.getElement().appendChild(this._leftElement);
  this.getElement().appendChild(this._contentElement);
  this.getElement().appendChild(this._rightElement);
  
  if (v) this._contentElement.innerHTML = "<span style='display: block; margin: 6px'>"+v+"</span>";
  
  var _this = this;
  
  this.addEvent("mouseover", function(){
    _this._leftElement.className = "s_cell s_button-left-o";
    _this._contentElement.className = "s_cell s_button-content-o";
    _this._rightElement.className = "s_cell s_button-right-o";
  });
  
  this.addEvent("mouseout", function(){
    _this._leftElement.className = "s_cell s_button-left";
    _this._contentElement.className = "s_cell s_button-content";
    _this._rightElement.className = "s_cell s_button-right";
  });

}

_b = sExtend(sButton, SElement, "sButton");
_b.tagName = "div";
_b.create = function(){
  this._element = this._DOC.createElement(this.tagName);
  this._leftElement = this._DOC.createElement("div");
  this._contentElement = this._DOC.createElement("div");
  this._rightElement = this._DOC.createElement("div");
  
  this._event = new sEvent(this._element);
}

_b.setText = function(v){ this._element.innerHTML = v; }

_b.setCWidth = function(v){ this._contentElement.style.width = v+"px" }

function sIframe(){
  SElement.call(this);
}

_i = sExtend(sIframe, SElement, "sIframe");
_i.tagName = "iframe";

_i.setSrc = function(v){ this._element.src = v; }
_i.getSrc = function(){ return this._element.src; }
_i.setScrolling = function(v){ this._element.scrolling = v; }
_i.getScrolling = function(){ return this._element.scrolling; }
_i.setBorder = function(v){
  switch (v){
    case "none": 
      this._element.frameBorder = "0";
      break;
    case "yes": 
      this._element.frameBorder = "1";
      break;
    default:
      this._element.style.border = v;
      break;   
  }
}

function sImage(v){
  SElement.call(this);
  /*
  var _d = this.getDisplay();
  var _this = this;
  
  this.addEvent("load", function(){
      _this.setDisplay(_d);
  } );
  */
  if (v)
  this.setSrc(v);
}

_img = sExtend(sImage, SElement, "sImage");
_img.tagName = "img";

_img.create = function(){
  this._element = new Image();
  this._event = new sEvent(this._element);
}

_img._src = false;

_img.setSrc = function(v){
  this._element.src = v;
  this._element.alt = v;
  this._src = v;
}
_img.getSrc = function(){ return this._src; }

function sLink(v){
  sComponent.call(this);
  
  if (v) this.setSrc(v);
}

_link = sExtend(sLink, sComponent, "sLink");
_link.tagName = "a";

_link.setSrc = function(v){ this._element.href = v; }
_link.getSrc = function(){ return this._element.href; }

_link.setTarget = function(v){ this._element.target = v; }
_link.getTarget = function(){ return this._element.target; }

