
$(document).ready(function() {
	$("#news").show();
	try {

		//if (insite_links != undefined) {
			$("a").each(function(){
				if (inArray($(this).attr("href"), insite_links)) {
		//		if ($(this).attr("href") == 'http://ezonomics.ing.ro/?section=article&aid=111') {
					var new_link = SITE_URL+ '/redirect_url.php?url='+base64_encode($(this).attr("href"));
					$(this).attr("href", new_link);
				}
			})
		//}
		} catch(e) {
        
    }

	/*
	$.insite_links = new Array();
	$.i = 0;
	$("a").each(function(){
		$.insite_links[$.i] = $(this).attr("href");
		$.i = $.i + 1;
	});

	$.ajax({
					type: "post",
					url: SITE_URL + "/includes/load_linkuri_tracking.php",
					data: "", 
					success: function(data){
						var links = data.split("|*");// == 'http://ezonomics.ing.ro/?section=article&aid=111'
						//$("a").each(function(){
						var insite_links = $.insite_links;
						for (k = 0; k < insite_links.length; k++) {
							if (inArray(insite_links[k], links)) {
								var new_link = SITE_URL+ '/redirect_url.php?url='+base64_encode(insite_links[k]);
								//$("a").eq(k).attr("href", new_link);
							}
						}

						return false;
					}
			});*/

	

	if($.browser.msie && ($.browser.version && $.browser.version < 7))
	{
		$(".hovered").hover(
			function(){ 
				$(this).addClass("hover");
				$(this).css("zIndex","100");
			},
			function(){
				$(this).removeClass("hover");
				$(this).css("zIndex","-1");
			}
		);
	}
	var timeOut;
	$(".parent").hover(
		function(){
			var id = this.id;
			var elem_number = id.replace("parent_","");
			if (elem_number != "") {
				
				$("#detalii_close_"+elem_number+" .detalii_close").show();
				timeOut= setTimeout(function(){
															$("#detalii_open_"+elem_number).fadeIn('slow');
															$("#detalii_close_"+elem_number + " .detalii_close").hide();
															$("#detalii_close_"+elem_number + " .detalii_open").show();
															}, 5000);
				
			}
		},
		function(){
			clearTimeout(timeOut);
			var id = this.id;
			var elem_number = id.replace("parent_","");
			if (elem_number != "") {
				$("#detalii_open_"+elem_number).fadeOut('slow');
				$("#detalii_close_"+elem_number+" .detalii_close").hide();
				$("#detalii_close_"+elem_number + " .detalii_open").hide();
				$("#detalii_close_"+elem_number + " .detalii_close").hide();
			}
		}
	);
	
	$(".submenu a b").click(function(){
									if ($($(this).parents('a')).hasClass('hover') == true){
										$($(this).parents('a')).removeClass("hover");
										$($(this).parents('li')).removeClass("hover");
									} else {
										$($(this).parents('a')).addClass("hover");
										$($(this).parents('li')).addClass("hover");
									}
									return false;
									
		});
		
	var elm = $(document).focused();
	$(".submenu a").live('blur',function(e){
			$(this).removeClass("hover");
			$(this).parents('li').removeClass("hover");
			if ($.focusedElement != '' && $.focusedElement != 'undefined') {
				document.location.href = $.focusedElement;
			}
			return false;
		});
	
	 
	$("#info-financiar-accordion .case-schimb").click(function() {
			$("#info-financiar-accordion").find(".infos").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#info-case").show();
			return false;
	});
	$("#info-financiar-accordion .curs-bnr").click(function() {
			$("#info-financiar-accordion").find(".infos").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#info-curs").show();
			return false;
	});
	$("#info-financiar-accordion .cotatii").click(function() {
			$("#info-financiar-accordion").find(".infos").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#info-cotatii").show();
			return false;
	});
	
	$("#info-financiar-accordion .dobanzi-credite").click(function() {
			$("#info-financiar-accordion").find(".infos-dobanzi").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#dobanzi-credite").show();
			return false;
	});
	$("#info-financiar-accordion .dobanzi-depozite").click(function() {
			$("#info-financiar-accordion").find(".infos-dobanzi").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#dobanzi-depozite").show();
			return false;
	});
	$("#info-financiar-accordion .dobanzi-indici-monetari").click(function() {
			$("#info-financiar-accordion").find(".infos-dobanzi").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#dobanzi-indici-monetari").show();
			return false;
	});
	
	$("#info-financiar-accordion .investitii-indici-bvb").click(function() {
			$("#info-financiar-accordion").find(".infos-investitii").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#investitii-indici-bvb").show();
			return false;
	});
	$("#info-financiar-accordion .investitii-pensii-private").click(function() {
			$("#info-financiar-accordion").find(".infos-investitii").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#investitii-pensii-private").show();
			return false;
	});
	$("#info-financiar-accordion .investitii-fonduri-mutuale").click(function() {
			$("#info-financiar-accordion").find(".infos-investitii").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#investitii-fonduri-mutuale").show();
			return false;
	});
	 
	  $("#box-ghiduri .curs-bnr").click(function() {
			$("#info-financiar-accordion").find(".infos").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#info-curs").show();
			return false;
	});
		
		 $("#box-ghiduri .cotatii").click(function() {
			$("#info-financiar-accordion").find(".infos").hide();
			$(this).parent().find("li").removeClass('active');
			$(this).addClass('active');
			$("#info-cotatii").show();
			return false;
	});


		var options = {
			newsList: "#news",
			startDelay: 10,
			placeHolder1: "_",
			placeHolder2: ""
		}
		$().newsTicker(options);

		function runEffect(){
		};
		
		$("#search").mouseover(function() {
			return false;
		});
		
		$("#search").mouseout(function() {

			return false;
		});
		
		$("#comparatii_menu").click(function(){
			var pos = $(this).offset();
			$("#popup-comparatii").css("left",pos.left-100);
			$("#popup-comparatii").css("top",pos.top+50);
			$("#popup-comparatii").fadeIn("slow");
			$("#overlay").show();
			return false;
		});
		
		$("#cotatii_menu").click(function(){
			var pos = $(this).offset();
			$("#popup-info-financiar").css("left",pos.left-245);
			$("#popup-info-financiar").css("top",pos.top+50);
			$("#popup-info-financiar").fadeIn("slow");
			$("#overlay").show();
			return false;
		});
		
		$(".close-popup").click(function(){
			$(this).parent().fadeOut("fast");
			$("#overlay").hide();
		});

		
		$(".change").each(function(){
			var elem = $(this).clone();
			var width = $(this).css("width");
			var parent = $(this).parent();
			var value = $(this).find(':selected').text();
			parent.html('<span class="inpb"><div class="select-wrap" style="width:'+width+'"><span class="search-select-label">'+value+'</span><em></em></div></span>');
			parent.css("width", width);
			width = parseInt(width.replace("px",""))-35;
			parent.find('.search-select-label').css("width", width+"px");
			elem.appendTo(parent.find('.select-wrap'));
		})

		$('select.change').change(function () {
			var label = $(this).find(" option:selected").text();
			$(this).parent().find('.search-select-label').html(label);

		});

	/*var feedback = '';
	feedback = '<div style="clear:both"></div><div id="feedbackLinkFixed" style="z-index: 10; position: fixed; right: 0; top: 300px;"><a href="http://spreadsheets.google.com/viewform?formkey=dElnYllsbWJid1hQNzBFZ2l2dkpRTHc6MQ" target="_blank" rel="noindex,nofollow"><img src="http://www.conso.ro/assets/images/feedback_conso.png" alt="Feedback" border="0" /></a></div><div style="clear:both"></div>';
	$("body").prepend(feedback);*/
	
	$('#cauti-credite-imobiliare-tipcredit').bind('change', function(){
		var opt_text = '' ;
		var selectedOption = '0';
		var sel = $('#cauti-credite-imobiliare-valuta');
		var opt = sel.attr('options');
		selectedOption = sel.attr("selectedIndex");
		$('option', sel).remove();
		if( $(this).val() == '0' )
			var myOptions = { '0' : ' RON', '1' : 'EUR' }
		else
			var myOptions = { '0' : 'RON', '1' : 'EUR', '2' : 'USD', '3' : 'CHF' }
		
		$.each(myOptions, function(val, text) {
			opt_text += '<option value="' + val + '">' + text + '</option>';
		});
		sel.html(opt_text);
		sel.val(selectedOption);
	});
	
	$('#compara-credite-imobiliare-tipcredit').bind('change', function(){
		var opt_text = '' ;
		var selectedOption = '0';
		var sel = $('#compara-credite-imobiliare-valuta');
		var opt = sel.attr('options');
		selectedOption = sel.attr("selectedIndex");
		$('option', sel).remove();
		
		var opt_text_per = '' ;
		var selectedOptionPer = '30';
		var selPer = $('#compara-credite-imobiliare-perioada');
		var optPer = selPer.attr('options');
		$('option', selPer).remove();
		
		if( $(this).val() == '0' ){
			var myOptions = { '0' : ' RON', '1' : 'EUR' }
			opt_text_per += '<option value="1">1 an</option>';
			for(i=2; i<=30; i++){
				opt_text_per += '<option value="' + i + '">' + i + ' ani</option>';
			}
		}
		else{
			var myOptions = { '0' : 'RON', '1' : 'EUR', '2' : 'USD', '3' : 'CHF' }
			opt_text_per += '<option value="1">1 an</option>';
			for(i=2; i<=40; i++){
				opt_text_per += '<option value="' + i + '">' + i + ' ani</option>';
			}
		}
		
		$.each(myOptions, function(val, text) {
			opt_text += '<option value="' + val + '">' + text + '</option>';
		});
		sel.html(opt_text);
		sel.val(selectedOption);
		
		selPer.html(opt_text_per);
		selPer.val(selectedOptionPer);
	});
	
	$('#compara-credite-consum-tipcredit').bind('change', function(){
		var opt_text_per = '' ;
		var selectedOptionPer = '30';
		var selPer = $('#compara-credite-consum-perioada');
		var optPer = selPer.attr('options');
		$('option', selPer).remove();
		var max_period = 10;
		switch($(this).val()){
			case '0': max_period = 10; break;
			case '1': max_period = 12; break;
			case '2': max_period = 35; break;
			case '3': max_period = 5; break;
			case '4': max_period = 5; break;
			case '5': max_period = 10; break;
			case '6': max_period = 10; break;
		}
		
		opt_text_per += '<option value="1">1 an</option>';
		for(i=2; i<=max_period; i++){
			opt_text_per += '<option value="' + i + '">' + i + ' ani</option>';
		}
		selPer.html(opt_text_per);
		selPer.val(selectedOptionPer);
	});
	
	$('#compara-depozite-perdepozit').bind('change', function(){
		var suma = $('#compara-depozite-suma');
		var opt_text_per = '' ;
		var selectedOptionPer = '1';
		var selPer = $('#compara-depozite-moment');
		var optPer = selPer.attr('options');
		$('option', selPer).remove();
		switch($(this).val()){
			case '0': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire' }; break;
			case '1': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire' }; break;
			case '2': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire' }; break;
			case '3': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial' }; break;
			case '4': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial' }; break;
			case '5': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial', '4' : 'Semestrial' }; break;
			case '6': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial', '4' : 'Semestrial' }; break;
			case '7': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial', '4' : 'Semestrial' }; break;
			case '8': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial', '4' : 'Semestrial' }; break;
			case '9': var myOptions = { '0' : ' Lunar', '1' : 'La scadenta', '2' : 'La constituire', '3' : 'Trimestrial', '4' : 'Semestrial' }; break;
		}
		$.each(myOptions, function(val, text) {
			opt_text_per += '<option value="' + val + '">' + text + '</option>';
		});
		selPer.html(opt_text_per);
		selPer.val(selectedOptionPer);
		
		if($(this).val() == 9){
			selPer.attr('disabled', 'disabled');
			suma.attr('disabled', 'disabled');
		}
		else{
			selPer.removeAttr('disabled');
			suma.removeAttr('disabled');
		}
	});
	
	var frm_caut_investesc_action_val = $('#frm-caut-investesc').attr('action');
	var frm_caut_investesc_action = $('#frm-caut-investesc');
	$('#submit-caut-investesc').bind('click', function(){
		var ti = $('#tip-investitie').val();
		var action = '';
		switch(ti){
			case '1': 
				action = frm_caut_investesc_action_val + 'depozite/'; 
				var tp = $('#popup-caut-investesc-produsul-1').val();
				switch(tp){
					case '0': action = frm_caut_investesc_action_val + 'depozite/'; break;
					case '1': action = frm_caut_investesc_action_val + 'depozite/'; break;
					case '2': action = frm_caut_investesc_action_val + 'conturi-economii/'; break;
				}
				break;
			case '2': action = frm_caut_investesc_action_val + 'fonduri-investitii/inceput/'; break;
			case '3': action = frm_caut_investesc_action_val + 'pensii-private/sumaacumulata/'; break;
		}
		frm_caut_investesc_action.attr('action', action);
		frm_caut_investesc_action.submit();
	});
	$('#tip-investitie').bind('change', function(){
		$('#popup-comparatii-investitii-1').css('display', 'none');
		$('#popup-comparatii-investitii-2').css('display', 'none');
		$('#popup-comparatii-investitii-3').css('display', 'none');
		$('#popup-comparatii-investitii-' + $(this).val()).css('display', '');
		if($(this).val() == 3){
			$('#caut-investesc-post-type').val('2');
		}
	});
	$('#popup-caut-investesc-produsul-1').bind('change', function(){
		$('#caut-investesc-tipdepozit').val($(this).val());
	});
	$('#popup-caut-investesc-valuta-1').bind('change', function(){
		$('#caut-investesc-valuta').val($(this).val());
	});
	$('#popup-caut-investesc-produsul-2').bind('change', function(){
		$('#caut-investesc-tipcard').val($(this).val());
		$('#caut-investesc-perioada').val('');
	});
	$('#popup-caut-investesc-produsul-3').bind('change', function(){
		$('#caut-investesc-post-type').val($(this).val());
		$('#caut-investesc-perioada').val('1');
	});
	
	var frm_caut_credit_action_val = $('#frm-caut-credit').attr('action');
	var frm_caut_credit_action = $('#frm-caut-credit');
	$('#tip-credit').bind('change', function(){
		$('#popup-comparatii-credit-1').css('display', 'none');
		$('#popup-comparatii-credit-2').css('display', 'none');
		$('#popup-comparatii-credit-3').css('display', 'none');
		$('#popup-comparatii-credit-4').css('display', 'none');
		$('#popup-comparatii-credit-5').css('display', 'none');
		$('#popup-comparatii-credit-6').css('display', 'none');
		$('#popup-comparatii-credit-' + $(this).val()).css('display', '');
		switch($(this).val()){
			case '1': $('#popup-caut-credit-tipcredit').val('0'); $('#popup-caut-credit-valuta').val('1'); 
						$('#popup-caut-credit-suma').val('50000'); $('#popup-caut-credit-perioada').val('30');
						break;
			case '2': $('#popup-caut-credit-tipcredit').val('1'); $('#popup-caut-credit-valuta').val('1'); 
						$('#popup-caut-credit-suma').val('3000'); $('#popup-caut-credit-perioada').val('5');
						break;
			case '3': $('#popup-caut-credit-tipcredit').val('0'); $('#popup-caut-credit-valuta').val('1'); 
						$('#popup-caut-credit-suma').val('10000'); $('#popup-caut-credit-perioada').val('5');
						break;
			case '4': $('#popup-caut-credit-valTva').val('15000'); $('#popup-caut-credit-avans').val('3750'); 
						$('#popup-caut-credit-durata').val('5'); $('#popup-caut-credit-tip-client').val('fizica');
						$('#popup-caut-credit-tip-autol').val('autoturism');
						break;
			case '5': $('#popup-caut-credit-suma').val('5000'); break;
			case '6': break;
		}
	});
	$('#tip-credit').bind('change', function(){
		$('#popup-comparatii-credit-1').css('display', 'none');
		$('#popup-comparatii-credit-2').css('display', 'none');
		$('#popup-comparatii-credit-3').css('display', 'none');
		$('#popup-comparatii-credit-4').css('display', 'none');
		$('#popup-comparatii-credit-5').css('display', 'none');
		$('#popup-comparatii-credit-6').css('display', 'none');
		$('#popup-comparatii-credit-' + $(this).val()).css('display', '');
	});
	$('#popup-caut-credit-produsul-1').bind('change', function(){
		$('#popup-caut-credit-tipcredit').val($(this).val()); $('#popup-caut-credit-valuta').val('1'); $('#popup-caut-credit-suma').val('50000'); $('#popup-caut-credit-perioada').val('30');
		
		var opt_text = '' ;
		var selectedOption = '1';
		var sel = $('#popup-caut-credit-valuta-1');
		var opt = sel.attr('options');
		$('option', sel).remove();
		if( $(this).val() == '0' ) var myOptions = { '0' : ' RON', '1' : 'EUR' }
		else var myOptions = { '0' : 'RON', '1' : 'EUR', '2' : 'USD', '3' : 'CHF' }
		$.each(myOptions, function(val, text) {
			opt_text += '<option value="' + val + '">' + text + '</option>';
		});
		sel.html(opt_text);
		sel.val(selectedOption);
	});
	$('#popup-caut-credit-valuta-1').bind('change', function(){
		$('#popup-caut-credit-valuta').val($(this).val());
	});
	$('#popup-caut-credit-produsul-2').bind('change', function(){
		$('#popup-caut-credit-tipcredit').val($(this).val()); $('#popup-caut-credit-valuta').val('1');
		switch($(this).val()){
			case '0': $('#popup-caut-credit-suma').val('5000'); $('#popup-caut-credit-perioada').val('5'); break;
			case '1': $('#popup-caut-credit-suma').val('3000'); $('#popup-caut-credit-perioada').val('5'); break;
			case '2': $('#popup-caut-credit-suma').val('30000'); $('#popup-caut-credit-perioada').val('20'); break;
			case '3': $('#popup-caut-credit-suma').val('5000'); $('#popup-caut-credit-perioada').val('1'); break;
			case '4': $('#popup-caut-credit-suma').val('3000'); $('#popup-caut-credit-perioada').val('5'); break;
			case '5': $('#popup-caut-credit-suma').val('3000'); $('#popup-caut-credit-perioada').val('5'); break;
			case '6': $('#popup-caut-credit-suma').val('10000'); $('#popup-caut-credit-perioada').val('7'); break;
		}
	});
	$('#popup-caut-credit-valuta-2').bind('change', function(){
		$('#popup-caut-credit-valuta').val($(this).val());
	});
	$('#popup-caut-credit-produsul-3').bind('change', function(){
		$('#popup-caut-credit-tipcredit').val($(this).val());
	});
	$('#popup-caut-credit-valuta-3').bind('change', function(){
		$('#popup-caut-credit-valuta').val($(this).val());
	});
	$('#popup-caut-credit-produsul-4').bind('change', function(){
		$('#popup-caut-credit-tip-client').val($(this).val());
	});
	$('#popup-caut-credit-valuta-4').bind('change', function(){
		$('#popup-caut-credit-valuta').val($(this).val());
	});
	$('#popup-caut-credit-produsul-5').bind('change', function(){
		$('#popup-caut-credit-tipcard').val($(this).val());
	});
	
	$('#popup-caut-credit-produsul-6').bind('change', function(){
		$('#popup-caut-credit-post-type').val($(this).val());
	});
	$('#popup-caut-credit-valuta-6').bind('change', function(){
		$('#popup-caut-credit-post-moneda').val($(this).val());
	});
	
	$('#submit-caut-credit').bind('click', function(){
		var ti = $('#tip-credit').val();
		var action = '';
		switch(ti){
			case '1': action = frm_caut_credit_action_val + 'credite-imobiliare/'; break;
			case '2': action = frm_caut_credit_action_val + 'credite-consum/'; break;
			case '3': action = frm_caut_credit_action_val + 'credite-auto/'; break
			case '4': action = frm_caut_credit_action_val + 'leasing-auto/'; break
			case '5': action = frm_caut_credit_action_val + 'carduri/'; break
			case '6': action = frm_caut_credit_action_val + 'credite-imm/'; break
		}
		frm_caut_credit_action.attr('action', action);
		frm_caut_credit_action.submit();
	});
	
	
});

				

