var st, dr, dId, sId, max, ult_max, vCycleImages, working, oferta = false;

$(document).ready(function(){
	
	//efectul de pe pagina noua de oferte.....TREBUIE MODIFICAT pt ca nu e fain efectu....
	$(".more_details").click(function(){
		$(".extra-details").slideUp(1000);
		//$(".ddd").removeClass("down");
		if ($(".extra-details").is(":hidden")) {
			$(".extra-details").slideDown(1000);
			$(this).addClass("show");
			$(this).html("Vezi mai putine detalii");
			$('.extra-details').addClass('advanced_show');
			return false;
		} else {
			$(".extra-details").slideUp(1000);
			$(this).removeClass(1000);
			$(this).html("Vezi mai multe detalii");
			$('.extra-details').removeClass('advanced_show');
			return false;
		}
	}); 
	
	//taburile de pe pagina noua de oferte
	$(".tab_content").hide(); //Hide all content
    $(".tabs li:nth-child(1)").addClass("active").show(); //Activate first tab
    $(".tab_content:nth-child(1)").show(); //Show first tab content
  
    //On Click Event
    $(".tabs li").click(function() {
  
      $(".tabs li").removeClass("active"); //Remove any "active" class
      $(this).addClass("active"); //Add "active" class to selected tab
      $(".tab_content").hide(); //Hide all tab content
  
      var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
      $(activeTab).fadeIn(); //Fade in the active ID content
      return false;
    });
    
    
    // cont tabs
	//When page loads...
		
		$("#contClient .contTabs_content").hide(); //Hide all content
		$("#contClient .contTabs li:first").addClass("active").show(); //Activate first tab
		$("#contClient .contTabs_content:first").show(); //Show first tab content
	
		//On Click Event
		$("#contClient .contTabs li").click(function() {
	
			$("#contClient .contTabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$("#contClient .contTabs_content").hide(); //Hide all tab content
	
			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).show(); //Fade in the active ID content
			return false;
		});
	
	
	
	
	// pic slider
	max = $('#slide').children().size();
	max = max - 4;

	if(max>1) $('#dreapta').unbind('click').click(function(){ dreapta(1); });

		// reset
		$('#slide').css('left','0px');
	
	
  $('.video').click(function(){
     $('.selected',$(this).parent().parent()).removeClass("selected");
     $(this).addClass("selected");
     if ($(this).attr("rel")=="video1" ){
       $('.despre-noi-test-video').html('<object width="640" height="359"><param name="movie" value="http://www.youtube.com/v/aLDN_jlnU88?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aLDN_jlnU88?fs=1&amp;hl=en_US&amp;autoplay=1;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="359"></embed></object>')
      }
     else{
       $('.despre-noi-test-video').html('<object width="640" height="359"><param name="movie" value="http://www.youtube.com/v/y6eHeL-vwjE?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/y6eHeL-vwjE?fs=1&amp;hl=en_US&amp;autoplay=1;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="359"></embed></object>')

     }
  });
    $('.videoFB').click(function(){
     $('.selected',$(this).parent().parent()).removeClass("selected");
     $(this).addClass("selected");
     if ($(this).attr("rel")=="video1" ){
       $('.despre-noi-test-video').html('<object width="440" height="300"><param name="movie" value="http://www.youtube.com/v/aLDN_jlnU88?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aLDN_jlnU88?fs=1&amp;hl=en_US&amp;autoplay=1;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="300"></embed></object>')
      }
     else{
       $('.despre-noi-test-video').html('<object width="440" height="300"><param name="movie" value="http://www.youtube.com/v/y6eHeL-vwjE?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/y6eHeL-vwjE?fs=1&amp;hl=en_US&amp;autoplay=1;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="300"></embed></object>')

     }
  });
  
	$("span.inima").click(function(){
		like($(this).attr('id'));
		return false;
	}); 
	



	$('#PRINT').click(function(){
		$('#upbg1').remove();
		$('#header').remove();
		$('#menubg').remove();
		$('#footer').remove();
		$('.m4').remove();
		$('.dcontact').remove();
		$('#INAPOI').remove();
		$('#PRINT').remove();
		$('.slider').remove();
		$('.dharta').remove();
		$('iframe').remove();
		$(".extra-details").slideDown(400);
		setTimeout("window.print()",500)
		
	});

	// mail
	$("a.mail").fancybox({
		'padding'			: 0,
		hideOnContentClick	: false,
		'titleShow'			: false,
		'frameWidth'		: 320,
		'frameHeight'		: 198,
		'centerOnScroll'	: true
	});

	// harta
	$('a#harta').fancybox({
		'padding'			: 0,
		'titleShow'			: false,
		'centerOnScroll'	: true
	});

	// fancybox
	$('a.picSlider').fancybox({
		'padding'			: 20,
		'titleShow'			: false,
		'centerOnScroll'	: true
	});
	
	$("a.oferta_place_subfooter, a.place_subfooter").fancybox({
		padding: 0,
		frameWidth: 500,
		frameHeight: 311,
		hideOnContentClick: false,
		centerOnScroll: false
	});	
	
	// video
	$('a.Reclama').fancybox({
		'padding'			: 20,
		'frameWidth'		: 635,
		'frameHeight'		: 357,
		'titleShow'			: false,
		'centerOnScroll'	: true
	});
		
	$.post('ajax.php?a=like',function(data) {
		likeL = generate_likelist(data);
		if(data['count']==0){
			$('#likeShowcase').css('height','189px');
			$('#like_list').html('<span class="nolikelist"></span>');
		}
		else {
			if(oferta==true)
				$('#likeShowcase').css('height',((data['count'])<=2)?(data['count']*111)+'px':'222px');
			else
				$('#likeShowcase').css('height',((data['count'])<=3)?(data['count']*111)+'px':'333px');
				
			$('#like_list').html(likeL);
			$('span.nr_oferte span').html(data['count']+' '+data['oferta-text']);
		}
		
	},"json");
	
	
	//submeniu blog
	$(".blogup").mouseenter(function(){
			$(this).children("div").css("display","block");
		});
	$(".blogup").mouseleave(function(){
		$(this).children("div").css("display","none");
	});
	//submeniu hovere butoane dreapta
	$(".link_oferta").mouseenter(function(){
			$(this).children("span").css("display","block");
		});
	$(".link_oferta").mouseleave(function(){
		$(this).children("span").css("display","none");
	});
	
	$('.raspunsRadio').click(function(){
		 raspunsid = $(this).val();
		 sondajid = $('#sondajID').val();
		 $.post('ajax.php?a=sondaj',
			{
			 	raspunsid: raspunsid,
			 	sondajid: sondajid
			},
				function(data)
					{
						$('#sondajcase').html(data);
						$.post('ajax.php?a=sondaj-update',{sondajid: sondajid},function(data2){$('#totalVoturi').html('Total voturi: '+data2);});
					}
		);
	 });
	 
	 
	//analytics tracking code
	$("#cereo_apt").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Cere oferta apartament']);
	});    
	$("#cereo_cv").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Cere oferta case vile']);
	});    
	$("#cereo_spatii").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Cere oferta spatii']);
	});		
	$("#cereo_teren").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Cere oferta terenuri']);
	});	

	$("#trimiteo_apt").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Trimite oferta apartament']);
	});    
	$("#trimiteo_cv").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Trimite oferta case vile']);
	});    
	$("#trimiteo_spatii").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Trimite oferta spatii']);
	});		
	$("#trimiteo_teren").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Trimite oferta terenuri']);
	});		
	
	$("#abnewsletter").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Abonare newsletter']);
	});		 
	$("#contactf").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Contact form']);
	});
	$("#ceredetaliio").click(function(){
		_gaq.push(['_trackEvent', 'Form submit', 'Cerere detalii oferta']);
	});
	
	
	//retrangere livesuport
	$(".liveright").click(function(){
		var sidebarWidth = $('#livesuport').css('width');
		if(sidebarWidth=='0' || sidebarWidth=='3px'){
			$('#livesuport').animate({
				width: '117px'
			}, function(){
				//ssss
			});
			$(this).removeClass('liveleft');
		}
		else {
			$('#livesuport').animate({
				width: '3px'
			}, function(){
				//sss
			});
			$(this).addClass('liveleft');
		}
		return false;
	});
	
	
	$('input.numeric').live("keyup",function(event){
		newnumber = $(this).val().replace(/\,/g, "");
         if ((event.keyCode>=96 && event.keyCode<=105) || (event.keyCode>=48 && event.keyCode<=57) || event.keyCode==46 || event.keyCode==8)
            $(this).val( newnumber.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") ); 
			
	}).each(function(){
		newnumber = $(this).val().replace(/\,/g, "");
		$(this).val( newnumber.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") ); 
	});
	 
});
$(function() {

	/*// pic slider
	max = $('#slide').children().size();
	max = max - 4;

	if(max>1) $('#dreapta').unbind('click').click(function(){ dreapta(1); });

		// reset
		$('#slide').css('left','0px');

	// ultimele oferte
	ult_max = $('.ultoferte').children().size();
	ult_max = Math.floor(ult_max / 5);

	if(ult_max>1) $('#ult_down').unbind('click').click(function(){ down(1); });

		// reset
		$('#ultoferte').css('top','0px');*/

	// social
	$('.retelebg3 a').hover(
		function() {
			$(this).find('span').show().animate(
				{
					opacity: '1',
					top: '-48px'
				}, 200
			);
		},
		function() {
			$(this).find('span').animate(
				{
					opacity: '0',
					top: '-38px'
				}, 200 ,function() {
					$(this).hide();
				}
			);
		}
	);
	
	
	$('.retelebg4 a').hover(
		function() {
			$(this).find('span').show().animate(
				{
					opacity: '1',
					top: '-48px'
				}, 200
			);
		},
		function() {
			$(this).find('span').animate(
				{
					opacity: '0',
					top: '-38px'
				}, 200 ,function() {
					$(this).hide();
				}
			);
		}
	);

	

	// scroll
	$('.jScroll').jScrollPane();

});

