$(document).ready(function(){

	$("#mail_send").validate({
                rules: {
                        contact_name: "required",
                        contact_subject: "required",
                        contact_email: {
                                required: true,
                                email: true
                        }
                },
                messages: {
                        contact_name: "Unesite Vaše ime",
                        contact_subject: "Unesite naslov poruke",
                        contact_email: "Unesite ispravnu email adresu"
                }
	});

	/* ucitavanje feed-ova */
	$('ul.feed_menu_feed a').click( function() {
		if($(this).attr('class').search(/active/) >= 0){
			$(this).blur();
			return false;
		}
		load_feed( $(this).attr('rel'));
		$('ul.feed_menu_feed a').removeClass('linkactive');
		$(this).addClass('linkactive');
	});

	/* link za mapu na kontakt strani */
	$('.strana23 #contact_form_text .blog_inner_text a').click( function(){
		//		$(this).attr('target', 'blank');return;
		window.open( $(this).attr('href'), 'mapa', "width=550, height=400");
		$(this).blur();
		return false;
	});

	$('table.mbi_marketdatatable a').click( function() {
		$(this).blur();
		return false;
	});
	$('table.mbi_marketdatatable a').hover( function() {
		window.status='';
		return false;
	}, function(){});

	$('.strana44 .vilotijeText a').click( function() {
		$(this).blur();
		return false;
	});
	$('.strana44 .vilotijeText a').hover( function() {
		window.status='';
		return false;
	}, function(){});
	return false;
});

function load_feed( url ){
	$('.feed_body').empty();
	$('.feed_body').append('<img src="/images/ajax-loader-old.gif" style="padding-top:50px;padding-left:100px;" alt="loading.." />');
	$('.feed_body').load( url+ ' .feed_body', '', function(){
	});
	return false;
}


$(document).ready(function(){
// 	$('.leading0').after('<div id="middlebanner"></div>');
// 	$('#middlebanner').load('/module.php?module=advert1&type=-1', '', function(){
// 	});
// 	$('#middlebanner li').css('list-style', 'none');
// 	$('#middlebanner li').css('padding', '0');
// 	$('#middlebanner li').css('margin', '0');
});


$(document).ready(function(){
	$(".mainlevel0-nav")
		.superfish({
			animation : { opacity:"show",height:"show", delay:100, speed:"normal"}
		});
});


function print_main(){
	var a = window. open('','','scrollbars=yes,width=600,height=400,resizable=yes');

	a.document.open("text/html");
	a.document.write('<html><head>');
	a.document.write('<link rel="stylesheet" type="text/css" href="templates/pregled/css/template_css.css">');
	a.document.write('<style type="text/css">#user3{display:none;}</style>');
	a.document.write('</head><body style="padding:0;background-image:none;background-color:#ffffff;">');

	var html = document.getElementById('middle').innerHTML;
	//	var html = '<a href="http://pregled.jeasoft.com/index.php?option=com_content&amp;sectionid=1&amp;catid=4&amp;task=view&amp;id=371&amp;Itemid=6">';

	html = html.replace( /\n+/ig, ' ', html );
	html = html.replace( /<a[^>]+>/ig, '', html ); //alert(html);
	html = html.replace( /<\/a[^>]*>/ig, '', html );
	html = html.replace( /<script(.+)script>/ig, '',html );
	a.document.write(html);
	a.document.write('</body></html>');
	a.document.close();
	//a.print();
	return false;
}
var messageElement = null;
function email_main(){
	$.blockUI(messageElement);
	//var html = $.ajax({url: "index2.php?option=com_pregled&no_html=1", async: false }).responseText; 
	//$.blockUI(html);
}

function set_search_form( value ){
	alert(value);
}
