/**
 * @fileOverview All JS-code for cineworld.nl
 * @author Wouter Bos
 * @since 1.0 - 2011-1-10
 * @version 1.0 - 2011-1-10
 */




if (typeof (nl) == "undefined") {
	/**
	 * @namespace Top Level Domain
	 */
	var nl = {}
}
if (typeof(nl.cineworld) == "undefined") {
	/**
	 * @namespace Domain name
	 */
	nl.cineworld = {}
}






/**
 * @namespace Fallback for teblets.
 * 
 * @example
 * nl.cineworld.swipeFallback()
 */
nl.cineworld.swipeFallback = function() {
	jQuery('#Menu2 > ul > li').click(function() {
		if (jQuery(this).hasClass('hover')) {
			jQuery(this).removeClass('hover');
		} else {
			jQuery(this).addClass('hover');
		}
	})
};






/**
 * @namespace Makes pager centered.
 * 
 * The function calculates the leftover space between de pager and its parent
 * and adds it as margin to the pager
 * 
 * @example
 * nl.cineworld.positionPager('div')
 */
nl.cineworld.positionPager = function(selector) {
	jQuery(selector).each( function() {
		if (jQuery('body.GalleriesDetail, body.Search').size() == 0) {
			jQuery(this).find('ol').css('width', (jQuery(this).find('ol a').outerWidth(true) * jQuery(this).find('ol a').size()) +"px")
			jQuery(this).css('width', (jQuery(this).find('ol').outerWidth(true) + (jQuery(this).find('> a > span').outerWidth(true) * jQuery(this).find('> a > span').size())) +"px")
			var parentWidth = jQuery(this).parent().innerWidth()
			var pagerWidth = jQuery(this).innerWidth()
			var marginLeftRight
			if (pagerWidth < parentWidth) {
				marginLeftRight = Math.floor((parentWidth-pagerWidth) / 2)
				jQuery(this).css('margin-left', marginLeftRight +"px")
				jQuery(this).css('margin-right', marginLeftRight +"px")
			}
		} else {
			jQuery(this).addClass('noCenter')
		}
	})
};






/**
 * @namespace Extra form check for profile form
 */
nl.cineworld.ProfileForm = (function() {
	var popup
	
	
	
	return {
		/**
		 * Checks Profile form and opens popup if user checked the checkbox to delete the user's profile.
		 *
		 * @example
		 * nl.cineworld.ProfileForm.CheckProfileForm()
		 */
		CheckProfileForm: function() {
			jQuery('#DivPopupWindowProfile div.tag_popupContent').empty()
			jQuery('#DivPopupWindowProfile div.tag_popupContent').append('<iframe src="/popup-profile-delete.asp" frameborder="0" scrolling="no"></iframe>')
			
			popup = new Estate.Popup({
				animationSpeed: 300,
				windowScrollOffsetY: 100,
				closeText: "",
				windowSelector: "#DivPopupWindowProfile",
				backgroundSelector: "#DivPopupBackgroundProfile"
			});
			
			if (jQuery('#Delete').is(':checked') == true) {
				popup.Open();
				return false;
			}
			
			return RequiredStandardForm('profielformulier')
		},
		
		/**
		 * Set events in popup window that appears when you want to delete your profile
		 *
		 * @example
		 * nl.cineworld.ProfileForm.SetRemoveProfileCheck()
		 */
		SetRemoveProfileCheck: function() {
			if (jQuery('#DeleteProfile').is(':checked') == false) {
				jQuery(parent.document).find('#Delete').attr('checked', false);
				parent.nl.cineworld.ProfileForm.ClosePopup()
			} else {
				parent.document.forms['profielformulier'].submit()
				parent.nl.cineworld.ProfileForm.ClosePopup()
			}
			
			return false;
		},
		
		/**
		 * Closes popup, created with CheckProfileForm
		 *
		 * @example
		 * nl.cineworld.ProfileForm.ClosePopup()
		 */
		ClosePopup: function() {
			popup.Close()
		}
	}
})();






/**
 * @namespace Manages the popups
 */
