/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth;
var arr_childs = [];
var arr_childs2 = [];
var arr_childs3 = [];

/* No need to change anything after this */

//document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;

		for(a = 0; a < inputs.length; a++) {
			$('#selectnum_rooms').remove();
			$('#selectnum_adults').remove();
			$('#selectnum_childs1').remove();
			$('#selectnum_adults2').remove();
			$('#selectnum_childs2').remove();
			$('#selectnum_adults3').remove();
			$('#selectnum_childs3').remove();
			$('#selectnum_rooms_rez').remove();
			$('#selectnum_adults_rez').remove();
			$('#selectnum_childs_rez').remove();
			$('#selectnum_adults_rez2').remove();
			$('#selectnum_childs_rez2').remove();
			$('#selectnum_adults_rez3').remove();
			$('#selectnum_childs_rez3').remove();
			$('#selecttransp_type').remove();
                        $('#selectperpage').remove();
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				
				//if(inputs[a].id == "upper" || inputs[a].id == "early_b" || inputs[a].id == "last_min") {
				 //alert($("#dialog").css('display'));	
				
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;
				//alert($('.checkbox').size());
				//alert(inputs[a].id);
				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				//alert(inputs[a].parentNode);
				if(($("#dialog").css('display')!='block') && (inputs[a].type == "checkbox")){
					inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				}
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
					
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				//alert($('#selectnum_rooms').length);
				//$('#selectnum_rooms').remove();
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					
					//alert(option[b].selected);
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
						//alert($('#num_adults').val( 1 ).html());
						//alert($('#num_adults option:first').val());
						//$('#roomsid').val(option[b].childNodes[0].nodeValue);
						$('#roomsid').val($('#num_rooms option:first').val());
						//$('#adultsid').val(option[b].childNodes[0].nodeValue);
 
						$('#adultsid').val($('#num_adults option:first').val());
						//alert($('#num_childs1 option:first').val());
						$('#childsid').val($('#1 option:first').val());
						//$('#childsid').val(option[b].childNodes[0].nodeValue);
						$('#transid').val($('#transp_type option:first').val());
						$('#adultsid2').val($('#num_adults2 option:first').val());
						$('#childsid2').val($('#num_childs2 option:first').val());
						$('#adultsid3').val($('#num_adults3 option:first').val());
						$('#childsid3').val($('#num_childs3 option:first').val());
						$('#perpageid').val($('#perpage option:first').val());
                                                $('#roomsid_rez').val(option[b].childNodes[0].nodeValue);
						$('#adultsid_rez').val(option[b].childNodes[0].nodeValue);
						$('#childsid_rez').val(option[b].childNodes[0].nodeValue);

					}
				}
				
				span[a] = document.createElement("span");
				//alert(inputs[a].id);
				if(inputs[a].id=='age_childs' || inputs[a].id=='perpage' || inputs[a].id=='num_rooms' || inputs[a].id=='num_adults' || inputs[a].id=='num_childs1' || inputs[a].id=='num_rooms2' || inputs[a].id=='num_adults2' || inputs[a].id=='num_childs2' || inputs[a].id=='num_rooms3' || inputs[a].id=='num_adults3' || inputs[a].id=='num_childs3' || inputs[a].id=='num_rooms_rez' || inputs[a].id=='num_adults_rez' || inputs[a].id=='num_childs_rez' || inputs[a].id=='num_adults_rez2' || inputs[a].id=='num_childs_rez2' || inputs[a].id=='num_adults_rez3' || inputs[a].id=='num_childs_rez3' || inputs[a].id=='sel_date' || inputs[a].id=='hotel_name'){
					if(inputs[a].id=='age_childs' || inputs[a].id=='perpage'){
						span[a].className = "newnewnewselect";
					}else if(inputs[a].id=='num_rooms' || inputs[a].id=='num_adults' || inputs[a].id=='num_childs1' || inputs[a].id=='num_rooms2' || inputs[a].id=='num_adults2' || inputs[a].id=='num_childs2' || inputs[a].id=='num_rooms3' || inputs[a].id=='num_adults3' || inputs[a].id=='num_childs3'){
						span[a].className = "newnewselect";
					} else if(inputs[a].id=='sel_date' || inputs[a].id=='hotel_name') {
						span[a].className = "new122_sel";
					}else{
						span[a].className = "newselect";
					}
				}else{
					span[a].className = "select";
				}
				//alert(inputs[a].name);
				span[a].id = "select" + inputs[a].name;
				 //alert($('#selectnum_rooms').length);
				span[a].appendChild(textnode);
				
				  //alert($('#adultsid_rez').val());
				//if($('#roomsid').val()=='1' && $('#adultsid').val()=='1' && $('#childsid').val()=='1'){
					//alert($(span[a]).html());
					inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				//}
				
				if(!inputs[a].getAttribute("disabled")) {
					
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
			this.className+=' pushed';
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		//alert(option.length);
		
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				//alert(option[d]);
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
				var theid = option[d].childNodes[0].nodeValue;
				//alert(theid);
			 	if(this.name=='offer_type'){
					
					//$('#typeid').val(theid);
				}else if(this.name=='transp_type'){
					//alert(this.value);
					$('#perpageid').val(this.value);
					//alert($('#transid').val());
				}else if(this.name=='perpage'){
					//alert(this.value);
					$('#perpage').val(this.value);
					//alert($('#transid').val());
				}else if(this.name=='num_rooms'){
                                    clear_values_room(this.value);
                                    if(this.value<2) {
                                        $('#num_childs2 option:eq(0)').attr('selected', true);
                                        $('#selectnum_childs2').html('0');
                                        $('#num_childs3 option:eq(0)').attr('selected', true);
                                        $('#selectnum_childs3').html('0');
                                        if($('#num_childs1 option:selected').val() =='0' && $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                            $('#alertage').css({"display": "none"});
                                            $('#deca_room2').css({"display": "none"});
                                            $('#childs_2_1').css({"display": "none"});
                                            $('#childs_2_2').css({"display": "none"});
                                            $('#deca_room3').css({"display": "none"});
                                            $('#childs_3_1').css({"display": "none"});
                                            $('#childs_3_2').css({"display": "none"});
                                        } else if( $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                            $('#deca_room2').css({"display": "none"});
                                            $('#childs_2_1').css({"display": "none"});
                                            $('#childs_2_2').css({"display": "none"});
                                            $('#deca_room3').css({"display": "none"});
                                            $('#childs_3_1').css({"display": "none"});
                                            $('#childs_3_2').css({"display": "none"});
                                        }
                                        $('#room3para').css({"display": "none"});
                                        $('#room2para').css({"display": "none"});

                                    } else if(this.value==2) {
                                        $('#num_childs3 option:eq(0)').attr('selected', true);
                                        $('#selectnum_childs3').html('0');
                                        if($('#num_childs2 option:selected').val()=='0') {
                                            $('#deca_room2').css({"display": "none"});
                                            $('#childs_2_1').css({"display": "none"});
                                            $('#childs_2_2').css({"display": "none"});
                                        }
                                        if($('#num_childs3 option:selected').val()=='0') {
                                            $('#deca_room3').css({"display": "none"});
                                            $('#childs_3_1').css({"display": "none"});
                                            $('#childs_3_2').css({"display": "none"});
                                        }

                                        $('#num_childs3 option:selected').val('0');
                                        if($('#num_childs1 option:selected').val() =='0' && $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                            $('#alertage').css({"display": "none"});
                                        }

                                        $('#room3para').css({"display": "none"});
                                        $('#room2para').css({"display": "block"});

                                    }else if(this.value==3){
                                        $('#num_childs3 option:selected').val('0');
                                        $('#room2para').css({"display": "block"});
                                        $('#room3para').css({"display": "block"});
                                    }
				}else if(this.name=='num_childs1'){
                                        if(this.value==0){
                                            if($('#num_childs1 option:selected').val() =='0' && $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                                $('#alertage').css({"display": "none"});
                                            }
                                            $('#deca_room1').css({"display": "none"});
                                            $('#childs_1_1').css({"display": "none"});
                                            $('#childs_1_2').css({"display": "none"});
                                        } else if(this.value==1) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room1').css({"display": "block"});
                                            $('#childs_1_1').css({"display": "block"});
                                            $('#childs_1_2').css({"display": "none"});
                                        } else if(this.value==2) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room1').css({"display": "block"});
                                            $('#childs_1_1').css({"display": "block"});
                                            $('#childs_1_2').css({"display": "block"});
                                        }else{
                                            $('#deca_room1').css({"display": "none"});
                                            $('#childs_1_1').css({"display": "none"});
                                            $('#childs_1_2').css({"display": "none"});
                                            dialog_open('rezerv', '0');
					}
                                        
				}else if(this.name=='num_childs2'){
                                        if(this.value==0){
                                            if($('#num_childs1 option:selected').val() =='0' && $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                                $('#alertage').css({"display": "none"});
                                            }
                                            $('#deca_room2').css({"display": "none"});
                                            $('#childs_2_1').css({"display": "none"});
                                            $('#childs_2_2').css({"display": "none"});
                                        } else if(this.value==1) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room2').css({"display": "block"});
                                            $('#childs_2_1').css({"display": "block"});
                                            $('#childs_2_2').css({"display": "none"});
                                        } else if(this.value==2) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room2').css({"display": "block"});
                                            $('#childs_2_1').css({"display": "block"});
                                            $('#childs_2_2').css({"display": "block"});
                                        }else{
                                            $('#deca_room2').css({"display": "none"});
                                            $('#childs_2_1').css({"display": "none"});
                                            $('#childs_2_2').css({"display": "none"});
                                            dialog_open('rezerv', '0');
					}

				}else if(this.name=='num_childs3'){
                                        if(this.value==0){
                                            if($('#num_childs1 option:selected').val() =='0' && $('#num_childs2 option:selected').val()=='0' && $('#num_childs3 option:selected').val()=='0') {
                                                $('#alertage').css({"display": "none"});
                                            }
                                            $('#deca_room3').css({"display": "none"});
                                            $('#childs_3_1').css({"display": "none"});
                                            $('#childs_3_2').css({"display": "none"});
                                        } else if(this.value==1) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room3').css({"display": "block"});
                                            $('#childs_3_1').css({"display": "block"});
                                            $('#childs_3_2').css({"display": "none"});
                                        } else if(this.value==2) {
                                            if($('#alertage').css('display')=='none') {
                                                $('#alertage').css({"display": "block"});
                                            }
                                            $('#deca_room3').css({"display": "block"});
                                            $('#childs_3_1').css({"display": "block"});
                                            $('#childs_3_2').css({"display": "block"});
                                        }else{
                                            $('#deca_room3').css({"display": "none"});
                                            $('#childs_3_1').css({"display": "none"});
                                            $('#childs_3_2').css({"display": "none"});
                                            dialog_open('rezerv', '0');
					}

				}else if(this.name=='sel_date') {
					dialog_load_hotels(this.value);
				}else if(this.name=='num_rooms_rez'){
                                        p_r();
					$('#roomsid_rez').val(theid);
				}else if(this.name=='num_adults_rez'){
					$('#adultsid_rez').val(theid);
				}else if(this.name=='num_childs_rez'){
                                        c_r();
					$('#childsid_rez').val(theid);
				}else if(this.name=='num_adults_rez2'){
					$('#adultsid_rez2').val(theid);
				}else if(this.name=='num_childs_rez2'){
                                        c_r();
					$('#childsid_rez2').val(theid);
				}else if(this.name=='num_adults_rez3'){
					$('#adultsid_rez3').val(theid);
				}else if(this.name=='num_childs_rez3'){
                                        c_r();
					$('#childsid_rez3').val(theid);
				}else if(this.name=='num_rooms2'){
					$('#roomsid2').val(theid);
				}else if(this.name=='num_adults2'){
					$('#adultsid2').val(theid);
				}else if(this.name=='num_childs2'){
					$('#childsid2').val(theid);
					var childstoapp2 = '';
						var countchldslength = arr_childs2.length;
						var cntrooms = $('.countrooms').length;
							if(theid<='2'){	
									if(theid>'0'){	
									if($('#alertage').is(":visible")==false){
										$('#alertage').show();
									}
											if($("#ch_r_2").html()==null){
												childstoapp2 = '<div id="ch_r_2" style="clear:left;padding:10px 0 0px 0px;float:left;width:150px;">';
											
												childstoapp2 += '<div style="float:left;padding:25px 0px 0 0px;font-size:10px;width:27px;"><span>ст. 2</span></div>';
											//}
		//								if($("#ch_r_2").html()==null){
											childstoapp2 += '<div id="chldhtml2" style="float:left;"></div>';
										}
										//alert(countchldslength);
										if(countchldslength=='0'){
											for(ch2 = 1; ch2 <= theid; ch2++) {
												//alert(theid);
												arr_childs2.push( theid );
											}
										}else if(countchldslength<theid){
											var elstoadd = theid - countchldslength;
											// alert(elstoadd);
											arr_childs2.length = theid;
										}else if(countchldslength>theid){
											//alert(theid);
											//arr_childs.push( theid );
											var elstoremove = countchldslength - theid;
											
											arr_childs2.splice(1, elstoremove);
											//alert(elstoremove);
										}
										if($("#ch_r_2").html()==null){
											childstoapp2 += '</div>';
										}
									}else{
										if(($("#selectnum_childs3").html()=='0' || $("#selectnum_childs3").html()==null) && ($("#selectnum_childs2").html()=='0' || $("#selectnum_childs2").html()==null) && ($("#selectnum_childs").html()=='0' || $("#selectnum_childs").html()==null)){
											$('#alertage').hide();
										}
										$("#ch_r_2").remove();
										
									}
									//}
							if(theid>'0'){
								//alert($("#ch_r_3").html());
								if($("#ch_r_3").html()!=null){
									$(childstoapp2).insertBefore("#ch_r_3");
								}else{
									$('#calculchilds_js').append(childstoapp2);
								}
								arr_childs_html('2');
								
								Custom.init();
							}
					}else{
						//alert('a');	
						dialog_open('rezerv', '0');
					}
					
					//alert(theid);
				}else if(this.id=='age_childs'){
					//$('#agechildsid').val(theid);
				}else if(this.name=='num_rooms3'){
					$('#roomsid3').val(theid);
				}else if(this.name=='num_adults3'){
					$('#adultsid3').val(theid);
				}else if(this.name=='num_childs3'){
					$('#childsid3').val(theid);
						var childstoapp3 = '';
					//alert(arr_childs2.length);
						var countchldslength = arr_childs3.length;
						if(theid<='2'){	
							if(theid>'0'){	
									if($('#alertage').is(":visible")==false){
										$('#alertage').show();
									}
							//alert($("#ch_r_2").html());
									if($("#ch_r_3").html()==null){
										childstoapp3 = '<div id="ch_r_3" style="clear:left;padding:10px 0 0px 0px;float:left;width:150px;">';
										childstoapp3 += '<div style="float:left;padding:25px 0px 0 0px;font-size:10px;width:27px;"><span>ст. 3</span></div>';
										childstoapp3 += '<div id="chldhtml3" style="float:left;"></div>';
									}
								//alert(countchldslength);
									if(countchldslength=='0'){
										for(ch3 = 1; ch3 <= theid; ch3++) {
											//alert(theid);
											arr_childs3.push( theid );
										}
									}else if(countchldslength<theid){
										var elstoadd = theid - countchldslength;
										// alert(elstoadd);
										arr_childs3.length = theid;
									}else if(countchldslength>theid){
										//alert(theid);
										//arr_childs.push( theid );
										var elstoremove = countchldslength - theid;
										
										arr_childs3.splice(1, elstoremove);
										//alert(elstoremove);
									}
									if($("#ch_r_3").html()==null){
										childstoapp3 += '</div>';
									}
								}else{
									if(($("#selectnum_childs3").html()=='0' || $("#selectnum_childs3").html()==null) && ($("#selectnum_childs2").html()=='0' || $("#selectnum_childs2").html()==null) && ($("#selectnum_childs").html()=='0' || $("#selectnum_childs").html()==null)){
										$('#alertage').hide();
									}
									$("#ch_r_3").remove();
									
								}
							if(theid>'0'){
								$('#calculchilds_js').append(childstoapp3);
								arr_childs_html('3');
								
								Custom.init();
							}
					}else{
						dialog_open('rezerv', '0');
					}
					
				}
			}
		}
		
	}
	
}


