﻿jQuery(function ($) {
	$.fn.quicksearch = function (opt) {
		
//		function is_empty(i) 
//		{
//			return (i === null || i === undefined || i === false) ? true: false;
//		}
//		
//		function strip_html(input)
//		{
//			var regexp = new RegExp(/\<[^\<]+\>/g);
//			var output = input.replace(regexp, "");
//			output = $.trim(output.toLowerCase().replace(/\n/, '').replace(/\s{2,}/, ' '));
//			return output;
//		}
//		
//		function get_key()
//		{
//			var input = strip_html($('input[rel="' + options.randomElement + '"]').val());
//			
//			if (input.indexOf(' ') === -1)
//			{
//				return input;
//				
//			}
//			else
//			{
//				return input.split(" ");
//				
//			}
//		}
//			
//		function test_key(k, value, type)
//		{
//			if (type === "string")
//			{
//				return test_key_string(k, value);
//				
//			}
//			else
//			{
//				return test_key_arr(k, value);
//				
//			}
//		}
//		
//		function test_key_string(k, value)
//		{
//			return (value.indexOf(k) > -1);
//		}
//		
//		function test_key_arr(k, value)
//		{
//			for (var i = 0; i < k.length; i++) {
//				var test = value.indexOf(k[i]);	
//				if (test === -1) {	
//					return false;
//				}
//			}			
//			return true;
//		}
//		
//		function select_element(el) 
//		{
//			if (options.hideElement === "grandparent") 
//			{
//				return $(el).parent().parent().parent();
//			} 
//			else if (options.hideElement === "parent") 
//			{
//				return $(el).parent();
//			} 
//			else
//			{
//				return $(el);
//			}
//		}
//		
//		function stripe(el)
//		{
//			if (doStripe)
//			{
//				var i = 0;
//				select_element(el).filter(':visible').each(function () {
//					
//					for (var j = 0; j < stripeRowLength; j++)
//					{
//						if (i === j)
//						{
//							$(this).addClass(options.stripeRowClass[i]);
//							
//						}
//						else
//						{
//							$(this).removeClass(options.stripeRowClass[j]);
//						}
//					}
//					i = (i + 1) % stripeRowLength;
//				});
//			}
//		}
//		
		function fix_widths(el)
		{
			$(el).find('td').each(function () {
				$(this).attr('width', parseInt($(this).css('width')));
			});
		}
		
//		function loader(o) {
//			if (options.loaderId) 
//			{
//				var l = $('input[rel="' + options.randomElement + '"]').parent().find('.loader');
//				if (o === 'hide') 
//				{
//					l.hide();
//				
//				} 
//				else 
//				{
//					l.show();
//				
//				}
//			}	
//			checkAmount();	
//		}
//		
//			
//		function place_form() {
//			var formPosition = options.position;
//			var formAttached = options.attached;

//			if (formPosition === 'before') {
//				$(formAttached).before(make_form());
//			} else if (formPosition === 'prepend') {
//				$(formAttached).prepend(make_form());
//			} else if (formPosition === 'append') {
//				$(formAttached).append(make_form());
//			} else {
//				$(formAttached).after(make_form());
//			}
//		}
//				
//		function make_form_label()
//		{
//			if (!is_empty(options.labelText)) {
//				return '<label for="' + options.randomElement + '" '+
//							'class="' + options.labelClass + '">'
//							+ options.labelText
//							+ '</label> ';	
//			}
//			return '';
//		}
//		
//		function make_form_input()
//		{
//			var val = (!is_empty(options.inputText)) ? options.inputText : ""
//			return '<input type="text" value="' + val + '" rel="' + options.randomElement  + '" class="' + options.inputClass + '" id="' + options.randomElement + '" /> ';
//		}
//		
//		function make_form_loader()
//		{
//			if (!is_empty(options.loaderImg)) {
//				return '<img src="' + options.loaderImg + '" alt="Loading" id="' + options.loaderId + '" class="' + options.loaderClass + '" />';
//			} else {
//				return '<span id="' + options.loaderId + '" class="' + options.loaderClass + '">' + options.loaderText + '</span>';
//			}
//		}
//		
//		function make_form()
//		{
//			var f = (!options.isFieldset) ? 'form' : 'fieldset';
//			return '<' + f + ' action="#" ' + 'id="'+ options.formId + '" ' + 'class="quicksearch">' +
//						make_form_label() +	make_form_input() + make_form_loader() +
//					'</' + f + '>';
//		}
//			
//		function focus_on_load()
//		{
//			$('input[rel="' + options.randomElement + '"]').get(0).focus();
//		}
//		
//		function toggle_text() {
//			$('input[rel="' + options.randomElement + '"]').focus(function () {
//				if ($(this).val() === options.inputText) {
//					$(this).val('');
//				}
//			});
//			$('input[rel="' + options.randomElement + '"]').blur(function () {
//				if ($(this).val() === "") {
//					$(this).val(options.inputText);
//				}
//			});
//		}
//		
//		function get_cache(el) 
//		{
//			return $(el).map(function(){
//				return strip_html(this.innerHTML);
//			});
//		}
//		
//		function init()
//		{
//			place_form();
//			if (options.fixWidths) fix_widths(el);
//			if (options.focusOnLoad) focus_on_load();
//			if (options.inputText != "" && options.inputText != null) toggle_text();
//			
//			cache = get_cache(el);
//			
//			stripe(el);
//			loader('hide');
//			
//		}
//		
//		function qs() 
//		{
//			clearTimeout(timeout);
//			timeout = setTimeout(function () {
//				
//				loader('show');
//				
//				setTimeout(function () {
//					options.onBefore();
//					
//					var k = get_key();
//					var k_type = (typeof k);
//					var i = 0;
//					
//					k = options.filter(k);
//					
//					if (k != "")
//					{
//						if (typeof score[k] === "undefined")
//						{
//							score[k] = new Array();
//							cache.each(function (i) {
//								if (test_key(k, cache[i], k_type))
//								{
//									score[k][i] = true;
//								}
//							});
//						}
//						
//						if (score[k].length === 0)
//						{
//							select_element(el).hide();
//							
//						}
//						else
//						{
//							$(el).each(function (i) {
//					
//								if (score[k][i])
//								{
//									select_element(this).show();
//									
//								}
//								else
//								{
//									select_element(this).hide();
//								}
//								
//							});
//							
//						}
//					}
//					else
//					{
//						select_element(el).show();
//					
//					}
//				
//					stripe(el);
//				}, options.delay/2);
//				
//				setTimeout( function () { 
//					loader('hide');
//				}, options.delay/2);
//				
//				options.onAfter();
//				
//			}, options.delay/2);
//		}
//		
//		var options = $.extend({
//			position: 'prepend',
//			attached: 'body',
//			formId: 'quicksearch',
//			labelText: '',
//			labelClass: 'qs_label',
//			inputText: '',
//			inputClass: 'qs_input',
//			loaderId: 'loader',
//			loaderClass: 'loader',
//			loaderImg: null,
//			loaderText: 'Loading...',
//			stripeRowClass: null,
//			hideElement: null,
//			delay: 500,
//			focusOnLoad: false,
//			onBefore: function () {},
//			onAfter: function () {},
//			filter: function (i) { 
//				return i;
//			},
//			randomElement: 'qsSearch',
//			isFieldset: false,
//			fixWidths: false
//		}, opt);
//		
//		var timeout;
//		var score = {};
//		var stripeRowLength = (!is_empty(options.stripeRowClass)) ? options.stripeRowClass.length : 0;
//		var doStripe = (stripeRowLength > 0) ? true : false;
//		var el = this;
//		var cache;
//		var selector = $(this).selector;
//		
//		$.fn.extend({
//			reset_cache: function () {
//				el = $(selector);
//				cache = get_cache(el);
//			}
//		});
//		
//		init();
//		
//		$('input[rel="' + options.randomElement + '"]').keydown(function (e) {
//			var keycode = e.keyCode;
//			if (!(keycode === 9 || keycode === 13 || keycode === 16 || keycode === 17 || keycode === 18 || keycode === 38 || keycode === 40 || keycode === 224))
//			{
//				qs();
//			}
//		});
//		
//		$('form.quicksearch, fieldset.quicksearch').submit( function () { return false; });
//		
//		return this;
		
	}; 
	
});