nl.cineworld.popup = (function() {
	function placePopupCode(html) {
		if (document.getElementById('DivPopupWindow') == null) {
			var popupHTML = '';
			popupHTML += '<div id="DivPopupWindow" class="divPopupWindow divPopupWindow_testimonial">';
			popupHTML += '    <div class="popupContent" id="PopupContent"></div>';
			popupHTML += '</div>';
			popupHTML += '<div id="DivPopupBackground" class="divPopupBackground divPopupBackground"></div>';
			jQuery('body').append(popupHTML);
		} else {
			jQuery('#DivPopupWindow div.popupContent').html('');
		}

		if (typeof (html) == 'string') {
			jQuery('#DivPopupWindow div.popupContent').html(html);
		}
	}



	/* Start public */
	return {
		/**
		 * Creates events that makes sure that links are opened in popup iframes instead of the current page.
		 * @example
		 * nl.cineworld.popup.Set()
		 */
		Set: function() {
			jQuery('a.tag_popup').setPopup()
		}
	}
	/* End public */
})();






/**
 * @namespace Manages the spotlight
 */
nl.cineworld.movieSpotlight = (function() {
	var root
	var xmlURL
	var slides = new Array()
	var preloadImage = new Array()
	var aniInterval
	var index = 0
	var specsCssLeft
	var config = {
		image: {
			x: 480,
			y: 259
		}
	}
	
	
	
	function handleXML(xml) {
		jQuery(xml).find('movie').each(function(index) {
			slides.push({
				id: jQuery(this).attr('id'),
				title: jQuery(this).find('title').text(),
				zaal: jQuery(this).find('zaal').text(),
				image: jQuery(this).find('visualsrc').text(),
				detail: jQuery(this).find('detail').text(),
				website: jQuery(this).find('website').text(),
				trailer: jQuery(this).find('trailer').text(),
				uitnodiging: jQuery(this).find('uitnodiging').text()
			})
			if (index == 0) {
				jQuery(root).find('div.tag_specs, img').show()
			}
			preloadImage[index] = new Image()
			preloadImage[index].src = slides.image
		});
 
		var pagerContent = ""
		for (var i = 0; i < slides.length; i++) {
			pagerContent += "<li></li>"
		}
		jQuery('ul.tag_localPager').append(pagerContent)
		jQuery('ul.tag_localPager li').first().addClass('active')
		jQuery('ul.tag_localPager li').css('cursor', 'pointer')
		jQuery('ul.tag_localPager li').click( function() {
			jQuery(this).siblings().removeClass('active')
			jQuery(this).addClass('active')
			index = (jQuery(this).index() - 1)
			animate()
		})
		
		jQuery(root).mouseenter( function() {
			jQuery(root).addClass('pauzed')
			clearInterval(aniInterval)
		})
		jQuery(root).mouseleave( function() {
			jQuery(root).removeClass('pauzed')
			startAnimation()
		})

		updateSlide()
		jQuery(root).find('span.tag_loading').hide()
		startAnimation()
		Reflection.add(jQuery(root).find('img')[0], { height: 0.1, opacity: 0.4 });
		jQuery(root).find('img').first().css('width', '480px')
		jQuery(root).find('img').first().css('height', '259px')
		jQuery(root).find('img:eq(1), canvas').css('top', '259px')
		jQuery(root).find('img:eq(1)').css('height', '259px')
		jQuery(root).find('img:eq(1), canvas').css('width', '480px')
	}
	
	function updateSlide() {
		Reflection.remove(jQuery(root).find('img')[0]);
		jQuery(root).find('img').first().attr('src', slides[index].image)
		jQuery(root).find('img').first().unbind()
		jQuery(root).find('img').first().click( function() { document.location.href = slides[index].detail } )
		jQuery(root).find('*.tag_head1').text(slides[index].title)
		jQuery(root).find('*.tag_head1').first().unbind()
		jQuery(root).find('*.tag_head1').first().click( function() { document.location.href = slides[index].detail } )
		jQuery(root).find('*.tag_head2').text('Nu in Cineworld '+ slides[index].zaal)
		jQuery(root).find('a.tag_reservation').attr('href', slides[index].uitnodiging)
		jQuery(root).find('a.tag_reservation').unbind('click')
		jQuery(root).find('a.tag_reservation').setPopup()
		if (slides[index].trailer) {
			jQuery(root).find('a.tag_trailer').attr('href', slides[index].trailer)
			jQuery(root).find('a.tag_trailer').unbind('click')
			jQuery(root).find('a.tag_trailer').setPopup()
			jQuery(root).find('a.tag_trailer').show()
		} else {
			jQuery(root).find('a.tag_trailer').hide()
		}
		jQuery(root).find('a.tag_info').attr('href', slides[index].detail)
	}
	
	function startAnimation() {
		clearInterval(aniInterval)
		aniInterval = setInterval('nl.cineworld.movieSpotlight.Animate()', 4000)
	}
	
	function animate() {
		jQuery(root).find('div.tag_specs').fadeOut(250)
		jQuery(root).find('img:gt(1), canvas').fadeOut(250)
		jQuery(root).find('img').first().fadeOut(250, function() {
			if (index < (slides.length - 1)) {
				index++
			} else {
				index = 0
			}
			updateSlide()
			jQuery(root).find('div.tag_specs').css('left', 0)
			jQuery(root).find('img').first().css({
				'top': '162px',
				'left': '360px',
				'width': '120px',
				'height': '64px',
				'opacity': '0.25'
			})
			jQuery(root).find('img').first().animate(
				{
					top: 0,
					left: 0,
					width: '480px',
					height: '259px',
					opacity: 1
				},
				250,
				"easeInCubic",
				function() {
					Reflection.add(jQuery(root).find('img')[0], { height: 0.1, opacity: 0.4 });
					jQuery(root).find('img').css('height', '259px')
					jQuery(root).find('img').css('width', '480px')
					jQuery(root).find('img:eq(1), canvas').css('top', jQuery(root).find('img').first().innerHeight() +"px")
					jQuery(root).find('img:eq(1), canvas').css('width', '480px')
					jQuery(root).find('div.tag_specs').show()
					jQuery(root).find('div.tag_specs').animate(
						{ left: specsCssLeft },
						350,
						"easeOutSine"
					)
					jQuery(root).find('ul.tag_localPager li').removeClass('active')
					jQuery(root).find('ul.tag_localPager li:eq('+ index +')').addClass('active')
				}
			)
		})
	}
	
	
	
	/* Start public */
	return {
		/**
		 * Sets up the spotlight
		 * @example
		 * nl.cineworld.movieSpotlight.Set('#MovieSpotlight')
		 */
		Set: function(selector) {
			root = jQuery(selector)
			specsCssLeft = jQuery(root).find('div.tag_specs').css('left')
			jQuery(root).find('div.tag_specs, img:first').hide()
			jQuery.ajax({
				url: '/xml/spotlight.asp?rnd='+ Math.random(),
				dataType: 'xml',
				success: handleXML
			});
		},
		
		/**
		 * (re)Starts the spotlight animation
		 * @example
		 * nl.cineworld.movieSpotlight.Animate()
		 */
		Animate: function() {
			animate()
		}
	}
	/* End public */
})();