function generate_likelist(data){
	if(oferta==true) ofer = 'oferta_';
	else ofer = '';
	var likeL = '';
	$.each(data['list'], function(key, info){
		
		likeL+= '<div class="'+ofer+'place_anunt" id="id_'+info['id']+'">';
			likeL+= '<a href="'+info['lang-ident']+info['ident']+'-'+info['id']+'" class="'+ofer+'place_anunt_a">';
			likeL+= '<span class="pic2">';
				likeL+= '<img alt="'+info['titlu']+'" width="60" heigh="60" src="upload/oferte/131x131/'+info['pic']+'">';
			likeL+= '</span>';
			likeL+= '<span class="'+ofer+'place_text">';
				likeL+= '<b>'+info['titlu']+'</b>';
				likeL+= info['info1'];
				likeL+= info['info2'];
				likeL+= info['info3'];
			likeL+= '</span>';
			likeL+= '<span class="place_del" onclick="unlike(\''+info['id']+'\'); return false;">';						
			likeL+= '</span>';			
			likeL+= '</a>';
			likeL+= '<span class="'+ofer+'place_pret"><div class="place_pretDiv">'+info['pret']+' '+info['moneda']+'</div>';
				likeL+= '<a href="'+info['lang-ident']+info['ident']+'-'+info['id']+'">'+data['detalii']+'</a>';
			likeL+= '</span>';
		likeL+= '</div>';
	});
	return likeL;
}

