$(function(){
	//verificari si ajustari de inaltime pentru anumite pagini unde
	//backgroundul risca sa intre sub continut......................................
	var high = $(window).height();
	if (high<946){high = 946;}
	$('.ouale, #continut .content-wrap, #continut .content, #toate-ouale .middle-wrap').css('height', high +'px');
	$(window).resize(function(){
		var high = $(window).height();
		if (high<946){high = 946;}
		$('.ouale, #continut .content-wrap, #toate-ouale .middle-wrap').css('height', high +'px');
	});
	var high = $(window).height();
	if (high<830){high = 830;}
	$('#home .content, #home .content-wrap,.inregistrares .content-wrap, .inregistrares .content').css('height', high +'px');
	$(window).resize(function(){
		var high = $(window).height();
		if (high<830){high = 830;}
		$('#home .content, #home .content-wrap,.inregistrares .content-wrap, .inregistrares .content').css('height', high +'px');
	});
	var high = $(window).height();
	if (high<1030){high = 1030;}
	$('.inregistrares .content-wrap, .inregistrares .content').css('height', high +'px');
	$(window).resize(function(){
		var high = $(window).height();
		if (high<1030){high = 1030;}
		$('.inregistrares .content-wrap, .inregistrares .content').css('height', high +'px');
	});
	var high = $(window).height();
	if (high<620){high = 620;}
	$('.prima-pagina .content, .prima-pagina .content-wrap').css('height', high +'px');
	$(window).resize(function(){
		var high = $(window).height();
		if (high<620){high = 620}
		$('.prima-pagina .content, .prima-pagina .content-wrap').css('height', high +'px');
	});

	var taburi = $('.middle').children().size() * 1322 + 216;
	$('.middle').css('width', taburi +'px')

	//slide pagina toate ouale...........................................
	$('.nav a.right').click(function(){
		var sePoate = $('.nav a.right').attr('id');
		$('.nav a.left').removeAttr('id','no-left');
		if (sePoate != 'no-right') {
			var x = $('.nav a.right').attr('rel');
			x = parseInt(x);
			var x = x + 1;
			var maxim = $('#toate-ouale .middle').children().size();
			if (x == maxim) {
				$('.nav a.right').attr('id', 'no-right');
			}
			$('.nav a.left').attr('rel', x)
			var slideelement = $('#toate-ouale .middle #tab' + x);
			$('.nav a.right').attr('rel', x)
			$(window).scrollTo(slideelement, 1500, {
				axis: 'x'
			});
		}
		return false;
	});
	$('.nav a.left').click(function(){
		var sePoate = $('.nav a.left').attr('id');
		$('.nav a.right').removeAttr('id','no-right');
		if (sePoate != 'no-left') {
			var x = $('.nav a.left').attr('rel');
			x = parseInt(x);
			var x = x - 1;
			if (x == 1) {
				$('.nav a.left').attr('id', 'no-left');
			}
			$('.nav a.right').attr('rel', x)
			var slideelement = $('#toate-ouale .middle #tab' + x);
			$('.nav a.left').attr('rel', x)
			$(window).scrollTo(slideelement, 1500, {
				axis: 'x'
			});
		}
		return false;
	});

	//alege oul inregistrare......................................................
	$('.alege-culoarea ul li a').hover(function (){
		$(this).parent().addClass('hovered');
	}, function(){
		$(this).parent().removeClass('hovered');
	});

	$('.alege-culoarea ul li a').click(function(){
		var parinte =$(this).parent();
		var bunic = $(parinte).parent();
		$('.nume-culoare', bunic).hide();
		$('.nume-culoare', parinte).show();
		var valoare=$(this).attr("class");
		$("#culoare1").val(valoare);
		return false;
	});

	//slide pe pagina oului.................................................................
//	$('.ou-gata a.stanga').click(function(){
//		$('.ou-gata a.dreapta').removeAttr('id','no-right');
//		$('.ou-gata a.dreapta').show();
//		var sePoate = $(this).attr('id');
//		if (sePoate != 'no-left') {
//			var x = $(this).attr('rel');
//			x = parseInt(x);
//			var x = x - 1;
//
//
//			if(x<1) x=x+1;
//			if (x == 1){
//				$(this).attr('id','no-left');
//				$(this).hide();
//			}
//
//
//			$(this).attr('rel', x);
//			$('a.dreapta').attr('rel',x);
//
//			$(".ou-gata #tab"+x).show();
//
//			var slideelement = $('.ou-gata #tab' + x);
//
//			$('.ou-gata .mask').scrollTo(slideelement, 500, {axis: 'x'});
//
//		}
//		return false;
//	})
	$('.ou-gata a.stanga').hover(function(){
		$(this).css('cursor','pointer');
	}, function(){
		$(this).removeAttr('style');
	});

//	$('.ou-gata a.dreapta').click(function(){
//		var sePoate = $(this).attr('id');
//		$('.ou-gata a.stanga').removeAttr('id','no-left');
//		$('.ou-gata a.stanga').show();
//		if (sePoate != 'no-right') {
//			var x = $(this).attr('rel');
//			x = parseInt(x);
//			var x = x + 1;
//
//			var maxim = $('.ou-gata ul').children().size();
//			if(x>maxim) x=x-1;
//			if (x == maxim){
//				$(this).attr('id','no-right');
//				$(this).hide();
//			}
//			$('a.stanga').attr('rel',x);
//			$(this).attr('rel', x);
//
//			$(".ou-gata #tab"+x).show();
//			var slideelement = $('.ou-gata #tab' + x);
//
//			$('.ou-gata .mask').scrollTo(slideelement, 500, {axis: 'x'});
//		}
//		return false;
//
//	});
	$('.ou-gata a.dreapta').hover(function(){
		$(this).css('cursor','pointer');
	}, function(){
		$(this).removeAttr('style');
	});

	//select text in textarea la click in modal.........................................
	$('.modal textarea').click(function(){
		$(this).select();
	});

	//character count pe pagina cu toate ouale............................................

	var lenth = $('.ou-gata .egg-wrap h2 a').html();



});
function prin_twitter(){
	var text=$("#text").val();
	var culoare=$("#culoare1").val();
	$("span","#culoarea").remove();
	$("span","#textul").remove();
	$.post('index/twitter',{text:text,culoare:culoare},function(data){
		eval(data);
	});

	return false;


}

