﻿	// Cenger Hotels - View, January 2011 //
	// Omega Graphic - Antalya / omegagraphic.com //
	// Author: Ozgur Gurckaya / gurckaya.com // 	

	//--------------- Jquery blog --------------------------

	$.fn.view = function(variables, init){
	
	variables = $.extend({}, {
		
			actionLock: false,
			mainMenuFlag: false,
			mainHeaderMenuFlag: false,
			currentSelection: '',
			mainMenuObjects: '',
			mainMenuProps: '',
			onlineFlag: false,
			languageFlag:false,
			pageType: '',
			padding: 0,
			newsletterName_Text: '',
			newsletterMail_Text: '',
			selectedNews: -1,
			leftFlag: false,
			rightFlag: false,
			carFlag: '',
			currentSlide:'',
			selectedThumb: 1
			
						
		}, variables);	
		
	init = $.extend({}, {
		
			processURL: '',
			processParameters: '',
			backResponse: function(){},
			ajaxResponse: ''
						
		}, init);			

		$(document).ready(function(){
			
			$('#prompt').css({top:$(window).height() / 2 - $('#prompt').height() / 2 + $(window).scrollTop() + 'px', left:$(window).width() / 2 - $('#prompt').width() / 2 + 'px'});
			$('#boxes').css({top:$(window).height() / 2 - $('#boxes').height() / 2 + $(window).scrollTop() - 25 + 'px', left:$(window).width() / 2 - $('#boxes').width() / 2 + 'px'});		
			//$('#subpage').css({top:$(window).height() / 2 - $('#subpage').height() / 2 + $(window).scrollTop() + 35 + 'px', left:$(window).width() / 2 - $('#subpage').width() / 2 + 'px'});	
			$('#subpage-gallery').css({top:$(window).height() / 2 - $('#subpage-gallery').height() / 2 + $(window).scrollTop() + 35 + 'px', left:$(window).width() / 2 - $('#subpage-gallery').width() / 2 + 'px'});

			$('#slider').css({left:$(window).width() / 2 - $('#slider').width() / 2 + 'px', top:($(window).height() / 2 - $('#slider').height() / 2) - 60 + 'px'});
			$('#subpage').css({left:$(window).width() / 2 - $('#subpage').width() / 2 + 'px', top:($(window).height() / 2 - $('#subpage').height() / 2) - 70 + 'px'});
			$('#services_slider').css({left:$(window).width() / 2 - $('#services_slider').width() / 2 + 'px', top:($(window).height() / 2 - $('#services_slider').height() / 2) - 60 + 'px'});		
			
			$('#fleet-container2').css({left:$(window).width() / 2 - 945 / 2 + 'px', top:($(window).height() / 2 - 290) + 20 + 'px'});

			$('#container-360').hide().css({left:$(window).width() / 2 - 320 + 'px',top:$(window).height() / 2 - 240 + 'px'});
			
			$('.left-arrow').css({left:'0px',top:$(window).height() / 2 - 35 + 'px'})//.animate({left:'-151px'}, 350, "easeout");
			$('.right-arrow').css({left:$(window).width() - 151 + 'px',top:$(window).height() / 2 - 35 + 'px'})/*.animate({left:$(window).width() + 151}, 350, "easeout");*/
			
			
			$('#res-cont').css({left:$(window).width() / 2 - 210 + 'px',top:$(window).height() / 2 - $('#res-cont').height() / 2 + 'px'});
			$('#news_area').css({left:$(window).width() / 2 - $('#news_area').width() / 2 + 'px', top:($(window).height() / 2 - $('#news_area').height() / 2) + 'px'});
			
			
			$('.left-arrow-fleet').css({left:'0px',top:$(window).height() / 2 - 30 + 'px'}).mouseover(function() {
				
				$(this).stop().animate({'padding-left':'20px'}, 500, "easeout");
				
			}).mouseout(function() {
				
				$(this).stop().animate({'padding-left':'10px'}, 500, "easeout");				
				
			});
			
			$('.left-arrow').click(function() {
				
				$('#overlay').css({opacity:0}).show().animate({opacity:0.5}, 600, "easeout", function() {
					
					$('#res-cont').css({opacity:0}).show().animate({opacity:1}, 600, "easeout");
				
				});
				
			});

			$('.service-object').hide();

			$('.whiteStyle11').click(function() {

				('#res-cont').animate({opacity:0}, 600, "easeout", function() {
					
					$('#res-cont').hide();
					$('#overlay').css({opacity:0}).animate({opacity:0}, 600, "easeout", function() {
						
						$('#overlay').hide();
						
					});
				
				});
				

			});

			$('.btn2').live('click', function() {

				$('#res-cont').animate({opacity:0}, 600, "easeout", function() {
					
					$('#res-cont').hide();
					$('#overlay').css({opacity:0}).animate({opacity:0}, 600, "easeout", function() {
						
						$('#overlay').hide();
						
					});
				
				});
				

			});



			
			$('#overlay').live('click', function() {
				
				$('#res-cont').animate({opacity:0}, 600, "easeout", function() {
					
					$('#res-cont').hide();
					$('#overlay').css({opacity:0}).animate({opacity:0}, 600, "easeout", function() {
						
						$('#overlay').hide();
						
					});
				
				});				
				
				
			});



			$('.service-button').mouseover(function() {
			
				var requestedSlide = $(this).attr('index');

				if (variables.currentSlide !== requestedSlide) {

					$('.service-object[index=' + variables.currentSlide + ']').stop().css({'z-index':405
}).animate({opacity:0}, 500, "easeout", function() {

						$(this).hide();
					
					});

					$('.service-object[index=' + requestedSlide+ ']').stop().css({'z-index':406,opacity:0}).show().animate({opacity:1}, 500, "easeout");

					variables.currentSlide = requestedSlide;


				};
				
			

			});

			$('.service-button[index=1]').mouseover();


			$('.open-360').click(function() {

				var src = $(this).attr('url');


				$('#overlay').css({opacity:0}).show().animate({opacity:0.8}, 500, "easein", function() {

					
					$('#container-360').css({opacity:0}).html('<div style="position:absolute;top:0px;background:#000;left:630px;padding:4px;width:16px;height:16px;text-align:center;cursor:pointer;z-index:700;" class="whiteStyle11_2"><b>X</b></div><iframe src="' + src + '" frameborder="0" width="655" height="490" scrolling="no"></iframe>').show().animate({opacity:1}, 500, "easeout");

			$('.whiteStyle11_2').click(function() {

				$('#container-360').animate({opacity:0}, 600, "easeout", function() {
					
					$('#container-360').hide();
					$('#overlay').css({opacity:0}).animate({opacity:0}, 600, "easeout", function() {
						
						$('#overlay').hide();
						
					});
				
				});
				

			});


				});

			$('#overlay').live('click', function() {
				
				$('#container-360').animate({opacity:0}, 600, "easeout", function() {
					
					$('#container-360').hide();
					$('#overlay').css({opacity:0}).animate({opacity:0}, 600, "easeout", function() {
						
						$('#overlay').hide();
						
					});
				
				});				
				
				
			});
			
			

			});

			
			$('.right-arrow-fleet').css({left:$(window).width() - 60 + 'px',top:$(window).height() / 2 - 30 + 'px'}).mouseover(function() {
				
				$(this).stop().animate({'padding-left':'-30px'}, 500, "easeout");
				
			}).mouseout(function() {
				
				$(this).stop().animate({'padding-left':'10px'}, 500, "easeout");				
				
			});		
			
			$('.fleet-car').animate({opacity:0.6}, 1500, "easeout").mouseover(function() {
				
				if(variables.carFlag !== $(this).attr('index')) {
					variables.carFlag = $(this).attr('index');
					$(this).stop().animate({opacity:1,'margin-right':'50px','margin-top':'-25px'}, 500, "easeout")//.effect("scale", {percent:150,direction:'horizontal'}, 350);
				}
				
			}).mouseout(function() {
			
				if(variables.carFlag == $(this).attr('index')) {
					variables.carFlag = '';
					$(this).stop().animate({opacity:0.6,'margin-right':'30px','margin-top':'0px'}, 500, "easeout")//*/.effect("scale", {percent:66,direction:'horizontal'}, 350);
				}				
				//$(this).stop()/*.animate({opacity:0.6}, 500, "easeout")*/.effect("scale", {percent:66}, 350);		
				
			});
			
			$('.fleet-thumb').animate({opacity:0.6}, 1500, "easeout").mouseover(function() {
				
			
				$(this).stop().animate({opacity:1,'margin-top':'-5px'}, 500, "easeout")//.effect("scale", {percent:150,direction:'horizontal'}, 350);
				
			}).mouseout(function() {

				$(this).stop().animate({opacity:0.6,'margin-top':'0px'}, 500, "easeout")//*/.effect("scale", {percent:66,direction:'horizontal'}, 350);
				
			});		
			
			$('.left-arrow-fleet').click(function() {
				
				var index = $(this).attr('index');
				
				if (variables.selectedThumb > 1) {
					
					variables.selectedThumb--;
					$('.fleet-thumb[index=' + variables.selectedThumb + ']').click();
					
				};
				
			});
			
			$('.right-arrow-fleet').click(function() {
				
				var index = $(this).attr('index');
				
				if (variables.selectedThumb < $('.fleet-thumb').length) {
					
					variables.selectedThumb++;
					$('.fleet-thumb[index=' + variables.selectedThumb + ']').click();
					
				};
				
			});
						
			$('.fleet-thumb').click(function() {
				
				if(!variables.actionLock) {
				
					var src = $(this).attr('src');
					srx = src.replace('thumbs', 'larges');				
					var image = new Image();					
					
					variables.actionLock = true;				
					
					$('.fleet-picture').animate({opacity:0}, 500, "easein", function() {
												
						$(image).load(function() {
		
							$('.fleet-picture').html('<img align="center" src="' + srx + '" style="padding-top:20px;" />');	
							$('.fleet-picture').css({'text-align':'center'});
							
							$('.fleet-picture').animate({opacity:1}, 500, "easein", function() {	
								variables.actionLock = false;	
							});
							
						}).attr('src',srx);						
					
					});
				
				};
				
			});
			
			$('.fleet-thumb:first').click();
					
			$('#overlay').css({'width':'100%','height':'100%'});
			
			$('#fleet').css({top:$(window).height() / 2 - $('#fleet').height() / 2 + 'px'});
			
			var e = 0;
			
			var fleetCount = $('.fleet-car').length;			
			var totalWidth = (fleetCount * 290) - 30;

			
			$('.up-arrow img,.down-arrow img').css({opacity:0.5}).mouseenter(function() {
				
				$(this).stop().animate({opacity:1}, 350, "linear");
				
			}).mouseleave(function() {
				
				$(this).stop().animate({opacity:0.5}, 350, "linear");				
				
			});
			
			$('.box').slideToggle(1, "linear").delay(1500).each(function() {
				
				$(this).delay(e * 0).slideToggle(750, "easeout");
				e++;
				
			});
			
			$('.box_big').slideToggle(1, "linear").delay(1500).each(function() {
				
				$(this).delay(e * 0).slideToggle(750, "easeout");
				e++;
				
			});	
			
			//$('#subpage').slideToggle(1, "linear").delay(1500).slideToggle(750, "easeout");
			
			$('#collapse').click(function() {			
				
				$('*[hidex=true]').slideToggle(750, "easeout");
				
			});

			
			$('.up-arrow').click(function() {
				
				var obj = $(this).attr('object');
				
				switch(obj) {
					
					case 'news':
												
						if (eval(variables.selectedNews) > -1) {
							
							variables.selectedNews--;
							getNews();
							
							
						};
					
						break;
					
				};
				
			});
			
			$('.down-arrow').click(function() {
				
				var obj = $(this).attr('object');
				
				switch(obj) {
					
					case 'news':
						
						var count = $('#news_count').val();

						if (eval(variables.selectedNews) < eval(count) - 2) {

							variables.selectedNews++;
							getNews();
							
						};
					
						break;
					
				};				
				

				
			});			
			
			getNews = function(){
				
				if (!variables.actionLock) {
					
					variables.actionLock = true;
						
					$('.news_content').animate({opacity:0}, 500, "easein");
					$('.news_photo').animate({opacity:0}, 500, "easein", function() {
						
						$('.news_photo').html('<img src="images/ani_loading.gif" style="padding-left:93px;padding-right:93px;padding-top:44px;padding-bottom:43px;border:1px solid #666;" width="23" height="23" />').animate({opacity:1}, 250, "easein", function() {																					
							
							init.processURL = "process.asp?action=getNews&seq=" + variables.selectedNews;
							
							init.backResponse = function() {
								
								var data = new Array();
								data = init.ajaxResponse.split('||');
								
								news_date = data[0];
								news_header = data[1];
								news_content = data[2];
								news_picture = data[3];	
								id = data[4];	
								
								if (news_picture == '') {
									
									news_picture = "noPictures.jpg";
									
								};
								
								var image = new Image();	
								
								$(image).load(function() {

									$('.news_photo').html('').append(image);
									
									$('.news_content').html('<span class="news-header"><a href="news.asp?id=' + id + '">' + news_header + '</a></span><br /><span class="news-date">' + news_date + '</span><br /><span class="news-content">' + news_content + '</span>')

		
									$('.news_content').animate({opacity:1}, 500, "easein");
									
										
									
									variables.actionLock = false;
									
								}).attr('src','images/content/' + news_picture);
													
							};
							
							ajax.get();							
							
							
						});
							
					});
					

				
				};
				
			};
			
			
						
			setUIArguments = function() {
				
				$('#gallery-app').hide().css({opacity:0});
				$('.gallery-app-bg').css({'position':'absolute',top:'0px',left:'0px',width:$(window).width(),height:$(window).height(),'background-color':'#000',opacity:0}).hide();								
			};
			
			setUIArguments();
			getNews();
			
			$('#save-review').click(function() {
				
				var parameters = $('#frmReview').serialize();
				var getProcess = true;

				init.processURL = "process.asp?action=saveReview&" + parameters;
				
				$('.review-form[validate=true]').each(function() {
					
					if($(this).val() == '') {
						
						get.warn("Lütfen doldurulması zorunlu alanları boş bırakmayın", 128, "ogOkOnly");
						getProcess = false;
						return false;
						
					}
					
				});
				
				init.backResponse = function() {
	
					if (init.ajaxResponse == 'ok') {
					
						get.warn("Görüşleriniz başarıyla kaydedildi. Görüşleriniz, onaylandıktan sonra en kısa sürede yayına alınacaktır. İlginiz için teşekkür ederiz.", 32, "ogOkOnly");
						$('.review-form').val('');
						
					} else {
						
						get.warn(init.ajaxResponse, 128, "ogOkOnly");
						
					}
					
				}	
				
				if(getProcess) {
					ajax.get();				
				}
				
			});				
			
			$('#newsletter_username').focus(function() {
				
				if(($(this).val() == 'Ad, Soyad') || ($(this).val() == 'Name, Surname') || ($(this).val() == 'Name, Vorname') || ($(this).val() == 'Имя, Фамилия') || ($(this).val() == 'Prénom, Nom')) {
					
					variables.newsletterName_Text = $(this).val();
					$(this).val('');
					
				};
				
			});
			
			$('#newsletter_username').blur(function() {
				
				if(($(this).val() == '')) {
					
					$(this).val(variables.newsletterName_Text);
					
				};
				
			});	
			
			$('#newsletter_mail').focus(function() {
				
				if(($(this).val() == 'E-Posta') || ($(this).val() == 'E-mail')) {
					
					variables.newsletterMail_Text = $(this).val();
					$(this).val('');
					
				};
				
			});
			
			$('#newsletter_mail').blur(function() {
				
				if(($(this).val() == '')) {
					
					$(this).val(variables.newsletterMail_Text);
					
				};
				
			});						
			
			$('#save-newsletter').click(function() {

				if(($('#newsletter_username').val() == '') || ($('#newsletter_username').val() == 'Ad, Soyad') || ($('#newsletter_username').val() == 'Name, Surname') || ($('#newsletter_username').val() == 'Name, Vorname') || ($('#newsletter_username').val() == 'Имя, Фамилия') || ($('#newsletter_username').val() == 'Prénom, Nom')) {
				
					get.warn("Lütfen adınızı ve soyadınızı yazıp yeniden deneyiniz", 16, "ogOkOnly");
					return false;
					
				};
				
				if(($('#newsletter_mail').val() == '') || ($('#newsletter_mail').val() == 'E-Posta') || ($('#newsletter_mail').val() == 'E-mail')) {
				
					get.warn("Lütfen e-posta adresinizi yazıp yeniden deneyiniz", 16, "ogOkOnly");
					return false;
					
				};
				
				if (newsletterValidation($('#newsletter_mail').val())){
				
					if(!init.actionLock) {												
						
						var parameters = $('#frmNewsletter').serialize();					
						
						init.processURL = "process.asp?action=saveVIAMail&" + parameters;
					
						init.backResponse = function() {
			
							if (init.ajaxResponse == 'ok') {
							
								get.warn("E-Posta adresiniz başarıyla kayıt edildi. İlginiz için teşekkür ederiz", 32, "ogOkOnly");
								$('#frmNewsletter input:not(#save-newsletter)').val('');
								
							} else {
								
								get.warn(init.ajaxResponse, 128, "ogOkOnly");
								
							};
							
						};
						
						ajax.get();
					
					};
					
				};
				
			});	
			
			newsletterValidation = function(str) {
		
				var at = "@";
				var dot = ".";
				var lat = str.indexOf(at);
				var lstr = str.length;
				var ldot = str.indexOf(dot);
			
				
				if (str.indexOf(at)==-1){
					
				   get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");			  
				   return false;
				   
				};
		
				if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
					
				   get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
				   return false;
				   
				};
		
				if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
					
					get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
					return false;
					
				};
		
				 if (str.indexOf(at,(lat+1))!=-1){
					 
					get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
					return false;
					
				 };
		
				 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
					 
					get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
					return false;
					
				 };
		
				 if (str.indexOf(dot,(lat+2))==-1){
					 
					get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
					return false;
					
				 };
				
				 if (str.indexOf(" ")!=-1){
					 
					get.warn("Geçersiz bir e-posta adresi girdiniz. Lütfen kontrol edin", 64, "ogOkOnly");
					return false;
					
				 };
		
				 return true;					
			};
			
	getTransfers = function () {
		
		var xmlDoc=null; 
		
		var x = document.getElementById("destinations");
		var y = document.getElementById("endpoints");
		
		if (x.options[x.selectedIndex].value !== "-1") {
							
			var ax = y.options.length;
			
			for (var i=0; i < ax; i++) {

				y.options[0] = null;
				
			}
				
			if (window.ActiveXObject) {
				
				xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); 
				xmlDoc.async=false; 
				xmlDoc.load("process.asp?transfer=" + x.options[x.selectedIndex].value + ""); 
				
			} 
			
				else if (document.implementation.createDocument) 
			
			{
				
				var xmlhttp = new window.XMLHttpRequest(); 								

				xmlhttp.open("GET", "process.asp?transfer=" + x.options[x.selectedIndex].value + "", false); 
				xmlhttp.send(null);
								
				parser=new DOMParser();
				var xmlDoc = parser.parseFromString(xmlhttp.responseText,"text/xml");				 				
				
			} else 	{ 
			
				alert('Tarayiciniz XML islemlerini desteklemiyor'); 
				
			} 				

			
			if (xmlDoc!=null) 	{
	
				var defaultOption = new Option();
				
				defaultOption.text = "Seçiniz...";
				defaultOption.value = "";
				
				y.options[0] = defaultOption;				
				
				var xt = xmlDoc.getElementsByTagName("record"); 
				
				if (xt.length > 0) {
				
					for (var i=1; i < xt.length + 1; i++) {
					
						var newOption = new Option();
					
						newOption.text = xt[i-1].getElementsByTagName("endpoint_name_TR")[0].childNodes[0].nodeValue;	
						newOption.value = xt[i-1].getElementsByTagName("id")[0].childNodes[0].nodeValue;	
						

						y.options[i] = newOption;
						
					}	 // end for
					
				}	 // end if			 
		
			} 	 // end if	
 
			
		} // end if		
		
	}
	
	checkRes_SearchForm = function() {
		
		var x = document.getElementById("reservation_type");
		var y1 = document.getElementById("reservation_date");
		var y = document.getElementById("reservation_date2");		
		var z = document.getElementById("destinations");
		var t = document.getElementById("endpoints");
		
		
		if (x.value == "" || y1.value == "" || z.value == "" || t.value == "") {
			
			alert("Lütfen doldurulması zorunlu alanları boş bırakmayın");
			return false;			
			
		} else {
			if (x.options[x.selectedIndex].value == "2") {
				
				if(y.value == '') {

					alert("Lütfen doldurulması zorunlu alanları boş bırakmayın");
					return false;						
					
				}
				
				var firstMonth = y.value.substring(5,7);
				var secondMonth = y1.value.substring(5,7);
			
				var firstDay = y.value.substring(0,2);
				var secondDay = y1.value.substring(0,2);	
				
				var firstYear = y.value.substring(6,10);
				var secondYear = y1.value.substring(6,10);
				
				var firstDate = new Date($('#reservation_date').val());
				var secondDate = new Date($('#reservation_date2').val());				
				
				if (firstDate > secondDate) {
					
					alert ("Dönüş tarihi gidiş tarihinden önce olamaz.");	
					return false;
										
				} 
									
				
/*				if (eval(firstYear) > eval(secondYear)) {
						
					alert ("Dönüş tarihi gidiş tarihinden önce olamaz.");	
					return false;
					
				} else if (eval(firstMonth) > eval(secondMonth)) {
					
					alert ("Dönüş tarihi gidiş tarihinden önce olamaz.");	
					return false;					
					
				} else if (firstDay > secondDay) {
						
					if (eval(firstMonth) > eval(secondMonth)) {
					
						alert ("Dönüş tarihi gidiş tarihinden önce olamaz.");	
						return false;
						
					}
					
				}*/

				
			}	
			
			frmReservation.submit();
			
			
		}
		
		
	}
	
	checkRound = function() {
		
		var x = document.getElementById("reservation_type");
		var y = document.getElementById("roundContainer");
		
		if (x.options[x.selectedIndex].value == "2") {
			
			y.style.display = "";
			
		} else {
			
			y.style.display = "none";
			
		}
		
	}
	
	checkMeeting = function() {
		
		var meetingControl = document.getElementById("meetingControl");
		var meetingRow = document.getElementById("meetingRow");		
		
		if (meetingControl.checked) {
			
			meetingRow.style.display = "";
			
		} else {
			
			meetingRow.style.display = "none";
			
		}		

	}
	
	checkRoundTime = function() {
		
		var roundTimeControl = document.getElementById("roundTimeControl");
		var roundTime = document.getElementById("roundTime");		
		
		if (!roundTimeControl.checked) {
			
			roundTime.style.display = "";
			
		} else {
			
			roundTime.style.display = "none";
			
		}
					
	}								
			

		});//end ready
		
		$(document).mousemove(function(e) {
			
			var fleetCount = $('.fleet-car').length;			
			var totalWidth = (fleetCount * 290) - 30;			

			/*if(eval(e.pageX) < 250) {
				
				if (!variables.leftFlag) {
					
					variables.leftFlag = true;
					$('.left-arrow').stop().animate({left:'0px'}, 350, "easeout");
					
				};
				
			} else {
				
				if (variables.leftFlag) {
				
					variables.leftFlag = false;
					$('.left-arrow').stop().animate({left:'-151px'}, 350, "easeout");
					
				};
				
			};
			
			if(eval(e.pageX) > $(window).width() - 250) {
				
				if (!variables.rightFlag) {
				
					variables.rightFlag = true;
					$('.right-arrow').stop().animate({left:$(window).width() - 151 + 'px'}, 350, "easeout");
					
				};
					
				
			} else {
				
				if (variables.rightFlag) {
				
					variables.rightFlag = false;
					$('.right-arrow').stop().animate({left:$(window).width() + 151 + 'px'}, 350, "easeout");
					
				};
				
			};	*/
			
			
			var x_ = $(window).width() > totalWidth ? ($(window).width() / totalWidth) : (totalWidth / $(window).width());
			
			var x_1 = e.pageX * x_ * -1 + ($(window).width() / 2);
			var x_2 = $('#fleet-container').css('left')
			x_2 = x_2.replace('px', '');

			$('#fleet-container').stop().animate({left:x_1 + 'px'}, 3500, "easeout");
			//$('#fleet-container').css({left:((x_1 - x_2) / 8) + 'px'});
			
			//var cont = document.getElementById('fleet-container');
			
			//document.getElementById('fleet-container').style.left -= ((x_1 - x_2) / 8);
			
			
												
			
		});
		
			
		$(window).resize(function() {
			
			$('.gallery-app-bg').css({width:$(window).width(),height:$(window).height() + $(window).scrollTop() + 'px'});

			$('#slider-content').css({left:$(window).width() / 2 - $('#slider-content').width() / 2 + 'px',top:$(window).height() / 2 - $('#slider-content').height() / 2 + 'px'});
			
			$('#boxes').css({top:$(window).height() / 2 - $('#boxes').height() / 2 + $(window).scrollTop() - 35 + 'px', left:$(window).width() / 2 - $('#boxes').width() / 2 + 'px'});
			
			//$('#subpage').css({top:$(window).height() / 2 - $('#subpage').height() / 2 + $(window).scrollTop() + 35 + 'px', left:$(window).width() / 2 - $('#subpage').width() / 2 + 'px'});	
			$('#subpage-gallery').css({top:$(window).height() / 2 - $('#subpage-gallery').height() / 2 + $(window).scrollTop() + 35 + 'px', left:$(window).width() / 2 - $('#subpage-gallery').width() / 2 + 'px'});
			
			$('#res-cont').css({left:$(window).width() / 2 - 210 + 'px',top:$(window).height() / 2 - $('#res-cont').height() / 2 + 'px'});

			$('#overlay').css({'width':'100%','height':'100%'});			
			$('#prompt').css({top:$(window).height() / 2 - $('#prompt').height() / 2 + $(window).scrollTop() + 'px', left:$(window).width() / 2 - $('#prompt').width() / 2 + 'px'});

			$('#slider').css({left:$(window).width() / 2 - $('#slider').width() / 2 + 'px', top:($(window).height() / 2 - $('#slider').height() / 2) - 60 + 'px'});
			$('#subpage').css({left:$(window).width() / 2 - $('#subpage').width() / 2 + 'px', top:($(window).height() / 2 - $('#subpage').height() / 2)  - 70 + 'px'});
			$('#services_slider').css({left:$(window).width() / 2 - $('#services_slider').width() / 2 + 'px', top:($(window).height() / 2 - $('#services_slider').height() / 2) - 60 + 'px'});
			
			/*$('.left-arrow').css({left:'-151px',top:$(window).height() / 2 - 35 + 'px'});
			$('.right-arrow').css({left:$(window).width() + 151 + 'px',top:$(window).height() / 2 - 35 + 'px'});*/
			
			$('.left-arrow').css({left:'0px',top:$(window).height() / 2 - 35 + 'px'});
			$('.right-arrow').css({left:$(window).width() - 151 + 'px',top:$(window).height() / 2 - 35 + 'px'});			
			
			$('.left-arrow-fleet').css({left:'0px',top:$(window).height() / 2 - 30 + 'px'});
			$('.right-arrow-fleet').css({left:$(window).width() - 60 + 'px',top:$(window).height() / 2 - 30 + 'px'});				
			
			$('#fleet').css({top:$(window).height() / 2 - $('#fleet').height() / 2 + 'px'});
			
			$('#fleet-container2').css({left:$(window).width() / 2 - 945 / 2 + 'px', top:($(window).height() / 2 - 290) + 20 + 'px'});	
			
			$('#news_area').css({left:$(window).width() / 2 - $('#news_area').width() / 2 + 'px', top:($(window).height() / 2 - $('#news_area').height() / 2) + 'px'});						

			$('#container-360').css({left:$(window).width() / 2 - 320 + 'px',top:$(window).height() / 2 - 240 + 'px'});
			
		});
		
		$(window).scroll(function() {
			
			$('.gallery-app-bg').css({top:$(window).scrollTop() + 'px'});
			$('#prompt').css({top:$(window).height() / 2 - $('#prompt').height() / 2 + $(window).scrollTop() + 'px', left:$(window).width() / 2 - $('#prompt').width() / 2 + 'px'});
			$('#overlay').css({top: $(window).scrollTop() + 'px'});			
			
		});		
	
			
		
		closeBox = function() {
			
			$('#overlay').animate({opacity:0}, 250, "easeout", function() {
				$('#prompt').hide().html('');
				$('#overlay').hide();
			});	
				
		};
		
		var ajax = {
			
			get: function() {
				
				
				var sb = init.processURL.replace('%40','@');
				
				$.post(sb, function(data) {	
			
					init.ajaxResponse = data;
					init.backResponse();
						
				});
				
				return;
				
			}
			
		};
		
		var get = {
				
			warn: function(text, icon, button) {
			
				$('#prompt').append('<div class="icon"><img src="images/prompt-icons/' + icon + '.png" /></div>')
				$('#prompt').append('<div class="p_text">' + text + '</div>')
				$('#prompt').append('<div class="buttons"><input type="button" onClick="closeBox();" value="Ok"/></div>')				
								
				$('#overlay').show().animate({opacity:0.4}, 250, "easeout", function() {
					
					$('#prompt').show();
				
				});
				
			},
			
			back: function() {
				

			}
			
		};	

	};
	//--------------------------------------------------------------
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