// header
function h_stanga(id) {
	var st = id * 504;

	var dId = (parseFloat(id) + 1);
	var sId = (parseFloat(id) - 1);

	if(dId>=1)$('#hDreapta').fadeIn('slow');

	$('#hDreapta').unbind('click').click(function(){ h_dreapta(dId); });

	if(sId<0)
		$('#hStanga').fadeOut('slow');
	else
		$('#hStanga').unbind('click').click(function(){ h_stanga(sId); });

	$('#hslider div').animate({
		'left' : '-'+st+'px'
	});
}

function h_dreapta(id) {
	if(id>=1){
		var dr = id * 504;
		var h_max = $('#hslider div').children().size();
		h_max = h_max;

		var dId = (parseFloat(id) + 1);
		var sId = (parseFloat(id) - 1);

		if(dId>1)$('#hStanga').fadeIn('slow');

		if(dId>=h_max)
			$('#hDreapta').fadeOut('slow');
		else
			$('#hDreapta').unbind('click').click(function(){ h_dreapta(dId); });

		$('#hStanga').unbind('click').click(function(){ h_stanga(sId); });

		$('#hslider div').animate({
			'left' : '-'+dr+'px'
		});
	}
}

var timerHS;
$(function() {

	var max  = $('#hslider div').children().size();
	max = max - 1;
	var nr   = 0;
	var last = 0;

	setTimeout(function(){
		timerHS = setInterval(function(){
			if( ( nr<=(max-1) ) && ( last==0 ) ) {
				nr = nr==0 ? 1 : (nr+1) ;
				h_dreapta(nr);
			} else {
				nr = last==0 ? (nr-1) : (nr-1) ;
				last=1;
				h_stanga(nr);
				if(nr==0)last=0;
			}
		},5000);
	},5000);
	
	$('#hDreapta').unbind('click').click(function(){ h_dreapta(1); });

});

