///////////////////////////////////////////////////////
// AJAX 
function Inint_AJAX() { 
	try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
	try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
	alert("XMLHttpRequest not supported");
	return null;
};

function dochange(src, vars_line) {
	document.getElementById(src).innerHTML="<center><font color=gray>Searching ...</color></center>";//+document.getElementById(src).innerHTML; 
	var req = Inint_AJAX();
	req.onreadystatechange = function () { 
		if (req.readyState==4 && req.status==200 ) {
				document.getElementById(src).innerHTML = req.responseText; //
				parseScript(req.responseText);
		}
	};
	req.open("POST", "ajax.php?src="+src+"&"+vars_line); // connection
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); // set Header
	req.send(null); //
}
function dochange2(src, vars_line) {
	document.getElementById(src).innerHTML="<center><font color=gray>Searching ...</color></center>";//+document.getElementById(src).innerHTML; 
	var req = Inint_AJAX();
	req.onreadystatechange = function () { 
		if (req.readyState==4 && req.status==200 ) {
				document.getElementById(src).innerHTML = req.responseText; //
				parseScript(req.responseText);
		}
	};
	req.open("POST", "ajax2.php?src="+src+"&"+vars_line); // connection
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); // set Header
	req.send(null); //
}

	function parseScript(_source) {
		var source = _source;
		var scripts = new Array();
		
		// Strip out tags
		while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
			var s = source.indexOf("<script");
			var s_e = source.indexOf(">", s);
			var e = source.indexOf("</script", s);
			var e_e = source.indexOf(">", e);
			
			// Add to scripts array
			scripts.push(source.substring(s_e+1, e));
			// Strip from source
			source = source.substring(0, s) + source.substring(e_e+1);
		}
		
		// Loop through every script collected and eval it
		for(var i=0; i<scripts.length; i++) {
			try {
				eval(scripts[i]);
			}
			catch(ex) {
				// do what you want here when a script fails
			}
		}
		
		// Return the cleaned source
		return source;
	}

///////////////////////////////////////////////////////////

//var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}