function add_iframe(elm){if($.browser.msie&&$.browser.version<=6&&$(".pre_ie_iframe",elm).length==0){var elm_w=elm.width();var elm_h=elm.height();var elm_z=(elm.css("z-index")!=0)?elm.css("z-index")-1:0;elm.wrapInner('<div class="pre_ie_iframe"></div>');$(".pre_ie_iframe",elm).css({height:elm_h,left:0,position:"absolute",top:0,width:elm_w,zIndex:elm_z+1});$("<iframe></iframe>").attr({className:"ie_iframe"}).css({border:0,height:elm_h,left:0,opacity:0,position:"absolute",top:0,width:elm_w,zIndex:elm_z}).appendTo(elm);$(elm).bind("resize",function(){var elm_w=elm.width();var elm_h=elm.height();$(".pre_ie_iframe",elm).css({height:elm_h,width:elm_w});$(".ie_iframe",elm).css({height:elm_h,width:elm_w})})}return}function cast_blanket(popup,time,o_args){var document_h=$(document).height();var document_w=$(document).width();var opacity=.5;if(o_args.opacity){opacity=o_args.opacity}$("<div></div>").attr({id:"blanket"}).css({height:document_h,left:0,opacity:opacity,position:"absolute",top:0,width:document_w,zIndex:100}).appendTo($("body"));if($.browser.msie){$("<iframe></iframe>").attr({id:"blanket_iframe"}).css({border:0,height:document_h,left:0,opacity:0,position:"absolute",top:0,width:document_w,zIndex:99}).appendTo($("body"))}position_popup(popup);if(time!=0){popup.fadeIn(time,change_blanket)}else{popup.show(10,change_blanket)}$(window).bind("resize",function(){change_blanket();position_popup(popup)});$("#blanket").bind("click",function(){$(window).unbind("resize");remove_blanket(popup,0)});return}function change_blanket(){var document_h=$(document).height();var document_w=$(document).width();if($.browser.msie&&$.browser.version<=6&&($(window).height()-$(document).height()<0)){document_w-=17}$("#blanket").css({height:document_h,width:document_w});$("#blanket_iframe").css({height:document_h,width:document_w})}function correct_footer_pos(){if($.browser.msie&&$.browser.version<=6){var doc_h=$(body).height();var f_h=$("#footer").height();$("#footer").css({top:doc_h-f_h})}return}function correct_ww_window(parent){if($.browser.msie&&$.browser.version<=6){var h=$(".ww_window",parent).height();$(".ww_window .lm, .ww_window .rm",parent).height(h)}return}function correct_ww_window_id(){if($.browser.msie&&$.browser.version<=6){var h=$("#x_ww_window").height();$("#x_ww_window .lm, #x_ww_window .rm").height(h)}return}function correct_ww_window_id1(){if($.browser.msie&&$.browser.version<=6){var h=$("#x_ww_window_1").height();$("#x_ww_window_1 .lm, #x_ww_window_1 .rm").height(h)}return}function position_popup(popup){var view_height=$(window).height();var view_width=$(window).width();var bb=(!isNaN(parseInt(popup.css("borderBottomWidth"))))?parseInt(popup.css("borderBottomWidth")):0;var bl=(!isNaN(parseInt(popup.css("borderLeftWidth"))))?parseInt(popup.css("borderLeftWidth")):0;var br=(!isNaN(parseInt(popup.css("borderRightWidth"))))?parseInt(popup.css("borderRightWidth")):0;var bt=(!isNaN(parseInt(popup.css("borderTopWidth"))))?parseInt(popup.css("borderTopWidth")):0;var popup_width=popup.width()+bl+br;var popup_height=popup.height()+bb+bt;var popup_loading_left=Math.ceil((view_width-popup_width)/2)+$(document).scrollLeft();var popup_loading_top=Math.ceil((view_height-popup_height)/2)+$(document).scrollTop();if(view_width-popup_width<0){popup_loading_left=$(document).scrollLeft()+10}if(view_height-popup_height<0){popup_loading_top=$(document).scrollTop()+10}if(popup.css("position")=='fixed'){var popup_loading_left=Math.ceil((view_width-popup_width)/2);var popup_loading_top=Math.ceil((view_height-popup_height)/2);if(view_width-popup_width<0){popup_loading_left=10}if(view_height-popup_height<0){popup_loading_top=10}}popup.css({left:popup_loading_left,top:popup_loading_top});return}function recalculate(days){var valute_raw=$(".calculator .btns .money .a").attr('class');valute_raw=valute_raw.split(" ");var valute='usd';valute=(valute_raw[0]!="a")?valute_raw[0]:valute_raw[1];var currency_usd=$(".currencies .usd .curr").text();currency_usd=parseFloat(currency_usd.replace(",","."));var currency=1;if(valute!='rur'){var currency=$(".currencies ."+valute+" .curr").text();currency=parseFloat(currency.replace(",","."))}var duration=parseInt($(".calculator .window .duration .num").text());duration=duration+days;$(".calculator .window .duration .num").text(duration);var aday=parseInt($(".calculator .li5 .info .price .aday").text());var price_old=parseInt($(".calculator .li5 .info .price .orig").text());duration=1;var price_new=duration*aday;$(".calculator .li5 .info .price .orig").text(price_new);var total=parseInt($(".calculator .total .orig").text());total=total-price_old+price_new;$(".calculator .total .orig").text(total);var str_days='дней';duration_str=new String(duration);var digit=duration_str[duration_str.length-1];if(digit==1&&duration!=11){str_days='день'}else if((digit==2||digit==3||digit==4)&&(duration!=12&&duration!=13&&duration!=14)){str_days='дня'}$(".calculator .window .duration .days").text(str_days);if(valute!='usd'){total=Math.ceil(total*currency_usd/currency)}$(".calculator .li5 .info .price .num").text(Math.ceil(price_new*currency_usd/currency));$(".calculator .total .num").text(total);return}function remove_blanket(popup,time){if(time!=0){popup.fadeOut(time);setTimeout(function(){$("#blanket").css({opacity:0})},time);setTimeout(function(){$("#blanket_iframe").remove()},time);setTimeout(function(){$("#blanket").remove()},time)}else{popup.hide();$("#blanket").css({opacity:0});$("#blanket_iframe").remove();$("#blanket").remove()}return}function switch_hotel_class(parent,mparent){var price_old=parseInt($(".info .price .orig",mparent).text());var thumb=$(".thumb img",parent).attr("src");var price=parseInt($(".price",parent).text());var l_photo=($(".ww_icons_photo a",parent).length==1)?$(".ww_icons_photo a",parent).attr("href"):"";var l_photo_alt=($(".ww_icons_photo a img",parent).length==1)?$(".ww_icons_photo a img",parent).attr("alt"):"";var l_camera=($(".ww_icons_camera a",parent).length==1)?$(".ww_icons_camera a",parent).attr("href"):"";var l_camera_alt=($(".ww_icons_camera a img",parent).length==1)?$(".ww_icons_camera a img",parent).attr("alt"):"";var l_text=($(".ww_icons_text a",parent).length==1)?$(".ww_icons_text a",parent).attr("href"):"";var l_text_alt=($(".ww_icons_text a img",parent).length==1)?$(".ww_icons_text a img",parent).attr("alt"):"";var duration=$(".calculator .duration .num").text();var id=$(".close a",parent).attr("href").replace(/#(\d+)/,"$1");$(".thumb .frame",mparent).css({backgroundImage:"url("+thumb+")"});$(".hotels input:checked",mparent).attr({value:id});$(".aday",mparent).text(price);$(".icons_photo a",mparent).attr({href:l_photo});$(".icons_photo a img",mparent).attr({alt:l_photo_alt,title:l_photo_alt});$(".icons_camera a",mparent).attr({href:l_camera});$(".icons_camera a img",mparent).attr({alt:l_camera_alt,title:l_camera_alt});$(".icons_text a",mparent).attr({href:l_text});$(".icons_text a img",mparent).attr({alt:l_text_alt,title:l_text_alt});$(".icons_photo",mparent).addClass("hide");if(l_photo!=""){$(".icons_photo",mparent).removeClass("hide")}$(".icons_camera",mparent).addClass("hide");if(l_camera!=""){$(".icons_camera",mparent).removeClass("hide")}$(".icons_text",mparent).addClass("hide");if(l_text!=""){$(".icons_text",mparent).removeClass("hide")}duration=1;var price_new=price*duration;$(".info .price .orig",mparent).text(price_new);var total=parseInt($(".calculator .total .orig").text());total=total-price_old+price_new;$(".calculator .total .orig").text(total);recalculate(0);var valute_raw=$(".calculator .btns .money .a").attr('class');valute_raw=valute_raw.split(" ");var valute='usd';valute=(valute_raw[0]!="a")?valute_raw[0]:valute_raw[1];var currency_usd=$(".currencies .usd .curr").text();currency_usd=parseFloat(currency_usd.replace(",","."));var currency=1;if(valute!='rur'){currency=$(".currencies ."+valute+" .curr").text();currency=parseFloat(currency.replace(",","."))}price_new=Math.ceil(price*currency_usd*duration/currency);$(".info .price .num",mparent).text(price_new);return}function switch_photo(where,indx,imgs){var cur_indx=$(".images li",where).index($(".a",where));if(indx!=cur_indx){var cur_li=$(".images li",where).eq(cur_indx);var li=$(".images li",where).eq(indx);var frame_h=$(".frame .photo").height();cur_li.removeClass("a");$(".pframe_pre",cur_li).css({visibility:"visible"});$(".pframe_pre_a",cur_li).hide();li.addClass("a");$(".pframe_pre",li).css({visibility:"hidden"});$(".pframe_pre_a",li).show();$(".pframe_pre_a .pframe img",li).ifixpng();$(".frame .photo img",where).remove();var top=0;if(imgs.gallery[indx]['height']<frame_h){top=(frame_h-imgs.gallery[indx]['height'])/2}$("<img />").attr({alt:imgs.gallery[indx]['title'],height:imgs.gallery[indx]['height'],src:imgs.gallery[indx]['photo'],title:imgs.gallery[indx]['title'],width:imgs.gallery[indx]['width']}).css({top:top}).appendTo($(".frame .photo",where));$(".frame .counter .cur",where).text(indx+1);var cont_width=$('.slider',where).width();var gal_width=where.width();var max_scroll=gal_width-cont_width;var li_center=119*indx+55;if(li_center>cont_width/2){$(".slider",where).animate({scrollLeft:li_center-cont_width/2},400)}else if($(".slider",where).scrollLeft()>0){$(".slider",where).animate({scrollLeft:li_center-cont_width/2},400)}}return}function switch_play_pause(parent,state){switch(state){case"play":$(".c_play",parent).hide();$(".c_pause",parent).show();break;case"pause":$(".c_play",parent).show();$(".c_pause",parent).hide();break;case"show":$(".c_play",parent).show();$(".c_next",parent).show();break;case"end":$(".c_play",parent).hide();$(".c_pause",parent).hide();$(".c_next",parent).hide();break}return}function switch_video(where,indx){var cur_indx=$(".videos li",where).index($(".a",where));if(indx!=cur_indx){var cur_li=$(".videos li",where).eq(cur_indx);var li=$(".videos li",where).eq(indx);cur_li.removeClass("a");$(".pframe_pre",cur_li).css({visibility:"visible"});$(".pframe_pre_a",cur_li).hide();li.addClass("a");$(".pframe_pre",li).css({visibility:"hidden"});$(".pframe_pre_a",li).show();$(".pframe_pre_a .pframe img",li).ifixpng();$(".player .player_v",where).remove();$("<div />").addClass("player_v").appendTo($(".player",where));$(".player_v",where).flowplayer("/flowplayer-3.1.5.swf",$(".pframe_pre a",li).attr("href"));var cont_width=$('.slider',where).width();var gal_width=where.width();var max_scroll=gal_width-cont_width;var li_center=119*indx+55;if(li_center>cont_width/2){$(".slider",where).animate({scrollLeft:li_center-cont_width/2},400)}else if($(".slider",where).scrollLeft()>0){$(".slider",where).animate({scrollLeft:li_center-cont_width/2},400)}}return}function toggle_form_hint(elm,type,text){elm.bind("focus",function(){switch(type){case'input':if($(this).val()==text){$(this).val('')}break;case'textarea':if($(this).text()==text){$(this).text('')}}});elm.bind("blur",function(){switch(type){case'input':if($(this).val()==''){$(this).val(text)}break;case'textarea':if($(this).text()==''){$(this).text(text)}}});return}$(document).ready(function(){$(".iepng").ifixpng();$('#gallery_mini .list_pre').css({overflow:"hidden"});var total_elms=$('#gallery_mini .list li').length;var cont_width=$('#gallery_mini .list_pre').width();var elm_w=142+2;var gal_width=total_elms*elm_w-2;var show_elms=Math.floor(cont_width/elm_w);var show=show_elms;$("#gallery_mini .list_pre").scrollLeft(0);$('#gallery_mini .list').css({width:gal_width});if(show<total_elms){$("#gallery_mini .nav_next a").removeClass("noa")}$("#gallery_mini .nav_prev a").bind("click",function(e){e.preventDefault();var cur_scr=cont_width+$('#gallery_mini .list_pre').scrollLeft();var show=(Math.floor(cur_scr/(elm_w-2))-(cur_scr/(elm_w-2))<=0)?Math.floor(cur_scr/(elm_w-2))-1:Math.floor(cur_scr/(elm_w-2));var scroll_val=(show==total_elms)?show*elm_w-cont_width:show*(elm_w-2)-cont_width;if(show<=show_elms){$(this).addClass("noa")}else{$(this).removeClass("noa")}if(show<total_elms){$("#gallery_mini .nav_next a").removeClass("noa")}$('#gallery_mini .list_pre').animate({scrollLeft:scroll_val},200)});$("#gallery_mini .nav_next a").bind("click",function(e){e.preventDefault();var cur_scr=cont_width+$('#gallery_mini .list_pre').scrollLeft();var show=(Math.ceil(cur_scr/(elm_w-2))-(cur_scr/(elm_w-2))==0)?Math.ceil(cur_scr/(elm_w-2))+1:Math.ceil(cur_scr/(elm_w-2));var scroll_val=(show==total_elms)?show*elm_w-cont_width:show*(elm_w-2)-cont_width;if(show>=total_elms){$(this).addClass("noa")}else{$(this).removeClass("noa")}if(show>show_elms){$("#gallery_mini .nav_prev a").removeClass("noa")}$('#gallery_mini .list_pre').animate({scrollLeft:scroll_val},200)});toggle_form_hint($(".subscribe .input input"),'input',"Ваш E-mail");toggle_form_hint($("#frm_name"),'input',"Ваше имя");toggle_form_hint($("#frm_2name"),'input',"Фамилия");toggle_form_hint($("#frm_email"),'input',"E-mail (электронная почта)");toggle_form_hint($("#frm_phone"),'input',"Контактный телефон");toggle_form_hint($("#frm_msg"),'textarea',"Вопросы по маршруту");$("#m_top_1 .menu td").hover(function(){if($(".msub",$(this)).length>0){$(this).addClass("hover")}},function(){$(this).removeClass("hover")});$("#m_top_2 .menu td").hover(function(){if($(".msub",$(this)).length>0){$(this).addClass("hover")}},function(){$(this).removeClass("hover")});$(".content .link").hover(function(){$(this).addClass("link_hover");$(".a_balloon",$(this)).show();$(".a_balloon .bg",$(this)).ifixpng();$(".a_balloon .icon img",$(this)).ifixpng()},function(){$(this).removeClass("link_hover");$(".a_balloon",$(this)).hide()});if($("#gallery .images li").length>0){var imgs={gallery:new Array()};var i=0;$("#gallery .images li").each(function(){if($(".photo img",$(this)).length>0){var img_w=$(".photo img",$(this)).attr("width");var img_h=$(".photo img",$(this)).attr("height");if($.browser.msie){img_w=parseInt($(".photo img",$(this)).css("width"));img_h=parseInt($(".photo img",$(this)).css("height"))}imgs.gallery[i]=new Array();imgs.gallery[i]['photo']=$(".photo img",$(this)).attr("src");imgs.gallery[i]['height']=img_h;imgs.gallery[i]['width']=img_w;imgs.gallery[i]['title']=$(".photo img",$(this)).attr("title")}++i})}var li1=$("#gallery .images .a");$(".pframe_pre",li1).css({visibility:"hidden"});$(".pframe_pre_a",li1).show();$(".pframe_pre_a .pframe img",li1).ifixpng();$("#gallery .images li a").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");switch_photo($("#gallery"),$("#gallery .images li").index($(this).parents("li")),imgs)});$("#gallery .frame .c_prev").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");var parent=$(this).parents(".frame");var total=$("#gallery .images li").length;var cur_indx=$("#gallery .images li").index($("#gallery .images .a"));if(cur_indx>0&&cur_indx==total-1){switch_play_pause(parent,"show")}if(cur_indx-1>=0){switch_photo($("#gallery"),cur_indx-1,imgs)}});$("#gallery .frame .c_next").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");var total=$("#gallery .images li").length;var cur_indx=$("#gallery .images li").index($("#gallery .images .a"));if(cur_indx<total-1){switch_photo($("#gallery"),cur_indx+1,imgs)}});$("#gallery .frame .c_play").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");var parent=$(this).parents(".frame");var total=$("#gallery .images li").length;var cur_indx=$("#gallery .images li").index($("#gallery .images .a"));if(cur_indx+1<=total){switch_play_pause(parent,"play");$(document).everyTime(3000,"gallery",function(){cur_indx=$("#gallery .images li").index($("#gallery .images .a"));if(cur_indx+2==total){switch_play_pause(parent,"end")}if(cur_indx<total-1){switch_photo($("#gallery"),cur_indx+1,imgs)}else{$(document).stopTime("gallery")}})}});$("#gallery .frame .c_pause").live("click",function(e){e.preventDefault();var parent=$(this).parents(".frame");var cur_indx=$("#gallery .images li").index($("#gallery .images .a"));var total=$("#gallery .images li").length;$(document).stopTime("gallery");if(cur_indx<total-1){switch_play_pause(parent,"pause")}else{switch_play_pause(parent,"end")}});$("#gallery .bot .zgallery").bind("click",function(e){e.preventDefault();var args=new Object();args={"type":"gallery","opacity":.95,"list":imgs.gallery,"total":$("#gallery .images li .photo").length};cast_blanket($("#ww_gallery"),400,args)});var li1=$("#ww_gallery .images .a");$(".pframe_pre",li1).css({visibility:"hidden"});$(".pframe_pre_a",li1).show();$(".pframe_pre_a .pframe img",li1).ifixpng();$("#ww_gallery .images li a").bind("click",function(e){e.preventDefault();$(document).stopTime("ww_gallery");switch_photo($("#ww_gallery"),$("#ww_gallery .images li").index($(this).parents("li")),imgs)});$("#ww_gallery .frame .c_prev").bind("click",function(e){e.preventDefault();$(document).stopTime("ww_gallery");var cur_indx=$("#ww_gallery .images li").index($("#ww_gallery .images .a"));var parent=$(this).parents(".frame");var total=$("#gallery .images li").length;if(cur_indx>0&&cur_indx==total-1){switch_play_pause(parent,"show")}if(cur_indx-1>=0){switch_photo($("#ww_gallery"),cur_indx-1,imgs)}});$("#ww_gallery .frame .c_next").bind("click",function(e){e.preventDefault();$(document).stopTime("ww_gallery");var total=$("#ww_gallery .images li").length;var cur_indx=$("#ww_gallery .images li").index($("#ww_gallery .images .a"));if(cur_indx<total-1){switch_photo($("#ww_gallery"),cur_indx+1,imgs)}});$("#ww_gallery .frame .c_play").bind("click",function(e){e.preventDefault();$(document).stopTime("ww_gallery");var parent=$(this).parents(".frame");var total=$("#ww_gallery .images li").length;var cur_indx=$("#ww_gallery .images li").index($("#ww_gallery .images .a"));if(cur_indx+1<=total){switch_play_pause(parent,"play");$(document).everyTime(3000,"ww_gallery",function(){cur_indx=$("#ww_gallery .images li").index($("#ww_gallery .images .a"));if(cur_indx+2==total){switch_play_pause(parent,"end")}if(cur_indx<total-1){switch_photo($("#ww_gallery"),cur_indx+1,imgs)}else{$(document).stopTime("ww_gallery")}})}});$("#ww_gallery .frame .c_pause").live("click",function(e){e.preventDefault();var parent=$(this).parents(".frame");var cur_indx=$("#ww_gallery .images li").index($("#ww_gallery .images .a"));var total=$("#ww_gallery .images li").length;$(document).stopTime("ww_gallery");if(cur_indx<total-1){switch_play_pause(parent,"pause")}else{switch_play_pause(parent,"end")}});$("#ww_gallery .close a").bind("click",function(e){e.preventDefault();remove_blanket($("#ww_gallery"),0)});$(".gallery .slider").css({overflowX:"hidden"});$(".gallery .frame .c_prev").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");var parent=$(this).parents(".frame");var li_w=170;var total=$(".gallery .images li").length;var cur_indx=$(".gallery .images li").index($(".gallery .images .a"));if(cur_indx>0&&cur_indx==total-1){switch_play_pause(parent,"show")}if(cur_indx>0){$(".gallery .slider").animate({scrollLeft:li_w*(cur_indx-1)},300);$(".gallery .images li").eq(cur_indx).removeClass("a");$(".gallery .images li").eq(cur_indx-1).addClass("a")}});$(".gallery .frame .c_next").bind("click",function(e){e.preventDefault();$(document).stopTime("gallery");var li_w=170;var total=$(".gallery .images li").length;var cur_indx=$(".gallery .images li").index($(".gallery .images .a"));if(cur_indx<total-1){$(".gallery .slider").animate({scrollLeft:li_w*(cur_indx+1)},300);$(".gallery .images li").eq(cur_indx).removeClass("a");$(".gallery .images li").eq(cur_indx+1).addClass("a")}});$(".gallery .frame .c_play").bind("click",function(e){e.preventDefault();var parent=$(this).parents(".frame");$(document).stopTime(".gallery");var li_w=170;var total=$(".gallery .images li").length;var cur_indx=$(".gallery .images li").index($(".gallery .images .a"));if(cur_indx<total-1){switch_play_pause(parent,"play");$(document).everyTime(3000,"gallery",function(){cur_indx=$(".gallery .images li").index($(".gallery .images .a"));if(cur_indx+2==total){switch_play_pause(parent,"end")}if(cur_indx<total-1){$(".gallery .slider").animate({scrollLeft:li_w*(cur_indx+1)},300);$(".gallery .images li").eq(cur_indx).removeClass("a");$(".gallery .images li").eq(cur_indx+1).addClass("a")}else{$(document).stopTime("gallery")}})}});$(".gallery .frame .c_pause").live("click",function(e){e.preventDefault();var parent=$(this).parents(".frame");var cur_indx=$(".gallery .images li").index($(".gallery .images .a"));var total=$(".gallery .images li").length;$(document).stopTime("gallery");if(cur_indx<total-1){switch_play_pause(parent,"pause")}else{switch_play_pause(parent,"end")}});$(document).bind("keydown",function(e){if(e==null){var keycode=e.keyCode}else{var keycode=e.which}if(keycode==27){remove_blanket($("#ww_gallery"),0);remove_blanket($("#ww_feedback"),0)}});$("#videos .player_v").flowplayer("/flowplayer-3.1.5.swf",{clip:{url:$("#videos .player_v").attr("title"),autoPlay:false}});var li1=$("#videos .videos .a");$(".pframe_pre",li1).css({visibility:"hidden"});$(".pframe_pre_a",li1).show();$(".pframe_pre_a .pframe img",li1).ifixpng();$("#videos .videos li a").bind("click",function(e){e.preventDefault();switch_video($("#videos"),$("#videos .videos li").index($(this).parents("li")))});$(".calculator .add input").bind("change",function(){var command=$(this).attr("checked");var parent=$(this).parents(".options li");var price=0;var days=0;var total=parseInt($(".calculator .total .orig").text());var total_dur=parseInt($(".calculator .window .duration").text());if(command){if($(".ado .price .orig",parent).length==1){price=parseInt($(".ado .price .orig",parent).text());$(".calculator .total .orig").text(total+price);if($(".info .days .num",parent).length>0){days=parseInt($(".info .days .num",parent).text())}days=(days!=0)?days:0;recalculate(days)}}else{if($(".ado .price .orig",parent).length==1){price=parseInt($(".ado .price .orig",parent).text());$(".calculator .total .orig").text(total-price);if($(".info .days .num",parent).length>0){days=parseInt($(".info .days .num",parent).text())}days=(days!=0)?-days:0;recalculate(days)}}});$(".videos .player_v").flowplayer("/flowplayer-3.1.5.swf",{clip:{url:$(".videos .player_v").attr("title"),autoPlay:false}});$(".calculator .btns .money a").bind("click",function(e){e.preventDefault();var parent=$(this).parents("li");if(!parent.hasClass("a")){var valute=parent.attr('class');$(".calculator .btns .money li").removeClass("a");parent.addClass("a");$(".calculator .total .valute span").removeClass("a");$(".calculator .total .valute ."+valute).addClass("a");$(".calculator .options .price .valute span").removeClass("a");$(".calculator .options .price .valute ."+valute).addClass("a");var days=0;recalculate(days);var currency_usd=$(".currencies .usd .curr").text();currency_usd=parseFloat(currency_usd.replace(",","."));var currency=1;if(valute!='rur'){currency=$(".currencies ."+valute+" .curr").text();currency=parseFloat(currency.replace(",","."))}$(".calculator .options .price").each(function(){var price=parseInt($(".orig",$(this)).text());if(valute!='usd'){price=Math.ceil(price*currency_usd/currency)}$(".num",$(this)).text(price)})}});$(".calculator .options .li5 .hotels input").bind("change",function(){var mparent=$(this).parents(".li5");var parent=$(this).parents(".hotels li");var w_h=$(".ww_window",parent).height();$(".ww_window",parent).css({top:-w_h/2+15});if($(".calculator .options .li5 .hotels .ww_window:visible").length>0){$(".calculator .options .li5 .hotels input").each(function(){$(this).removeClass("chck")});switch_hotel_class(parent,mparent);$(".calculator .options .li5 .hotels .ww_window:visible").fadeOut(300,function(){$(".ww_window",parent).fadeIn(400);$("input",parent).addClass("chck");correct_ww_window(parent)})}else{$(".ww_window",parent).fadeIn(400);$(this).addClass("chck");correct_ww_window(parent);switch_hotel_class(parent,mparent)}});$(".calculator .options .li5 .hotels .ww_window").bind("click",function(){$(this).fadeOut(300)});$(".facts_kb li a").bind("click",function(e){e.preventDefault();var parent=$(this).parents("li");var w_h=$(".ww_window",parent).height();var w_w=$(".ww_window",parent).width();var p_top=parent.offset().top;var p_left=parent.offset().left;var p_h=parent.height();var indx=parent.index(".facts_kb li");if($("#x_ww_window").length>0){if(!$("#x_ww_window").hasClass("x_class"+indx)){$("#x_ww_window").fadeOut(300,function(){$("#x_ww_window").remove();$(".ww_window",parent).clone().attr({id:"x_ww_window"}).css({width:w_w}).appendTo("body");w_w=$("#x_ww_window").width();w_h=$("#x_ww_window").height();if(parent.parents(".left").hasClass("left")){$("#x_ww_window .rarr").addClass("larr");p_left=p_left-w_w-10+400}else{p_left=p_left-w_w-10}p_top=p_top-w_h/2+15;$("#x_ww_window").addClass("x_class"+indx).css({left:p_left,top:p_top});$("#x_ww_window").fadeIn(400);correct_ww_window_id()})}else{$("#x_ww_window").fadeOut(300,function(){$("#x_ww_window").remove()})}}else{$(".ww_window",parent).clone().attr({id:"x_ww_window"}).css({width:w_w}).appendTo("body");w_w=$("#x_ww_window").width();w_h=$("#x_ww_window").height();if(parent.parents(".left").hasClass("left")){$("#x_ww_window .rarr").addClass("larr");p_left=p_left-w_w-10+400}else{p_left=p_left-w_w-10}p_top=p_top-w_h/2+15;$("#x_ww_window").addClass("x_class"+indx).css({left:p_left,top:p_top});$("#x_ww_window").fadeIn(400);correct_ww_window_id()}});$("#x_ww_window").live("click",function(){$(this).fadeOut(300,function(){$(this).remove()})});$(".facts li a").bind("click",function(e){e.preventDefault();var parent=$(this).parents("li");var w_h=$(".ww_window",parent).height();var w_w=$(".ww_window",parent).width();var p_top=parent.offset().top;var p_left=parent.offset().left;var p_h=parent.height();var indx=parent.index(".facts li");if($("#x_ww_window_1").length>0){if(!$("#x_ww_window_1").hasClass("x_class"+indx)){$("#x_ww_window_1").fadeOut(300,function(){$("#x_ww_window_1").remove();$(".ww_window",parent).clone().attr({id:"x_ww_window_1"}).css({width:w_w}).appendTo("body");w_h=$("#x_ww_window_1").height();p_top=p_top-w_h-9;$("#x_ww_window_1").addClass("x_class"+indx).css({left:p_left,top:p_top});$("#x_ww_window_1").fadeIn(400);correct_ww_window_id1()})}else{$("#x_ww_window_1").fadeOut(300,function(){$("#x_ww_window_1").remove()})}}else{$(".ww_window",parent).clone().attr({id:"x_ww_window_1"}).css({width:w_w}).appendTo("body");w_h=$("#x_ww_window_1").height();p_top=p_top-w_h-9;$("#x_ww_window_1").addClass("x_class"+indx).css({left:p_left,top:p_top});$("#x_ww_window_1").fadeIn(400);correct_ww_window_id1()}});$("#x_ww_window_1").live("click",function(){$(this).fadeOut(300,function(){$(this).remove()})});$(".calculator .btns .ado a").bind("click",function(e){e.preventDefault();var parent=$(".calculator .btns .ado");var w_h=$(".ww_window",parent).height();if($(".calculator .btns .ado .ww_window:visible").length>0){$(".calculator .btns .ado .ww_window").fadeOut(300)}else{$(".ww_window",parent).css({top:-w_h/2+15});$(".ww_window",parent).fadeIn(400);correct_ww_window(parent)}});$("#ww_add").bind("click",function(){if($(".calculator .btns .ado .ww_window:visible").length>0){$(".calculator .btns .ado .ww_window").fadeOut(300)}});$(".calculator .thumb .icons .descr a").bind("click",function(e){e.preventDefault();var liparent=$(this).parents(".calculator li");liparent.addClass("z10");var parent=$(".thumb .icons .descr",liparent);var w_h=$(".ww_window",parent).height();if($(".calculator .thumb .icons .descr .ww_window:visible").length>0){$(".calculator .thumb .icons .descr .ww_window").fadeOut(300,function(){liparent.removeClass("z10")})}else{$(".ww_window",parent).css({top:-w_h/2+10});$(".ww_window",parent).fadeIn(400);correct_ww_window(parent)}});$(".calculator .thumb .icons .descr .ww_window").bind("click",function(){$(this).fadeOut(300)});$(".tour_switch>a").bind("click",function(e){e.preventDefault();var switch_class=".tour_full";if($(this).parents(".tour_switch").hasClass("tour_full")){switch_class=".tour_brief"}$(".tour_switch").removeClass("tour_a");$(switch_class).addClass("tour_a");correct_footer_pos()});$("#btn_order").bind("click",function(e){e.preventDefault();var href=$(this).attr("href");var hotel_id=($("input[name=frm_hotel]:checked").val())?$("input[name=frm_hotel]:checked").val():0;if(hotel_id!=0){href+='&hotel_id='+hotel_id}$(".options>li").not(".li5").each(function(){if($(":checkbox",$(this)).is(":checked")){var option_id=($(":checkbox",$(this)).val())?$(":checkbox",$(this)).val():0;if(option_id!=0){href+='&option_id[]='+option_id}}});window.location.replace(href)})});
