function checkAll() {
	var val = document.visualmail.allbox.checked;
	for (var i=0;i < document.visualmail.elements.length;i++) {
		var e = document.visualmail.elements[i];
		if (e.name != 'allbox')
			e.checked = val;
	}
}
function searchNick(){
	window.open("./code/modules/messages/nickSearch.php","Nick_Search","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=260, height=130");
//window.open('./code/modules/messages/nickSearch.php', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;
}

function addNick(){
	if (window.opener.post.naarNicks.value != ""){
		window.opener.post.naarNicks.value += ",";
		window.opener.post.naarIds.value += ",";
	}
	
	window.opener.post.naarNicks.value += document.ss.nicks.options[document.ss.nicks.selectedIndex].text;
	window.opener.post.naarIds.value += document.ss.nicks.value;
}

function hideNumbers(name, x){
	var elem = new getObj(name);
	
	which = elem.style.display;

	if (which == "" || which == "block") { 
		elem.style.display = "none";
		x.src = "templates/b2p/images/forum/show_line_numbers.png";
	}
	else {  
		elem.style.display = "block";
		x.src = "templates/b2p/images/forum/hide_line_numbers.png";
	}
}

function showHide(id){
	var elem = new getObj(id);
	which = elem.style.display;

	if (which == "" || which == "block") { 
		elem.style.display = "none";
	}
	else {  
		elem.style.display = "block";
	}
}

function changeSize(name, type){
	var elem = new getObj(name);
	var h = elem.style.height;
	h = h.replace('px', '');
	if (h == '') h = 150;
	
	if (type == '+')
		h = parseInt(h)+parseInt(100);
	else h = parseInt(h)-parseInt(100);
	elem.style.height = h + 'px';
}
function showSource(id){
	var elem = new getObj(id);
	x = elem.obj.innerHTML;

	newWindow=window.open('','','toolbar=no,scrollbars=yes,width=800,height=600');
	newWindow.document.open("text/html", "replace");
	newWindow.document.writeln('<style>a{color:black;text-decoration:none;}a:link{color:black;text-decoration:none;}a:hover{color:black;text-decoration:underline;}</style>');
	newWindow.document.writeln(x);
	newWindow.document.close();

}
function getObj(name)
{
    if (document.getElementById) {	
        this.obj = document.getElementById(name);
        this.style = document.getElementById(name).style;
    }
    else if (document.all) {
        this.obj = document.all[name];
        this.style = document.all[name].style;
    }
    else if (document.layers) {
        this.obj = getObjNN4(document,name);
        this.style = this.obj;
    }
}

function getObjNN4(obj,name)
{
    var x = obj.layers;
    var foundLayer;
    for (var i=0;i<x.length;i++) {
        if (x[i].id == name)
            foundLayer = x[i];
        else if (x[i].layers.length)
            var tmp = getObjNN4(x[i],name);
        if (tmp) foundLayer = tmp;
    }
    return foundLayer;
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popUp(URL) {
	/*day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=350,height=300');");*/
	window.open(URL,"avatar_reator","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=350, height=400");
}
function confirmIt(){
	//alert('x');
	return confirm('are you sure?');
}