/*
 * Summary:
 * Shows tweets
 */
nl.cineworld.Twitter = ( function() {
	var config = {
		twitter_user    		: "cineworldnl",
		twitter_count			: 10,
		twitter_include_rts		: 1,
		twitter_api_url 		: "http://api.twitter.com/1/statuses/user_timeline"
	}
	
	function returnTweetUrl(tweetID) {
		return "http://twitter.com/" + config.twitter_user + "/statuses/" + tweetID;
	}
	
	function left(str, n){
		if (n <= 0) {
			return "";
		} else if (n > String(str).length) {
			return str;
		} else {
			return String(str).substring(0,n) + "...";
		}
	}

	
	/* START PUBLIC */
	return {
		Init: function() {
			// Create API URL
			var url = config.twitter_api_url + ".json?screen_name=" + config.twitter_user + "&count=" + config.twitter_count + "&include_rts=" + config.twitter_include_rts + "&callback=?";
			
			// Enable caching
			jQuery.ajaxSetup({ cache: true });
			
			// Send JSON request
			// The returned JSON object will have a property called "results" where we find
			// a list of the tweets matching our request query
			jQuery.getJSON(url, function(data) {
				jQuery.each(data, function(i, tweet) {
					// Before we continue we check that we got data
					if(tweet.text !== undefined) {
						var tweetUrl = returnTweetUrl(tweet.id_str);
						var tweetText = tweet.text;
						
						// Build the html string for the current tweet
						var tweet_html = "";
						tweet_html 	  += "<li>" + "\n";
						tweet_html    += "    <a href=\"" + tweetUrl + "\" target=\"_blank\">" + "\n";
						tweet_html    += "        <span class=\"txt\">" + tweetText + "</span>" + "\n";
						tweet_html    += "    </a>" + "\n";
						tweet_html    += "</li>" + "\n";

						// Append html string to tweet_container div
						jQuery('ul.twitterTape').append(tweet_html);
					}
				});
				
				var listPager = new Estate.TwitterListPager('div.twitterContainer', 4500)
				listPager.Run(listPager)
			});
		}
	}
	/* END PUBLIC */
})();

