$(document).ready(function() {

	var gallery = $('#gallery');
	var slider = $('#slideshow');
	var returnBack = $('#return');
	var responce = $('#responce');
	var details = $('#details');

	gallery.show();
    slider.hide();
    returnBack.hide();	
	slider.css("overflow", "hidden");
	
	setTimeout(function() {
	$("#bird").show();
	},3000);
		$('#bird')
			.sprite({fps: 12, no_of_frames: 1})
			.spRandom({
				top: 250,
				left: 450,
				right: 250,
				bottom: 150,
				speed: 4500,
				pause: 4000
			});
		setTimeout(function() {
	$("#bird").show();
	},6000);
	    $('#clouds').pan({fps: 30, speed: 1, dir: 'left'}); 
					
				

					
						
							$('#sm1').click(function (){ 
							  	 var id = 1;
								 // alert("To Id mou einai:" +theID);
								 $.ajax({
									type: "POST",
									url: "static.php",
									data: "id="+id,
									success: function(data){
										responce.html(data);
									    }
								});
								 $.ajax({
									type: "POST",
									url: "details.php",
									data: "id="+id,
									success: function(data){
										details.html(data);
									    }
								});
							});
							
							
								$('#sm2').click(function (){ 
								  	 var id = 2;
									 // alert("To Id mou einai:" +theID);
									 $.ajax({
										type: "POST",
										url: "static.php",
										data: "id="+id,
										success: function(data){
											responce.html(data);
										    }
									});
									 $.ajax({
										type: "POST",
										url: "details.php",
										data: "id="+id,
										success: function(data){
											details.html(data);
										    }
									});
								});
							
							
									$('#sm3').click(function (){ 
									  	 var id = 3;
										 // alert("To Id mou einai:" +theID);
										 $.ajax({
											type: "POST",
											url: "static.php",
											data: "id="+id,
											success: function(data){
												responce.html(data);
											    }
										});
										 $.ajax({
											type: "POST",
											url: "details.php",
											data: "id="+id,
											success: function(data){
												details.html(data);
											
											$('#kataxorisi').click(function() {

											  var name = $('#name').val();
											  var surname = $('#surname').val();
											  var email = $('#email').val();
										      var comment = $('#comment').val();
											  

												$.ajax({
													type: "GET",
													url: "sendMail.php",
													data: "name="+name+"&surname="+surname+"&email="+email+"&comment="+comment,
													success: function(data){
															$('#responceForm').html(data);						

													}

												});



											});
											    }
										});
									});

							
							
										$('#sm4').click(function (){ 
										  	 var id = 4;
											 // alert("To Id mou einai:" +theID);
											 $.ajax({
												type: "POST",
												url: "static.php",
												data: "id="+id,
												success: function(data){
													responce.html(data);
												    }
											});
											 $.ajax({
												type: "POST",
												url: "details.php",
												data: "id="+id,
												success: function(data){
													details.html(data);
													
													//$('#map_canvas').gMap(); 
													
												//	$('#map_canvas').gMap({ markers: [{ latitude: 41.098614,
												//	                              longitude: 25.443508,
												//	                              html: "Permini EPE",
												//	                              popup: true }],
												//	                  zoom: 6 });
													
													
																	$("#map_canvas").gMap({     scrollwheel: false,
																	                  markers: [{ latitude: 41.098614,
																	                              longitude: 25.4403508,
																	                               html: "<b>Permini Ε.Π.Ε</b><br/>Ροδίτης Κομοτηνής 69100<br/><b>	Τηλέφωνο:</b> 25310 - 25227<br/><b>Fax:</b> 2531- 71466", 																	                                             },
																	                              
																	                             { latitude: 41.09743,
																	                              longitude: 25.449998,
																	                               html: "<b>Κ.Β Κατσικάκης Α.Ε</b><br/>Ροδίτης Κομοτηνής 69100<br/><b>	Τηλέφωνο:</b> 25310 - 33630", 																	                                             

 }],
																	                 
																	                  zoom: 13 });
												    }
											});
										});

							
											$('#m1').click(function (){ 
												
											  	 var id = 1;
												 // alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														responce.html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																slider.css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){

																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("#slides").show();
																	   		 },1000);

															
																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});

																
																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);

																

																	returnBack.click(function () { 
																		      slider.hide();

																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
							
											$('#m2').click(function (){ 
												
											  	 var id = 2;
												 // alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														$('#responce').html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																	slider.css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){

																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("#slides").show();
																	   		 },1000);

															
																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});

																
																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);

																

																	returnBack.click(function () { 
																		      slider.hide();

																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
											
											$('#m3').click(function (){ 
												
											  	 var id = 3;
												 // alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														$('#responce').html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																	slider.css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){
																	
																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("#slides").show();
																	   		 },1000);

															
																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});

																
																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);

																

																	returnBack.click(function () { 
																		      slider.hide();

																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
											
											$('#m4').click(function (){ 
												
											  	 var id = 4;
												// alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														responce.html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																	$("#slideshow").css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){
																		if(productId == '62'){
																			var productTitle = "Ταπετσαρίες";
																		}
																		if(productId == '96'){
																			var productTitle = "Χαλιά";
																		}
																		$("#categoryName").html("Διακοσμιτικές Προτάσεις |"+productTitle);
																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("#slides").show();
																	   		 },1000);


																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});


																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);



																	returnBack.click(function () { 
																		          slider.hide();
																				  $("#categoryName").html("Διακοσμιτικές Προτάσεις");
																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
											$('#m5').click(function (){ 
												
											  	 var id = 5;
												 // alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														responce.html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																	$("#slideshow").css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){

																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("#slides").show();
																	   		 },1000);

															
																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});

																
																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);

																

																	returnBack.click(function () { 
																		      slider.hide();

																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
											
											$('#m6').click(function (){ 
												
											  	 var id = 6;
												 // alert("To Id mou einai:" +theID);
												 $.ajax({
													type: "POST",
													url: "gallery.php",
													data: "id="+id,
													success: function(data){
														responce.html(data);
																var gallery = $('#gallery');
																var slider = $('#slideshow');
																var returnBack = $('#return');

																$("#slideshow").css("overflow", "hidden");
																gallery.show();
														        slider.hide();
															    returnBack.hide();
															$('.col').click(function (){ 
															      gallery.hide(); 

																  var productId = $(this).attr("id");
																 // alert("To Id mou einai:" +theID);
																 $.ajax({
																	type: "POST",
																	url: "slider.php",
																	data: "productId="+productId,
																	success: function(data){

																		slider.fadeIn('slow').html(data);
																	    setTimeout(function() {
																			$("ul#slides").show();
																	   		 },1000);

															
																		$("#slides").cycle({
																			fx: 'fade',
																			pause: 1,
																			prev: '#prev',
																			next: '#next'
																		});

																
																		slider.hover(function() {
																			$("ul#nav").fadeIn();
																			},
																				function() {
																			$("ul#nav").fadeOut();
																			});



																	}




																});
																setTimeout(function() {
																	 returnBack.slideDown('slow');
															   		 },1000);

																

																	returnBack.click(function () { 
																		      slider.hide();

																			 	  $(this).hide();
																			      gallery.fadeIn(); 
																		    });



															    });
													    }
												});
												 $.ajax({
													type: "POST",
													url: "description.php",
													data: "id="+id,
													success: function(data){
														details.html(data);
													//	slideshow.hide();
													    }
												});
											});
							
							
							
										
						
});
