function popupWindow(path, where, hite, wide){
	if (window.event){ 
		window.event.returnValue = false;   
	}
	var width;
	var height;
	var imgWidth;
	var imgHeight;
	
	if (screen.width<wide){
		width=screen.width-20;
		imgWidth=width-10;
		var windowX = (screen.width-width)/2;
	}
	else{
		var windowX = (screen.width-wide)/2;
		width=wide;
	}

	if (screen.height<hite){
		height=screen.height-70;
		imgHeight=height-20;
		var windowY = (screen.height-height)/2-30;
	}
	else{
		var windowY = (screen.height-hite)/2-10;
		height=hite;
	}

	var rand_no = Math.random();
	var i = Math.round(100*Math.random());
	if(screen.height<hite || screen.width<wide){
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	else{
		var props=window.open(path, i, 'scrollbars=0,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	props.moveTo(windowX,windowY);
}


if(window.ActiveXObject) {
	try {
		var oHTTP = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch(e) {
		var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	}
} 
else {
	var oHTTP = new XMLHttpRequest();
}

function FetchClasses(){
	var tip_sport = document.forms['admin_tip'].elements['tip_sport'].value;
	if(tip_sport!="0"){	
		callPageResponse('../includes/call_fly.php?cmd=fly_tip&tip_sport='+tip_sport+'');
	}
	return false;
}

function FetchCountry(){
	var country = document.forms['admin_member'].elements['country'].value;
	if(country!="0"){	
		callPageResponse('../includes/call_fly.php?cmd=fly_country&country='+country+'');
	}
	return false;
}

function FetchCountryOut(){
	var country = document.forms['admin_member'].elements['country'].value;
	if(country!="0"){	
		callPageResponse('../includes/call_fly.php?cmd=fly_country&country='+country+'');
	}
	return false;
}

function callPageResponse(page) {
	var getValue;
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			getValue=oHTTP.responseText;
			if(getValue!=""){
				document.getElementById('forms_input_id').innerHTML = getValue;
			}
		}
	}
	oHTTP.send(null);
}

function FetchCountry2(){
	var country = document.forms['admin_affiliate'].elements['country'].value;
	if(country!="0"){	
		callPageResponse('../includes/call_fly.php?cmd=fly_country&country='+country+'');
	}
	return false;
}

function FetchCountryOut2(){
	var country = document.forms['admin_affiliate'].elements['country'].value;
	if(country!="0"){	
		callPageResponse2('includes/call_fly.php?cmd=fly_country&country='+country+'');
	}
	return false;
}

function callPageResponse2(page) {
	var getValue;
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			getValue=oHTTP.responseText;
			if(getValue!=""){
				document.getElementById('forms_input_id').innerHTML = getValue;
			}
		}
	}
	oHTTP.send(null);
}

function saveEntries(page,elements) {
	var getValue;
	var elementID = String(elements);
	oHTTP.open("GET", page, true);
	oHTTP.setRequestHeader("If-Modified-Since", "Fri, 31 Dec 1999 23:59:59 GMT");
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4 && oHTTP.status == 200) {
			getValue=oHTTP.responseText;
			if(getValue!=""){
				clearMsg(elementID);	
				document.getElementById(elementID).innerHTML = getValue;
			}
		}
	}
	oHTTP.send(null);
}

function clearMsg(ID){ 
	document.getElementById(ID).innerHTML="";
}

function updateMinMax(ID){
	var parameter_id = ID;
	var param_value = document.getElementById('param_value'+ID+'').value;
	if(parameter_id!=0){
		saveEntries('../includes/processx.php?cmd=update_minmax&parameter_id='+parameter_id+'&value='+param_value+'','param_value'+parameter_id+'');
	}
	return false;
}


