var images2;
var PopAbierto;


   $(document).bind('keydown', function(e) { 

       if (e.which == 27 && PopAbierto=="Journey") {

           showJourneyPreview(0);

       }
   }); 


(function( $ ){
  $.fn.bgImageTween = function(images, staytime, fadetime) {
    $(this).wrapInner('<div class="bgImageTweenfaderContent"></div>');
    var content = $('.bgImageTweenfaderContent', this);
    $(this).prepend('<div class="bgImageTweenfader"></div>');
    var fader = $('.bgImageTweenfader', this);
    
    content.css('position', 'absolute');
    fader.css('position', 'absolute');
    fader.css('width', $(this).width() );
    fader.css('height', $(this).height() );
    fader.css('opacity', 0);
    
    n = images.shift(); images.push(n);
    $(this).css('backgroundImage', 'url('+n+')');
    n= images.shift(); images.push(n);
    fader.css('backgroundImage', 'url('+n+')');
    
    function switcher() {
      fader.delay(staytime);
      fader.animate({opacity: 1},fadetime);
      fader.queue(function(){
        n = images.shift(); images.push(n);
        fader.parent().css('backgroundImage', 'url('+n+")");
        $(this).dequeue();
      });
      fader.delay(staytime);
      fader.animate({opacity: 0},fadetime);
      fader.queue(function(){
        n = images.shift(); images.push(n);
        fader.css('backgroundImage', 'url('+n+")", switcher() );
        $(this).dequeue();
      });
    };
    switcher();
  };
})( jQuery );


function validateBookingForm(formulario1){
	var captchaok1=false;
	var captcha1 = $('#captcha_input').attr("value");
	$.ajax({
           async:false,
           type: "POST",
           dataType: "html",
           contentType: "application/x-www-form-urlencoded",
           url:"http://www.danube-express.com/ajax.php",
           data:"captchaValue="+captcha1+"&formulario="+formulario1,
           beforeSend:function(){},
           success:function(data){
			var res = data.split('*');
		   if (res[0]=="true"){
				captchaok1=true
		   }else{
				captchaok1=false;
		   }
		   },
           timeout:4000,
           error:function(){captchaok1=false;}
         }); 
		 
	if (captchaok1==true){
		return keepvalidateBookingForm();
	}
	else{
		alert("The code you entered is wrong.");
		return false;
	}

}

function validateBrochureSubmissionForm(formulario){
	var captchaok=false;
	var captcha = $('#captcha_input1').attr("value");
	$.ajax({
           async:false,
           type: "POST",
           dataType: "html",
           contentType: "application/x-www-form-urlencoded",
           url:"http://www.danube-express.com/ajax1.php",
           data:"captchaValue="+captcha+"&formulario="+formulario,
           beforeSend:function(){},
           success:function(data){
			var res = data.split('*');
		   if (res[0]=="true"){
				captchaok=true
		   }else{
				captchaok=false;
		   }
		   },
           timeout:4000,
           error:function(){captchaok=false;}
         }); 
		 
	if (captchaok==true){
		return seguirValidandoBrochure();
	}
	else{
		alert("The code you entered is wrong.");
		return false;
	}
}



function seguirValidandoBrochure(){

  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail1 = document.getElementById('bemail').value;
  
	if(document.getElementById('binitial').value == ""){
		alert('You have enter your initials.');
		return false;
	}
	if(document.getElementById('bsurname').value == ""){
		alert('You have enter your surname.');
		return false;
	}	
	if(document.getElementById('btelephone').value == ""){
		alert('You have enter your telephone.');
		return false;
	}
	if(strEmail1.search(validRegExp) == -1){
		alert('You have to enter a valid email.');
		return false;
	}
	if(document.getElementById('baddress1').value == ""){
		alert('You have enter an address.');
		return false;
	}	
/*  	if(document.getElementById('baddress2').value == ""){
		alert('You have enter an address.');
		return false;
	}	
	if(document.getElementById('bpostcode').value == ""){
		alert('You have enter a postcode.');
		return false;
	}*/
	if(document.getElementById('btown').value == ""){
		alert('You have to enter your town.');
		return false;
	}
	if(document.getElementById('bcomments').value == ""){
		alert('You have to enter your comments.');
		return false;
	}		
	return true;  			


}



function validateNewsleterSubmissionForm(){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail1 = document.getElementById('NewsletterSubmissionsEmail').value;
  
	if(document.getElementById('NewsletterSubmissionsName').value == "" || document.getElementById('NewsletterSubmissionsName').value == "Name"){
		alert('You have to enter your name.');
		return false;
	}
	
	if(strEmail1.search(validRegExp) == -1 || document.getElementById('NewsletterSubmissionsEmail').value == "Email" ){
		alert('You have to enter a valid email.');
		return false;
	}
	
	return true;
}



function validateContactUsSubmissionForm(formulario3){
	var captchaok3=false;
	var captcha3 = $('#captcha_input3').attr("value");
	$.ajax({
           async:false,
           type: "POST",
           dataType: "html",
           contentType: "application/x-www-form-urlencoded",
           url:"http://www.danube-express.com/ajax2.php",
           data:"captchaValue="+captcha3+"&formulario="+formulario3,
           beforeSend:function(){},
           success:function(data){
			var res = data.split('*');
		   if (res[0]=="true"){
				captchaok3=true
		   }else{
				captchaok3=false;
		   }
		   },
           timeout:4000,
           error:function(){captchaok3=false;}
         }); 
		 
	if (captchaok3==true){
		return seguirValidandoContactUs();
	}
	else{
		alert("The code you entered is wrong.");
		return false;
	}
}


function seguirValidandoContactUs(){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail1 = document.getElementById('CEmail').value;
  
	if(document.getElementById('CName').value == "" || document.getElementById('CName').value == "Name"){
		alert('You have to enter your name.');
		return false;
	}
	
	if(document.getElementById('CSurname').value == "" || document.getElementById('CSurname').value == "Surname"){
		alert('You have to enter your surname.');
		return false;
	}
	
	if(strEmail1.search(validRegExp) == -1 || document.getElementById('CEmail').value == "Email" ){
		alert('You have to enter a valid email.');
		return false;
	}
	
	if(document.getElementById('CMessage').value == "" || document.getElementById('CMessage').value == "How Can We Help?"){
		alert('You have to type in a message.');
		return false;
	}		
	
	return true;
}



function validateEnquirySubmissionForm(formulario4){
	var captchaok4=false;
	var captcha4 = $('#captcha_input4').attr("value");
	var cookie = document.getElementById('flag').value;
	$.ajax({
           async:false,
           type: "POST",
           dataType: "html",
           contentType: "application/x-www-form-urlencoded",
           url:"http://www.danube-express.com/ajax3.php",
           data:"captchaValue="+captcha4+"&formulario="+formulario4 + "&cookie="+cookie,
           beforeSend:function(){},
           success:function(data){
			var res = data.split('*');
		   if (res[0]=="true"){
				captchaok4=true
		   }else{
				captchaok4=false;
		   }
		   },
           timeout:4000,
           error:function(){captchaok4=false;}
         }); 
		 
	if (captchaok4==true){
		return seguirValidandoEnquiry();
	}
	else{
		alert("The code you entered is wrong.");
		return false;
	}
}


