/**

 * @author carlos.mantilla

 */

	$j = jQuery.noConflict();

	

	function getLocations(locationsSelect, parentSelect, lang, firstOption){

		var parentId = $j("#"+parentSelect).val();

		if(parentId>0){

			$j("#"+locationsSelect).removeOption(/./);

			if(firstOption!="")

				$j("#"+locationsSelect).addOption("0", firstOption);

			$j("#"+locationsSelect).ajaxAddOption('locations.php?cCode='+parentId+'&lang='+lang, {}, false);

			//alert('locations.php?cCode='+parentId+'&lang='+lang);

		}

	}	

	

	function roomsUpdate(rooms){
		if(rooms>0){
			for(i=0; i<3; i++){
				var id="#people_"+i;
				if(i<rooms) $j(id).show();
				else  $j(id).hide();
			}
		}
	}



	function kidsAgeLink(kids, div){			

		var id_div = "#kidsAges_" + div;

		if(kids>0){

			$j(id_div).show();

			for(j=0; j<3; j++){

				var id_select = "#kidAge_" + div + "_" + j;

				if(j<kids)

					$j(id_select).show();

				else 

					$j(id_select).hide();

			}

		}

		else $j(id_div).hide();

	}	



	function addFormField() {

		var id = document.getElementById("id").value;

		$("#divTxt").append("<p id='row" + id + "'><label for='txt" + id + "'>Field " + id + " <input type='text' size='20' name='txt[]' id='txt" + id + "'> <a href='#' onClick='removeFormField(\"#row" + id + "\"); return false;'>Remove</a><p>");

		

		$('#row' + id).highlightFade({

			speed:1000

		});

		

		id = (id - 1) + 2;

		document.getElementById("id").value = id;

	}

	

	

		/*$.ajax({

			url: 'cities.php',

			type: 'GET',

			datatype: 'text',

			data: 'cCode='+countryId+'&lang='+lang,

			error: function(){

				alert('Error loading XML document');

			},

			success: function(json){

				alert(json);

				cities.ajaxAddOption(json);

			}			

		})*/	

	

	function updateRate(hotelNum, ratePlan, rateCategory, ratePlanNumber){

		$('ratePlanCode').value = ratePlan;

		$('xxx_'+hotelNum).value = ratePlan;

		$('hotelNum').value = hotelNum;

		$('rateCategory').value = rateCategory;

		$('ratePlanNumber').value = ratePlanNumber;

		$('formBook').submit();

	}

	