function evalHTMLjs(txt)
	{
		var stext = '<script type="text/javascript">';
		var etext = '</script>';

		var t = txt;
		var c = 0;
		
		while ( true )
		{
			s = t.indexOf(stext);
			if ( s == -1 )
				return;
				
			t = t.substr(s+stext.length);
				
			js = t.substr(0,t.indexOf(etext));
			
			eval(js);
			
			t = t.substr(t.indexOf(etext)+etext.length);
		}
	}

function changeMod(mod,appState)
{
	var addLnk = addLink || '';
	window.nowMod = mod;
    var opt =
    {
        // Use POST
        method: 'post',
        // Send this lovely data
        postBody: appState+'&Mindex_ajmod='+mod+'&'+addLnk,
        evalScripts: true,
        // Handle successful response
        onSuccess: function(t)
        {
            $('js_search').innerHTML = t.responseText;
			if(nowMod!="Ss"){
				try{$('todaySetsView').style.display="none";}catch(e){}
				try{$('bestRatedSetsView').style.display="none";}catch(e){}
				try{$('mostDownloadedSetsView').style.display="none";}catch(e){}
			}else{
				try{$('todaySetsView').style.display="";}catch(e){}
				try{$('bestRatedSetsView').style.display="";}catch(e){}
				try{$('mostDownloadedSetsView').style.display="";}catch(e){}
			}  
			t.responseText.evalScripts() ; 
			rotatorsInit();	
            initAfterAjax('js_search');			
        },
        // Handle other errors
        onFailure: function(t)
        {
            //alert('Error ');
        }
    }
    new Ajax.Request('tabloader.php?', opt);
}