function comparatii_detalii_open(elem_number) {
	$("#detalii_open_"+elem_number).fadeIn("slow");
	$("#detalii_close_"+elem_number + " .detalii_close").hide();
	$("#detalii_close_"+elem_number + " .detalii_open").show();
}
	
function comparatii_detalii_close(elem_number) {
	$("#detalii_open_"+elem_number).fadeOut("slow");
	$("#detalii_close_"+elem_number + " .detalii_open").hide();
	$("#detalii_close_"+elem_number + " .detalii_close").show();
}

var trimite_unui_prieten = function(url){
	window.open(url, 'trimite_unui_prieten', "toolbar=0,location=0,directories=0,status=0,menubar=no,scrollbars=yes,resizable=no,width=400,height=250");
}
$.focusedElement = '';
$.fn.extend({
	focused: function(options) {
		var focusedElement = null;
		
		$('.submenu ul li a').live('hover',
		function() {
			focusedElement = $(this).attr("href");
			$.focusedElement = focusedElement;
		})
		
		$('.submenu ul li a').live('mouseout',
		function() {
			focusedElement = '';
			$.focusedElement = focusedElement;
		})
	}
});


function home_js () {
	$(".link").easyTooltip();
	$('#submit-sondaj').bind('click', function(){
		$.post(SITE_URL + "/vote_sondaj.php", $("#form-sondaj").serialize(), function(msg){
			if( msg != '' ){
				$('#container-sondaj').html(msg);
			}
		});
	});
	
	$('a[id^="cauti-credit-"]').each(function(i) {
		$(this).bind('click', function(){
			$('a[id^="cauti-credit-"]').removeClass('active');
			$(this).addClass('active');
			if ($('#cauti-credit-form-' + (i+1) + '').length) {
				$('div[id^="cauti-credit-form"]').each(function(i) {
					$(this).hide();
				});
				$('#cauti-credit-form-' + (i+1) + '').show();
			}
			else{
				$('#cauti-credit-form').show();
			}
		});
	});
	
	$('a[id^="cauti-sa-investesti-"]').each(function(i) {
		$(this).bind('click', function(){
			$('a[id^="cauti-sa-investesti-"]').removeClass('active');
			$(this).addClass('active');
			if ($('#cauti-sa-investesti-form-' + (i+1) + '').length) {
				$('div[id^="cauti-sa-investesti-form"]').each(function(i) {
					$(this).hide();
				});
				$('#cauti-sa-investesti-form-' + (i+1) + '').show();
			}
			else{
				$('#cauti-sa-investesti-form').show();
			}
		});
	});
	
	/*$('#rss-content-parteneri-media').load(SITE_URL + '/load_parteneri_media.php', {index: 0}, function(msg) {
		$('#rss-content-parteneri-media').html(msg);
	});*/
	$('a[id^="parteneri-media-"]').each(function(i) {
		$(this).css('cursor', 'pointer');
		$(this).bind('click', function(){
			$('a[id^="parteneri-media-"]').removeClass('active');
			$(this).addClass('active');
			$('div[id^="rss-content-partener-"]').each(function(i) { $(this).hide(); })
			$('#rss-content-partener-'+(i+1)).show();
/*			$('#rss-content-parteneri-media').load(SITE_URL + '/load_parteneri_media.php', {index: i}, function(msg) {
				$('#rss-content-parteneri-media').html(msg);
			});*/
		});
	});
}

