//on dom ready...

function sendAjaxRequest(elm,n){
	
	elm.getParent().getParent().getElements("li").removeClass("opened");
	elm.getParent().addClass("opened");
	
	var pathname = window.location.pathname;
	pathname = pathname.split("/")[1];
	pathname = pathname.replace(".html", "");
	var req = new Request({
			method: 'get',
			url: 'bralnik-'+pathname+strstr(elm.get('href'),'/',false),
			data: { 'do' : '1' },
			onComplete: function(response) { 
				var newsString = strstr(response,'<div class="layout_full block first last even">',false);
				newsString = strstr(newsString,'<!-- indexer::stop -->',true);
				
				$('media-box-content-'+n).innerHTML = newsString;
				$$('#media-box-content-'+n+' h2').dispose();
				
			}
		}).send();
};
function sendAjaxRequestFAQ(elm,n){
	
	elm.getParent().getParent().getElements("li").removeClass("opened");
	elm.getParent().addClass("opened");
	
	
	
	//alert('faq-ajax'+strstr(elm.get('href'),'/',false))
	var req = new Request({
			method: 'get',
			url: '/faq-ajax'+strstr(elm.get('href'),'/',false),
			data: { 'do' : '1' },
			onComplete: function(response) { 
				var newsString = strstr(response,'<div class="mod_faqreader block">',false);
				newsString = strstr(newsString,'<!-- indexer::stop -->',true);
				
				$('faq-box-content-'+n).innerHTML = newsString;
				
				
			}
		}).send();
};
function strstr (haystack, needle, bool) {
    var pos = 0;
    
    haystack += '';
    pos = haystack.indexOf( needle );
	if (pos == -1) 
		return false;
	else {
        if (bool) return haystack.substr( 0, pos );
		else return haystack.slice( pos );
    }
};