if (typeof SESSIONURL == "undefined") {
	SESSIONURL = ""
}
if (typeof vbphrase == "undefined") {
	vbphrase = new Array()
}
var vB_Editor = new Array();
var ignorequotechars = false;
var pagenavcounter = 0;
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = ((userAgent.indexOf("opera") != -1) || (typeof (window.opera) != "undefined"));
var is_saf = ((userAgent.indexOf("applewebkit") != -1) || (navigator.vendor == "Apple Computer, Inc."));
var is_webtv = (userAgent.indexOf("webtv") != -1);
var is_ie = ((userAgent.indexOf("msie") != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4 = ((is_ie) && (userAgent.indexOf("msie 4.") != -1));
var is_moz = ((navigator.product == "Gecko") && (!is_saf));
var is_kon = (userAgent.indexOf("konqueror") != -1);
var is_ns = ((userAgent.indexOf("compatible") == -1) && (userAgent.indexOf("mozilla") != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_mac = (userAgent.indexOf("mac") != -1);
var is_regexp = (window.RegExp) ? true : false;
var AJAX_Compatible = false;
var pointer_cursor = (is_ie ? "hand" : "pointer");
String.prototype.vBlength = function () {
	return (is_ie && this.indexOf("\n") != -1) ? this.replace(/\r?\n/g, "_").length : this.length
};

function array_pop(A) {
	if (typeof A != "object" || !A.length) {
		return null
	} else {
		var B = A[A.length - 1];
		A.length--;
		return B
	}
}
if (typeof Array.prototype.shift === "undefined") {
	Array.prototype.shift = function () {
		for (var C = 0, A = this[0], B = this.length - 1; C < B; C++) {
			this[C] = this[C + 1]
		}
		this.length--;
		return A
	}
}

function array_push(A, B) {
	A[A.length] = B;
	return A.length
}

function fetch_object(A) {
	if (document.getElementById) {
		return document.getElementById(A)
	} else {
		if (document.all) {
			return document.all[A]
		} else {
			if (document.layers) {
				return document.layers[A]
			} else {
				return null
			}
		}
	}
}

function fetch_tags(B, A) {
	if (B == null) {
		return new Array()
	} else {
		if (typeof B.getElementsByTagName != "undefined") {
			return B.getElementsByTagName(A)
		} else {
			if (B.all && B.all.tags) {
				return B.all.tags(A)
			} else {
				return new Array()
			}
		}
	}
}

function fetch_tag_count(B, A) {
	return fetch_tags(B, A).length
}

function do_an_e(A) {
	if (!A || is_ie) {
		window.event.returnValue = false;
		window.event.cancelBubble = true;
		return window.event
	} else {
		A.stopPropagation();
		A.preventDefault();
		return A
	}
}

function e_by_gum(A) {
	if (!A || is_ie) {
		window.event.cancelBubble = true;
		return window.event
	} else {
		if (A.target.type == "submit") {
			A.target.form.submit()
		}
		A.stopPropagation();
		return A
	}
}

function validatemessage(B, C, A) {
	if (is_kon || is_saf || is_webtv) {
		return true
	} else {
		if (C.length < 1) {
			alert(vbphrase.must_enter_subject);
			return false
		} else {
			var D = PHP.trim(stripcode(B, false, ignorequotechars));
			if (D.length < A) {
				alert(construct_phrase(vbphrase.message_too_short, A));
				return false
			} else {
				if (typeof (document.forms.vbform) != "undefined" && typeof (document.forms.vbform.imagestamp) != "undefined") {
					if (document.forms.vbform.imagestamp.value.length != 6) {
						alert(vbphrase.complete_image_verification);
						document.forms.vbform.imagestamp.focus();
						return false
					} else {
						return true
					}
				} else {
					return true
				}
			}
		}
	}
}

function stripcode(H, A, C) {
	if (!is_regexp) {
		return H
	}
	if (C) {
		var B = new Date().getTime();
		while ((startindex = PHP.stripos(H, "[quote")) !== false) {
			if (new Date().getTime() - B > 2000) {
				break
			}
			if ((stopindex = PHP.stripos(H, "[/quote]")) !== false) {
				fragment = H.substr(startindex, stopindex - startindex + 8);
				H = H.replace(fragment, "")
			} else {
				break
			}
			H = PHP.trim(H)
		}
	}
	if (A) {
		H = H.replace(/<img[^>]+src="([^"]+)"[^>]*>/gi, "$1");
		var G = new RegExp("<(\\w+)[^>]*>", "gi");
		var E = new RegExp("<\\/\\w+>", "gi");
		H = H.replace(G, "");
		H = H.replace(E, "");
		var D = new RegExp("(&nbsp;)", "gi");
		H = H.replace(D, " ")
	} else {
		var F = new RegExp("\\[(\\w+)[^\\]]*\\]", "gi");
		var I = new RegExp("\\[\\/(\\w+)\\]", "gi");
		H = H.replace(F, "");
		H = H.replace(I, "")
	}
	return H
}

function vB_PHP_Emulator() {}
vB_PHP_Emulator.prototype.stripos = function (A, C, B) {
	if (typeof B == "undefined") {
		B = 0
	}
	index = A.toLowerCase().indexOf(C.toLowerCase(), B);
	return (index == -1 ? false : index)
};
vB_PHP_Emulator.prototype.ltrim = function (A) {
	return A.replace(/^\s+/g, "")
};
vB_PHP_Emulator.prototype.rtrim = function (A) {
	return A.replace(/(\s+)$/g, "")
};
vB_PHP_Emulator.prototype.trim = function (A) {
	return this.ltrim(this.rtrim(A))
};
vB_PHP_Emulator.prototype.preg_quote = function (A) {
	return A.replace(/(\+|\{|\}|\(|\)|\[|\]|\||\/|\?|\^|\$|\\|\.|\=|\!|\<|\>|\:|\*)/g, "\\$1")
};
vB_PHP_Emulator.prototype.unhtmlspecialchars = function (B) {
	f = new Array(/&lt;/g, /&gt;/g, /&quot;/g, /&amp;/g);
	r = new Array("<", ">", '"', "&");
	for (var A in f) {
		B = B.replace(f[A], r[A])
	}
	return B
};
vB_PHP_Emulator.prototype.unescape_cdata = function (C) {
	var B = /<\=\!\=\[\=C\=D\=A\=T\=A\=\[/g;
	var A = /\]\=\]\=>/g;
	return C.replace(B, "<![CDATA[").replace(A, "]]>")
};
vB_PHP_Emulator.prototype.htmlspecialchars = function (D) {
	var C = new Array((is_mac && is_ie ? new RegExp("&", "g") : new RegExp("&(?!#[0-9]+;)", "g")), new RegExp("<", "g"), new RegExp(">", "g"), new RegExp('"', "g"));
	var B = new Array("&amp;", "&lt;", "&gt;", "&quot;");
	for (var A = 0; A < C.length; A++) {
		D = D.replace(C[A], B[A])
	}
	return D
};
vB_PHP_Emulator.prototype.in_array = function (D, C, A) {
	var E = new String(D);
	if (A) {
		E = E.toLowerCase();
		for (var B in C) {
			if (C[B].toLowerCase() == E) {
				return B
			}
		}
	} else {
		for (var B in C) {
			if (C[B] == E) {
				return B
			}
		}
	}
	return -1
};
vB_PHP_Emulator.prototype.str_pad = function (B, A, C) {
	B = new String(B);
	C = new String(C);
	if (B.length < A) {
		padtext = new String(C);
		while (padtext.length < (A - B.length)) {
			padtext += C
		}
		B = padtext.substr(0, (A - B.length)) + B
	}
	return B
};
vB_PHP_Emulator.prototype.urlencode = function (D) {
	D = escape(D.toString()).replace(/\+/g, "%2B");
	var B = D.match(/(%([0-9A-F]{2}))/gi);
	if (B) {
		for (var C = 0; C < B.length; C++) {
			var A = B[C].substring(1, 3);
			if (parseInt(A, 16) >= 128) {
				D = D.replace(B[C], "%u00" + A)
			}
		}
	}
	D = D.replace("%25", "%u0025");
	return D
};
vB_PHP_Emulator.prototype.ucfirst = function (D, C) {
	if (typeof C != "undefined") {
		var B = D.indexOf(C);
		if (B > 0) {
			D = D.substr(0, B)
		}
	}
	D = D.split(" ");
	for (var A = 0; A < D.length; A++) {
		D[A] = D[A].substr(0, 1).toUpperCase() + D[A].substr(1)
	}
	return D.join(" ")
};
var PHP = new vB_PHP_Emulator();

function vB_AJAX_Handler(A) {
	this.async = A ? true : false
}
vB_AJAX_Handler.prototype.init = function () {
	if (typeof vb_disable_ajax != "undefined" && vb_disable_ajax == 2) {
		return false
	}
	try {
		this.handler = new XMLHttpRequest();
		return (this.handler.setRequestHeader ? true : false)
	} catch (e) {
		try {
			this.handler = eval("new ActiveXObject('Microsoft.XMLHTTP');");
			return true
		} catch (e) {
			return false
		}
	}
};
vB_AJAX_Handler.prototype.is_compatible = function () {
	if (typeof vb_disable_ajax != "undefined" && vb_disable_ajax == 2) {
		return false
	}
	if (is_ie && !is_ie4) {
		return true
	} else {
		if (typeof XMLHttpRequest != "undefined") {
			try {
				return XMLHttpRequest.prototype.setRequestHeader ? true : false
			} catch (B) {
				try {
					var A = new XMLHttpRequest();
					return A.setRequestHeader ? true : false
				} catch (B) {
					return false
				}
			}
		} else {
			return false
		}
	}
};
vB_AJAX_Handler.prototype.not_ready = function () {
	return (this.handler.readyState && (this.handler.readyState < 4))
};
vB_AJAX_Handler.prototype.onreadystatechange = function (A) {
	if (!this.handler) {
		if (!this.init()) {
			return false
		}
	}
	if (typeof A == "function") {
		this.handler.onreadystatechange = A
	} else {
		alert("XML Sender OnReadyState event is not a function")
	}
};
vB_AJAX_Handler.prototype.send = function (A, B) {
	if (!this.handler) {
		if (!this.init()) {
			return false
		}
	}
	if (!this.not_ready()) {
		this.handler.open("POST", A, this.async);
		this.handler.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		this.handler.send(B + "&s=" + fetch_sessionhash());
		if (!this.async && this.handler.readyState == 4 && this.handler.status == 200) {
			return true
		}
	}
	return false
};
vB_AJAX_Handler.prototype.fetch_data = function (A) {
	if (A && A.firstChild && A.firstChild.nodeValue) {
		return PHP.unescape_cdata(A.firstChild.nodeValue)
	} else {
		return ""
	}
};
var AJAX_Compatible = vB_AJAX_Handler.prototype.is_compatible();

function vB_Hidden_Form(A) {
	this.action = A;
	this.variables = new Array()
}
vB_Hidden_Form.prototype.add_variable = function (A, B) {
	this.variables[this.variables.length] = new Array(A, B)
};
vB_Hidden_Form.prototype.add_variables_from_object = function (F) {
	var D = fetch_tags(F, "input");
	for (var C = 0; C < D.length; C++) {
		switch (D[C].type) {
		case "checkbox":
		case "radio":
			if (D[C].checked) {
				this.add_variable(D[C].name, D[C].value)
			}
			break;
		case "text":
		case "hidden":
		case "password":
			this.add_variable(D[C].name, D[C].value);
			break;
		default:
			continue
		}
	}
	var E = fetch_tags(F, "textarea");
	for (var C = 0; C < E.length; C++) {
		this.add_variable(E[C].name, E[C].value)
	}
	var B = fetch_tags(F, "select");
	for (var C = 0; C < B.length; C++) {
		if (B[C].multiple) {
			for (var A = 0; A < B[C].options.length; A++) {
				if (B[C].options[A].selected) {
					this.add_variable(B[C].name, B[C].options[A].value)
				}
			}
		} else {
			this.add_variable(B[C].name, B[C].options[B[C].selectedIndex].value)
		}
	}
};
vB_Hidden_Form.prototype.fetch_variable = function (A) {
	for (var B = 0; B < this.variables.length; B++) {
		if (this.variables[B][0] == A) {
			return this.variables[B][1]
		}
	}
	return null
};
vB_Hidden_Form.prototype.submit_form = function () {
	this.form = document.createElement("form");
	this.form.method = "post";
	this.form.action = this.action;
	for (var A = 0; A < this.variables.length; A++) {
		var B = document.createElement("input");
		B.type = "hidden";
		B.name = this.variables[A][0];
		B.value = this.variables[A][1];
		this.form.appendChild(B)
	}
	document.body.appendChild(this.form).submit()
};
vB_Hidden_Form.prototype.build_query_string = function () {
	var B = "";
	for (var A = 0; A < this.variables.length; A++) {
		B += this.variables[A][0] + "=" + PHP.urlencode(this.variables[A][1]) + "&"
	}
	return B
};
vB_Hidden_Form.prototype.add_input = vB_Hidden_Form.prototype.add_variable;
vB_Hidden_Form.prototype.add_inputs_from_object = vB_Hidden_Form.prototype.add_variables_from_object;

function openWindow(A, B, D, C) {
	return window.open(A, (typeof C == "undefined" ? "vBPopup" : C), "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes" + (typeof B != "undefined" ? (",width=" + B) : "") + (typeof D != "undefined" ? (",height=" + D) : ""))
}

function js_open_help(C, B, A) {
	return openWindow("help.php?s=" + SESSIONHASH + "&do=answer&page=" + C + "&pageaction=" + B + "&option=" + A, 600, 450, "helpwindow")
}

function attachments(A) {
	return openWindow("misc.php?" + SESSIONURL + "do=showattachments&t=" + A, 480, 300)
}

function who(A) {
	return openWindow("misc.php?" + SESSIONURL + "do=whoposted&t=" + A, 230, 300)
}

function imwindow(A, C, B, D) {
	return openWindow("sendmessage.php?" + SESSIONURL + "do=im&type=" + A + "&u=" + C, B, D)
}

function SendMSNMessage(A) {
	if (!is_ie) {
		alert(vbphrase.msn_functions_only_work_in_ie);
		return false
	} else {
		MsgrObj.InstantMessage(A);
		return false
	}
}

function AddMSNContact(A) {
	if (!is_ie) {
		alert(vbphrase.msn_functions_only_work_in_ie);
		return false
	} else {
		MsgrObj.AddContact(0, A);
		return false
	}
}

function detect_caps_lock(D) {
	D = (D ? D : window.event);
	var C = (D.which ? D.which : (D.keyCode ? D.keyCode : (D.charCode ? D.charCode : 0)));
	var B = (D.shiftKey || (D.modifiers && (D.modifiers & 4)));
	var A = (D.ctrlKey || (D.modifiers && (D.modifiers & 2)));
	return (C >= 65 && C <= 90 && !B && !A) || (C >= 97 && C <= 122 && B)
}

function set_cookie(A, C, B) {
	document.cookie = A + "=" + escape(C) + "; path=/" + (typeof B != "undefined" ? "; expires=" + B.toGMTString() : "")
}

function delete_cookie(A) {
	document.cookie = A + "=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"
}

function fetch_cookie(A) {
	cookie_name = A + "=";
	cookie_length = document.cookie.length;
	cookie_begin = 0;
	while (cookie_begin < cookie_length) {
		value_begin = cookie_begin + cookie_name.length;
		if (document.cookie.substring(cookie_begin, value_begin) == cookie_name) {
			var B = document.cookie.indexOf(";", value_begin);
			if (B == -1) {
				B = cookie_length
			}
			return unescape(document.cookie.substring(value_begin, B))
		}
		cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
		if (cookie_begin == 0) {
			break
		}
	}
	return null
}

function js_toggle_all(B, E, A, D, G) {
	for (var C = 0; C < B.elements.length; C++) {
		var F = B.elements[C];
		if (F.type == E && PHP.in_array(F.name, D, false) == -1) {
			switch (E) {
			case "radio":
				if (F.value == A) {
					F.checked = G
				}
				break;
			case "select-one":
				F.selectedIndex = G;
				break;
			default:
				F.checked = G;
				break
			}
		}
	}
}

function js_select_all(A) {
	exclude = new Array();
	exclude[0] = "selectall";
	js_toggle_all(A, "select-one", "", exclude, A.selectall.selectedIndex)
}

function js_check_all(A) {
	exclude = new Array();
	exclude[0] = "keepattachments";
	exclude[1] = "allbox";
	exclude[2] = "removeall";
	js_toggle_all(A, "checkbox", "", exclude, A.allbox.checked)
}

function js_check_all_option(B, A) {
	exclude = new Array();
	exclude[0] = "useusergroup";
	js_toggle_all(B, "radio", A, exclude, true)
}

function checkall(A) {
	js_check_all(A)
}

function checkall_option(B, A) {
	js_check_all_option(B, A)
}

function resize_textarea(G, F) {
	if (G < 0) {
		var B = -5;
		var D = -10
	} else {
		var B = 5;
		var D = 10
	}
	var A = fetch_object(F);
	if (typeof A.orig_rows == "undefined") {
		A.orig_rows = A.rows;
		A.orig_cols = A.cols
	}
	var C = A.rows + B;
	var E = A.cols + D;
	if (C >= A.orig_rows && E >= A.orig_cols) {
		A.rows = C;
		A.cols = E
	}
	return false
}

function toggle_collapse(A) {
	if (!is_regexp) {
		return false
	}
	obj = fetch_object("collapseobj_" + A);
	img = fetch_object("collapseimg_" + A);
	cel = fetch_object("collapsecel_" + A);
	if (!obj) {
		if (img) {
			img.style.display = "none"
		}
		return false
	}
	if (obj.style.display == "none") {
		obj.style.display = "";
		save_collapsed(A, false);
		if (img) {
			img_re = new RegExp("_collapsed\\.gif$");
			img.src = img.src.replace(img_re, ".gif")
		}
		if (cel) {
			cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
			cel.className = cel.className.replace(cel_re, "$1")
		}
	} else {
		obj.style.display = "none";
		save_collapsed(A, true);
		if (img) {
			img_re = new RegExp("\\.gif$");
			img.src = img.src.replace(img_re, "_collapsed.gif")
		}
		if (cel) {
			cel_re = new RegExp("^(thead|tcat)$");
			cel.className = cel.className.replace(cel_re, "$1_collapsed")
		}
	}
	return false
}

function save_collapsed(A, E) {
	var D = fetch_cookie("vbulletin_collapse");
	var C = new Array();
	if (D != null) {
		D = D.split("\n");
		for (var B in D) {
			if (D[B] != A && D[B] != "") {
				C[C.length] = D[B]
			}
		}
	}
	if (E) {
		C[C.length] = A
	}
	expires = new Date();
	expires.setTime(expires.getTime() + (1000 * 86400 * 365));
	set_cookie("vbulletin_collapse", C.join("\n"), expires)
}

function vBpagenav() {}
vBpagenav.prototype.controlobj_onclick = function (C) {
	this._onclick(C);
	var B = fetch_tags(this.menu.menuobj, "input");
	for (var A = 0; A < B.length; A++) {
		if (B[A].type == "text") {
			B[A].focus();
			break
		}
	}
};
vBpagenav.prototype.form_gotopage = function (A) {
	if ((pagenum = parseInt(fetch_object("pagenav_itxt").value, 10)) > 0) {
		window.location = this.addr + "&page=" + pagenum
	}
	return false
};
vBpagenav.prototype.ibtn_onclick = function (A) {
	return this.form.gotopage()
};
vBpagenav.prototype.itxt_onkeypress = function (A) {
	return ((A ? A : window.event).keyCode == 13 ? this.form.gotopage() : true)
};

function vbmenu_register(B, A, C) {
	if (typeof vBmenu == "object") {
		return vBmenu.register(B, A)
	}
}

function set_unselectable(B) {
	if (!is_ie4 && typeof B.tagName != "undefined") {
		if (B.hasChildNodes()) {
			for (var A = 0; A < B.childNodes.length; A++) {
				set_unselectable(B.childNodes[A])
			}
		}
		B.unselectable = "on"
	}
}

function fetch_sessionhash() {
	return (SESSIONURL == "" ? "" : SESSIONURL.substr(2, 32))
}

function construct_phrase() {
	if (!arguments || arguments.length < 1 || !is_regexp) {
		return false
	}
	var A = arguments;
	var D = A[0];
	var C;
	for (var B = 1; B < A.length; B++) {
		C = new RegExp("%" + B + "\\$s", "gi");
		D = D.replace(C, A[B])
	}
	return D
}

function switch_id(C, D) {
	var E = C.options[C.selectedIndex].value;
	if (E == "") {
		return
	}
	var A = new String(window.location);
	var B = new String("");
	A = A.split("#");
	if (A[1]) {
		B = "#" + A[1]
	}
	A = A[0];
	if (A.indexOf(D + "id=") != -1 && is_regexp) {
		re = new RegExp(D + "id=\\d+&?");
		A = A.replace(re, "")
	}
	if (A.indexOf("?") == -1) {
		A += "?"
	} else {
		lastchar = A.substr(A.length - 1);
		if (lastchar != "&" && lastchar != "?") {
			A += "&"
		}
	}
	window.location = A + D + "id=" + E + B
}

function img_alt_2_title(A) {
	if (!A.title && A.alt != "") {
		A.title = A.alt
	}
}

function PostBit_Init(D, C) {
	if (typeof vBmenu != "undefined") {
		var B = fetch_tags(D, "div");
		for (var A = 0; A < B.length; A++) {
			if (B[A].id && B[A].id.substr(0, 9) == "postmenu_") {
				vBmenu.register(B[A].id, true)
			}
		}
	}
	if (typeof vB_QuickEditor != "undefined") {
		vB_AJAX_QuickEdit_Init(D)
	}
	if (typeof vB_QuickReply != "undefined") {
		qr_init_buttons(D)
	}
	if (typeof mq_init != "undefined") {
		mq_init(D)
	}
	if (typeof vBrep != "undefined") {
		if (typeof C != "undefined" && typeof C != "null") {
			vbrep_register(C)
		}
	}
	if (typeof inlineMod != "undefined") {
		im_init(D)
	}
}

function vBulletin_init() {
	if (is_webtv) {
		return false
	}
	var F = fetch_tags(document, "img");
	for (var B = 0; B < F.length; B++) {
		img_alt_2_title(F[B])
	}
	if (typeof vBmenu == "object") {
		if (window.attachEvent && !is_saf) {
			document.attachEvent("onclick", vbmenu_hide);
			window.attachEvent("onresize", vbmenu_hide)
		} else {
			if (document.addEventListener && !is_saf) {
				document.addEventListener("click", vbmenu_hide, false);
				window.addEventListener("resize", vbmenu_hide, false)
			} else {
				window.onclick = vbmenu_hide;
				window.onresize = vbmenu_hide
			}
		}
		var C = fetch_tags(document, "td");
		for (var E = 0; E < C.length; E++) {
			if (C[E].hasChildNodes() && C[E].firstChild.name && C[E].firstChild.name.indexOf("PageNav") != -1) {
				var D = C[E].title;
				C[E].title = "";
				C[E].innerHTML = "";
				C[E].id = "pagenav." + E;
				var A = vBmenu.register(C[E].id);
				if (is_saf) {
					A.controlobj._onclick = A.controlobj.onclick;
					A.controlobj.onclick = vBpagenav.prototype.controlobj_onclick
				}
			}
		}
		if (typeof D != "undefined") {
			fetch_object("pagenav_form").addr = D;
			fetch_object("pagenav_form").gotopage = vBpagenav.prototype.form_gotopage;
			fetch_object("pagenav_ibtn").onclick = vBpagenav.prototype.ibtn_onclick;
			fetch_object("pagenav_itxt").onkeypress = vBpagenav.prototype.itxt_onkeypress
		}
		vBmenu.activate(true)
	}
	return true
}

function vB_Popup_Handler() {
	this.open_steps = 10;
	this.open_fade = false;
	this.active = false;
	this.menus = new Array();
	this.activemenu = null;
	this.hidden_selects = new Array()
}
vB_Popup_Handler.prototype.activate = function (A) {
	this.active = A
};
vB_Popup_Handler.prototype.register = function (B, A) {
	this.menus[B] = new vB_Popup_Menu(B, A);
	return this.menus[B]
};
vB_Popup_Handler.prototype.hide = function () {
	if (this.activemenu != null) {
		this.menus[this.activemenu].hide()
	}
};
var vBmenu = new vB_Popup_Handler();

function vbmenu_hide(A) {
	if (A && A.button && A.button != 1 && A.type == "click") {
		return true
	} else {
		vBmenu.hide()
	}
}

function vB_Popup_Menu(B, A) {
	this.controlkey = B;
	this.menuname = this.controlkey.split(".")[0] + "_menu";
	this.init_control(A);
	if (fetch_object(this.menuname)) {
		this.init_menu()
	}
	this.slide_open = (is_opera ? false : true);
	this.open_steps = vBmenu.open_steps
}
vB_Popup_Menu.prototype.init_control = function (A) {
	this.controlobj = fetch_object(this.controlkey);
	this.controlobj.state = false;
	if (this.controlobj.firstChild && (this.controlobj.firstChild.tagName == "TEXTAREA" || this.controlobj.firstChild.tagName == "INPUT")) {} else {
		if (!A && !(is_mac && is_ie)) {
			var C = document.createTextNode(" ");
			this.controlobj.appendChild(C);
			var B = document.createElement("img");
			B.src = "http://cdn2.cardschat.com/images_fb/holder.gif";
			B.setAttribute("class", "statussprite ssmenuopen");
			B.border = 0;
			B.title = "";
			B.alt = "";
			this.controlobj.appendChild(B)
		}
		this.controlobj.unselectable = true;
		if (!A) {
			this.controlobj.style.cursor = pointer_cursor
		}
		this.controlobj.onclick = vB_Popup_Events.prototype.controlobj_onclick;
		this.controlobj.onmouseover = vB_Popup_Events.prototype.controlobj_onmouseover
	}
};
vB_Popup_Menu.prototype.init_menu = function () {
	this.menuobj = fetch_object(this.menuname);
	if (this.menuobj && !this.menuobj.initialized) {
		if (this.menuobj.className.indexOf('pagenav_menu') == -1) {
				document.body.appendChild(this.menuobj);
		}
		this.menuobj.initialized = true;
		this.menuobj.onclick = e_by_gum;
		this.menuobj.style.position = "absolute";
		this.menuobj.style.zIndex = 50;
		if (is_ie && !is_mac) {
			this.menuobj.style.filter += "progid:DXImageTransform.Microsoft.alpha(enabled=1,opacity=100)";
			this.menuobj.style.filter += "progid:DXImageTransform.Microsoft.shadow(direction=135,color=#8E8E8E,strength=3)"
		}
		this.init_menu_contents()
	}
};
vB_Popup_Menu.prototype.init_menu_contents = function () {
	var D = fetch_tags(this.menuobj, "td");
	for (var C = 0; C < D.length; C++) {
		if (D[C].className == "vbmenu_option") {
			if (D[C].title && D[C].title == "nohilite") {
				D[C].title = ""
			} else {
				D[C].controlkey = this.controlkey;
				D[C].onmouseover = vB_Popup_Events.prototype.menuoption_onmouseover;
				D[C].onmouseout = vB_Popup_Events.prototype.menuoption_onmouseout;
				var B = fetch_tags(D[C], "a");
				if (B.length == 1) {
					D[C].className = D[C].className + " vbmenu_option_alink";
					D[C].islink = true;
					var A = B[0];
					var E = false;
					D[C].target = A.getAttribute("target");
					if (typeof A.onclick == "function") {
						D[C].ofunc = A.onclick;
						D[C].onclick = vB_Popup_Events.prototype.menuoption_onclick_function;
						E = true
					} else {
						if (typeof D[C].onclick == "function") {
							D[C].ofunc = D[C].onclick;
							D[C].onclick = vB_Popup_Events.prototype.menuoption_onclick_function;
							E = true
						} else {
							D[C].href = A.href;
							D[C].onclick = vB_Popup_Events.prototype.menuoption_onclick_link
						}
					}
					if (E) {
						var F = document.createElement("span");
						F.innerHTML = A.innerHTML;
						D[C].insertBefore(F, A);
						D[C].removeChild(A)
					}
				} else {
					if (typeof D[C].onclick == "function") {
						D[C].ofunc = D[C].onclick;
						D[C].onclick = vB_Popup_Events.prototype.menuoption_onclick_function
					}
				}
			}
		}
	}
};
vB_Popup_Menu.prototype.show = function (B, A) {
	if (!vBmenu.active) {
		return false
	} else {
		if (!this.menuobj) {
			this.init_menu()
		}
	}
	if (!this.menuobj) {
		return false
	}
	if (vBmenu.activemenu != null) {
		vBmenu.menus[vBmenu.activemenu].hide()
	}
	vBmenu.activemenu = this.controlkey;
	this.menuobj.style.display = "";
	if (this.slide_open) {
		this.menuobj.style.clip = "rect(auto, 0px, 0px, auto)"
	}
	this.pos = this.fetch_offset(B);
	this.leftpx = this.pos.left;
	this.toppx = this.pos.top + B.offsetHeight;
	if ((this.leftpx + this.menuobj.offsetWidth) >= document.body.clientWidth && (this.leftpx + B.offsetWidth - this.menuobj.offsetWidth) > 0) {
		this.leftpx = this.leftpx + B.offsetWidth - this.menuobj.offsetWidth;
		this.direction = "right"
	} else {
		this.direction = "left"
	}
	this.menuobj.style.left = this.leftpx + "px";
	this.menuobj.style.top = this.toppx + "px";
	if (!A && this.slide_open) {
		this.intervalX = Math.ceil(this.menuobj.offsetWidth / this.open_steps);
		this.intervalY = Math.ceil(this.menuobj.offsetHeight / this.open_steps);
		this.slide((this.direction == "left" ? 0 : this.menuobj.offsetWidth), 0, 0)
	} else {
		if (this.menuobj.style.clip && this.slide_open) {
			this.menuobj.style.clip = "rect(auto, auto, auto, auto)"
		}
	}
	this.handle_overlaps(true);
	if (this.controlobj.editorid) {
		this.controlobj.state = true;
		vB_Editor[this.controlobj.editorid].menu_context(this.controlobj, "mousedown")
	}
};
vB_Popup_Menu.prototype.hide = function (A) {
	if (A && A.button && A.button != 1) {
		return true
	}
	this.stop_slide();
	this.menuobj.style.display = "none";
	this.handle_overlaps(false);
	if (this.controlobj.editorid) {
		this.controlobj.state = false;
		vB_Editor[this.controlobj.editorid].menu_context(this.controlobj, "mouseout")
	}
	vBmenu.activemenu = null
};
vB_Popup_Menu.prototype.hover = function (A) {
	if (vBmenu.activemenu != null) {
		if (vBmenu.menus[vBmenu.activemenu].controlkey != this.id) {
			this.show(A, true)
		}
	}
};
vB_Popup_Menu.prototype.slide = function (C, B, A) {
	if (this.direction == "left" && (C < this.menuobj.offsetWidth || B < this.menuobj.offsetHeight)) {
		if (vBmenu.open_fade && is_ie) {
			A += 10;
			this.menuobj.filters.item("DXImageTransform.Microsoft.alpha").opacity = A
		}
		C += this.intervalX;
		B += this.intervalY;
		this.menuobj.style.clip = "rect(auto, " + C + "px, " + B + "px, auto)";
		this.slidetimer = setTimeout("vBmenu.menus[vBmenu.activemenu].slide(" + C + ", " + B + ", " + A + ");", 0)
	} else {
		if (this.direction == "right" && (C > 0 || B < this.menuobj.offsetHeight)) {
			if (vBmenu.open_fade && is_ie) {
				A += 10;
				menuobj.filters.item("DXImageTransform.Microsoft.alpha").opacity = A
			}
			C -= this.intervalX;
			B += this.intervalY;
			this.menuobj.style.clip = "rect(auto, " + this.menuobj.offsetWidth + "px, " + B + "px, " + C + "px)";
			this.slidetimer = setTimeout("vBmenu.menus[vBmenu.activemenu].slide(" + C + ", " + B + ", " + A + ");", 0)
		} else {
			this.stop_slide()
		}
	}
};
vB_Popup_Menu.prototype.stop_slide = function () {
	clearTimeout(this.slidetimer);
	this.menuobj.style.clip = "rect(auto, auto, auto, auto)";
	if (vBmenu.open_fade && is_ie) {
		this.menuobj.filters.item("DXImageTransform.Microsoft.alpha").opacity = 100
	}
};

vB_Popup_Menu.prototype.fetch_offset = function(elem) {
    if (elem.getBoundingClientRect) {
        // "правильный" вариант
        return this.getOffsetRect(elem)
    } else {
        // пусть работает хоть как-то
        return this.getOffsetSum(elem)
    }
}

vB_Popup_Menu.prototype.getOffsetSum = function(elem) {
    var top=0, left=0
    while(elem) {
        top = top + parseInt(elem.offsetTop)
        left = left + parseInt(elem.offsetLeft)
        elem = elem.offsetParent
    }
    return {top: top, left: left}
}

vB_Popup_Menu.prototype.getOffsetRect = function(elem) {
    // (1)
    var box = elem.getBoundingClientRect()

    // (2)
    var body = document.body
    var docElem = document.documentElement

    // (3)
    var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop
    var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft

    // (4)
    var clientTop = docElem.clientTop || body.clientTop || 0
    var clientLeft = docElem.clientLeft || body.clientLeft || 0

    // (5)
    var top  = box.top +  scrollTop - clientTop
    var left = box.left + scrollLeft - clientLeft
    return { top: Math.round(top), left: Math.round(left) }
}

vB_Popup_Menu.prototype.overlaps = function (C, A) {
	var B = new Array();
	var D = this.fetch_offset(C);
	B.L = D.left;
	B.T = D.top;
	B.R = B.L + C.offsetWidth;
	B.B = B.T + C.offsetHeight;
	if (B.L > A.R || B.R < A.L || B.T > A.B || B.B < A.T) {
		return false
	}
	return true
};
vB_Popup_Menu.prototype.handle_overlaps = function (E) {
	if (is_ie) {
		var C = fetch_tags(document, "select");
		if (E) {
			var F = new Array();
			F = {
				L: this.leftpx,
				R: this.leftpx + this.menuobj.offsetWidth,
				T: this.toppx,
				B: this.toppx + this.menuobj.offsetHeight
			};
			for (var B = 0; B < C.length; B++) {
				if (this.overlaps(C[B], F)) {
					var A = true;
					var D = C[B];
					while (D = D.parentNode) {
						if (D.className == "vbmenu_popup") {
							A = false;
							break
						}
					}
					if (A) {
						C[B].style.visibility = "hidden";
						array_push(vBmenu.hidden_selects, B)
					}
				}
			}
		} else {
			while (true) {
				var B = array_pop(vBmenu.hidden_selects);
				if (typeof B == "undefined" || B == null) {
					break
				} else {
					C[B].style.visibility = "visible"
				}
			}
		}
	}
};

function vB_Popup_Events() {}
vB_Popup_Events.prototype.controlobj_onclick = function (A) {
	if (typeof do_an_e == "function") {
		do_an_e(A);
		if (vBmenu.activemenu == null || vBmenu.menus[vBmenu.activemenu].controlkey != this.id) {
			vBmenu.menus[this.id].show(this)
		} else {
			vBmenu.menus[this.id].hide()
		}
	}
};
vB_Popup_Events.prototype.controlobj_onmouseover = function (A) {
	if (typeof do_an_e == "function") {
		do_an_e(A);
		vBmenu.menus[this.id].hover(this)
	}
};
vB_Popup_Events.prototype.menuoption_onclick_function = function (A) {
	this.ofunc(A);
	vBmenu.menus[this.controlkey].hide()
};
vB_Popup_Events.prototype.menuoption_onclick_link = function (A) {
	A = A ? A : window.event;
	if (A.shiftKey || (this.target != null && this.target != "" && this.target.toLowerCase() != "_self")) {
		if (this.target != null && this.target.charAt(0) != "_") {
			window.open(this.href, this.target)
		} else {
			window.open(this.href)
		}
	} else {
		window.location = this.href
	}
	A.cancelBubble = true;
	if (A.stopPropagation) {
		A.stopPropagation()
	}
	if (A.preventDefault) {
		A.preventDefault()
	}
	vBmenu.menus[this.controlkey].hide();
	return false
};
vB_Popup_Events.prototype.menuoption_onmouseover = function (A) {
	this.className = "vbmenu_hilite" + (this.islink ? " vbmenu_hilite_alink" : "");
	this.style.cursor = pointer_cursor
};
vB_Popup_Events.prototype.menuoption_onmouseout = function (A) {
	this.className = "vbmenu_option" + (this.islink ? " vbmenu_option_alink" : "");
	this.style.cursor = "default"
};

function display_post(A) {
	if (AJAX_Compatible) {
		vB_PostLoader[A] = new vB_AJAX_PostLoader(A);
		vB_PostLoader[A].init()
	} else {
		pc_obj = fetch_object("postcount" + this.postid);
		openWindow("showpost.php?" + (SESSIONURL ? "s=" + SESSIONURL : "") + (pc_obj != null ? "&postcount=" + PHP.urlencode(pc_obj.name) : "") + "&p=" + A)
	}
	return false
}
var vB_PostLoader = new Array();

function vB_AJAX_PostLoader(A) {
	this.postid = A;
	this.container = fetch_object("edit" + this.postid)
}
vB_AJAX_PostLoader.prototype.init = function () {
	if (this.container) {
		postid = this.postid;
		pc_obj = fetch_object("postcount" + this.postid);
		this.ajax = new vB_AJAX_Handler(true);
		this.ajax.onreadystatechange(vB_PostLoader[postid].ajax_check);
		this.ajax.send("showpost.php?p=" + this.postid, "ajax=1&postid=" + this.postid + (pc_obj != null ? "&postcount=" + PHP.urlencode(pc_obj.name) : ""))
	}
};
vB_AJAX_PostLoader.prototype.ajax_check = function () {
	var A = vB_PostLoader[postid].ajax.handler;
	if (A.readyState == 4 && A.status == 200) {
		vB_PostLoader[postid].display(A.responseXML);
		if (is_ie) {
			A.abort()
		}
	}
	return false
};
vB_AJAX_PostLoader.prototype.display = function (A) {
	if (fetch_tag_count(A, "postbit")) {
		this.container.innerHTML = this.ajax.fetch_data(fetch_tags(A, "postbit")[0]);
		PostBit_Init(fetch_object("post" + this.postid), this.postid)
	} else {
		openWindow("showpost.php?" + (SESSIONURL ? "s=" + SESSIONURL : "") + (pc_obj != null ? "&postcount=" + PHP.urlencode(pc_obj.name) : "") + "&p=" + this.postid)
	}
};


function addEvent(obj, type, fn) {
	if (obj.addEventListener) obj.addEventListener(type, fn, false);
	else if (obj.attachEvent) {
		obj["e" + type + fn] = fn;
		obj[type + fn] = function () {
			obj["e" + type + fn](window.event);
		}
		obj.attachEvent("on" + type, obj[type + fn]);
	}
}

function removeEvent(obj, type, fn) {
	if (obj.removeEventListener) obj.removeEventListener(type, fn, false);
	else if (obj.detachEvent) {
		obj.detachEvent("on" + type, obj[type + fn]);
		obj[type + fn] = null;
		obj["e" + type + fn] = null;
	}
}

function openInNewWindow() {
	var newWindow = window.open(this.getAttribute('href'), '_blank');
	newWindow.focus();
	return false;
}

function getNewWindowLinks() {
	if (document.getElementById && document.createElement && document.appendChild) {

		var x = document.getElementsByTagName('a');
		regex = /\/sites\//;
		for (i = 0; i < x.length; i++) {
			a = x[i].getAttribute('href');
			if (x[i].getAttribute('id') != '1') {
				if (typeof (a) !== 'undefined') {
					if (a != null) {
						if (a.match(regex) != null) {
							x.item(i).onclick = openInNewWindow;
						}
					}
				}
			}
		}
	}
}

addEvent(window, 'load', getNewWindowLinks);



function foo(e, desturl) {

	document.getElementById('localeMessage').style.visibility = 'visible';
	document.getElementById('desturl').href = desturl

	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {
		posx = e.pageX;
		posy = e.pageY;
	} else if (e.clientX || e.clientY) {
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}


	document.getElementById("darkLayer").style.display = "block";

	//document.getElementById('localeMessage').style.marginLeft = 'auto';
	//document.getElementById('localeMessage').style.marginRight = 'auto';
	document.getElementById('localeMessage').style.left = posx + 'px';
	document.getElementById('localeMessage').style.top = parseInt(posy - 50) + 'px';
	document.getElementById('localeMessage').style.display = 'block';
	return false;

}




function locale_usca() {
	document.getElementById('localeMessage').innerHTML = "<h6>**ONLY US &amp; Canadian Players**</h6><p>You are visiting a poker site that ONLY Accepts US players &amp; Canadians. We suggest you visit Titan Poker - Our #1 rated poker site for non-US players.</p><a href=\"http://www.cardschat.com/sites/22nu.php\"  target=\"_blank\" class=\"first\"><strong>Visit Titan</strong></a><br><a href=\"\" style=\"margin-left:120px\" id=desturl  target=\"_blank\" onclick=\"document.getElementById('localeMessage').style.visibility='hidden';\">Continue Anyway</a><a href=\"#\" class=\"closer\" onclick=\"document.getElementById('localeMessage').style.visibility='hidden'; return false;\">X</a></div>";
}


function plocale_us() {
	document.getElementById('localeMessage').innerHTML = "<h6>***<font color=\"red\"> NO US Players </font>***</h6><p>You are visiting a poker site that does NOT accept US players. Cardschat.com recommends the highly popular <span style='cursor:pointer;cursor:hand;text-decoration:underline;' target=\"_blank\" onclick=\"window.location='http://www.cardschat.com/sites/lock-poker.php'\">Lock Poker</span>, where you will receive a $750 bonus and all US players &amp; US credit cards are accepted.</p><a href=\"http://www.cardschat.com/sites/lock-poker.php\" target=\"_blank\" class=\"first\"><strong>Visit Lock Poker</strong></a><br><a href=\"\" style=\"margin-left:220px;background:grey\" target=\"_blank\" id=desturl onclick=\"document.getElementById('localeMessage').style.visibility='hidden';\">Continue Anyway</a><a href=\"#\" class=\"closer\" style=\"background:grey\" onclick=\"document.getElementById('localeMessage').style.visibility='hidden'; return false;\">X</a></div></div>";
}



function locale_us() {


	document.getElementById('localeMessage').innerHTML = '<div style="color:#000;width:450px;border:solid black 6px;background:#FFF;padding:0px;font-family:verdana"><div style="font-weight:bold;color:#000;text-align:right;font-size:12px;background:#999;width:12px;text-decoration:none;margin-right:0;margin-left:auto;padding:1px"><a href="#" style="font-family:verfana;font-weight:bold;color:#000;;text-decoration:none;" onclick="document.getElementById(\'localeMessage\').style.visibility=\'hidden\'; document.getElementById(\'darkLayer\').style.display=\'none\';return false;">X</a></div><div style="padding:10px 10px 0 10px"><span class="us-no" style="width:70px;float:left;padding-right:30px;padding-bottom:10px;"></span><span style="color:#BF0000;font-size:25px;font-weight:bold">No US Players Allowed!</span><div style="padding-bottom:10px;clear:left;font-size:12px;font-weight:normal">The poker site you have selected does <span style="color:red;font-weight:bold">NOT</span> accept US players!</div><div style="padding-bottom:10px;font-size:14px;font-weight:bold">For all US players, Cardschat.com recommends:</div><img src="http://img2.cardschat.com/pkimg/usimg/betonline.png" style="float:left; width:150px;margin-top:5px;margin-right:20px;border:solid 1px #666"><span class="tick"></span><span style="font-size:12px;color:#34630a;font-weight:bold">25% Bonus on All Deposits!</span><br/><span class="tick"></span><span style="font-size:12px;color:#34630a;font-weight:bold">Accepts US Players!</span><br/><span class="tick"></span><span style="font-size:12px;color:#34630a;font-weight:bold">Accepts US Credit Cards!</span><br/><div style="clear:left;width:200px;margin-left:auto;margin-right:auto;padding-top:15px;"><div style="padding-left:35px;padding-top:6px;font-size:12px;width:185px;height:28px;background:url(http://cdn2.cardschat.com/images/big-yellow-button.png);font-weight:bold"><a style="text-decoration:none;color:#000" href="http://www.cardschat.com/sites/betonline-poker.php" target="_blank" class="first">Visit BetOnline Poker</a></div></div><div style="font-weight:bold;color:#999; text-decoration:none;text-align:right;font-size:10px;padding:8px 0 5px 50px;"><a href="" style="color:#999;margin-left:220px;" target="_blank" id=desturl onclick="document.getElementById(\'localeMessage\').style.visibility=\'hidden\';">continue anyway...</a></div></div></div>';
}

function resizeWindow() {
	var _width = 2000;
	if (window.innerHeight) {
		_width = window.innerWidth;
	} else {
		_width = document.documentElement.clientWidth;
	}
	if (_width < 1165) {
		if (document.body.className.indexOf('hide-block') == -1) document.body.className = document.body.className + ' hide-block';
	} else {
		document.body.className = document.body.className.replace('hide-block', '');
	}
}
addEvent(window, 'load', resizeWindow);
addEvent(window, 'resize', resizeWindow);
