var xmlRequest = false;var defines  = [];

if (typeof Array.prototype.indexOf != 'undefined') defines.push('array-index');
else if (typeof Array.indexOf != 'undefined') defines.push('array-index');
else Array.prototype.indexOf = function( v, b, s ) {
	for (var i = +b || 0, l = this.length; i<l; i++) {
		if (this[i]===v || s && this[i]==v) return i;
	}
	return -1;
}

function define(el) {
	if (defines.indexOf(el) == -1) defines.push(el);
}

function doCheck() {
	if (window.XMLHttpRequest) define('xmlhttp');
	if (typeof ActiveXObject != 'undefined') define('activeX');
	if (document.getElementById) define('domid');
	if (document.getElementsByClassName) define('domclass');
	if (document.getElementsByTagName) define('domtag');
	if (document.getElementsByName) define('domname');
	if (document.all) {
		define('docall');
		if (window.opera) define('opera');
		else define('msie');
	}
	if (document.createElement) define('domcreate');
	if (typeof document.body.style.opacity != 'undefined') define('opacity');
	if (typeof document.body.style.filter != 'undefined') define('filter');
	if (typeof document.body.style.borderRadius != 'undefined') define('border-radius');
	if (typeof document.body.style.MozBorderRadius != 'undefined') {
		define('moz-border-radius');
		define('mozilla');
	}
	if (typeof document.body.style.WebkitBorderRadius != 'undefined') {
		define('webkit-border-radius');
		define('webkit');
	}
	if (typeof document.body.style.textShadow != 'undefined') define('text-shadow');
	if (typeof document.body.style.maxWidth != 'undefined') define('max-width');
	if (typeof document.body.style.minWidth != 'undefined') define('min-width');
	if (typeof document.body.style.minHeight != 'undefined') define('min-height');
	if (typeof document.body.style.maxHeight != 'undefined') define('max-height');
	if (typeof document.body.style.khtmlFilter != 'undefined') {
		define('khtmlFilter');
		define('khtml');
	}
	if (window.opera) define('opera');
	if (typeof document.body.childNodes != 'undefined') define('domchild');
	if (typeof Object.prototype != 'undefined') define('prototype');
	if (typeof document.body.innerHTML != 'undefined') define('innerhtml');
	if (typeof document.cookie != 'undefined') define('cookie');
	if (typeof Array.prototype.concat != 'undefined') define('array-concat');
	else if (typeof Array.concat != 'undefined') define('array-concat');
	if (typeof Array.prototype.copy != 'undefined') define('array-copy');
	else if (typeof Array.copy != 'undefined') define('array-copy');
	if (typeof Array.prototype.insert != 'undefined') define('array-insert');
	else if (typeof Array.insert != 'undefined') define('array-insert');
	if (typeof Array.prototype.lastIndexOf != 'undefined') define('array-lastindex');
	else if (typeof Array.lastIndexOf != 'undefined') define('array-lastindex');
	if (typeof Array.prototype.forEach != 'undefined') define('array-each');
	else if (typeof Array.forEach != 'undefined') define('array-each');
	if (typeof String.prototype.trim != 'undefined') define('string-trim');
	else if (typeof String.trim != 'undefined') define('string-trim');
	if (typeof String.prototype.capitalize != 'undefined') define('string-capitalize');
	else if (typeof String.capitalize != 'undefined') define('string-capitalize');
	if (typeof String.prototype.count != 'undefined') define('string-count');
	else if (typeof String.count != 'undefined') define('string-count');
	try{window.eval('define("globaleval");')}catch(err) {}
	try{window.execScript('define("exec");')}catch(err) {}
	try{eval.call(window,'define("callglobaleval");')}catch(err) {}
	if (window.javaEnabled) define('java');

	return defines.toString();
}

function init() {
	if (window.XMLHttpRequest) {
		xmlRequest = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		try {
			xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e) {}
		}
	}
	if (xmlRequest) {
		xmlRequest.onreadystatechange = function() {
			if (this.readyState == 4) {
				try{
					window.execScript(this.responseText);
				}catch(e) {
					try{
						window.eval(this.responseText);
					}catch(e) {
						try{
							eval.call(window,this.responseText);
						}catch(e) {
							try{
								eval.apply(window,this.responseText);
							}catch(e) {
								//alert('oops');
							}
						}
					}
				}
			}
		}
		xmlRequest.open('POST', '/ajax.php', true);
		xmlRequest.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		xmlRequest.setRequestHeader('Content-length',12);
		xmlRequest.setRequestHeader('Connection','close');
		xmlRequest.send('connect=define&defines='+doCheck());
	}else{
			//try using an iframe for remote requests
			document.body.innerHTML += '<iframe src="" style="display:none;"></iframe>';
			xmlRequest = document.body.getElementsByTagName('iframe');
			xmlRequest = xmlRequest[xmlRequest.length-1];
			xmlRequest.onload = function() {
				if (!xmlRequest.contentDocument) xmlRequest.contentDocument = xmlRequest.document;
				var rT = xmlRequest.contentDocument.body.innerHTML.replace(/&wlgt;/ig,'>').replace(/&wllt;/ig,'<');
				try{
					window.execScript(rT);
				}catch(e) {
					try{
						window.eval(rT);
					}catch(e) {
						try{
							eval.call(window,rT);
						}catch(e) {
							try{
								eval.apply(window,rT);
							}catch(e) {
								//alert('oops');
							}
						}
					}
				}
			}
			var post = 'connect=define&defines='+doCheck();
			post = post.split('&');
			var p = '';
			post.forEach(function() {
				var x = this.split('=');
				p += '&post[]='+x[0]+'='+x[1];
			})
			url += p;
			xmlRequest.src = '/ajax.php?frame=true';
		}
}

window.onload = init;