Estate.TwitterListPager = function(rootSelector, animationIntervalSpeed) {
	var error
	error = Estate.Check.ArgumentsCount(arguments.length, 2);
	if (error != "") throw new Error(error);

	var config;
	config = {
		root: null,
		rootSelector: "",
		animationSpeed: 500,
		pagerPreviousText: '&lt;',
		pagerNextText: '&gt;',
		animationIntervalSpeed: animationIntervalSpeed
	}
	config.rootSelector = rootSelector;
	config.root = jQuery(config.rootSelector);
	var viewportHeight = Estate.StringTools.RemoveMeasurement(jQuery(config.root).css('height'));
	var pageSize = Math.ceil(viewportHeight / jQuery(config.root).find('li:first').innerHeight());
	var pageCount = Math.ceil(jQuery(config.root).find('li').size() / pageSize);
	var listCount = jQuery(config.root).find('li').size();
	var pageIndex = 1;
	var ul = jQuery(config.root).find('ul');
	var intervalAnimation;
	


	// Page either up or down
	function page(moveIndex) {
		if (jQuery(ul).is(':animated') == 0) {
			if (moveIndex > 0) {
				// Forward
				pageIndex++;
				jQuery(ul).animate({ marginTop: '-=' + viewportHeight + "px" }, config.animationSpeed, "easeInQuad", function() { setPagerStyles(moveIndex) });
			}
			if (moveIndex < 0) {
				// Backward
				pageIndex--;
				jQuery(ul).animate({ marginTop: '+=' + viewportHeight + "px" }, config.animationSpeed, "easeInQuad", function() { setPagerStyles(moveIndex) });
			}
		}
	}
	
	function setPagerStyles(moveIndex) {
		if (moveIndex != null) {
			if (moveIndex == 1) {
				jQuery(ul).find('li:lt('+ pageSize +')').detach().appendTo(ul);
				jQuery(ul).animate({ marginTop: '+=' + viewportHeight + "px" }, 0);
			} else {
				var lastItems = jQuery(ul).find('li').size() - (pageSize + 1);
				jQuery(ul).find('li:gt('+ lastItems +')').detach().prependTo(ul);
				jQuery(ul).animate({ marginTop: '-=' + viewportHeight + "px" }, 0);
			}
		}
	}
	
	// Set animation interval
	function animate() {
		intervalAnimation = setInterval(function() { page(1) }, config.animationIntervalSpeed);
	}
		
	/* Start public */
	/**
	 * Runs the pager
	 * @example
	 * var listPager = new Estate.TwitterListPager('div.tag_tickerTape', 3000) 
	 * listPager.Run()
	 */
	this.Run = function() {
		if (jQuery(config.root).find('li').size() > 1) {
			var listHTML = jQuery(ul).html();
			jQuery(ul).html(listHTML + listHTML + listHTML);
			jQuery(ul).css('margin-top', "-"+ (listCount * jQuery(config.root).find('li:first').innerHeight()) + "px");
			
			setPagerStyles();
			animate();
			
			// Stop animation when cursor hovers over block
			jQuery(config.root).mouseenter( function() {
				clearInterval(intervalAnimation);
			})
			jQuery(config.root).mouseleave( function() {
				animate();
			})
		}
	}
	/* End public */
};



/**
 * @namespace Manages the "Now in Cineworld"-block
 */
