function checkBrowser() {
	var browser = navigator.appName;

	if(browser == "Netscape") {

		this.browser = "ns";

	} else if(browser == "Microsoft Internet Explorer") {

		this.browser = "ie";

	}

	this.version = parseInt(navigator.appVersion);

	this.ns4 = ((this.browser=="ns")&&(this.version <= 4));
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4') > 0);
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5') > 0);
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6') > 0);
	this.moz = ((this.browser=="ns")&&(this.version >= 5));
}
is = new checkBrowser();


function jumpsite(location) {
	if (location != "") {
    	self.location=""+location;
    }
}

function verify_delete_post(post_id) {
	if (post_id != "") {
    	if(confirm("Are you sure you want to delete this post?")) {
        	self.location="mod.php?action=remove_msg&msg_id="+post_id;
        }
    }
}

function verify_delete_forum(div_id,forum_id,forum_name) {
	if (forum_id != "") {
    	if(confirm("Are you sure you want to delete the forum '"+forum_name+"'?")) {
        	self.location="admin.php?did="+div_id+"&fid="+forum_id+"&delete=1";
        }
    }
}

function add_smiley(text) {
	text = ' ' + text + ' ';
	document.form_posting.msg_body.value  += text;
	document.form_posting.msg_body.focus();
}

function set_topic_name(text) {
	text = ' ' + text + ' ';
	document.form_posting.topic_name.value = text;
	document.form_posting.topic_name.focus();
}

function set_msg_body(text) {
	text = ' ' + text + ' ';
	document.form_posting.msg_body.value = text;
	document.form_posting.msg_body.focus();
}

function focus_msg_body(){
	document.form_posting.msg_body.focus();
}

function focus_topic_name(){
	document.form_posting.topic_name.focus();
}

function open_window(url,width,height) {
	if(!width) {
		width=400;
	}
	if(!height) {
		height=300;
	}
	window.open(url, "_blank","toolbar=no,location=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizeable=no,status=no");
}

function uncheck_other_checkboxes(checkbox) {
	var checkboxGroup = checkbox.form[checkbox.name];

	for (var c = 0; c < checkboxGroup.length; c++) {
		if (checkboxGroup[c] != checkbox) {
			checkboxGroup[c].checked = false;
		}
	}
}

function uncheck_first_checkbox(checkbox) {
	var checkboxGroup = checkbox.form[checkbox.name];

	checkboxGroup[0].checked = false;

}

function check_all_checkboxes(form) {
	for (var c = 0; c < form.elements.length; c++) {
		if (form.elements[c].type == 'checkbox') {
			form.elements[c].checked = true;
		}
	}
}

function uncheck_all_checkboxes(form) {
	for (var c = 0; c < form.elements.length; c++) {
		if (form.elements[c].type == 'checkbox') {
			form.elements[c].checked = false;
		}
	}
}

function imgInTextOnMouseOver(scaled_width,img) {
	if(img.width == scaled_width) { 
		img.title='Image ReScaled! Click to enlarge!';
	}; 
	// return false;
}
function imgInTextOnClick(scaled_width,img,url) {
	if(img.width == scaled_width) { 
		window.open(url);
	}; 
	// return false;
}

var submitIsClicked = 0;
function submitClick(objForm, strAction) {
	if (submitIsClicked == 0) {
		objForm.action=''+strAction+'';
		objForm.submit();	
	} 
	submitIsClicked++;
	window.status='Submit: '+submitIsClicked+';';
	//return false;
}



