document.onfocusin = function() { 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
}

function loadScode(objThis, imgPath) {
  var arr = ("" + objThis.src).slice(-4).split("");
  for(var i=0; i<arr.length; i++) arr[i] = '<img src="' + imgPath + 'sa1225' + arr[i] + '163tr0.gif" title="" alt="" />';
  objThis.parentNode.innerHTML = arr.join("");
}

function archiveSelect(obj) {
  if(obj.selectedIndex>0) document.location.href = obj.value;
}

function resetForm(objThis, strURL) {
	resetForm.imageURL = strURL;
	objThis = objThis.parentNode.form;
  var arr = objThis["emoticon"].options, leng = arr.length;
  if(leng<1) return;
  var val = arr[0].value;
  for(var i=0; i<leng; i++) if(arr[i].selected) val = arr[i].value;
  objThis["content"].style.cssText = "background-image:url('" + strURL + val + "');background-repeat:no-repeat;";
}

function changeBgImage(objThis) {
  objThis.form["content"].style.cssText = "background-image:url('" + resetForm.imageURL + objThis.value + "');background-repeat:no-repeat;";
}

function selBox(box1, box2) {
  if(box1 && (box1=$id(box1))) {
  	if(box2 && (box2=$id(box2))) box2.style.display = "none";
  	box1.style.display = box1.style.display=="none" ? "" : "none";
  }
}

var imgTable = {
	img: ["profile", "archive", "articles","album", "comments", "guest","links"],
	oned : {},
	showed: 0,
  output: function(url) {
  	var b = [];
    for(var i=0, a = this.img; i<a.length; i++) b[i] = '<a href="###"><img src="'+ (a[i] = url + a[i]) +'.gif"  onmouseover="imgTable.on(this,'+ i +')" onclick="imgTable.show('+ i +')" alt="" /></a>';
    document.write(b.join(""));
  },
  on: function(o, n, b) {
  	var t = this.img[n];
    this.oned[n] = o, o.src = t + "on.gif";
    o.onmouseout = b ? null : function() { this.src = t + ".gif"; };
  },
  off: function(n) {
  	var t = this.oned[n];
    if(t) this.oned[n].src = this.img[n] + ".gif";
  },
  show: function(n) {
    var o = document.getElementById("tab"+ (n+1) +"_data"), p = document.getElementById("tab"+ (this.showed+1) +"_data");
    this.on(this.oned[n], n, true), this.off(this.showed);
    if(o) { o.style.display = "block"; this.showed = n; }
    if(p) p.style.display = "none";
  }
}

window.onresize = window.onload = function() {
	var n = 703, my_div = document.getElementById("blogmaincontentframe"), p = my_div.offsetTop, e = document.body.clientHeight;
	my_div.style.height = e<n ? (e - p - 49) : (n - p);
};