nl.cineworld.moviesToday = (function() {
	var root
	var today
	var itemHTML = ''
	itemHTML += '<li>'
	itemHTML += '	<span class="image"><img src="## IMAGE ##" width="150" height="220" alt="## MOVIENAME ##" /></span>'
	itemHTML += '	<span class="zaal">Cineworld ## ZAAL ##</span>'
	itemHTML += '	<span class="time">## TIME ##</span>'
	itemHTML += '	<span class="overlay buttons">'
	itemHTML += '		<a href="## URL ##">Info</a>'
	itemHTML += '		<a class="tag_reservation" rel="({height: \'590px\'})" href="## URLreserveren ##">Direct reserveren</a>'
	itemHTML += '	</span>'
	itemHTML += '</li>'

	
	
	function getItemHTML(image, moviename, zaal, time, URL, URLreserveren) {
		var newItemHTML = itemHTML
		
		if (image != null) {
			newItemHTML = newItemHTML.replace('## IMAGE ##', image)
		}
		if (moviename != null) {
			newItemHTML = newItemHTML.replace('## MOVIENAME ##', moviename)
		}
		if (zaal != null) {
			newItemHTML = newItemHTML.replace('## ZAAL ##', zaal)
		}
		if (time != null) {
			newItemHTML = newItemHTML.replace('## TIME ##', time)
		}
		if (URL != null) {
			newItemHTML = newItemHTML.replace('## URL ##', URL)
		}
		if (URLreserveren != null) {
			newItemHTML = newItemHTML.replace('## URLreserveren ##', URLreserveren)
		}
		
		
		return newItemHTML
	}
	
	function handleJSON(data, arg_isInit) {
		var newListContent = ''
		if (data.film.length > 0) {
			jQuery.each(data.film, function(i,item) {
				newListContent += getItemHTML(item.Afbeelding, item.FilmNaam, item.Zaal, item.StartTime, item.URL, item.URLreserveren)
			});
			jQuery(root).find('div.tag_collection').html('<div><ul>'+ newListContent +'</ul></div>')
			jQuery(root).find('a.tag_reservation').unbind()
			jQuery(root).find('a.tag_reservation').setPopup()
			
			jQuery(root).find('ul').css('margin-left', 0)
			var listpager2 = new Estate.ListPager2('div.tag_collection', 500)
			listpager2.Run()
			jQuery(root).find('div.tag_collection').css('height', jQuery(root).find('div.tag_collection').innerHeight() +'px')
		} else {
			if (jQuery(root).find('li.afternoon').hasClass('active') == true && arg_isInit == true) {
				jQuery(root).find('li.evening').click()
			} else {
				var dayPeriod = "middag"
				if (jQuery(root).find('li.evening').hasClass('active')) {
					dayPeriod = "avond"
				}
				jQuery(root).find('div.tag_collection').text('Er zijn op deze '+ dayPeriod +' geen voorstellingen.')
			}
		}
	}
	
	function getDateString(dayOfWeek) {
		var offSetDayOfWeek
		if (dayOfWeek != null) {
			if (dayOfWeek >= today.getDay()) {
				offSetDayOfWeek = dayOfWeek - today.getDay()
			} else {
				offSetDayOfWeek = dayOfWeek + (7 - today.getDay())
			}
			var offsetDate = new Date( today.getTime() + (1000 * 60 * 60 * 24 * offSetDayOfWeek ) )
			return offsetDate.getDate() +"-"+ (offsetDate.getMonth() + 1) +"-"+ offsetDate.getFullYear()
		} else {
			return today.getDate() +"-"+ (today.getMonth() + 1) +"-"+ today.getFullYear()
		}
	}

	function getJSON(arg_todayString, arg_middag, arg_avond, arg_isInit) {
		var todayString = (arg_todayString) ? arg_todayString : getDateString()
		var middag = (arg_middag != null) ? arg_middag : true
		var avond = (arg_avond != null) ? arg_avond : true
		jQuery.getJSON('/service/getFilmStrip.asp', 'forDatum='+ todayString +'&middag='+ middag +'&avond='+ avond +'&rndval='+ Math.random(), function(data) { handleJSON(data, arg_isInit) })
	}

	function setDateLinks() {
		jQuery(root).find('div.tag_dateSelector ul.tag_date li:eq('+ today.getDay() +')').addClass('active')
		if (today.getHours() >= 18) {
			jQuery(root).find('div.tag_dateSelector ul.tag_time li.evening').addClass('active')
		} else {
			jQuery(root).find('div.tag_dateSelector ul.tag_time li.afternoon').addClass('active')
		}
		
		jQuery(root).find('div.tag_dateSelector ul.tag_date li').each( function(index) {
			jQuery(this).append('<input type="hidden" value="'+ getDateString(jQuery(this).index()) +'" />')
		})
		
		jQuery(root).find('div.tag_dateSelector ul.tag_date li, ul.tag_time li').click( function() {
			jQuery(this).siblings().removeClass('active')
			jQuery(this).addClass('active')
			getJSON(jQuery(root).find('ul.tag_date li.active input').val(), jQuery(root).find('ul.tag_time li.afternoon').hasClass('active'), jQuery(root).find('ul.tag_time li.evening').hasClass('active'), false)
		})
		
		jQuery(root).find('div.tag_dateSelector ul.tag_date li').first().detach().appendTo(jQuery(root).find('div.tag_dateSelector ul.tag_date'))
	}



	/* Start public */
	return {
		/**
		 * Starts the "Movies today"-block
		 * 
		 * @example
		 * nl.cineworld.moviesToday.Set()
		 */
		Set: function(selector) {
			if (jQuery(selector).size() == 1) {
				root = jQuery(selector)
				today = new Date()
				setDateLinks()
				getJSON(jQuery('ul.tag_date li.active input').val(), jQuery('ul.tag_time li.afternoon').hasClass('active'), jQuery('ul.tag_time li.evening').hasClass('active'), true)
			}
		}
	}
	/* End public */
})();