function seguirValidandoEnquiry(){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail1 = document.getElementById('QEmail').value;
  
	if(document.getElementById('QName').value == "" || document.getElementById('QName').value == "Name"){
		alert('You have to enter your name.');
		return false;
	}

	if(document.getElementById('QSurname').value == "" || document.getElementById('QSurname').value == "Surname"){
		alert('You have to enter your surname.');
		return false;
	}	
	
/*	if(document.getElementById('QTelephone').value == "" || document.getElementById('QTelephone').value == "Telephone"){
		alert('You have to enter your telephone.');
		return false;
	}	
*/	
	if(strEmail1.search(validRegExp) == -1 || document.getElementById('QEmail').value == "Email" ){
		alert('You have to enter a valid email.');
		return false;
	}	
	
	if(document.getElementById('QMessage').value == "" || document.getElementById('QMessage').value == "How Can We Help ?"){
		alert('You have to type in a message.');
		return false;
	}		
	
	return true;
}

/* FORM FIELD FUNCTIONS */
function onfocus_form(field, label){	
	if(field.value == label) {document.getElementById(field.id).value = '';}
}
function onblur_form(field, label){
	if(field.value == '') {document.getElementById(field.id).value = label;}
}
function setval(field, label){
	if(field.value == label) {document.getElementById(field.id).value = '';}
}

function IsNumeric(inputVal) {
    return inputVal.match(/^-{0,1}\d*\.{0,1}\d+$/);
}

function keepvalidateBookingForm(){

	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail1 = document.getElementById('email').value;
		
	var errors = "";
		
	if(document.getElementById('title').value == ""){
		errors += 'You have to enter the 1st. Passenger Title.\n';
	}		
	if(document.getElementById('first_names').value == ""){
		errors += 'You have to enter the 1st. Passenger First Name.\n';
	}		
	if(document.getElementById('surname').value == ""){
		errors += 'You have to enter the 1st. Passenger Last Name.\n';
	}	
	if(document.getElementById('address_1').value == ""){
		errors += 'You have to enter the 1st. Passenger Address.\n';
	}	
	if(document.getElementById('town').value == ""){
		errors += 'You have to enter the 1st. Passenger Town.\n';
	}		
		
	if(IsNumeric(document.getElementById('telephone').value)){
		if(document.getElementById('telephone').value == ""){
			errors += 'You have to enter the 1st. Passenger Telephone. Only numbers and no spaces allowed.\n';
		}
	} else {
		errors += 'You have to enter the 1st. Passenger Telephone. Only numbers and no spaces allowed.\n';
	}
	
	if(document.getElementById('dob').value == ""){
		errors += 'You have to enter the 1st. Passenger Date of Birth.\n';
	}		
	if(IsNumeric(document.getElementById('age').value)){
		if(document.getElementById('age').value.length > 2){			
			errors += 'You have to enter the 1st. Passenger Age of Travel. Only numbers 2 digits allowed.\n';			
		}
	}else{
		errors += 'You have to enter the 1st. Passenger Age of Travel. Only numbers 2 digits allowed.\n';			
	}
	if(document.getElementById('nationality').value == ""){
		errors += 'You have to enter the 1st. Passenger Nationality.\n';
	}	
	
	for(var p=2; p <= 12; p++){
		if(document.getElementById('passenger_' + p).style.display != 'none'){
			if(document.getElementById('p' + p + '_dob').value == ""){
				errors += 'You have to enter the Date of Birth for passenger No ' + p + '.\n';
			}	
			if(IsNumeric(document.getElementById('p' + p + '_age').value)){
				if(document.getElementById('p' + p + '_age').value.length > 2 ){					
					errors += 'You have to enter the Age of Travel for passenger No ' + p + '. Only numbers 2 digits allowed.\n';					
				}
			}else{
				errors += 'You have to enter the Age of Travel for passenger No ' + p + '. Only numbers 2 digits allowed.\n';					
			}
			if(document.getElementById('p' + p + '_nationality').value == ""){
				errors += 'You have to enter the Nationality for passenger No ' + p + '.\n';
			}	
		}
	}

	if(document.getElementById('confirmation').checked == false){
		errors += 'You have to agree to the Important Information and Booking Conditions.\n';
	}		

	if(errors != ""){
		alert(errors);
		return false;
	} else {	
		for (i = 1; i <= $jq162("#no_of_compartments").val(); i ++ ) {
			document.getElementById("compartment_" + i)[document.getElementById("compartment_" + i).selectedIndex].value = document.getElementById("compartment_" + i)[document.getElementById("compartment_" + i).selectedIndex].text;
		//	alert( document.getElementById("compartment_" + i)[document.getElementById("compartment_" + i).selectedIndex].value);
		}
		return true;
		
	}
	
}

function fbrowser(fid){
	document.getElementById(fid).click(); 
	document.getElementById('hp_' + fid).value = document.getElementById(fid).value;
}

function fshow(fid){
	document.getElementById('hp_' + fid).value = document.getElementById(fid).value;
}

/* ADMIN VALIDATIONS */
function about_train_admin_val(){
}



function showPopUpCMS(popup, eid, action){
	if(action == 1){
		$("#blackback").fadeIn('fast');
		$("#" + popup).fadeIn('fast');
		document.getElementById('popup_hiddenfield').value = eid;			
	} else {
		$("#" + popup).hide();
		document.getElementById('popup_hiddenfield').value = eid;
		$("#blackback").fadeOut('fast');
	}
}

