var formA = 1;
var winResW;
var winResW2;
var winRes;
$(function() {
	
	$('.reservation_l').click(function() {
	
		var href = $(this).attr('href');
		var winRes = window.open(href, "windowReview","width=520,height=380,left="+((screen.width-520)/2)+",top="+((screen.height-380)/2)+",resizable,scrollbars=yes,status=1");
		winRes.focus();
		return false;
		
	});
	
	$('.all_season').click(function() {
	
		var href = $(this).attr('href');
		winRes = window.open(href, "windowReview","width=720,height=480,left="+((screen.width-720)/2)+",top="+((screen.height-480)/2)+",resizable,scrollbars=yes,status=1");
		winRes.focus();
		return false;
		
	});
	
	$('#openListWay').click(function() {
		//var href = $(this).attr('href');
		
		asd1 ();
		return false;
		
	});
	
	$('#openListWay2').click(function() {
		//var href = $(this).attr('href');
		
		asd2 ();
		return false;
		
	});
})

function asd2 (){
	formA = 2;
	winResW2 = window.open('/subway_list/', "windowReview","width=920,height=630,left="+((screen.width-920)/2)+",top="+((screen.height-630)/2)+",resizable,scrollbars=yes,status=1");
	winResW2.focus();
}

function asd1 (){
	formA = 1;
	winResW = window.open('/subway_list/', "windowReview","width=920,height=630,left="+((screen.width-920)/2)+",top="+((screen.height-630)/2)+",resizable,scrollbars=yes,status=1");
	winResW.focus();
}

function insWay (obj){
//alert (subW);
	var result = 'Любое';
	if (obj.length > 0){
		result = '';
	}
	var wy = '';
	for (var i in obj) {
		//result += i + " = " + obj[i] + " TYPE: "+(typeof obj[i])+"\n";
		result += obj[i]+'<br>';
		wy += i+'_';
	}

	
	//var tmpSWay = subW.split('_');
	//$('#way_hotel_subway').val(subW);
	//$('#cntWay').text(tmpSWay.length);
	if (formA == 2){
		if (obj.length > 1){
			//result = '';
			$('#openListWay2').addClass("openListWay2");
		}
		else{
			$('#openListWay2').removeClass("openListWay2");
		}
		
		$('#openListWay2').html(result);
		$('#way_hotel_subway2').val(wy);
		winResW2.close();
	}
	else{
		$('#openListWay').html(result);
		$('#way_hotel_subway').val(wy);
	winResW.close();
}
}