/*
 * jQuery plugin. It will make links open in iframe popups instead of in the main document
 */
(function($) {
	$.fn.setPopup = function( type ) {  

		function placePopupCode(html) {
			if (document.getElementById('DivPopupWindow') == null) {
				var popupHTML = '';
				popupHTML += '<div id="DivPopupWindow" class="divPopupWindow">';
				popupHTML += '    <div class="close tag_close"></div>';
				popupHTML += '    <div class="popupContent" id="PopupContent"></div>';
				popupHTML += '</div>';
				popupHTML += '<div id="DivPopupBackground" class="divPopupBackground divPopupBackground"></div>';
				jQuery('body').append(popupHTML);
			} else {
				jQuery('#DivPopupWindow div.popupContent').html('');
			}

			if (typeof (html) == 'string') {
				jQuery('#DivPopupWindow div.popupContent').html(html);
			}
		}
		
		return this.each(function() {
			var $this = $(this);

			$this.bind('click', function(event) {
				event.preventDefault()
				event.stopPropagation()
				placePopupCode('<iframe src="'+ $this.attr('href') +'" frameborder="0" scrolling="no"></iframe>')
				
				if ($this.attr('rel') != "") {
					var itemConfig = eval($this.attr('rel'))
					if (itemConfig.height) {
						jQuery('#DivPopupWindow #PopupContent').css('height', itemConfig.height)
					}
				}

				var popup = new Estate.Popup({
					animationSpeed: 300,
					windowScrollOffsetY: 100,
					closeText: "",
					windowSelector: "#DivPopupWindow",
					backgroundSelector: "#DivPopupBackground"
				});
				popup.Open();
			});
		});
	};
})( jQuery );





/**
 * Form validator for ordering tickets
 * 
 * @example
 * validateUpdate()
 */
function validateUpdate() {
    var valBasis = parseFloat(document.getElementById('basisprijs').value);
    var personen = document.getElementById('aantal_personen').value;
    var theone
    var inp
    for (i=0;i<document.reserveerForm.zitplaats.length;i++){
        if (document.reserveerForm.zitplaats[i].checked==true){
			theone=i;
			inp = document.reserveerForm.zitplaats[i].value;
			break //exist for loop, as target acquired.
        }
    }
        
    if (theone==3) {
        valBasis += 1;
        var ret=personen % 2;
        if (ret != 0) {
            alert('Loveseats dienen per veelvoud van 2 gereserveerd te worden.');
            return false;
        }            
    }
    
    var res = 0.45 * personen;
    var sub = valBasis * personen;
    var tot = res + sub;
    res=res.toFixed(2);                        
    sub=sub.toFixed(2);
    tot=tot.toFixed(2);
    tot=tot.replace(".",",");
    sub=sub.replace(".",",");
    res=res.replace(".",",");
    document.getElementById('reskosten').innerHTML = res;
    document.getElementById('subtotaal').innerHTML = sub;
    document.getElementById('totaal').innerHTML = tot;
    
    return true;            
}
