var ajax1 = null;
var ajax2 = null;

function load_card_on_main_page(link, type) {
    if (document.getElementById('card_on_main_page') == null) return null;
	if (window.XMLHttpRequest)
	{
		ajax1 = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
		{
			ajax1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
	ajax1.onreadystatechange = process_card_on_main_page;
    var D = new Date(); var time = +D;
	ajax1.open('GET', '/card.phtml?time=' + time + '&link=' + encodeURIComponent(link) + '&type=' + type, true);
	ajax1.send(null);
}

function process_card_on_main_page() {
     if (ajax1.readyState == 4) {
         if (ajax1.status == 200) {
			document.getElementById('card_on_main_page').innerHTML = ajax1.responseText;
        }
	 }
}

function load_random_on_main_page() {
    if (document.getElementById('random_on_main_page') == null) return null;
	if (window.XMLHttpRequest)
	{
		ajax2 = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
		{
			ajax2 = new ActiveXObject("Microsoft.XMLHTTP");
		}
	ajax2.onreadystatechange = process_random_on_main_page;
    var D = new Date(); var time = +D;
	ajax2.open('GET', '/random.phtml?time=' + time, true);
	ajax2.send(null);
}

function process_random_on_main_page() {
     if (ajax2.readyState == 4) {
         if (ajax2.status == 200) {
			document.getElementById('random_on_main_page').innerHTML = ajax2.responseText;
        }
	 }
}