function stopTimerHS() {
	clearInterval(timerHS);
}

// pic slider
function stanga(id) {
	if(!working) {
		working=true;

		st = id * 80;

		dId = id+1;
		sId = id-1;

		//if(dId>=2)$('#dreapta').fadeIn('slow');

		$('#dreapta').unbind('click').click(function(){ dreapta(dId); });

		if(sId<0) $('#stanga').unbind('click');
		else $('#stanga').unbind('click').click(function(){ stanga(sId); });

		$('#slide').animate({
			'left' : '-'+st+'px'
		},function(){
			working=false;
			//$('#seeFull').unbind('click').click(function(){ $('#img_'+id).trigger('click'); });
		});

	}
}

function dreapta(id) {
	if(!working) {
		working=true;

		if(id>0){
			dr = id * 80;

			dId = id+1;
			sId = id-1;

			//if(dId>2)$('#stanga').fadeIn('slow');

			if(dId>max) $('#dreapta').unbind('click');
			else $('#dreapta').unbind('click').click(function(){ dreapta(dId); });

			$('#stanga').unbind('click').click(function(){ stanga(sId); });

			$('#slide').animate({
				'left' : '-'+dr+'px'
			},function(){
				working=false;
				//$('#seeFull').unbind('click').click(function(){ $('#img_'+id).trigger('click'); });
			});
		}

	}
}

function bigImg(button) {

	$('.picsSlider a').hide();
	$('.picsSlider a img[src="'+ $(button).attr('href') +'"]').parent().css('display','block');

}

// ultimele oferte
function up(id) {
	if(!working) {
		working=true;

		uIdO = id+1;
		dIdO = id-1;

		$('#ult_down').unbind('click').click(function(){ down(uIdO); });

		if(dIdO<0) $('#ult_up').unbind('click');
		else $('#ult_up').unbind('click').click(function(){ up(dIdO); });

		$('.ultoferte').animate({
			'top' : ( (id * 633) == 0 ? 1 : '-'+(id * 633) )+'px'
		},function(){
			working=false;
		});

	}
}

function down(id) {
	if(!working) {
		working=true;

		if(id>0){

			uIdO = id+1;
			dIdO = id-1;

			if(uIdO>=ult_max) $('#ult_down').unbind('click');
			else $('#ult_down').unbind('click').click(function(){ down(uIdO); });

			$('#ult_up').unbind('click').click(function(){ up(dIdO); });

			$('.ultoferte').animate({
				'top' : '-'+ ( id * 633 ) +'px'
			},function(){
				working=false;
			});
		}

	}
}