function showPopUp(popup, action){
	if(action == 1){
		$("#blackback").fadeIn('fast');
		$("#" + popup).fadeIn('fast');
	} else {
		$("#" + popup).fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}

function updateDayTextWithItLink(){
	var textbox = document.getElementById('popup_hiddenfield').value;
	var pickedcity = document.getElementById('itcity').value;
	var selectedText = GetContents(textbox);
	var newtext = "<a href='javascript: showPopUp(\"itineraryBox_" + pickedcity + "\", 1);'>" + selectedText + "</a>";
	InsertHTML(textbox, newtext);
	showPopUpCMS('ItineraryListPopUpCMS', '', 0);
}

function GetContents(editor1)
{
	if (editor1=="JourneyDay1description"){
		var oEditor = CKEDITOR.instances.JourneyDay1description;
	}else if(editor1=="JourneyDay2description"){
		var oEditor = CKEDITOR.instances.JourneyDay2description;
	}else if(editor1=="JourneyDay3description"){
		var oEditor = CKEDITOR.instances.JourneyDay3description;
	}else if(editor1=="JourneyDay4description"){
		var oEditor = CKEDITOR.instances.JourneyDay4description;
	}else if(editor1=="JourneyDay5description"){
		var oEditor = CKEDITOR.instances.JourneyDay5description;
	}else if(editor1=="JourneyDay6description"){
		var oEditor = CKEDITOR.instances.JourneyDay6description;
	}else if(editor1=="JourneyDay7description"){
		var oEditor = CKEDITOR.instances.JourneyDay7description;
	}else if(editor1=="JourneyDay8description"){
		var oEditor = CKEDITOR.instances.JourneyDay8description;
	}else if(editor1=="JourneyDay9description"){
		var oEditor = CKEDITOR.instances.JourneyDay9description;
	}else if(editor1=="JourneyDay10description"){
		var oEditor = CKEDITOR.instances.JourneyDay10description;
	}
	

	
	
	var seltext = oEditor.getSelection().getNative();
	if(seltext == ""){
		alert('You have to have a portion of the text selected.');
		showPopUpCMS('ItineraryListPopUpCMS', '', 0);
	}
	return seltext;
}


function InsertHTML(editor1, value)
{
	// Get the editor instance that we want to interact with.
	if (editor1=="JourneyDay1description"){
		var oEditor = CKEDITOR.instances.JourneyDay1description;
	}else if(editor1=="JourneyDay2description"){
		var oEditor = CKEDITOR.instances.JourneyDay2description;
	}else if(editor1=="JourneyDay3description"){
		var oEditor = CKEDITOR.instances.JourneyDay3description;
	}else if(editor1=="JourneyDay4description"){
		var oEditor = CKEDITOR.instances.JourneyDay4description;
	}else if(editor1=="JourneyDay5description"){
		var oEditor = CKEDITOR.instances.JourneyDay5description;
	}else if(editor1=="JourneyDay6description"){
		var oEditor = CKEDITOR.instances.JourneyDay6description;
	}else if(editor1=="JourneyDay7description"){
		var oEditor = CKEDITOR.instances.JourneyDay7description;
	}else if(editor1=="JourneyDay8description"){
		var oEditor = CKEDITOR.instances.JourneyDay8description;
	}else if(editor1=="JourneyDay9description"){
		var oEditor = CKEDITOR.instances.JourneyDay9description;
	}else if(editor1=="JourneyDay10description"){
		var oEditor = CKEDITOR.instances.JourneyDay10description;
	}		

	// Check the active editing mode.
	if ( oEditor.mode == 'wysiwyg' )
	{
		// Insert HTML code.
		// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertHtml
		oEditor.insertHtml( value );
	}
	else
		alert( 'You must be in WYSIWYG mode!' );

}


function GetContents_preview(editor1)
{
	if (editor1=="JourneyDay1description"){
		var oEditor = CKEDITOR.instances.JourneyDay1description;
	}else if(editor1=="JourneyDay2description"){
		var oEditor = CKEDITOR.instances.JourneyDay2description;
	}else if(editor1=="JourneyDay3description"){
		var oEditor = CKEDITOR.instances.JourneyDay3description;
	}else if(editor1=="JourneyDay4description"){
		var oEditor = CKEDITOR.instances.JourneyDay4description;
	}else if(editor1=="JourneyDay5description"){
		var oEditor = CKEDITOR.instances.JourneyDay5description;
	}else if(editor1=="JourneyDay6description"){
		var oEditor = CKEDITOR.instances.JourneyDay6description;
	}else if(editor1=="JourneyDay7description"){
		var oEditor = CKEDITOR.instances.JourneyDay7description;
	}else if(editor1=="JourneyDay8description"){
		var oEditor = CKEDITOR.instances.JourneyDay8description;
	}else if(editor1=="JourneyDay9description"){
		var oEditor = CKEDITOR.instances.JourneyDay9description;
	}else if(editor1=="JourneyDay10description"){
		var oEditor = CKEDITOR.instances.JourneyDay10description;
	}else if(editor1=="ItineraryPopupDescription"){
		var oEditor = CKEDITOR.instances.ItineraryPopupDescription;
	}else if(editor1=="HotelDescription"){
		var oEditor = CKEDITOR.instances.HotelDescription;
	}else if(editor1=="CabinDescription"){
		var oEditor = CKEDITOR.instances.CabinDescription;
	}else if(editor1=="AboutTrainCarriageDescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriageDescription;
	}else if(editor1=="AboutTrainCarriageLefttext"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriageLefttext;
	}else if(editor1=="AboutTrainCarriageRighttext"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriageRighttext;
	}else if(editor1=="InfoPageFirstboxtext"){
		var oEditor = CKEDITOR.instances.InfoPageFirstboxtext;
	}else if(editor1=="InfoPageSecondboxtext"){
		var oEditor = CKEDITOR.instances.InfoPageSecondboxtext;
	}else if(editor1=="InfoPageThirdboxtext"){
		var oEditor = CKEDITOR.instances.InfoPageThirdboxtext;
	}else if(editor1=="HomepageParagraph1"){
		var oEditor = CKEDITOR.instances.HomepageParagraph1;
	}else if(editor1=="HomepageParagraph2"){
		var oEditor = CKEDITOR.instances.HomepageParagraph2;
	}else if(editor1=="AboutTrainToplefttext"){
		var oEditor = CKEDITOR.instances.AboutTrainToplefttext;
	}else if(editor1=="AboutTrainCarriage0Shortdescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriage0Shortdescription;
	}else if(editor1=="AboutTrainCarriage1Shortdescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriage1Shortdescription;
	}else if(editor1=="AboutTrainCarriage2Shortdescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriage2Shortdescription;
	}else if(editor1=="AboutTrainCarriage3Shortdescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriage3Shortdescription;
	}else if(editor1=="AboutTrainCarriage4Shortdescription"){
		var oEditor = CKEDITOR.instances.AboutTrainCarriage4Shortdescription;
	}else if(editor1=="AboutTrainLefttext"){
		var oEditor = CKEDITOR.instances.AboutTrainLefttext;
	}else if(editor1=="AboutTrainRighttext"){
		var oEditor = CKEDITOR.instances.AboutTrainRighttext;
	}else if(editor1=="JourneyHeadertext"){
		var oEditor = CKEDITOR.instances.JourneyHeadertext;
	}else if(editor1=="JourneyIncludedtext1"){
		var oEditor = CKEDITOR.instances.JourneyIncludedtext1;
	}else if(editor1=="JourneyIncludedtext2"){
		var oEditor = CKEDITOR.instances.JourneyIncludedtext2;
	}else if(editor1=="JourneyIncludedtext3"){
		var oEditor = CKEDITOR.instances.JourneyIncludedtext3;
	}else if(editor1=="JourneyIncludedtext4"){
		var oEditor = CKEDITOR.instances.JourneyIncludedtext4;
	}else if(editor1=="JourneyDay1description"){
		var oEditor = CKEDITOR.instances.JourneyDay1description;
	}else if(editor1=="JourneyDay2description"){
		var oEditor = CKEDITOR.instances.JourneyDay2description;
	}else if(editor1=="JourneyDay3description"){
		var oEditor = CKEDITOR.instances.JourneyDay3description;
	}else if(editor1=="JourneyDay4description"){
		var oEditor = CKEDITOR.instances.JourneyDay4description;
	}else if(editor1=="JourneyDay5description"){
		var oEditor = CKEDITOR.instances.JourneyDay5description;
	}else if(editor1=="JourneyDay6description"){
		var oEditor = CKEDITOR.instances.JourneyDay6description;
	}else if(editor1=="JourneyDay7description"){
		var oEditor = CKEDITOR.instances.JourneyDay7description;
	}else if(editor1=="JourneyDay8description"){
		var oEditor = CKEDITOR.instances.JourneyDay8description;
	}else if(editor1=="JourneyDay9description"){
		var oEditor = CKEDITOR.instances.JourneyDay9description;
	}else if(editor1=="JourneyDay10description"){
		var oEditor = CKEDITOR.instances.JourneyDay10description;
	}
		
	var fulltext = oEditor.getData();
	return fulltext;
}


/*IMAGES PREVIEW*/
$(function() {

  // File target is a <input type="file" />
  $("#file-target").change(function() {
    
    // Browser supports `files` as part of DOM
    if (this.files) {
    
      //  This works in Firefox, #image-preview is an <img src="" />
      $("#image-preview").attr("src", this.files[0].getAsDataURL());
      
    } else {
    
      // This is just wishful thinking, but it's a security issue so the value of the input is never
      // a true local file path
      $("#image-preview").attr("src", $("#file-target").val());
    
    }
    
    // Firefox gives you a file name
    // Safari / Chrome gives you nothing
    // IE / Opera gives you a weird /fakepath/filename.ext
    $("#file-upload-area").append($("#file-target").val());
    
    $("#preview-area").show();
  
  });

});
/*IMAGES PREVIEW*/

/* -------------- PREVIEW FUNCTIONS ------------------ */
function showItineraryPreview(act){
	if(act == 1){
				
		var filename = document.getElementById('ItineraryPopupHeaderPicture1');
		if(filename.value == "" || !filename.value){
			filename = document.getElementById('hp1img').src;
			document.getElementById('itpreview_img').src = filename;
		} else {
			$("#itpreview_img").attr("src", filename.files[0].getAsDataURL());
		}
		
		var title = document.getElementById('ItineraryPopupName').value;
		var descr = GetContents_preview('ItineraryPopupDescription');
		
		document.getElementById('itpreview_title').innerHTML = title;
		document.getElementById('itpreview_desc').innerHTML = descr;
		
		$("#blackback").fadeIn('fast');
		$("#ItineraryFullBoxPopUp").fadeIn('fast');
		
	} else {
		$("#ItineraryFullBoxPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}


function showHotelPreview(act){
	if(act == 1){
	
		var filename1 = document.getElementById('HotelHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('hp1hotel').src;
			document.getElementById('hotelpreview_img1').src = filename1;
		} else {
			$("#hotelpreview_img1").attr("src", filename1.files[0].getAsDataURL());
		}	

		var title = document.getElementById('HotelName').value;
		var cityname = document.getElementById('HotelCityName').value;
		var descr = GetContents_preview('HotelDescription');
		
		document.getElementById('hotelpreview_title1').innerHTML = title;
		document.getElementById('hotelpreview_cityname1').innerHTML = cityname;
		document.getElementById('hotelpreview_title2').innerHTML = title;
		document.getElementById('hotelpreview_cityname2').innerHTML = cityname;
		document.getElementById('hotelpreview_desc').innerHTML = descr;
		
		$("#blackback").fadeIn('fast');
		$("#hotelsPopUp").fadeIn('fast');
		
	} else {
		$("#hotelsPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}

function showCabinPreview(act){
	if(act == 1){
	
		var filename1 = document.getElementById('CabinHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('cabinpic1how').src;
			document.getElementById('cabin_pic1').src = filename1;
			document.getElementById('cabin_pic1a').src = filename1;
		} else {
			$("#cabin_pic1").attr("src", filename1.files[0].getAsDataURL());
			$("#cabin_pic1a").attr("src", filename1.files[0].getAsDataURL());
		}			
		var filename2 = document.getElementById('CabinHeaderPicture2');
		if(filename2.value == "" || !filename2.value){
			filename2 = document.getElementById('cabinpic2how').src;
			document.getElementById('cabin_pic2').src = filename2;
		} else {
			$("#cabin_pic2").attr("src", filename2.files[0].getAsDataURL());
		}	
		var filename3 = document.getElementById('CabinHeaderPicture3');
		if(filename3.value == "" || !filename3.value){
			filename3 = document.getElementById('cabinpic3how').src;
			document.getElementById('cabin_pic3').src = filename3;
		} else {
			$("#cabin_pic3").attr("src", filename3.files[0].getAsDataURL());
		}				

		var title = document.getElementById('CabinName').value;
		var descr = GetContents_preview('CabinDescription');
		
		document.getElementById('cabinTitle').innerHTML = title;
		document.getElementById('cabindesc').innerHTML = descr;
		
		$("#blackback").fadeIn('fast');
		$("#cabinsPopUp").fadeIn('fast');
		
	} else {
		$("#cabinsPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}


function showCarriagePreview(act){
	if(act == 1){
	
		var filename1 = document.getElementById('AboutTrainCarriageHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('carrprevimg_1').src;
			document.getElementById('carriagebackimage').style.backgroundImage = 'url(' + filename1 + ')';
			document.getElementById('carriagesmallpic1').src = filename1;
		} else {
			$("#carriagebackimage").css('background-image', 'url(' +filename1.files[0].getAsDataURL()+ ')');			
			$("#carriagesmallpic1").attr("src",  filename1.files[0].getAsDataURL());
		}	

		var filename2 = document.getElementById('AboutTrainCarriageHeaderPicture2');
		if(filename2.value == "" || !filename2.value){
			filename2 = document.getElementById('carrprevimg_2').src;
			document.getElementById('carriagesmallpic2').src = filename2;
		} else {
			$("#carriagesmallpic2").attr("src", filename2.files[0].getAsDataURL());
		}			

		var filename3 = document.getElementById('AboutTrainCarriageHeaderPicture3');
		if(filename3.value == "" || !filename3.value){
			filename3 = document.getElementById('carrprevimg_3').src;
			document.getElementById('carriagesmallpic3').src = filename3;
		} else {
			$("#carriagesmallpic3").attr("src", filename3.files[0].getAsDataURL());
		}	
		
		var filename4 = document.getElementById('AboutTrainCarriageHeaderPicture4');
		if(filename4.value == "" || !filename4.value){
			filename4 = document.getElementById('carrprevimg_4').src;
			document.getElementById('carriagesmallpic4').src = filename4;
		} else {
			$("#carriagesmallpic4").attr("src", filename4.files[0].getAsDataURL());
		}			
		
		
		var title = document.getElementById('AboutTrainCarriageName').value;
		var descr = GetContents_preview('AboutTrainCarriageDescription');
		var lefttitle = document.getElementById('AboutTrainCarriageLefttitle').value;
		var lefttext = GetContents_preview('AboutTrainCarriageLefttext');
		var righttitle = document.getElementById('AboutTrainCarriageRighttitle').value;
		var righttext = GetContents_preview('AboutTrainCarriageRighttext');
		
		document.getElementById('carriagetitle').innerHTML = title;
		document.getElementById('carriagedesc').innerHTML = descr;
		document.getElementById('carrletftitle').innerHTML = lefttitle;
		document.getElementById('carrletftext').innerHTML = lefttext;
		document.getElementById('carrrighttitle').innerHTML = righttitle;
		document.getElementById('carrrighttext').innerHTML = righttext;
		
		$("#blackback").fadeIn('fast');
		$("#carriagesPopUp").fadeIn('fast');
		
	} else {
		$("#carriagesPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}

function showHolidayExtentionPreview(act){
	if(act == 1){
	
		var descr1 = GetContents_preview('InfoPageFirstboxtext');
		var descr2 = GetContents_preview('InfoPageSecondboxtext');
		var descr3 = GetContents_preview('InfoPageThirdboxtext');		
		
		document.getElementById('holidaytext1').innerHTML = descr1;
		document.getElementById('holidaytext2').innerHTML = descr2;
		document.getElementById('holidaytext3').innerHTML = descr3;
		
		$("#blackback").fadeIn('fast');
		$("#holidayPopUp").fadeIn('fast');
		
	} else {
		$("#holidayPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}

function showInsurancePreview(act){
	if(act == 1){

		var title = document.getElementById('InfoPagePageheading').value;			
		var descr = GetContents_preview('InfoPageFirstboxtext');

		document.getElementById('institle').innerHTML = title;
		document.getElementById('insdesc').innerHTML = descr;
		
		$("#blackback").fadeIn('fast');
		$("#insurancePopUp").fadeIn('fast');
		
	} else {
		$("#insurancePopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}



function showInfoPagesPreview(act){
	if(act == 1){

		var leftData = "";
		var rightData = "";
		
		var InfoPagePageheading = document.getElementById('InfoPagePageheading').value;
		
		var InfoPageFirstboxheading = document.getElementById('InfoPageFirstboxheading').value;
		var InfoPageFirstBoxPositition = document.getElementById('InfoPageFirstBoxPositition').value;
		var InfoPageFirstboxtext = GetContents_preview('InfoPageFirstboxtext');
		
		var InfoPageSecondboxheading = document.getElementById('InfoPageSecondboxheading').value;
		var InfoPageSecondBoxPositition = document.getElementById('InfoPageSecondBoxPositition').value;
		var InfoPageSecondboxtext = GetContents_preview('InfoPageSecondboxtext');

		var InfoPageVideo1code = document.getElementById('InfoPageVideo1code').value;
		var InfoPageVideo1Position = document.getElementById('InfoPageVideo1Position').value;
		var InfoPageVideo2code = document.getElementById('InfoPageVideo2code').value;
		var InfoPageVideo2Position = document.getElementById('InfoPageVideo2Position').value;
		
		
		
		if(InfoPageFirstBoxPositition == 'left'){
			leftData += "<p><span class='title_black18'>" + InfoPageFirstboxheading + "</span></p>";
			leftData += InfoPageFirstboxtext;
		} else {
			rightData += "<p><span class='title_black18'>" + InfoPageFirstboxheading + "</span></p>";
			rightData += InfoPageFirstboxtext;
		}

		if(InfoPageSecondBoxPositition == 'left'){
			leftData += "<p><span class='title_black18'>" + InfoPageSecondboxheading + "</span></p>";
			leftData += InfoPageSecondboxtext;
		} else {
			rightData += "<p><span class='title_black18'>" + InfoPageSecondboxheading + "</span></p>";
			rightData += InfoPageSecondboxtext;
		}

		if(InfoPageVideo1code != ""){
			if(InfoPageVideo1Position == 'left'){
				leftData += "<br /><iframe width='454' height='254' src='" + InfoPageVideo1code + "?rel=0' frameborder='0' allowfullscreen></iframe><br /><br />";
			} else {
				rightData += "<br /><iframe width='454' height='254' src='" + InfoPageVideo1code + "?rel=0' frameborder='0' allowfullscreen></iframe><br /><br />";
			}	
		}

		if(InfoPageVideo2code != ""){
			if(InfoPageVideo2Position == 'left'){
				leftData += "<br /><iframe width='454' height='254' src='" + InfoPageVideo2code + "?rel=0' frameborder='0' allowfullscreen></iframe><br /><br />";
			} else {
				rightData += "<br /><iframe width='454' height='254' src='" + InfoPageVideo2code + "?rel=0' frameborder='0' allowfullscreen></iframe><br /><br />";
			}			
		}
		
		document.getElementById('pheading').innerHTML = InfoPagePageheading;
		document.getElementById('leftData').innerHTML = leftData;
		document.getElementById('rightData').innerHTML = rightData;
		
		$("#blackback").fadeIn('fast');
		$("#infopagesPopUp").fadeIn('fast');
		
	} else {
		$("#infopagesPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}


function showHomepagePreview(act){
	if(act == 1){

		var filename1 = document.getElementById('HomepageHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('homepagepic_1').src;
			var img1 = filename1;
		} else {
			var img1 = filename1.files[0].getAsDataURL();
		}	
		
		var filename2 = document.getElementById('HomepageHeaderPicture2');
		if(filename2.value == "" || !filename2.value){
			filename2 = document.getElementById('homepagepic_2').src;
			var img2 = filename2;
		} else {
			var img2 = filename2.files[0].getAsDataURL();
		}			
		
		var filename3 = document.getElementById('HomepageHeaderPicture3');
		if(filename3.value == "" || !filename3.value){
			filename3 = document.getElementById('homepagepic_3').src;
			var img3 = filename3;
		} else {
			var img3 = filename3.files[0].getAsDataURL();
		}			
	
	
		images2 = [img1, img2, img3];	
		var showtime = 3000;
		var transitiontime = 5000;
		$('#picture_homepage').bgImageTween(images2, showtime, transitiontime );
	
		var hometitle = document.getElementById('HomepageHeadline').value;			
		var title1 = document.getElementById('HomepageParagraph1Heading').value;			
		var title2 = document.getElementById('HomepageParagraph2Heading').value;			
		var descr1 = GetContents_preview('HomepageParagraph1');
		var descr2 = GetContents_preview('HomepageParagraph2');

		document.getElementById('hometitle').innerHTML = hometitle;
		document.getElementById('title1').innerHTML = title1;
		document.getElementById('title2').innerHTML = title2;
		document.getElementById('text1').innerHTML = descr1;
		document.getElementById('text2').innerHTML = descr2;
		
		if(hometitle == 'undefined'){hometitle = '';}
		if(title1 == 'undefined'){title1 = '';}
		if(title2 == 'undefined'){title2 = '';}
		if(descr1 == 'undefined'){descr1 = '';}
		if(descr2 == 'undefined'){descr2 = '';}
		
		$("#blackback").fadeIn('fast');
		$("#homepagePopUp").fadeIn('fast');
		
	} else {
		$("#homepagePopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}


function showAboutTrainPreview(act){
	if(act == 1){
	
		var filename1 = document.getElementById('AboutTrainHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('abouttrainmainpic_1').src;
			document.getElementById('trainbackimage').style.backgroundImage = 'url(' + filename1 + ')';
			document.getElementById('abtrainpic1').src = filename1;
		} else {
			$("#trainbackimage").css('background-image', 'url(' +filename1.files[0].getAsDataURL()+ ')');			
			$("#abtrainpic1").attr("src",  filename1.files[0].getAsDataURL());
		}	

		var filename2 = document.getElementById('AboutTrainHeaderPicture2');
		if(filename2.value == "" || !filename2.value){
			filename2 = document.getElementById('abouttrainmainpic_2').src;
			document.getElementById('abtrainpic2').src = filename2;
		} else {
			$("#abtrainpic2").attr("src", filename2.files[0].getAsDataURL());
		}			

		var filename3 = document.getElementById('AboutTrainHeaderPicture3');
		if(filename3.value == "" || !filename3.value){
			filename3 = document.getElementById('abouttrainmainpic_3').src;
			document.getElementById('abtrainpic3').src = filename3;
		} else {
			$("#abtrainpic3").attr("src", filename3.files[0].getAsDataURL());
		}	
		
		var filename4 = document.getElementById('AboutTrainHeaderPicture4');
		if(filename4.value == "" || !filename4.value){
			filename4 = document.getElementById('abouttrainmainpic_4').src;
			document.getElementById('abtrainpic4').src = filename4;
		} else {
			$("#abtrainpic4").attr("src", filename4.files[0].getAsDataURL());
		}			
			
		
		var AboutTrainToptitle = document.getElementById('AboutTrainToptitle').value;
		var AboutTrainLefttitle = document.getElementById('AboutTrainLefttitle').value;
		var AboutTrainRighttitle = document.getElementById('AboutTrainRighttitle').value;
		var AboutTrainVideocode1 = document.getElementById('AboutTrainVideocode1').value;
		var AboutTrainVideocode2 = document.getElementById('AboutTrainVideocode2').value;		
		var AboutTrainCarriage0Name = document.getElementById('AboutTrainCarriage0Name').value;
		var AboutTrainCarriage1Name = document.getElementById('AboutTrainCarriage1Name').value;
		var AboutTrainCarriage2Name = document.getElementById('AboutTrainCarriage2Name').value;
		var AboutTrainCarriage3Name = document.getElementById('AboutTrainCarriage3Name').value;
		var AboutTrainCarriage4Name = document.getElementById('AboutTrainCarriage4Name').value;
		
		var AboutTrainToplefttext = GetContents_preview('AboutTrainToplefttext');
		var AboutTrainCarriage0Shortdescription = GetContents_preview('AboutTrainCarriage0Shortdescription');
		var AboutTrainCarriage1Shortdescription = GetContents_preview('AboutTrainCarriage1Shortdescription');
		var AboutTrainCarriage2Shortdescription = GetContents_preview('AboutTrainCarriage2Shortdescription');
		var AboutTrainCarriage3Shortdescription = GetContents_preview('AboutTrainCarriage3Shortdescription');
		var AboutTrainCarriage4Shortdescription = GetContents_preview('AboutTrainCarriage4Shortdescription');
		var AboutTrainLefttext = GetContents_preview('AboutTrainLefttext');
		var AboutTrainRighttext = GetContents_preview('AboutTrainRighttext');
		
		document.getElementById('at_toptitle').innerHTML = AboutTrainToptitle;
		document.getElementById('at_lefttitle').innerHTML = AboutTrainLefttitle;
		document.getElementById('at_righttitle').innerHTML = AboutTrainRighttitle;
		
		document.getElementById('at_video1').innerHTML = "<iframe width='454' height='254' src='" + AboutTrainVideocode1 + "'?rel=0' frameborder='0' allowfullscreen></iframe>";
		document.getElementById('at_video2').innerHTML = "<iframe width='454' height='254' src='" + AboutTrainVideocode2 + "'?rel=0' frameborder='0' allowfullscreen></iframe>";
		
		document.getElementById('carrname0').innerHTML = AboutTrainCarriage0Name;
		document.getElementById('carrname1').innerHTML = AboutTrainCarriage1Name;
		document.getElementById('carrname2').innerHTML = AboutTrainCarriage2Name;
		document.getElementById('carrname3').innerHTML = AboutTrainCarriage3Name;
		document.getElementById('carrname4').innerHTML = AboutTrainCarriage4Name;
		
		document.getElementById('at_lefttext').innerHTML = AboutTrainToplefttext;
		document.getElementById('carrtext0').innerHTML = AboutTrainCarriage0Shortdescription;
		document.getElementById('carrtext1').innerHTML = AboutTrainCarriage1Shortdescription;
		document.getElementById('carrtext2').innerHTML = AboutTrainCarriage2Shortdescription;
		document.getElementById('carrtext3').innerHTML = AboutTrainCarriage3Shortdescription;
		document.getElementById('carrtext4').innerHTML = AboutTrainCarriage4Shortdescription;
		document.getElementById('at_lefttext2').innerHTML = AboutTrainLefttext;
		document.getElementById('at_righttext').innerHTML = AboutTrainRighttext;
		
		$("#blackback").fadeIn('fast');
		$("#abouttrainPopUp").fadeIn('fast');
		
	} else {
		$("#abouttrainPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}


function showJourneyPreview(act){
	if(act == 1){
	PopAbierto = "Journey";
		var filename1 = document.getElementById('JourneyHeaderPicture1');
		if(filename1.value == "" || !filename1.value){
			filename1 = document.getElementById('journeyupimg_1').src;
			var img1 = filename1;
		} else {
			var img1 = filename1.files[0].getAsDataURL();
		}
		var filename2 = document.getElementById('JourneyHeaderPicture2');
		if(filename2.value == "" || !filename2.value){
			filename2 = document.getElementById('journeyupimg_2').src;
			var img2 = filename2;
		} else {
			var img2 = filename2.files[0].getAsDataURL();
		}
		var filename3 = document.getElementById('JourneyHeaderPicture3');
		if(filename3.value == "" || !filename3.value){
			filename3 = document.getElementById('journeyupimg_3').src;
			var img3 = filename3;
		} else {
			var img3 = filename3.files[0].getAsDataURL();
		}
		var filename4 = document.getElementById('JourneyHeaderPicture4');
		if(filename4.value == "" || !filename4.value){
			filename4 = document.getElementById('journeyupimg_4').src;
			var img4 = filename4;
		} else {
			var img4 = filename4.files[0].getAsDataURL();
		}
		var filename5 = document.getElementById('JourneyHeaderPicture5');
		if(filename5.value == "" || !filename5.value){
			filename5 = document.getElementById('journeyupimg_5').src;
			var img5 = filename5;
		} else {
			var img5 = filename5.files[0].getAsDataURL();
		}		
		var filename6 = document.getElementById('JourneyHeaderPicture6');
		if(filename6.value == "" || !filename6.value){
			filename6 = document.getElementById('journeyupimg_6').src;
			var img6 = filename6;
		} else {
			var img6 = filename6.files[0].getAsDataURL();
		}		
		var filename7 = document.getElementById('JourneyHeaderPicture7');
		if(filename7.value == "" || !filename7.value){
			filename7 = document.getElementById('journeyupimg_7').src;
			var img7 = filename7;
		} else {
			var img7 = filename7.files[0].getAsDataURL();
		}		
		var filename8 = document.getElementById('JourneyHeaderPicture8');
		if(filename8.value == "" || !filename8.value){
			filename8 = document.getElementById('journeyupimg_8').src;
			var img8 = filename8;
		} else {
			var img8 = filename8.files[0].getAsDataURL();
		}		
		var filename9 = document.getElementById('JourneyHeaderPicture9');
		if(filename9.value == "" || !filename9.value){
			filename9 = document.getElementById('journeyupimg_9').src;
			var img9 = filename9;
		} else {
			var img9 = filename9.files[0].getAsDataURL();
		}		
		var filename10 = document.getElementById('JourneyHeaderPicture10');
		if(filename10.value == "" || !filename10.value){
			filename10 = document.getElementById('journeyupimg_10').src;
			var img10 = filename10;
		} else {
			var img10 = filename10.files[0].getAsDataURL();
		}		
		var filename11 = document.getElementById('JourneyHeaderPicture11');
		if(filename11.value == "" || !filename11.value){
			filename11 = document.getElementById('journeyupimg_11').src;
			var img11 = filename11;
		} else {
			var img11 = filename11.files[0].getAsDataURL();			
		}		
		var filename12 = document.getElementById('JourneyHeaderPicture12');
		if(filename12.value == "" || !filename12.value){
			filename12 = document.getElementById('journeyupimg_12').src;
			var img12 = filename12;
		} else {
			var img12 = filename12.files[0].getAsDataURL();
		}		
		var filename13 = document.getElementById('JourneyHeaderPicture13');
		if(filename13.value == "" || !filename13.value){
			filename13 = document.getElementById('journeyupimg_13').src;
			var img13 = filename13;
		} else {
			var img13 = filename13.files[0].getAsDataURL();
		}		
		var filename15 = document.getElementById('JourneyHeaderPicture15');
		if(filename15.value == "" || !filename15.value){
			filename15 = document.getElementById('journeyupimg_15').src;
			var img15 = filename15;
		} else {
			var img15 = filename15.files[0].getAsDataURL();
		}		
	
		var images3 = [img1, img2, img3];	
		var showtime = 3000;
		var transitiontime = 5000;
		$('#picture_frame').bgImageTween(images3, showtime, transitiontime );
	

			$("#accordion").tabs("#accordion div", {
				tabs: 'img', 
				effect: 'horizontal',
				initialIndex: 'mapc'
			});	
	
		var aJourneyHeaderheadline = document.getElementById('JourneyHeaderheadline').value;
			
		var aJourneyDay1title = document.getElementById('JourneyDay1title').value;
		var aJourneyDay2title = document.getElementById('JourneyDay2title').value;
		var aJourneyDay3title = document.getElementById('JourneyDay3title').value;
		var aJourneyDay4title = document.getElementById('JourneyDay4title').value;
		var aJourneyDay5title = document.getElementById('JourneyDay5title').value;
		var aJourneyDay6title = document.getElementById('JourneyDay6title').value;
		var aJourneyDay7title = document.getElementById('JourneyDay7title').value;
		var aJourneyDay8title = document.getElementById('JourneyDay8title').value;
		var aJourneyDay9title = document.getElementById('JourneyDay9title').value;
		var aJourneyDay10title = document.getElementById('JourneyDay10title').value;
		var aJourneyMaptitle = document.getElementById('JourneyMaptitle').value;
		
		if(aJourneyMaptitle == 'undefined' || aJourneyMaptitle == ''){
			aJourneyMaptitle = ''; mapti = 'none'; mapc = 'none';
			document.getElementById('aJourneyMaptitle').style.display = 'none';
		}else{
			document.getElementById('aJourneyMaptitle').innerHTML = aJourneyMaptitle;
		}
		
		var aJourneyHeadertext = GetContents_preview('JourneyHeadertext');		
		
		var aJourneyIncludedtext1 = GetContents_preview('JourneyIncludedtext1');
		var aJourneyIncludedtext2 = GetContents_preview('JourneyIncludedtext2');
		var aJourneyIncludedtext3 = GetContents_preview('JourneyIncludedtext3');
		var aJourneyIncludedtext4 = GetContents_preview('JourneyIncludedtext4');		
		
		var aJourneyDay1description = GetContents_preview('JourneyDay1description');
		var aJourneyDay2description = GetContents_preview('JourneyDay2description');
		var aJourneyDay3description = GetContents_preview('JourneyDay3description');
		var aJourneyDay4description = GetContents_preview('JourneyDay4description');
		var aJourneyDay5description = GetContents_preview('JourneyDay5description');
		var aJourneyDay6description = GetContents_preview('JourneyDay6description');
		var aJourneyDay7description = GetContents_preview('JourneyDay7description');
		var aJourneyDay8description = GetContents_preview('JourneyDay8description');
		var aJourneyDay9description = GetContents_preview('JourneyDay9description');
		var aJourneyDay10description = GetContents_preview('JourneyDay10description');

		document.getElementById('aJourneyHeaderheadline').innerHTML = aJourneyHeaderheadline;
		document.getElementById('aJourneyHeaderheadline2').innerHTML = aJourneyHeaderheadline;
		document.getElementById('aJourneyHeadertext').innerHTML = aJourneyHeadertext;
		document.getElementById('aJourneyIncludedtext1').innerHTML = aJourneyIncludedtext1;
		document.getElementById('aJourneyIncludedtext2').innerHTML = aJourneyIncludedtext2;
		document.getElementById('aJourneyIncludedtext3').innerHTML = aJourneyIncludedtext3;
		document.getElementById('aJourneyIncludedtext4').innerHTML = aJourneyIncludedtext4;
		document.getElementById('pdaytitle_1').innerHTML = "Day 1 - " + aJourneyDay1title;
		document.getElementById('pdaytitle_2').innerHTML = "Day 2 - " + aJourneyDay2title;
		document.getElementById('pdaytitle_3').innerHTML = "Day 3 - " + aJourneyDay3title;
		document.getElementById('pdaytitle_4').innerHTML = "Day 4 - " + aJourneyDay4title;
		document.getElementById('pdaytitle_5').innerHTML = "Day 5 - " + aJourneyDay5title;
		document.getElementById('pdaytitle_6').innerHTML = "Day 6 - " + aJourneyDay6title;
		document.getElementById('pdaytitle_7').innerHTML = "Day 7 - " + aJourneyDay7title;
		document.getElementById('pdaytitle_8').innerHTML = "Day 8 - " + aJourneyDay8title;
		document.getElementById('pdaytitle_9').innerHTML = "Day 9 - " + aJourneyDay9title;
		document.getElementById('pdaytitle_10').innerHTML = "Day 10 - " + aJourneyDay10title;
		
		
		document.getElementById('aJourneyDay1description').innerHTML = aJourneyDay1description;
		document.getElementById('aJourneyDay2description').innerHTML = aJourneyDay2description;
		document.getElementById('aJourneyDay3description').innerHTML = aJourneyDay3description;
		document.getElementById('aJourneyDay4description').innerHTML = aJourneyDay4description;
		document.getElementById('aJourneyDay5description').innerHTML = aJourneyDay5description;
		document.getElementById('aJourneyDay6description').innerHTML = aJourneyDay6description;
		document.getElementById('aJourneyDay7description').innerHTML = aJourneyDay7description;
		document.getElementById('aJourneyDay8description').innerHTML = aJourneyDay8description;
		document.getElementById('aJourneyDay9description').innerHTML = aJourneyDay9description;
		document.getElementById('aJourneyDay10description').innerHTML = aJourneyDay10description;
		

		
		
		document.getElementById('pdaybackimage_1').style.backgroundImage = "url(" + img4 + ")";
		document.getElementById('pdaybackimage_2').style.backgroundImage = "url(" + img5 + ")";
		document.getElementById('pdaybackimage_3').style.backgroundImage = "url(" + img6 + ")";
		document.getElementById('pdaybackimage_4').style.backgroundImage = "url(" + img7 + ")";
		document.getElementById('pdaybackimage_5').style.backgroundImage = "url(" + img8 + ")";
		document.getElementById('pdaybackimage_6').style.backgroundImage = "url(" + img9 + ")";
		document.getElementById('pdaybackimage_7').style.backgroundImage = "url(" + img10 + ")";
		document.getElementById('pdaybackimage_8').style.backgroundImage = "url(" + img11 + ")";
		document.getElementById('pdaybackimage_9').style.backgroundImage = "url(" + img12 + ")";
		document.getElementById('pdaybackimage_10').style.backgroundImage = "url(" + img15 + ")";
		document.getElementById('mapc').style.backgroundImage = "url(" + img13 + ")";
		

		var activeday_1 = 'none';
		var activeday_2 = 'none';
		var activeday_3 = 'none';
		var activeday_4 = 'none';
		var activeday_5 = 'none';
		var activeday_6 = 'none';
		var activeday_7 = 'none';
		var activeday_8 = 'none';
		var activeday_9 = 'none';
		var activeday_10 = 'none';
		var mapc = 'none';
		var mapti = 'block';
		var activedayimg_1 = '';
		var activedayimg_2 = '';
		var activedayimg_3 = '';
		var activedayimg_4 = '';
		var activedayimg_5 = '';
		var activedayimg_6 = '';
		var activedayimg_7 = '';
		var activedayimg_8 = '';
		var activedayimg_9 = '';
		var activedayimg_10 = '';
		
		if(aJourneyHeaderheadline == 'undefined'){aJourneyHeaderheadline = '';}
		if(aJourneyHeadertext == 'undefined'){aJourneyHeadertext = '';}
		if(aJourneyIncludedtext1 == 'undefined'){aJourneyIncludedtext1 = '';}
		if(aJourneyIncludedtext2 == 'undefined'){aJourneyIncludedtext2 = '';}
		if(aJourneyIncludedtext3 == 'undefined'){aJourneyIncludedtext3 = '';}
		if(aJourneyIncludedtext4 == 'undefined'){aJourneyIncludedtext4 = '';}
		if(aJourneyDay1title == 'undefined' || aJourneyDay1title == ''){aJourneyDay1title = ''; activeday_1 = 'none'; activedayimg_1 = 'none';}
		if(aJourneyDay2title == 'undefined' || aJourneyDay2title == ''){aJourneyDay2title = ''; activeday_2 = 'none'; activedayimg_2 = 'none';}
		if(aJourneyDay3title == 'undefined' || aJourneyDay3title == ''){aJourneyDay3title = ''; activeday_3 = 'none'; activedayimg_3 = 'none';}
		if(aJourneyDay4title == 'undefined' || aJourneyDay4title == ''){aJourneyDay4title = ''; activeday_4 = 'none'; activedayimg_4 = 'none';}
		if(aJourneyDay5title == 'undefined' || aJourneyDay5title == ''){aJourneyDay5title = ''; activeday_5 = 'none'; activedayimg_5 = 'none';}
		if(aJourneyDay6title == 'undefined' || aJourneyDay6title == ''){aJourneyDay6title = ''; activeday_6 = 'none'; activedayimg_6 = 'none';}
		if(aJourneyDay7title == 'undefined' || aJourneyDay7title == ''){aJourneyDay7title = ''; activeday_7 = 'none'; activedayimg_7 = 'none';}
		if(aJourneyDay8title == 'undefined' || aJourneyDay8title == ''){aJourneyDay8title = ''; activeday_8 = 'none'; activedayimg_8 = 'none';}
		if(aJourneyDay9title == 'undefined' || aJourneyDay9title == ''){aJourneyDay9title = ''; activeday_9 = 'none'; activedayimg_9 = 'none';}
		if(aJourneyDay10title == 'undefined' || aJourneyDay10title == ''){aJourneyDay10title = ''; activeday_10 = 'none'; activedayimg_10 = 'none';}
		
		
		if(aJourneyDay1description == 'undefined'){aJourneyDay1description = '';}
		if(aJourneyDay2description == 'undefined'){aJourneyDay2description = '';}
		if(aJourneyDay3description == 'undefined'){aJourneyDay3description = '';}
		if(aJourneyDay4description == 'undefined'){aJourneyDay4description = '';}
		if(aJourneyDay5description == 'undefined'){aJourneyDay5description = '';}
		if(aJourneyDay6description == 'undefined'){aJourneyDay6description = '';}
		if(aJourneyDay7description == 'undefined'){aJourneyDay7description = '';}
		if(aJourneyDay8description == 'undefined'){aJourneyDay8description = '';}
		if(aJourneyDay9description == 'undefined'){aJourneyDay9description = '';}
		if(aJourneyDay10description == 'undefined'){aJourneyDay10description = '';}
		
		
		document.getElementById('activeday_1').style.display = activeday_1;
		document.getElementById('activeday_2').style.display = activeday_2;
		document.getElementById('activeday_3').style.display = activeday_3;
		document.getElementById('activeday_4').style.display = activeday_4;
		document.getElementById('activeday_5').style.display = activeday_5;
		document.getElementById('activeday_6').style.display = activeday_6;
		document.getElementById('activeday_7').style.display = activeday_7;
		document.getElementById('activeday_8').style.display = activeday_8;
		document.getElementById('activeday_9').style.display = activeday_9;
		document.getElementById('activeday_10').style.display = activeday_10;

		document.getElementById('activedayimg_1').style.display = activedayimg_1;
		document.getElementById('activedayimg_2').style.display = activedayimg_2;
		document.getElementById('activedayimg_3').style.display = activedayimg_3;
		document.getElementById('activedayimg_4').style.display = activedayimg_4;
		document.getElementById('activedayimg_5').style.display = activedayimg_5;
		document.getElementById('activedayimg_6').style.display = activedayimg_6;
		document.getElementById('activedayimg_7').style.display = activedayimg_7;
		document.getElementById('activedayimg_8').style.display = activedayimg_8;
		document.getElementById('activedayimg_9').style.display = activedayimg_9;
		document.getElementById('activedayimg_10').style.display = activedayimg_10;		
		document.getElementById('mapti').style.display = mapti;	
		
		
		
		$("#blackback").fadeIn('fast');
		$("#journeyPopUp").fadeIn('fast');
		
	} else {
		PopAbierto = "";
		$("#journeyPopUp").fadeOut('fast');
		$("#blackback").fadeOut('fast');
	}
}
/* -------------- PREVIEW FUNCTIONS ------------------ */

