
App = {
	emptyFunction : function() {},
	pageName : '',

	initialise : function() 
	{
		if (typeof this.initors[this.pageName] == 'function') 
		{
			App.initors[this.pageName]();
		} 
		this.initSideFade();
	},
	
	initSideFade : function()
	{
		$('#rightRotate2').innerFade({
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				containerheight: '140px'
		});
		$('#leftRotate').innerFade({
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				containerheight: '200px'
			});

		$('#rightRotate').innerFade({
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				containerheight: '140px'
		});
		$('#leftRotateDown').innerFade({
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				containerheight: '200px'
		});
		$('#sectionRotate').innerFade({
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				prevLink: '#prevImg',
				nextLink: '#nextImg'
				//containerheight: '180px'
		});
		
	}
};

App.initors = {
	'search_catwalk' : function()
	{
		var url = $("#page_url").val();
		var sezon = '';
		var town = '';
		$(".select_change").change(function (){
			 sezon = $('#select_sezon').val();
			 if(sezon != '')
			{
				town = $('#select_oras').val();
				if(town != '')
				{
					url +="/"+sezon+"-"+town;
					window.location = url;
				}
			}	 
		}); 
 
 		$("#select_catwalk").change(function (){
			 catwalkUrl = $('#select_catwalk').val();
			 if(catwalkUrl != '')
			{
					window.location = catwalkUrl;
			} 
		}); 
	},
	'search_catwalk_beauty' : function()
	{
		var url = $("#page_url").val();
		var town = '';
		$(".select_change").change(function (){
			town = $('#select_oras').val();
			if(town != '')
			{
				url +="/"+town;
				window.location = url;
			}	 
		}); 
 
 		$("#select_catwalk").change(function (){
			 catwalkUrl = $('#select_catwalk').val();
			 if(catwalkUrl != '')
			{
					window.location = catwalkUrl;
			} 
		}); 
	},
	'catwalk' : function()
	{		
		/*****filter search********/
		var url = $("#page_url").val();
		var sezon = '';
		var town = '';
		$(".select_change").change(function (){
			 sezon = $('#select_sezon').val();
			 if(sezon != '')
			{
				town = $('#select_oras').val();
				if(town != '')
				{
					url +="/"+sezon+"-"+town;
					window.location = url;
				}
			}	 
		}); 
 
 		$("#select_catwalk").change(function (){
			 catwalkUrl = $('#select_catwalk').val();
			 if(catwalkUrl != '')
			{
					window.location = catwalkUrl;
			} 
		}); 
		/*************************/

		//galerie
		var count = Number($('#count').html());
		$(".selectImg").click(function (){
			var indx = Number($('#indx').html());
			$('#img_arrow_left').hide();
			$('#img_arrow_right').hide();
			if($(this).attr('id') < count)
			{
				$('#img_arrow_right').show();
			}
			if($(this).attr('id') > 1)
			{
				$('#img_arrow_left').show();
			}

			$('#li_'+indx).hide();
			$('#li_'+$(this).attr('id')).show();
			$('#indx').html($(this).attr('id'));
		});

		$("#img_arrow_right").click(function () { 
			var indx = Number($('#indx').html());
			if(indx < count)
			{
				$('#img_arrow_left').show();
				$('#img_arrow_right').hide();
				var next = indx +1;
				if(next < count)
				{
					$('#img_arrow_right').show();
				}
				$('#li_'+indx).hide();
				$('#li_'+next).show();
				$('#indx').html(next);
			}
		});	
		$("#img_arrow_left").click(function () { 
			var indx = Number($('#indx').html());
			if(indx > 1)
			{
				$('#img_arrow_right').show();
				$('#img_arrow_left').hide();
				var indx = Number($('#indx').html());
				var prev = indx -1;
				if(prev > 1)
				{
					$('#img_arrow_left').show();
				}
				$('#li_'+indx).hide();
				$('#li_'+prev).show();
				$('#indx').html(prev);
			}
		});	
		//zoom
		$('.lightbox').lightBox(); 
		$("#zoom").click(function () { 
			$('#img_'+$('#indx').html()).lightBox().click(); 
		});	

		$("input[name='galeryFirst']").val('0');

		$("#next-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			var totalShow = galeryFirst + 6;
			if(totalShow < galeryCount)
			{
				var next = Number(galeryFirst+1);
				$('#galery-item-'+next).hide();	
				$("input[name='galeryFirst']").val(next);
				$('#prev-arrow').show();
				if((next+6) == galeryCount)
				{
					$('#next-arrow').hide();
				}
			}
			else
			{
				$('#next-arrow').hide();
			}
		});

		$("#prev-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			if(galeryFirst >= 1)
			{
				$('#galery-item-'+galeryFirst).show();	
				var prev = Number(galeryFirst-1);
				$("input[name='galeryFirst']").val(prev);
				$('#next-arrow').show();
				if (prev == 0)
				{
					$('#prev-arrow').hide();
				}
			}
		});
	},
	'beauty_catwalk' : function()
	{		
		/*****filter search********/
		var url = $("#page_url").val();
		var sezon = '';
		var town = '';
		$(".select_change").change(function (){
			 sezon = $('#select_sezon').val();
			 if(sezon != '')
			{
				town = $('#select_oras').val();
				if(town != '')
				{
					url +="/"+sezon+"-"+town;
					window.location = url;
				}
			}	 
		}); 
 
 		$("#select_catwalk").change(function (){
			 catwalkUrl = $('#select_catwalk').val();
			 if(catwalkUrl != '')
			{
					window.location = catwalkUrl;
			} 
		}); 
		/*************************/

		//galerie
		var count = Number($('#count').html());
		$(".selectImg").click(function (){
			var indx = Number($('#indx').html());
			$('#img_arrow_left').hide();
			$('#img_arrow_right').hide();
			if($(this).attr('id') < count)
			{
				$('#img_arrow_right').show();
			}
			if($(this).attr('id') > 1)
			{
				$('#img_arrow_left').show();
			}

			$('#li_'+indx).hide();
			$('#li_'+$(this).attr('id')).show();
			$('#text_'+indx).hide();
			$('#text_'+$(this).attr('id')).show();
			$('#indx').html($(this).attr('id'));
		});

		$("#img_arrow_right").click(function () { 
			var indx = Number($('#indx').html());
			if(indx < count)
			{
				$('#img_arrow_left').show();
				$('#img_arrow_right').hide();
				var next = indx +1;
				if(next < count)
				{
					$('#img_arrow_right').show();
				}
				$('#li_'+indx).hide();
				$('#li_'+next).show();
				$('#indx').html(next);
			}
		});	
		$("#img_arrow_left").click(function () { 
			var indx = Number($('#indx').html());
			if(indx > 1)
			{
				$('#img_arrow_right').show();
				$('#img_arrow_left').hide();
				var indx = Number($('#indx').html());
				var prev = indx -1;
				if(prev > 1)
				{
					$('#img_arrow_left').show();
				}
				$('#li_'+indx).hide();
				$('#li_'+prev).show();
				$('#indx').html(prev);
			}
		});	
		//zoom
		$('.lightbox').lightBox(); 
		$("#zoom").click(function () { 
			$('#img_'+$('#indx').html()).lightBox().click(); 
		});	

		$("input[name='galeryFirst']").val('0');

		$("#next-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			var totalShow = galeryFirst + 6;
			if(totalShow < galeryCount)
			{
				var next = Number(galeryFirst+1);
				$('#galery-item-'+next).hide();	
				$("input[name='galeryFirst']").val(next);
				$('#prev-arrow').show();
				if((next+6) == galeryCount)
				{
					$('#next-arrow').hide();
				}
			}
			else
			{
				$('#next-arrow').hide();
			}
		});

		$("#prev-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			if(galeryFirst >= 1)
			{
				$('#galery-item-'+galeryFirst).show();	
				var prev = Number(galeryFirst-1);
				$("input[name='galeryFirst']").val(prev);
				$('#next-arrow').show();
				if (prev == 0)
				{
					$('#prev-arrow').hide();
				}
			}
		});
	},
	'editorial' : function()
	{		
		//$('#comments').nextComments();	
		//galerie
		$(".selectImg").click(function (){
			var indx = Number($('#indx').html());

			$('#img_arrow_left').hide();
			$('#img_arrow_right').hide();
			if($(this).attr('id') < count)
			{
				$('#img_arrow_right').show();
			}
			if($(this).attr('id') > 1)
			{
				$('#img_arrow_left').show();
			}

			$('#li_'+indx).hide();
			$('#li_'+$(this).attr('id')).show();
			$('#text_'+indx).hide();
			$('#text_'+$(this).attr('id')).show();
			$('#indx').html($(this).attr('id'));
		});

		var count = Number($('#count').html());
		$("#img_arrow_right").click(function () { 
			var indx = Number($('#indx').html());
			if(indx < count)
			{
				$('#img_arrow_left').show();
				$('#img_arrow_right').hide();
				var next = indx +1;
				if(next < count)
				{
					$('#img_arrow_right').show();
				}

				$('#li_'+indx).hide();
				$('#li_'+next).show();
				$('#text_'+indx).hide();
				$('#text_'+next).show();
				$('#indx').html(next);
			}
		});	
		$("#img_arrow_left").click(function () { 
			var indx = Number($('#indx').html());
			if(indx > 1)
			{
				var indx = Number($('#indx').html());
				var prev = indx -1;
				$('#img_arrow_right').show();
				$('#img_arrow_left').hide();
				if(prev > 1)
				{
					$('#img_arrow_left').show();
				}

				$('#li_'+indx).hide();
				$('#li_'+prev).show();
				$('#text_'+indx).hide();
				$('#text_'+prev).show();
				$('#indx').html(prev);
			}
		});	
		//zoom
		$('.lightbox').lightBox(); 
		$("#zoom").click(function () { 
			$('#img_'+$('#indx').html()).lightBox().click(); 
		});	

		$("input[name='galeryFirst']").val('0');

		$("#next-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			var totalShow = galeryFirst + 6;
			if(totalShow < galeryCount)
			{
				var next = Number(galeryFirst+1);
				$('#galery-item-'+next).hide();				
				$("input[name='galeryFirst']").val(next);
				$('#prev-arrow').show();
				if((next+6) == galeryCount)
				{
					$('#next-arrow').hide();
				}
			}
			else
			{
				$('#next-arrow').hide();
			}
		});

		$("#prev-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			if(galeryFirst >= 1)
			{
				$('#galery-item-'+galeryFirst).show();	
				var prev = Number(galeryFirst-1);
				$("input[name='galeryFirst']").val(prev);
				$('#next-arrow').show();
				if (prev == 0)
				{
					$('#prev-arrow').hide();
				}
			}
		});
	},
	'first_trend' : function()
	{		
		//$('#comments').nextComments();
		$(".big_image").hide();
		$(".text_image_top").hide();
		$("#image_top_0").show();
		$("#text_image_top_0").show();
		$(".small_image_vedeta").click(function (){
			$(".big_image").hide();
			$(".text_image_top").hide();
			$("#image_top_"+$(this).attr('id')).show();
			$("#text_image_top_"+$(this).attr('id')).show();
		});

		$('.lightbox').lightBox();
	},
	'test_vdete' : function()
	{	
		App.currentQuestion = 0;
		App.points = 0;
		App.countQuestions = Number($('.quest').html());
		

		$("#questions").hide();
		$(".question").hide();
		$(".answer").hide();
		$(".validate").hide();
		$(".next").hide();
		$(".last").hide();
		$(".final_answer").hide();
		$(".restart").hide();

		$("#start").click(function (){
			App.currentQuestion = 1;
			$("#intro").hide();
			$("#questions").show();
			$("#question_"+App.currentQuestion).show();
			$(".validate").show();
		});
		$(".next").click(function (){
			$("#answer_"+App.currentQuestion).hide();
			App.currentQuestion++;
			$(".question").hide();
			$("#question_"+App.currentQuestion).show();
			$(".validate").show();
			$(".next").hide();
		});
		$(".validate").click(function (){
			str = $("input[name='answer_"+App.currentQuestion+"']:checked").val(); 
			if(str)
			{
				$("#question_"+App.currentQuestion).hide();
				$("#answer_"+App.currentQuestion).show();	
				arr = str.split("-");
				if(arr[0] == "no") strRes = "Raspuns gresit!";
				if(arr[0] == "yes") strRes = "Raspuns corect!";
				
				App.points += Number(arr[1]);

				$('p.special',"#answer_"+App.currentQuestion).html(strRes);
				$(".validate").hide();
				if(App.currentQuestion == App.countQuestions)
				{
					$(".last").show();
				}
				else
				{
					$(".next").show();
				}
			}
			else
			{
				alert("Nu ati raspuns la intrebare!");
			}
		});
		$(".last").click(function (){
			var maxPoints = Number($('#maxPoints').html());
			var countRes = Number($('#countRes').html());
			var i=1;
			var interval = '';
			while(i<=countRes)
			{
				min = Number($('span.min',"#final_answer_"+i).html());
				max = Number($('span.max',"#final_answer_"+i).html());
				if(App.points >= min && App.points <= max)
				{
					interval = min +"-"+ max;
				}
				i++;
			}
			$("#answer_"+App.currentQuestion).hide();
			$('p.special',".final_answer").html("Scor: "+App.points+"/"+maxPoints);
			$("#"+interval).show();
			$(".last").hide();
			$(".block").hide();
			$(".restart").show();
		});
	},
	'horoscop_saptamanal' : function()
	{		
		//$('#comments').nextComments();	
		$("#ok_zodie").click(function (){
			var url =$('#zodii').val();
			window.location = url;
		});
		
		$('#ok_perioada').click(function(){
			var zi = $('#zi option:selected').text(); 
			var luna = $('#luna').val();
			var  luna_zi = luna+zi;
			var  zodie = '';

			if(luna_zi >= 321 && luna_zi <= 420) { zodie = 'berbec'; }
			if(luna_zi >= 421 && luna_zi <= 520) { zodie = 'taur'; }
			if(luna_zi >= 521 && luna_zi <= 621) { zodie = 'gemeni'; }
			if(luna_zi >= 622 && luna_zi <= 722) { zodie = 'rac';}
			if(luna_zi >= 723 && luna_zi <= 822) { zodie = 'leu';}
			if(luna_zi >= 823 && luna_zi <= 922) { zodie = 'fecioara';}
			if(luna_zi >= 923 && luna_zi <= 1022) { zodie = 'balanta';}
			if(luna_zi >= 1023 && luna_zi <= 1121) { zodie = 'scorpion';}
			if(luna_zi >= 1122 && luna_zi <= 1221) { zodie = 'sagetator';}
			if((luna_zi >= 1222 && luna_zi <= 1231) || (luna_zi <= 120 && luna_zi >= 101)) { zodie = 'capricorn';}
			if(luna_zi >= 122 && luna_zi <= 219) { zodie = 'varsator';}
			if(luna_zi >= 220 && luna_zi <= 320) { zodie = 'pesti';}
			
			if(zodie != '')
			{
				url = $("#zodii option[text="+zodie+"]").val();
				window.location = url;
			}
		});

	},
	'zodiac_european' : function()
	{				
		$("#ok_zodiac").click(function (){
			var url =$('#zodii').val();
			window.location = url;
		});
		

	},
	'categorie_astro' : function()
	{			
		$("#show_chinezesc").click(function (){
			var url =$('#select_chinezesc').val();
			if(url=='0'){ alert ("Alegeti zodia"); }
			else{ window.location = url; }
		});
		$("#show_european").click(function (){
			var url =$('#select_european').val();
			if(url=='0'){ alert ("Alegeti zodia"); }
			else{ window.location = url; }
		});
		$("#ok_viitor").click(function (){
			var url =$('#zodii_viitor').val();
			if(url=='0'){ alert ("Alegeti zodia"); }
			else{ window.location = url; }
		});
		
		$('#ok_perioada_viitor').click(function(){
			var zi = $('#ziua option:selected').text(); 
			var luna = $('#luna').val();
			var  luna_zi = luna+zi;
			var  zodie = '';

			if(luna_zi >= 321 && luna_zi <= 420) { zodie = 'berbec'; }
			if(luna_zi >= 421 && luna_zi <= 520) { zodie = 'taur'; }
			if(luna_zi >= 521 && luna_zi <= 621) { zodie = 'gemeni'; }
			if(luna_zi >= 622 && luna_zi <= 722) { zodie = 'rac';}
			if(luna_zi >= 723 && luna_zi <= 822) { zodie = 'leu';}
			if(luna_zi >= 823 && luna_zi <= 922) { zodie = 'fecioara';}
			if(luna_zi >= 923 && luna_zi <= 1022) { zodie = 'balanta';}
			if(luna_zi >= 1023 && luna_zi <= 1121) { zodie = 'scorpion';}
			if(luna_zi >= 1122 && luna_zi <= 1221) { zodie = 'sagetator';}
			if((luna_zi >= 1222 && luna_zi <= 1231) || (luna_zi <= 120 && luna_zi >= 101)) { zodie = 'capricorn';}
			if(luna_zi >= 122 && luna_zi <= 219) { zodie = 'varsator';}
			if(luna_zi >= 220 && luna_zi <= 320) { zodie = 'pesti';}
			
			if(zodie != '')
			{
				url = $("#zodii_viitor option[text="+zodie+"]").val();
				window.location = url;
			}
		});
		
		var calculateDestinyNr = function(x)
		{
			if (x < 10)
			{
				return x;
			}
			var intermediateNr = 0;
			x = x.toString();	

			for (i = 0; i < x.length ; i++)
			{			
				 intermediateNr += parseInt(x.charAt(i));
			}	

			while (intermediateNr > 9)
			{
				intermediateNr = calculateDestinyNr(intermediateNr);
			}

			return intermediateNr;
		
		}
			
		$('#ok_numere').click(function(){
			var zi = $('#ziua_numar option:selected').text(); 
			var luna = $('#luna_numar').val();
			var anul = $('#an_numar').val();
			var an_luna_zi=anul+luna+zi; 
			var an_luna_zi_final=calculateDestinyNr(an_luna_zi);
				numar = an_luna_zi_final;							
			if(numar != '')
			{
				url = $("input[name="+numar+"]").val();
				if(typeof(url) == "undefined")
				{
					alert("Nu exista articol pentru numarul "+numar);
				}
				else
				{
					window.location = url;
				}						
			}
		});
	},
	'astro_mix' : function()
	{			
		$("#ok_compatibilitate").click(function (){
			var zodie_femeie = $('#select_tu').val();
			var zodie_barbat = $('#select_el').val();
			var url = $("."+zodie_femeie+" #"+zodie_barbat).val();
			if(typeof(url) == "undefined")
			{
				alert("Nu exista articol pentru "+zodie_femeie+" si "+zodie_barbat);
			}
			else
			{
				window.location = url;
			}
		});
		
		var calculateDestinyNr = function(x)
		{
			if (x < 10)
			{
				return x;
			}
			var intermediateNr = 0;
			x = x.toString();	

			for (i = 0; i < x.length ; i++)
			{			
				 intermediateNr += parseInt(x.charAt(i));
			}	

			while (intermediateNr > 9)
			{
				intermediateNr = calculateDestinyNr(intermediateNr);
			}

			return intermediateNr;
		
		}
			
		$('#ok_numere').click(function(){
			var zi = $('#ziua_numar option:selected').text(); 
			var luna = $('#luna_numar').val();
			var anul = $('#an_numar').val();
			var an_luna_zi=anul+luna+zi; 
			var an_luna_zi_final=calculateDestinyNr(an_luna_zi);
				numar = an_luna_zi_final;							
			if(numar != '')
			{
				url = $("input[name="+numar+"]").val();
				if(typeof(url) == "undefined")
				{
					alert("Nu exista articol pentru numarul "+numar);
				}
				else
				{
					window.location = url;
				}				
				
			}
		});
		
		$("#ok_profil").click(function (){
			var sex = $('#select_sex').val();
			var zodie = $('#select_zodie').val();
			var url = $("."+sex+" #"+zodie).val();
			if(typeof(url) == "undefined")
			{
				alert("Nu exista articol pentru "+sex+" si "+zodie);
			}
			else
			{
				window.location = url;
			}
		});
	},
	'compatibilitate': function()
	{			
		$("#ok_compatibilitate").click(function (){
			var zodie_femeie = $('#select_tu').val();
			var zodie_barbat = $('#select_el').val();
			var url = $("."+zodie_femeie+" #"+zodie_barbat).val();
			if(typeof(url) == "undefined")
			{
				alert("Nu exista articol pentru "+zodie_femeie+" si "+zodie_barbat);
			}
			else
			{
				window.location = url;
			}
		});
	},
	'profil_sexual': function()
	{			
		$("#ok_profil").click(function (){
			var sex = $('#select_sex').val();
			var zodie = $('#select_zodia').val();
			var url = $("."+sex+" #"+zodie).val();
			if(typeof(url) == "undefined")
			{
				alert("Nu exista articol pentru "+sex+" si "+zodie);
			}
			else
			{
				window.location = url;
			}
		});
	},
	'zodiac_chinezesc' : function()
	{			
		$("#show_chinezesc").click(function (){
			var url =$('#select_chinezesc').val();
			window.location = url;
		});

		$('#show_by_date').click(function(){
			var zi = $('#zi option:selected').text(); 
			var luna = $('#luna').val();
			var anul = $('#anul').val();
			var  an_luna_zi = anul+luna+zi;
			var  zodie = '';
			var element = '';
		
			if(an_luna_zi >= 19500217 && an_luna_zi <= 19510502) {zodie = 'Tigru'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 19510206 && an_luna_zi <= 19520126) {zodie = 'Iepure'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 19520127 && an_luna_zi <= 19530213) {zodie = 'Dragon'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 19530214 && an_luna_zi <= 19540202) {zodie = 'Sarpe'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 19540203 && an_luna_zi <= 19550123) {zodie = 'Cal'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 19550124 && an_luna_zi <= 19560211) {zodie = 'Capra'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 19560212 && an_luna_zi <= 19570130) {zodie = 'Maimuta'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 19570131 && an_luna_zi <= 19580217) {zodie = 'Cocos'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 19580218 && an_luna_zi <= 19590207) {zodie = 'Caine'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 19590208 && an_luna_zi <= 19600127) {zodie = 'Porc mistret'; element = 'Pamant, Yin';}	
			if(an_luna_zi >= 19600128 && an_luna_zi <= 19610214) {zodie = 'Sobolan'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 19610215 && an_luna_zi <= 19620204) {zodie = 'Bou'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 19620205 && an_luna_zi <= 19630124) {zodie = 'Tigru'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 19630125 && an_luna_zi <= 19640212) {zodie = 'Iepure'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 19640213 && an_luna_zi <= 19650201) {zodie = 'Dragon'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 19650202 && an_luna_zi <= 19660120) {zodie = 'Sarpe'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 19660121 && an_luna_zi <= 19670208) {zodie = 'Cal'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 19670209 && an_luna_zi <= 19680129) {zodie = 'Capra'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 19680130 && an_luna_zi <= 19690216) {zodie = 'Maimuta'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 19690217 && an_luna_zi <= 19700205) {zodie = 'Cocos'; element = 'Pamant, Yin';}	
			if(an_luna_zi >= 19700206 && an_luna_zi <= 19710126) {zodie = 'Caine'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 19710127 && an_luna_zi <= 19720214) {zodie = 'Porc mistret'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 19720215 && an_luna_zi <= 19730202) {zodie = 'Sobolan'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 19730203 && an_luna_zi <= 19740122) {zodie = 'Bou'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 19740123 && an_luna_zi <= 19750210) {zodie = 'Tigru'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 19750211 && an_luna_zi <= 19760130) {zodie = 'Iepure'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 19760131 && an_luna_zi <= 19770217) {zodie = 'Dragon'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 19770218 && an_luna_zi <= 19780206) {zodie = 'Sarpe'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 19780207 && an_luna_zi <= 19790127) {zodie = 'Cal'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 19790128 && an_luna_zi <= 19800215) {zodie = 'Capra'; element = 'Pamant, Yin';}	
			if(an_luna_zi >= 19800216 && an_luna_zi <= 19810204) {zodie = 'Maimuta'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 19810205 && an_luna_zi <= 19820124) {zodie = 'Cocos'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 19820125 && an_luna_zi <= 19830212) {zodie = 'Caine'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 19830213 && an_luna_zi <= 19840201) {zodie = 'Porc mistret'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 19840202 && an_luna_zi <= 19850219) {zodie = 'Sobolan'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 19850220 && an_luna_zi <= 19860208) {zodie = 'Bou'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 19860209 && an_luna_zi <= 19870128) {zodie = 'Tigru'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 19870129 && an_luna_zi <= 19880216) {zodie = 'Iepure'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 19880217 && an_luna_zi <= 19890205) {zodie = 'Dragon'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 19890206 && an_luna_zi <= 19900126) {zodie = 'Sarpe'; element = 'Pamant, Yin';}	
			if(an_luna_zi >= 19900127 && an_luna_zi <= 19910214) {zodie = 'Cal'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 19910215 && an_luna_zi <= 19920203) {zodie = 'Capra'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 19920204 && an_luna_zi <= 19930122) {zodie = 'Maimuta'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 19930123 && an_luna_zi <= 19940209) {zodie = 'Cocos'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 19940210 && an_luna_zi <= 19950130) {zodie = 'Caine'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 19950131 && an_luna_zi <= 19960218) {zodie = 'Porc mistret'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 19960219 && an_luna_zi <= 19970206) {zodie = 'Sobolan'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 19970207 && an_luna_zi <= 19980127) {zodie = 'Bou'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 19980128 && an_luna_zi <= 19990215) {zodie = 'Tigru'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 19990216 && an_luna_zi <= 20000204) {zodie = 'Iepure'; element = 'Pamant, Yin';}	
			if(an_luna_zi >= 20000205 && an_luna_zi <= 20010123) {zodie = 'Dragon'; element = 'Metal, Yang';}	
			if(an_luna_zi >= 20010124 && an_luna_zi <= 20020211) {zodie = 'Sarpe'; element = 'Metal, Yin';}	
			if(an_luna_zi >= 20020212 && an_luna_zi <= 20030131) {zodie = 'Cal'; element = 'Apa, Yang';}	
			if(an_luna_zi >= 20030201 && an_luna_zi <= 20040121) {zodie = 'Capra'; element = 'Apa, Yin';}	
			if(an_luna_zi >= 20040122 && an_luna_zi <= 20050208) {zodie = 'Maimuta'; element = 'Lemn, Yang';}	
			if(an_luna_zi >= 20050209 && an_luna_zi <= 20060128) {zodie = 'Cocos'; element = 'Lemn, Yin';}	
			if(an_luna_zi >= 20060129 && an_luna_zi <= 20070217) {zodie = 'Caine'; element = 'Foc, Yang';}	
			if(an_luna_zi >= 20070218 && an_luna_zi <= 20080206) {zodie = 'Porc mistret'; element = 'Foc, Yin';}	
			if(an_luna_zi >= 20080207 && an_luna_zi <= 20090125) {zodie = 'Sobolan'; element = 'Pamant, Yang';}	
			if(an_luna_zi >= 20090126 && an_luna_zi <= 20100213) {zodie = 'Bou'; element = 'Pamant, Yin';}
		
			if(zodie != '')
			{
				url = $("#select_chinezesc option[text="+zodie+"]").val();
				window.location = url+"?element="+element;
			}
		});
		$('#ok_zodiac_euro').click(function(){
			var zi = $('#ziua option:selected').text(); 
			var luna = $('#luna_euro').val();
			var  luna_zi = luna+zi;
			var  name = '';

			if(luna_zi >= 321 && luna_zi <= 420) { name = 'berbec'; }
			if(luna_zi >= 421 && luna_zi <= 520) { name = 'taur'; }
			if(luna_zi >= 521 && luna_zi <= 621) { name = 'gemeni'; }
			if(luna_zi >= 622 && luna_zi <= 722) { name = 'rac';}
			if(luna_zi >= 723 && luna_zi <= 822) { name = 'leu';}
			if(luna_zi >= 823 && luna_zi <= 922) { name = 'fecioara';}
			if(luna_zi >= 923 && luna_zi <= 1022) { name = 'balanta';}
			if(luna_zi >= 1023 && luna_zi <= 1121) { name = 'scorpion';}
			if(luna_zi >= 1122 && luna_zi <= 1221) { name = 'sagetator';}
			if((luna_zi >= 1222 && luna_zi <= 1231) || (luna_zi <= 120 && luna_zi >= 101)) { name = 'capricorn';}
			if(luna_zi >= 122 && luna_zi <= 219) { name = 'varsator';}
			if(luna_zi >= 220 && luna_zi <= 320) { name = 'pesti';}			
			if(name != '')
			{
				url = $("input[name="+name+"]").val();
				window.location = url;
			}
		});
	},
	'deco_shopping' : function()
	{		
		//galerie
		$(".selectImg").click(function (){
			var indx = Number($('#indx').html());

			$('#img_arrow_left').hide();
			$('#img_arrow_right').hide();
			if($(this).attr('id') < count)
			{
				$('#img_arrow_right').show();
			}
			if($(this).attr('id') > 1)
			{
				$('#img_arrow_left').show();
			}

			$('#li_'+indx).hide();
			$('#li_'+$(this).attr('id')).show();
			$('#text_'+indx).hide();
			$('#text_'+$(this).attr('id')).show();
			$('#indx').html($(this).attr('id'));
		});

		var count = Number($('#count').html());
		$("#img_arrow_right").click(function () { 
			var indx = Number($('#indx').html());
			if(indx < count)
			{
				$('#img_arrow_left').show();
				$('#img_arrow_right').hide();
				var next = indx +1;
				if(next < count)
				{
					$('#img_arrow_right').show();
				}
				$('#li_'+indx).hide();
				$('#text_'+indx).hide();
				$('#li_'+next).show();
				$('#text_'+next).show();
				$('#indx').html(next);
				
			}
		});	
		$("#img_arrow_left").click(function () { 
			var indx = Number($('#indx').html());
			if(indx > 1)
			{
				$('#img_arrow_right').show();
				$('#img_arrow_left').hide();
				var indx = Number($('#indx').html());
				var prev = indx -1;
				if(prev > 1)
				{
					$('#img_arrow_left').show();
				}
				$('#li_'+indx).hide();
				$('#li_'+prev).show();
				$('#text_'+indx).hide();
				$('#text_'+prev).show();
				$('#indx').html(prev);
			}
		});	
		//zoom
		$('.lightbox').lightBox(); 
		$("#zoom").click(function () { 
			$('#img_'+$('#indx').html()).lightBox().click(); 
		});	

		$("input[name='galeryFirst']").val('0');

		$("#next-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			var totalShow = galeryFirst + 6;
			if(totalShow < galeryCount)
			{
				var next = Number(galeryFirst+1);
				$('#galery-item-'+next).hide();				
				$("input[name='galeryFirst']").val(next);
				$('#prev-arrow').show();
				if((next+6) == galeryCount)
				{
					$('#next-arrow').hide();
				}
			}
			else
			{
				$('#next-arrow').hide();
			}
		});

		$("#prev-arrow").click(function () { 
			var galeryCount =  Number($("input[name='galeryCount']").val());
			var galeryFirst =  Number($("input[name='galeryFirst']").val());
			if(galeryFirst >= 1)
			{
				$('#galery-item-'+galeryFirst).show();	
				var prev = Number(galeryFirst-1);
				$("input[name='galeryFirst']").val(prev);
				$('#next-arrow').show();
				if (prev == 0)
				{
					$('#prev-arrow').hide();
				}
			}
		});
	},
	'deco_dosar_poze' : function()
	{		
		$('.img').hide();
		$('.image_text').hide();
		$('#img_1').show();
		$('#image_text_1').show();
		$(".small_pic").click(function (){
			$('.img').hide();
			$('.image_text').hide();
			var current = $(this).attr('id');
			$('#img_'+current).show();
			$('#image_text_'+current).show();
		});

		$('.lightbox').lightBox(); 
	},
	'home_carusel' : function()
	{
		/*
		var currentCoverStory = 0;
		var total_cover_story =  Number($("input[name='count']").val());
		var timeoutId = 1;
		var time = 3000;

		var change_article = function(total_cover_story)
		{
			console.log("in change"+timeoutId);
			
			nextCoverStory = (currentCoverStory + 1) > total_cover_story ? 1 : (currentCoverStory + 1);
			select_cover_story(nextCoverStory, total_cover_story);
//			clearTimeout(timeoutId);
//			console.log("timeout: "+timeoutId+ " time: "+time);
//			timeoutId = setTimeout(change_article(total_cover_story ), time);
		}

		var select_cover_story = function(current_cover_story, total_cover_story)
		{
			for (var i = 0; i < total_cover_story; i++)
			{
				$('#main_' + i).hide();
				console.log('hide #main_' + i);
			}
			$('#main_' + current_cover_story).show();
			currentCoverStory = current_cover_story;
			
			if (total_cover_story > 1)
			{
				window.clearTimeout(timeoutId);
				timeoutId = window.setTimeout('change_article(' + total_cover_story + ')', time);
			}
			
		}
		
		change_article(total_cover_story);
		*/

		var total_cover_story =  Number($("input[name='count']").val());
		change_article(total_cover_story);

		$("input[name='lastModif']").val('0');

		$(".next").click(function () { 
			var galeryCount =  Number($("input[name='count']").val());
			var galeryFirst =  Number($("input[name='lastModif']").val());
			var totalShow = galeryFirst + 5;
			if(totalShow < galeryCount)
			{
				var next = Number(galeryFirst+1);
				$('#galery-item-'+galeryFirst).hide();				
				$("input[name='lastModif']").val(next);
			}
		});

		$(".prev").click(function () { 
			var galeryCount =  Number($("input[name='count']").val());
			var galeryFirst =  Number($("input[name='lastModif']").val()-1);
			if(galeryFirst >= 0)
			{
				$('#galery-item-'+galeryFirst).show();	
				$("input[name='lastModif']").val(galeryFirst);
			}
		});
	},
	'subsectiune_deco_shopping' : function()
	{		
		$("#search").click(function (){
			var url =$('#search_deco_shopping').val();
			window.location = url;
		});
	}
};

jQuery(document).ready(function() {	
	App.initialise();	
});