// JavaScript Document
function ajax(){
    var xmlHttp;
	try{
        xmlHttp=new XMLHttpRequest();
    }catch (e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHttp");
        }catch(e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
            }catch(e){
                alert("Your browser does not support AJAX!");return false;
            }
            }
        }return xmlHttp;
}
var aj_cache=new Array();
function new_advers(page)
{
//if(!aj_cache[page])
if(true)
	{
    var NI=ajax();
	
if(NI)	{
		$("#newadverall").animate({
		   opacity: '0.1'
		 }, "slow");

		NI.open("GET", "new_adver_all_ajax.php?p="+page, true);
		NI.onreadystatechange=function(){
            if(NI.readyState==4){
                if(NI.status==200){
                    $('#newadverall').html(NI.responseText);
                    $("#newadverall").animate({
							   opacity: '1'
							 }, "fast");
						  aj_cache[page]=NI.responseText;
                }
            }
        };
		NI.send(null);
    }
    }
    else{
		$("#newadverall").fadeOut("slow",function(){
			$('#newadverall').html(aj_cache[page]);
		});
       $("#newadverall").fadeIn("slow");
	}
}
function last_ads(page)
{
//if(!aj_cache[page])

	
    var NI=ajax();
	if(NI)
	{
		$("#last").animate({
		   opacity: '0.1'
		 }, "slow");

		NI.open("GET", "last_ajax.php?p4="+page, true);
		NI.onreadystatechange=function(){
            if(NI.readyState==4){
                if(NI.status==200){
                    $('#last').html(NI.responseText);
                    $("#last").animate({
							   opacity: '1'
							 }, "fast");
						  aj_cache[page]=NI.responseText;
                }
            }
        };
		NI.send(null);
    }
    
}

function last_neg(page)
{
//if(!aj_cache[page])

	
    var NI=ajax();
	if(NI)
	{
		$("#last_neg").animate({
		   opacity: '0.1'
		 }, "slow");

		NI.open("GET", "last_negin_ajax.php?p2="+page, true);
		NI.onreadystatechange=function(){
            if(NI.readyState==4){
                if(NI.status==200){
                    $('#last_neg').html(NI.responseText);
                    $("#last_neg").animate({
							   opacity: '1'
							 }, "fast");
						  aj_cache[page]=NI.responseText;
                }
            }
        };
		NI.send(null);
    }
    
}

///last_free_advertisement

function last_free(page)
{
//if(!aj_cache[page])

	
    var NI=ajax();
	if(NI)
	{
		$("#last_free").animate({
		   opacity: '0.1'
		 }, "fast");

		NI.open("GET", "free_adver_ajax.php?p2="+page, true);
		NI.onreadystatechange=function(){
            if(NI.readyState==4){
                if(NI.status==200){
                    $('#last_free').html(NI.responseText);
                    $("#last_free").animate({
							   opacity: '1'
							 }, "fast");
						  aj_cache[page]=NI.responseText;
                }
            }
        };
		NI.send(null);
    }
    
}


/////

function new_stars(page)
{
	//if(!aj_cache[page])

    var NI=ajax();
	if(NI)
	{
		$("#sp2").animate({
		   opacity: '0.1'
		 }, "slow");

		NI.open("GET", "sp2.php?p2="+page, true);
		NI.onreadystatechange=function(){
            if(NI.readyState==4){
                if(NI.status==200){
                    $('#sp2').html(NI.responseText);
                    $("#sp2").animate({
							   opacity: '1'
							 }, "fast");
						  aj_cache[page]=NI.responseText;
                }
            }
        };
		NI.send(null);
    }
    
}





		


var sug_run=1;
function show_sug(key)
{
	if(sug_run)
	{
		sug_run=0;
      $('#sug_list').load("http://www.7gardoon.com/sugajax.php?p="+key, function() {
	  	   sug_run=1;
	   });
	}
	 
	/* var ss=ajax();
    
	if(ss)
	{
		key=encodeURI(key);
		ss.open("GET", "http://www.7gardoon.com/sugajax.php?p="+key, true);
		ss.onreadystatechange=function()
		{
            if(ss.readyState==4)
			{
                if(ss.status==200){
                    document.getElementById('sug_list').innerHTML=ss.responseText;
                }
            }
        };
		ss.send(null);
    }*/
}