// contact rapid
function contact_rpd() {

	var agent = $("input[name=c_agent]").val();
	var nume = $("input[name=c_nume]").val();
	var tel  = $("input[name=c_tel]").val();
	var mail = $("input[name=c_mail]").val();
	var msg  = $("textarea[name=c_msg]").val();
	
	if(nume.length == 0) $("input[name=c_nume]").addClass('error'); else $("input[name=c_nume]").removeClass('error');
	if(tel.length < 6 || tel.length > 12) $("input[name=c_tel]").addClass('error');  else $("input[name=c_tel]").removeClass('error');
	if(mail.length == 0) $("input[name=c_mail]").addClass('error'); else $("input[name=c_mail]").removeClass('error');
	if(msg.length  == 0) $("textarea[name=c_msg]").addClass('error');  else $("textarea[name=c_msg]").removeClass('error');

	if( nume.length > 0 && tel.length > 0 && mail.length > 0 && msg.length > 0 ) {
		$('#contact_form').addClass('loading');
		$('#contact_form form').fadeOut('slow',function(){

			$.post('ajax.php?a=contact_rpd',
				{
					agent: agent,
					nume: nume,
					tel : tel,
					mail: mail,
					msg : msg,
					link: document.location.href
				},function(data) {
					if(data.length > 0) {
						$('#contact_form').removeClass('loading');
						eval(data);
						$('#contact_form form').fadeIn('slow');
					} else {
						$('#contact_form').removeClass('loading');
						$('#contact_form p').fadeIn('slow');
						setTimeout(function(){

							$("input[name=c_nume]").val('');
							$("input[name=c_tel]").val('');
							$("input[name=c_mail]").val('');
							$("textarea[name=c_msg]").val('');

							$('#contact_form p').fadeOut('slow',function(){
								$('#contact_form form').fadeIn('slow');
							});

						},3000);
					}
				}
			);

		});

	}

}

// contact pentru oferte
function oferte_rpd() {

	var nume = $("input[name=c_nume]").val();
	var tel  = $("input[name=c_tel]").val();
	var mail = $("input[name=c_mail]").val();

	if(nume.length == 0) $("input[name=c_nume]").addClass('error'); else $("input[name=c_nume]").removeClass('error');
	if(tel.length < 6 || tel.length > 12) $("input[name=c_tel]").addClass('error');  else $("input[name=c_tel]").removeClass('error');
	if(mail.length == 0) $("input[name=c_mail]").addClass('error'); else $("input[name=c_mail]").removeClass('error');

	if( nume.length > 0 && tel.length > 0 && mail.length > 0 ) {

		$('.infoCautare').addClass('loading');
		$('.infoCautare form').fadeOut('slow',function(){

			$.post('ajax.php?a=oferte_rpd',
				{
					nume: nume,
					tel : tel,
					mail: mail
				},function(data) {
					if(data.length > 0) {
						$('.infoCautare').removeClass('loading');
						eval(data);
						$('.infoCautare form').fadeIn('slow');
					} else {
						$('.infoCautare').removeClass('loading');
						$('.infoCautare p').fadeIn('slow');
						setTimeout(function(){

							$("input[name=c_nume]").val('');
							$("input[name=c_tel]").val('');
							$("input[name=c_mail]").val('');

							$('.infoCautare p').fadeOut('slow',function(){
								$('.infoCautare form').fadeIn('slow');
							});

						},3000);
					}
				}
			);

		});

	}

}

// menu
function menu(id,btn) {

	$('a.vanz').removeClass('sel');
	$(btn).addClass('sel');

	$('.vanzB').hide();
	$('.vanzB.'+id).show();

}

// newsletter
function newsletter() {

	var mail = $("input[name=newsletter]").val();

	if(mail.length == 0 || mail == 'Adresa email ...') alert('Va rugam introduceti o adresa de e-mail.');
	else {

		$.post('ajax.php?a=newsletter',
			{
				mail : mail
			},function(data) {
				if(data.length > 0) {
					alert(data);
				} else {
					$("input[name=newsletter]").val('Adresa email ...');
					alert('Va multumim pentru abonare !');
				}
			}
		);

	}

}

