var vivinteres_lev =  function(raz,id,id_prosm){
        loadContent(interes_nav,raz,id,1,id_prosm,0); 
}

var loadContent = function(e,raz,id,nav,id_pr,str){
    var xmlhttp;
    var element = document.getElementById(e);
    var randv;
    var randv=Math.round(Math.random()*100);  
    var path;
    if(nav==2)path='/interesnoe/telo.php?id='+id+'&'+randv;
    if(nav==3)path='/interesnoe/telo_n.php?raz='+raz+'&f='+str+'&'+randv;
    if(nav==1)path='/interesnoe/navi_lev.php?raz='+raz+'&id='+id+'&id_prosm='+id_pr+'&'+randv;

    if(window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
    else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==1){
            e.innerHTML = "Загрузка...";
        }
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
	    e.innerHTML = "";	
            d = document.createElement("div");
            d.innerHTML = xmlhttp.responseText;
            e.appendChild(d);
        }
    }
    xmlhttp.open("GET",path,true);
    xmlhttp.setRequestHeader('Content-Type', 'text/plain');
    xmlhttp.send();
if(nav==2){
var id_prosm=getCookie("interes_prosm");  if(!id_prosm)id_prosm="";
var id_prosm_n;
if(id>0){
if(id_prosm){var m_id_prosm=id_prosm.split(/_/);
if(!in_array(id, m_id_prosm))id_prosm_n=id_prosm+'_'+id; else id_prosm_n=id_prosm;
            }else id_prosm_n=id;
set_cook("interes_prosm",id_prosm_n,1);
        }
vivinteres_lev(raz,id,id_prosm_n);}
}




function in_array(needle, haystack, strict) { 	 
	    var found = false, key, strict = !!strict;
	    for (key in haystack) {
	        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
	            found = true;
	            break;
	        }
	    }
	 
	    return found;
}
