// JavaScript Document
// Global Functions for Website www.topinternational.com


			// select witdh for IE
			$(document).ready(function(){
			if($.browser.msie){
					$("select").selecteSizer();
				}
			});
			
			// jqueryui - Theme elements

			$(function(){
			
			
			// lightbox
				
				//$("a[@rel*=lightbox]").lightBox(); // Select all links that contains lightbox in the attribute rel
				
				$("a.lightbox").lightBox(); // Select all links with lightbox class
				
			
				// Accordion
				$("#accordion").accordion({ header: "h3" });
	
				// Tabs
				$('#tabs').tabs();
	

				// Dialog			
				$('#dialog').dialog({
					autoOpen: false,
					width: 600,
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
				// Dialog Link
				$('#dialog_link').click(function(){
					$('#dialog').dialog('open');
					return false;
				});

				
				// hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
				
				 var galleries = $('.ad-gallery').adGallery({
				 
				  loader_image: '/images/loader.gif',
				  width: 465, // Width of the image, set to false and it will read the CSS width
				  height: 330, // Height of the image, set to false and it will read the CSS height
				  
				  effect: 'fade' // or 'slide-vert', 'resize', 'slide-hori', 'none' or false
				 
				 });
				$('#switch-effect').change(
				  function() {
					galleries[0].settings.effect = $(this).val();
					return false;
				  }
				);
				$('#toggle-slideshow').click(
				  function() {
					galleries[0].slideshow.toggle();
					return false;
				  }
				);
				
				// Fill Hotel-Select changing Country-Select
				$("select#country").change(function(){
					//alert ('Test');
					$.getJSON("/includes/plugins/select.php",{id_oco: $(this).val()}, function(j){
						var options = '';
						for (var i = 0; i < j.length; i++) {
							options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
						}
						$("#id_hot").html(options);
						$('#id_hot option:first').attr('selected', 'selected');
					})
				})	

			
			});