// format numar
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	num = num.toString().replace(/ /g,'');
	if(isNaN(num))
	num = '0';
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	num = Math.floor(num/100).toString();
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+' '+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') +  num);
}

function pageCountF(page){
	//alert(page);
	var action = $('a.pagg_'+page).attr('href');
	//alert(razvan);
	$('form.filtru').attr("action",action);
	var attrs = $('form.filtru').attr("action");
	//alert(attrs);
	document.filtree.submit();
}

function like(id) {
	$.post('ajax.php?a=like',
		{
			id : id
		},function(data) {
			likeL = generate_likelist(data);
			
			$('.nolikelist').remove();
			if(oferta==true)
				$('#likeShowcase').css('height',((data['count']<=2)?(data['count']*111)+'px':'222px'));
			else
				$('#likeShowcase').css('height',((data['count']<=3)?(data['count']*111)+'px':'333px'));
			$('#like_list').css('top','0px');
			$('#like_list').prepend(likeL);
			$('span.nr_oferte span').html(data['count']+' '+data['oferta-text']);
			if($('#'+id).is('.selected')) {
				$('#'+id).removeClass('selected');
			}
			else $('#'+id).addClass('selected');
			
		},"json");
}

function unlike(id) {
	$.post('ajax.php?a=unlike',
		{
			id : id
		},function(data) {
			$("#id_"+id).remove();
			if(data['count']==0){
				$('#likeShowcase').css('height','189px');
				$('#like_list').html('<span class="nolikelist"></span>');
			}
			else {
				if(oferta==true)
					$('#likeShowcase').css('height',((data['count']<=2)?(data['count']*111)+'px':'222px'));
				else
					$('#likeShowcase').css('height',((data['count']<=3)?(data['count']*111)+'px':'333px'));
			}
			$('span.nr_oferte span').html(data['count']+' '+data['oferta-text']);
			$('#'+id).removeClass('selected');
		},"json");
}

var stop = 1;
function scroll_likelist_up() {
	if(stop==1){
		var test = jQuery('#like_list').children().size();
		if (test % 1 == 0) {var test = test + 1;}
		stop=0;
			//alert(test);
			var top=$('#like_list').css('top');
		  $('#like_list').animate({
		    top: ((top=='0px')?'':'+=111')
		  }, 500, function() {
		    // Animation complete.
		    stop=1;
		  });
	}
}

function scroll_likelist_down(total) {
	if(stop==1){
		var test = $('#like_list').children().size();
		test2=((-111)*(test-total))+'px';
		stop=0;
		var top=$('#like_list').css('top');
		  $('#like_list').animate({
		    top: ((top==test2 || test<=total)?'-=0':'-=111')

		  }, 500, function() {
		    // Animation complete.
		     stop=1;
		  });
	}
}
//oportunitati
function scroll_op_up() {
	if(stop==1){
		var test = jQuery('.ultoferte').children().size();
		if (test % 1 == 0) {var test = test + 1;}
		stop=0;
			//alert(test);
			var top=$('.ultoferte').css('top');
		  $('.ultoferte').animate({
		    top: ((top=='0px')?'':'+=127')
		  }, 500, function() {
		    // Animation complete.
		    stop=1;
		  });
	}
}

function scroll_op_down() {
	if(stop==1){
		var test = $('.ultoferte').children().size();
		test2=((-127)*(test-7))+'px';
		stop=0;
		var top=$('.ultoferte').css('top');
		  $('.ultoferte').animate({
		    top: ((top==test2 || test<=5)?'-=0':'-=127')

		  }, 500, function() {
		    // Animation complete.
		     stop=1;
		  });
	}
}

function detalii_angajat(id){
	$.post('ajax.php?a=detalii-angajat',
		{
		 	id: id
		},
			function(data)
				{
					popUp(data);
				}
	);
	
}