function base64_encode (data) {
    // http://kevin.vanzonneveld.net
    // +   original by: Tyler Akins (http://rumkin.com)
    // +   improved by: Bayron Guevara
    // +   improved by: Thunder.m
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Pellentesque Malesuada
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: utf8_encode
    // *     example 1: base64_encode('Kevin van Zonneveld');
    // *     returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='

    // mozilla has this native
    // - but breaks in 2.0.0.12!
    //if (typeof this.window['atob'] == 'function') {
    //    return atob(data);
    //}
        
    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = [];

    if (!data) {
        return data;
    }

    data = this.utf8_encode(data+'');
    
    do { // pack three octets into four hexets
        o1 = data.charCodeAt(i++);
        o2 = data.charCodeAt(i++);
        o3 = data.charCodeAt(i++);

        bits = o1<<16 | o2<<8 | o3;

        h1 = bits>>18 & 0x3f;
        h2 = bits>>12 & 0x3f;
        h3 = bits>>6 & 0x3f;
        h4 = bits & 0x3f;

        // use hexets to index into b64, and append result to encoded string
        tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
    } while (i < data.length);
    
    enc = tmp_arr.join('');
    
    switch (data.length % 3) {
        case 1:
            enc = enc.slice(0, -2) + '==';
        break;
        case 2:
            enc = enc.slice(0, -1) + '=';
        break;
    }

    return enc;
}

function utf8_encode ( argString ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: sowberry
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +   improved by: Yves Sucaet
    // +   bugfixed by: Onno Marsman
    // +   bugfixed by: Ulrich
    // *     example 1: utf8_encode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'

    var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");

    var utftext = "";
    var start, end;
    var stringl = 0;

    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;

        if (c1 < 128) {
            end++;
        } else if (c1 > 127 && c1 < 2048) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc !== null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }

    if (end > start) {
        utftext += string.substring(start, string.length);
    }

    return utftext;
}

function inArray(needle, haystack) {
    var length = haystack.length;
    for(var i = 0; i < length; i++) {
        if(haystack[i] == needle) return true;
    }
    return false;
}