// set up the variables we will need later ...
var compNumber = 0;
var hiddenFilters = true;

//var hotelname;
//var compHot;
//var price;
//var internet;
//var parking;
//var accessable;
//var railway;
//var airport;
//var motorway;
//var daylight;
//var urban;
//var rural;
//var pool;
//var golf;
//var gym;
//var spa;
//var restaurant;
//var bar;
//var business;

$(document).ready(function() {


    var locationValue = $('input.hfDefaultLocation').val();

    //append class idleField to seperate log in form to allow value swap to work
    $('.input-wrap input, .delegates-wrap input').addClass('idleField');
    
    //swap values of inputs dependant on focus and blur
    $.each($('input.idleField'), function() {
        $(this).data('initial',$(this).val());
    });
    
    $('input.idleField').focus(function() {
        if($(this).val() == locationValue){
            $(this).val('');
        }else{
            $(this).removeClass('idleField');
            if($(this).val() == $(this).data('initial')) {
                return false;
            }
        }
    })
    
    .blur(function() {
        if($(this).val() == '') {
            $(this).val($(this).data('initial'));
        }
    }); 

    //Change class of search input so text is white on focus.
    //Also remove default text
//     $('.input-wrap input, .delegates-wrap input').addClass("idleField");  
//     $('.input-wrap input, .delegates-wrap input').focus(function() {  
//         $(this).removeClass("idleField").addClass("focused");  
//         if (this.value == this.defaultValue){  
//             this.value = '';  
//         }  
//         if(this.value != this.defaultValue){  
//             this.select();  
//         }  
//     });  

//     $('.input-wrap input, .delegates-wrap input').blur(function() {  
//         $(this).removeClass("focusField").addClass("idleField");  
//         if ($.trim(this.value == '')){  
//             this.value = (this.defaultValue ? this.defaultValue : '');  
//         }  
//     });  

			
// Set up all the page elements //
//			$('#hotLabel').hide();

// Tipsy tool tips
//
//
//			$('#UShape, #Theatre, #Classroom, #Reception, #Cabaret, #Boardroom, #Banquet, #any').tipsy({gravity: 's', fade:true});
//			$('.UShape, .Theatre, .Classroom, .Reception, .Cabaret, .Boardroom, .Banquet, .any').tipsy({gravity: 'n', fade:true});
//			$('.internet, .parking, .accessible, .railway, .airport, .motorway, .suburban, .rural, .pool, .golf, .gym, .spa, .restaurant, .bar, .businessCentre, .daylight').tipsy({gravity: 'n', fade:true});

// Hide compare for IE6
//			if ($.browser.msie && $.browser.version.substr(0,1) == 6){
//				$('#compare').hide();
//			}
// IE6 z-index fix


			$(function() {
				var zIndexNumber = 1000;
				$('tr').each(function() {
					$(this).css('zIndex', zIndexNumber);
					zIndexNumber -= 10;
				});
			});
			
            //init iphone switches
			$('.on_off :checkbox').iphoneStyle(); 
            //init compare slider
			$('#slider').easySlider();
			
// map popup
            //$('#mapBTN').click(function(){
           //    var hotelIDs = '';
            //    
            //    $('.hotelHolder:visible .openBtn').each(function() {
            //        hotelIDs = hotelIDs + $(this).attr('id') + ',';
            //    });
            //    if (hotelIDs.length != 0)
           ///         hotelIDs = hotelIDs.substring(0, hotelIDs.length - 1);
            //    $.showAkModalMap('/search/map.aspx?hotelIDs=' + hotelIDs,'',927,520);return false;
           // });
            
//           $('#mapBTN').click(function(){
//                var hotelIDs = '';
//                
//                $('.hotelHolder:visible .openBtn').each(function() {
//                    hotelIDs = hotelIDs + $(this).attr('id') + ',';
//                });
//                if (hotelIDs.length != 0)
//                    hotelIDs = hotelIDs.substring(0, hotelIDs.length - 1);
//                $.showAkModalMap('/search/map.aspx', hotelIDs,'',927,540);return false;
//            });

			
// clear the form
//			$.fn.clearForm = function() {
//			  return this.each(function() {
//				var type = this.type, tag = this.tagName.toLowerCase();
//				if (tag == 'form')
//				  return $(':input',this).clearForm();
//				if ( type == 'password' || tag == 'textarea')
//				  this.value = '';
//				else if (type == 'checkbox' || type == 'radio')
//				  this.checked = false;
//				else if (tag == 'select')
//				  this.selectedIndex = -1;
//			  });
//			};
//			
//			$(':input').clearForm();

//			$('.compNo').html('(' + compNumber + ')');
			
//			$('.rounded').corners("7px");
			
//			$('#compareBTN, #compareBTN2').click(function(){
//					if(compNumber < 2){
//						alert("Please choose 2 or more hotels to compare");
//					}else{
//					
//						if(hiddenFilters == false){
//							$('#hiddenFilters').slideToggle('fast');
//							$('.openFilters').hide();
//							$('.closeFilters').show();
//							hiddenFilters = true;
//						}
//						if ($.browser.msie && $.browser.version.substr(0,1) == 6){
//							$('#compare').show();
//						}else{
//							$('#compare').animate({'top': '360px'}, '2000');
//							$('html').animate({scrollTop: $('#wrapper').offset().top},1000);
//						}
//					}	
//				})
			
//				$('#closeComp').click(function(){
//					if ($.browser.msie && $.browser.version.substr(0,1) == 6){
//							$('#compare').hide();
//						}else{
//							$('#compare').animate({'top': '1000px'}, '500');
//						}
//					
//				})
//				$('#backBTN').click(function(){
//					if ($.browser.msie && $.browser.version.substr(0,1) == 6){
//							$('#compare').hide();
//						}else{
//							$('#compare').animate({'top': '1000px'}, '500');
//					}
//					
//				})
		
		
		
			//	

///////////////KEEP//////////////////////////////
			$('.hotelHolder .on_off input:checkbox').change(function(){
				if ($(this).is(':checked')){
					hotelID = $(this).attr('id');
					hotelname = $(this).parents('.hotelTop').children('h3').html();
					compHot = '<div class="name" id="hotel_' + hotelID + '" >' + hotelname + '</div>';		

					$.get("../../services/hotels.ashx", {hotelId: $(this).attr('id'), facilities : 1},
					  function(data){
					    var xml;
						if ($.browser.msie && typeof data == "string") {
							xml = new ActiveXObject("Microsoft.XMLDOM");
							xml.async = false;
							xml.loadXML(data);          
						} else {
							xml = data;
						}				
						
						hotelprice = '<div class="ticks" id="price_' + hotelID + '" >' + $(xml).find('pricexml').text() + '</div>';
						
						if($(xml).find('internetxml').text() == 'True'){
							internet = '<div class="ticks" id="internet_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							internet = '<div class="ticks" id="internet_' + hotelID + '" ></div>';
						}	
						if($(xml).find('parkingxml').text() == 'True') {
							parking = '<div class="ticks" id="parking_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							parking = '<div class="ticks" id="parking_' + hotelID + '" ></div>';
						}
						if ($(xml).find('accessablexml').text() == 'True'){
							accessable = '<div class="ticks" id="accessable_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							accessable = '<div class="ticks" id="accessable_' + hotelID + '" ></div>';
						}
						if ($(xml).find('railwayxml').text() == 'True'){
							railway = '<div class="ticks" id="railway_'+ hotelID +'" ><img src="../../images/tick.gif"></div>';
						}else{
							railway = '<div class="ticks" id="railway_' + hotelID + '" ></div>';
						}
						if ($(xml).find('airportxml').text() == 'True'){
							airport = '<div class="ticks" id="airport_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							airport = '<div class="ticks" id="airport_' + hotelID + '" ></div>';
						}
						if ($(xml).find('motorwayxml').text() == 'True'){
							motorway = '<div class="ticks" id="motorway_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							motorway = '<div class="ticks" id="motorway_' + hotelID + '" ></div>';
						}
						if ($(xml).find('daylightxml').text() == 'True'){
							daylight = '<div class="ticks" id="daylight_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							daylight = '<div class="ticks" id="daylight_' + hotelID + '" ></div>';
						}
						if ($(xml).find('urbanxml').text() == 'True'){
							urban = '<div class="ticks" id="urban_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							urban = '<div class="ticks" id="urban_' + hotelID + '" ></div>';
						}
						if ($(xml).find('ruralxml').text() == 'True'){
							rural = '<div class="ticks" id="rural_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							rural = '<div class="ticks" id="rural_' + hotelID + '" ></div>';
						}
						if ($(xml).find('poolxml').text() == 'True'){
							pool = '<div class="ticks" id="pool_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							pool = '<div class="ticks" id="pool_' + hotelID + '" ></div>';
						}
						if ($(xml).find('golfxml').text() == 'True'){
							golf = '<div class="ticks" id="golf_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							golf = '<div class="ticks" id="golf_' + hotelID + '" ></div>';
						}
						if ($(xml).find('gymxml').text() == 'True'){
							gym = '<div class="ticks" id="gym_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							gym = '<div class="ticks" id="gym_' + hotelID + '" ></div>';
						}
						if ($(xml).find('spaxml').text() == 'True'){
							spa = '<div class="ticks" id="spa_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							spa = '<div class="ticks" id="spa_' + hotelID + '" ></div>';
						}
						if ($(xml).find('restaurantxml').text() == 'True'){
							restaurant = '<div class="ticks" id="restaurant_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							restaurant = '<div class="ticks" id="restaurant_' + hotelID + '" ></div>';
						}
						if ($(xml).find('barxml').text() == 'True'){
							bar = '<div class="ticks" id="bar_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							bar = '<div class="ticks" id="bar_' + hotelID + '" ></div>';
						}
						if ($(xml).find('businessxml').text() == 'True'){
							business = '<div class="ticks" id="business_' + hotelID + '" ><img src="../../images/tick.gif"></div>';
						}else{
							business = '<div class="ticks" id="business_' + hotelID + '" ></div>';
						}
						$('#hotName').append(compHot);
						$('#price').append(hotelprice);
						$('#internetC').append(internet);
						$('#parkingC').append(parking);
						$('#accessableC').append(accessable);
						$('#railwayC').append(railway);
						$('#airportC').append(airport);
						$('#motorwayC').append(motorway);
						$('#daylightC').append(daylight);
						$('#urbanC').append(urban);
						$('#ruralC').append(rural);
						$('#poolC').append(pool);
						$('#golfC').append(golf);
						$('#gymC').append(gym);
						$('#spaC').append(spa);
						$('#restaurantC').append(restaurant);
						$('#barC').append(bar);
						$('#businessC').append(business);
					}); 
	
					compNumber++ ;
					$('.compNo').html('(' + compNumber + ')');
				
				}else{
				
					compNumber-- ;
					$('.compNo').html('(' + compNumber + ')');
					var remID = '#hotel_' + $(this).attr('id');
					var remPrice = '#price_' + $(this).attr('id');
					var remInternet = '#internet_' + $(this).attr('id');
					var remParking = '#parking_' + $(this).attr('id');
					var remAccessable = '#accessable_' + $(this).attr('id');
					var remRailway = '#railway_' + $(this).attr('id');
					var remAirport = '#airport_' + $(this).attr('id');
					var remMotorway = '#motorway_' + $(this).attr('id');
					var remDaylight = '#daylight_' + $(this).attr('id');
					var remUrban = '#urban_' + $(this).attr('id');
					var remRural = '#rural_' + $(this).attr('id');
					var remPool = '#pool_' + $(this).attr('id');
					var remGolf = '#golf_' + $(this).attr('id');
					var remGym = '#gym_' + $(this).attr('id');
					var remSpa = '#spa_' + $(this).attr('id');
					var remRestaurant = '#restaurant_' + $(this).attr('id');
					var remBar = '#bar_' + $(this).attr('id');
					var remBusiness = '#business_' + $(this).attr('id');
					
					
					$(remID).remove();
					$(remPrice).remove();
					$(remInternet).remove();
					$(remParking).remove();
					$(remAccessable).remove();
					$(remRailway).remove();
					$(remAirport).remove();
					$(remMotorway).remove();
					$(remDaylight).remove();
					$(remUrban).remove();
					$(remRural).remove();
					$(remPool).remove();
					$(remGolf).remove();
					$(remGym).remove();
					$(remSpa).remove();
					$(remRestaurant).remove();
					$(remBar).remove();
					$(remBusiness).remove();
				}
				
				$(this).blur();
			});	
///////////////END KEEP//////////////////////////////			
			
			
//			$('.openBtn').click(function (){
//				$(this).hide();
//				$(this).next().show('fast');
//				$(this).next().next().slideToggle('fast');
//				$(this).parent().addClass('selected');
//				moreInfo = $(this).parent().find('.moreInfo');
//				if ($(moreInfo).find('.moreInfoLoading').length != 0){
//				    $.ajax({
//                              url: "/search/moreinfo.aspx",
//                              global: false,
//                              type: "POST",
//                              data: ({hotelID : this.getAttribute('id')}),
//                              dataType: "html",
//                              success: function(msg){
//                                  var regex1 = /<(.|)form.*>/g;
//                                  var regex2 = /.*<input.*id="__VIEWSTATE".*\/>.*/g;
//                                  $(moreInfo).html(msg.replace(regex1, '').replace(regex2, ''));
//                                  $(moreInfo).find('#viewHotel').click(function(){
//                                    $.showAkModal('/search/hotelpanel.aspx?hotelID=' + $(moreInfo).parent().find('.openBtn').attr('id'),'Hotel Details',930,1700);
//                                    return false;
//                                  });
//                                  $(moreInfo).find('.rounded').corners("7px");
//                                  $(moreInfo).find('#UShape, #Theatre, #Classroom, #Reception, #Cabaret, #Boardroom, #Banquet, #any').tipsy({gravity: 's', fade:true});
//			                      $(moreInfo).find('.UShape, .Theatre, .Classroom, .Reception, .Cabaret, .Boardroom, .Banquet, .any').tipsy({gravity: 'n', fade:true});
//			                      $(moreInfo).find('.internet, .parking, .accessible, .railway, .airport, .motorway, .suburban, .rural, .pool, .golf, .gym, .spa, .restaurant, .bar, .businessCentre, .daylight').tipsy({gravity: 'n', fade:true});
//                                  $("img").pngfix();
//                                 
//                                  $(moreInfo).find('.notFav').click(addFav);
//									$(moreInfo).find('.fav').click(remFav);
//                                  
//                              }
//                    }).responseText;
//				}				
//			}); 
//			$('.closeBtn').click(function (){
//				$(this).hide();
//				$(this).prev().show('fast');
//				$(this).next().slideToggle('fast');
//				$(this).parent().removeClass('selected');
//			});
			
			
//live search

			
			

//filter code
		
		$('.openFilters').click(function (){
				$(this).hide();
				$(this).next().show('fast');
				$('#hiddenFilters').slideToggle('fast');
				hiddenFilters = false;
		}); 
		$('.closeFilters').click(function (){
				$(this).hide();
				$(this).prev().show('fast');
				$('#hiddenFilters').slideToggle('fast');
				hiddenFilters = true;
		});
			
		$('#hiddenFilters').slideToggle('fast');	
		
//		$('.FIcons').click(function (){
//				
//			currentId = $(this).children().attr("id");
//			
//			window._currentRoom = currentId;
//			//alert(currentId);
////sort out the icons
//			switch(currentId){
//				case 'UShape':
//					$('#UShape').attr({src:'../images/UShape_on.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Theatre':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_on.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Classroom':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_on.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Reception':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_on.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Cabaret':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_on.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Boardroom':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_on.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'Banquet':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_on.jpg'});
//					$('#any').attr({src:'../images/any_off.jpg'});
//				break;
//				case 'any':
//					$('#UShape').attr({src:'../images/UShape_off.jpg'});
//					$('#Theatre').attr({src:'../images/Theatre_off.jpg'});
//					$('#Classroom').attr({src:'../images/Classroom_off.jpg'});
//					$('#Reception').attr({src:'../images/Reception_off.jpg'});
//					$('#Cabaret').attr({src:'../images/Cabaret_off.jpg'});
//					$('#Boardroom').attr({src:'../images/Boardroom_off.jpg'});
//					$('#Banquet').attr({src:'../images/Banquet_off.jpg'});
//					$('#any').attr({src:'../images/any_on.jpg'});
//				break;
//			}
//			//filter();		
//			});
			
			
			
		
// brand filter
//			var allBrand = true;
//			$('#allBrands').change(function(){
//				if ($(this).is(':checked')){
//					allBrand = true;
//				}else{
//					allBrand = false;
//				}
//				//filter();
//			});
// additional filters

			//$('#innerHolder .on_off input:checkbox').change(function(){
				//filter();
			//});	
// delegate filter
			
			//$('#delTB').keyup(function(){
			//	filter();
			//});

			
// clear delegate text
//			$('.default-value').each(function() {
//				var default_value = this.value;
//				$(this).focus(function() {
//					if(this.value == default_value) {
//						this.value = '';
//					}
//				});
//				$(this).blur(function() {
//					if(this.value == '') {
//						this.value = '0000';
//					}
//				});
//			});
// check hotels

//			function addFav()
//				{
//					//alert($(this));
//						 var addHotID = $(this).attr('id');
//						$.post("../../services/guests.ashx?addfavourite=" + addHotID);
//						var insert = $("<div class='fav' id=" + addHotID + "><img src='../images/fav.gif'/></div>");
//						insert.click(remFav);
//						$(this).replaceWith(insert);
//						
//					}
//					
//					function remFav(){
//							//alert($(this));
//							var remHotID = $(this).attr('id');
//							$.post("../../services/guests.ashx?removefavourite=" + remHotID);
//							var insert = $("<div class='notFav' id=" + remHotID + "><img src='../images/notFav.gif'/></div>");
//							insert.click(addFav);
//							$(this).replaceWith(insert);
//							
//						}


//			function filter(){

//				var del = $('#delTB').val();
//				var currentId = window._currentRoom;
//				var facilities = [];
//				
//				$('#innerHolder .on_off input:checkbox').each(function(){
//					
//					if ($(this).is(':checked')){
//						facilities.push(this.id);
//						return;
//					}
//					
//				});
//				$('#t1 tbody tr td').each(function(){				
//					var thisdel = parseInt($(this).find('div.' + currentId).text());
//						if(del>0){
//							if(thisdel >= del){ 
//								$(this).show();	
//							}else{
//								$(this).hide();
//								return;
//							};
//						}
//						if(currentId != undefined && currentId != ""){
//							var thisroom = $(this).find('div.descHolder div.' + currentId).length > 0;
//						
//							if(thisroom || currentId == 'any'){
//								$(this).show();	
//							}else{
//								$(this).hide();
//								return;
//							};
//						};
//						for (i=0, j=facilities.length; i<j;i++){
//						
//							if($(this).find('div.descHolder div.' + facilities[i]).length > 0){	
//								$(this).show();	
//							}else{
//								$(this).hide();
//								return;
//							};
//						}
//						var thisBrand = $(this).find('div.hotelHolder .hotelType').attr("id");
//							//alert(allBrand);
//						if(thisBrand == "6c19277f-fc72-4297-b913-1dde63018a2a"){
//							// crown plaza colour change
//							$(this).find('.HotelName a').addClass("crownPlaza");
//						};
//						if(thisBrand == "644a7f05-0e3e-4db7-8e8b-311d96cd4ca3"){
//							// Express colour change
//							$(this).find('.HotelName a').addClass("express");	
//						};
//							
//							if(allBrand == false){
//								if(thisBrand == "6c19277f-fc72-4297-b913-1dde63018a2a"){
//									// crown plaza
//									$(this).hide();
//								};
//								if(thisBrand == "644a7f05-0e3e-4db7-8e8b-311d96cd4ca3"){
//									// Express
//									$(this).hide();
//									
//								};
//							};
//							
//					});
//				checkAmount();	
//				
//				};

		}
			
			
			
);

			