function clear_values_room(room) {
    if(room==1) {
        $('#num_adults2 option:eq(0)').attr('selected', true);
        $('#selectnum_adults2').html('1');
        $('#num_childs2 option:eq(0)').attr('selected', true);
        $('#selectnum_childs2').html('0');

        $('#num_adults3 option:eq(0)').attr('selected', true);
        $('#selectnum_adults3').html('1');
        $('#num_childs3 option:eq(0)').attr('selected', true);
        $('#selectnum_childs3').html('0');

        $('#age_childs_2_1 option:eq(0)').attr('selected', true);
        $('#age_childs_2_2 option:eq(0)').attr('selected', true);
        $('#age_childs_3_1 option:eq(0)').attr('selected', true);
        $('#age_childs_3_2 option:eq(0)').attr('selected', true);
    }else if(room==2) {
        $('#num_childs3 option:eq(0)').attr('selected', true);
        $('#selectnum_childs3').html('0');
        $('#age_childs_3_1 option:eq(0)').attr('selected', true);
        $('#age_childs_3_2 option:eq(0)').attr('selected', true);
    } else if(room==3) {
        $('#num_childs3 option:eq(0)').attr('selected', true);
        $('#selectnum_childs3').html('0');
    }
}

function arr_childs_html(room) {
 //alert(arr_childs.length);

if(room=='1'){
	var chldshtml = '';
	for(ch = 1; ch <= arr_childs.length; ch++) {
	 //alert(ch);
		 	chldshtml += ' <div class="countchlds" id="childs' + ch +'" style="float:left;width:45px;">';
		//if(countchldslength =='0'){
			chldshtml += '<div style="padding:0px 0 5px 3px;">Дете ' + ch + '</div>';
		//}
			chldshtml += '<input type="hidden" id="agechildsid" value="" />';
			chldshtml += '<select class="styled" name="age_childs_1_' + ch + '"  id="age_childs">';
				chldshtml += '<option value="">-?-</option>';
				chldshtml += '<option value="">< 1</option>';
				for(var i=1; i<=18; i++){
			
				 chldshtml += '<option value='+ i + '>' + i + '</option>';
				
				}
			chldshtml += '</select>';
		chldshtml += '</div>';
	}
	$('#chldhtml').html('');
	$('#chldhtml').html(chldshtml);
}else if(room=='2'){
		var chldshtml2 = '';
		for(ch2 = 1; ch2 <= arr_childs2.length; ch2++) {
	 //alert(ch2);
		 	chldshtml2 += ' <div class="countchlds_2" id="childs' + ch2 +'" style="float:left;width:45px;">';
		//if(countchldslength =='0'){
		//}
			chldshtml2 += '<div style="padding:0px 0 5px 3px;">Дете ' + ch2 + '</div>';
			chldshtml2 += '<input type="hidden" id="agechildsid" value="" />';
			chldshtml2 += '<select class="styled" name="age_childs_2_' + ch2 + '"  id="age_childs">';
			chldshtml2 += '<option value="">-?-</option>';
			chldshtml2 += '<option value="">< 1</option>';
			for(var i=1; i<=18; i++){
			
			 chldshtml2 += '<option value='+ i + '>' + i + '</option>';
			
			}

			chldshtml2 += '</select>';
		chldshtml2 += '</div>';
		}
		$('#chldhtml2').html('');
		$('#chldhtml2').html(chldshtml2);
}else if(room=='3'){
		var chldshtml3 = '';
		for(ch3 = 1; ch3 <= arr_childs3.length; ch3++) {
	 // alert(ch3);
		 	chldshtml3 += ' <div class="countchlds_2" id="childs' + ch3 +'" style="float:left;width:45px;">';
		//if(countchldslength =='0'){
		//}
			chldshtml3 += '<div style="padding:0px 0 5px 3px;">Дете ' + ch3 + '</div>';
			chldshtml3 += '<input type="hidden" id="agechildsid" value="" />';
			chldshtml3 += '<select class="styled" name="age_childs_3_' + ch3 + '"  id="age_childs">';
				chldshtml3 += '<option value="">-?-</option>';
				chldshtml3 += '<option value="">< 1</option>';
				for(var i=1; i<=18; i++){
			
				 chldshtml3 += '<option value='+ i + '>' + i + '</option>';
				
				}
			chldshtml3 += '</select>';
		chldshtml3 += '</div>';
		}
		$('#chldhtml3').html('');
		$('#chldhtml3').html(chldshtml3);
}
	//alert(chldshtml);

}


//window.onload = Custom.init;

