String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

jQuery(function () {
jQuery('.boc').click(function () {jQuery.beautyOfCode.init({brushes: ['Xml', 'JScript', 'CSharp', 'Plain', 'Php']})});
jQuery('[id^="sh_"]').click(function () {
	sh_id = this.id.replace('sh_','');
	return show_hide(sh_id);
});
});

function show_hide(id) {
 shids = id.split('|');
 for (var x = 0;x < shids.length; x++) {
  shid = document.getElementById(shids[x]);
  if (shid) {
   if (shid.style.display=='none') shid.style.display='';
   else shid.style.display='none';
  }
 }
 return false;
}

var codePage = false;

function temp_edit(id) {
  if (document.forms.temp_form&&document.getElementById) {
    theform = document.forms.temp_form;
    if (codePage) {window.location = '?s='+theform.s.value+'&a=edit&id='+id;return false;}
    theform.action = '?a=edit&id='+id;
    theform.title.value = document.getElementById('nt_'+id).innerHTML.trim();
    theform.content.value = document.getElementById('nc_'+id).innerHTML.trim();
    document.getElementById('admin_form').style.display='';
  }
  //return false;
}

function ltgt() {
  if (document.forms.temp_form&&document.getElementById) {
    theform = document.forms.temp_form;
    theform.content.value = theform.content.value.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  }
}

function getCookie(name){
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return "";
    }
    else begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value) {
var exdate=new Date();exdate.setDate(100);path="/";domain="jeaster.net";secure=(location.protocol=='http:'?false:true);
document.cookie= name + "=" + escape(value) + ((exdate) ? "; expires=" + exdate : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function findPos(obj) {var curleft = curtop = 0;if (obj.offsetParent) {do {curleft += obj.offsetLeft;curtop += obj.offsetTop;} while (obj = obj.offsetParent);return [curleft,curtop];}}

