function LoadPopup(url) {
 if (window.XMLHttpRequest) {
	try {
		req_popup= new XMLHttpRequest();
	}
	catch (e) {
		req_popup = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_popup = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_popup = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_popup = false;
			}
		}
 }
 if (req_popup) {
 req_popup.onreadystatechange=processReqChange;
 req_popup.open("GET", url, true);
 req_popup.send(null);
 }

}



function processReqChange()
{	
	var htm;
	if (req_popup.readyState == 4)
	{	
		if (req_popup.status == 200)
		{	
			htm = req_popup.responseText;
			if (htm) {
			return overlib(htm,FULLHTML,CENTER,BELOW);
			}
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}

function Reminder(url) {
 if (window.XMLHttpRequest) {
	try {
		req_reminder= new XMLHttpRequest();
	}
	catch (e) {
		req_reminder = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_reminder = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_reminder = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_reminder = false;
			}
		}
 }
 if (req_reminder) {
 req_reminder.onreadystatechange=processReminder;
 req_reminder.open("GET", url, true);
 req_reminder.send(null);
 }

}

function processReminder()
{	
	if (req_reminder.readyState == 4)
	{	
		if (req_reminder.status == 200)
		{
			window.document.getElementById("reminder_2").innerHTML = req_reminder.responseText;
			window.document.getElementById("reminder").style.display = "block";
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}

var pol;
function most_famous_b(url, param) {
 pol = param;
 if (window.XMLHttpRequest) {
	try {
		req_most_famous_b= new XMLHttpRequest();
	}
	catch (e) {
		req_most_famous_b = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_most_famous_b = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_most_famous_b = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_most_famous_b = false;
			}
		}
 }
 if (req_most_famous_b) {
 req_most_famous_b.onreadystatechange=processmost_famous_b;
 req_most_famous_b.open("GET", url, true);
 req_most_famous_b.send(null);
 }

}

function processmost_famous_b()
{	
	if (req_most_famous_b.readyState == 4)
	{	
		if (req_most_famous_b.status == 200)
		{
			window.document.getElementById("most_famous_boy").innerHTML = req_most_famous_b.responseText;
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}
var pol1;
function most_famous_g(url, param) {
 pol1 = param;
 if (window.XMLHttpRequest) {
	try {
		req_most_famous_g= new XMLHttpRequest();
	}
	catch (e) {
		req_most_famous_g = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_most_famous_g = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_most_famous_g = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_most_famous_g = false;
			}
		}
 }
 if (req_most_famous_g) {
 req_most_famous_g.onreadystatechange=processmost_famous_g;
 req_most_famous_g.open("GET", url, true);
 req_most_famous_g.send(null);
 }

}

function processmost_famous_g()
{	
	if (req_most_famous_g.readyState == 4)
	{	
		if (req_most_famous_g.status == 200)
		{
			window.document.getElementById("most_famous_girl").innerHTML = req_most_famous_g.responseText;
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}

// ----- tonto2

var guz;
var sort_1;
function list_most(url, param, sort) {
 guz = param;
 guz = "list_most_"+guz;
 sort_1 = sort;
 if (window.XMLHttpRequest) {
	try {
		req_list_most= new XMLHttpRequest();
	}
	catch (e) {
		req_list_most = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_list_most = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_list_most = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_list_most = false;
			}
		}
 }
 if (req_list_most) {
 req_list_most.onreadystatechange=processlist_most;
 req_list_most.open("GET", url, true);
 req_list_most.send(null);
 }

}

function processlist_most()
{	
	if (req_list_most.readyState == 4)
	{	
		if (req_list_most.status == 200)
		{	
			window.document.getElementById(guz).innerHTML = req_list_most.responseText;
			if (sort_1 == 'top') {
				most_famous_g('list_item_most.ajax.php?fam_type=girl&page=prev&list=top', 'girl');
			} else {
				most_famous_g('list_item_most.ajax.php?fam_type=girl&page=prev&list=last', 'girl');	
			}
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}
// ----- tonto2

var guz1;
var sort_2;
function list_mostb(url, param, sort) {
 guz1 = param;
 guz1 = "list_most_"+guz1;
 sort_2 = sort;
 if (window.XMLHttpRequest) {
	try {
		req_list_mostb= new XMLHttpRequest();
	}
	catch (e) {
		req_list_mostb = false;
	}
 }
 else if(window.ActiveXObject) {
	 try {
		req_list_mostb = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				req_list_mostb = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				req_list_mostb = false;
			}
		}
 }
 if (req_list_mostb) {
 req_list_mostb.onreadystatechange=processlist_mostb;
 req_list_mostb.open("GET", url, true);
 req_list_mostb.send(null);
 }

}

function processlist_mostb()
{	
	if (req_list_mostb.readyState == 4)
	{	
		if (req_list_mostb.status == 200)
		{	
			window.document.getElementById(guz1).innerHTML = req_list_mostb.responseText;
			if (sort_2 == 'top') {
				most_famous_b('list_item_most.ajax.php?fam_type=boy&list=top', 'boy');
			} else {
				most_famous_b('list_item_most.ajax.php?fam_type=boy&list=last', 'boy');	
			}
		}
		else
		{
			alert("Данните не могат да бъдат заредени");
		}
	}
}
