function IncludeJavaScript(jsFile)
{document.write('<script type="text/javascript" src="'
+jsFile+'"></scr'+'ipt>');}
IncludeJavaScript('pub/js/date.format.js');$(function(){$('a[rel=lightbox]').lightBox();$("#ab_nwl").bind('click',function(){if(!$("#nwl_box").hasClass('opened')){$("#nwl_box").slideDown().addClass('opened');}else{$("#nwl_box").slideUp().removeClass('opened');}
return false;})
$("input[name='nwl_mail']").bind('focus',function(){if($(this).val()=='email'){$(this).val('');}})
$("input[name='nwl_mail']").bind('blur',function(){if($(this).val()==''){$(this).val('email');}});$(".left_men > li:not(.subm li)").bind('mouseenter',function(){$(this).find(".subm").show();$(this).find('a:first').addClass('hover');});$(".left_men > li:not(.subm li)").bind('mouseleave',function(){$('.subm').hide();$(this).find('a:first').removeClass('hover');});$("#menu_top ul li:not(.subpag li)").bind('mouseenter',function(){$(".subpag").hide();$(this).find(".subpag").show();});$("#menu_top ul li:not(.subpag li)").bind('mouseleave',function(){$(".subpag").hide();});$("#cere-oferta").bind("mouseenter",function(){$(this).prepend("<input type='hidden' name='is_human' value='1'/>");});$("#origin2").bind("keyup",function(){if($(this).val().length>=3){}});$("#origin2").autocomplete({source:PATH.root+"pub/php/searchAeroport.php",minLength:3,select:function(event,ui){}});$("#destination2").autocomplete({source:PATH.root+"pub/php/searchAeroport.php",minLength:3,select:function(event,ui){}});});var is_visible=0;var is_visible2=0;function xalert(mesaj){jQuery.facebox(mesaj);}
function showHideNwl(){var $nwl_box=$('#nwl_box');if(is_visible){$nwl_box.slideUp();is_visible=0;}else{$nwl_box.slideDown();is_visible=1;}}
function showHideNwl2(){var $nwl_box=$('#nwl_box2');if(is_visible2){$nwl_box.fadeOut();is_visible2=0;}else{$nwl_box.fadeIn();is_visible2=1;}}
function insertNwl(no){if(no==1){var $nwlbox=$('#nwl_box');}
if(no==2){var $nwlbox=$('#nwl_box2');}
var adresa=$('input',$nwlbox).val();$.ajax({type:"POST",url:PATH.root+'ajax/insertNwl',data:'adresa='+adresa,success:function(rasp){xalert(rasp);}});}
function ajaxGetHotels(id_stat){$.ajax({type:"POST",url:PATH.root+'ajax/getHotels',data:'id_stat='+id_stat,success:function(rasp){$("#id_hotel").html(rasp);}});}
function jsonSelectOption(json,selectID){this.selectID=selectID;this.json=json;this.length=json.length;this.options=new Array();this.oldOptions="";this.createOptionsTag=function(arr){var opt='<option value="">Toate statiunile</option>\n';for(var i in arr){opt+='<option value="'+i+'" title="'+arr[i]+'">'+arr[i]+'</option>\n';}
return opt;}
this.createOptions=function(){var obj=this.json;for(var i in obj){this.options[i]=this.createOptionsTag(obj[i]);}}
this.changeOptions=function(key){if(typeof this.options[key]!='undefined'){$("#"+this.selectID).html(this.options[key]);}else{$("#"+this.selectID).html('<option value="">Toate statiunile</option>\n');}}
this.restoreDefaultOptions=function(){$("#"+this.selectID).html(this.oldOptions);}
this.createOptions();this.oldOptions=$("#"+this.selectID).html();}
function showOfDiv(cur_of){$(".ofm").hide();$("#ofm_"+cur_of).fadeIn('slow');}
$.fn.galerie=function(opt){if(opt.img_per_layer){var img_per_layer=opt.img_per_layer;}else{var img_per_layer=4;}
var cur_img=0;var imgs=new Array();var layers=1;var cur_layer=0;var obj=this;$(obj).find("#img_view #img_cont img:first").show();getImages=function(){$(obj).find("#img_view #img_cont img").each(function(i){imgs[i]=this.src;})
if(imgs.length>img_per_layer){layers=Math.ceil(imgs.length/img_per_layer);}}
prepareLayers=function(){var k=0;$(obj).find("#img_preview #prev_imgs a").each(function(i){$(this).addClass('layer_'+k);if(k!=0){$(this).hide();}
if((i+1)%img_per_layer==0&&i!=0){k++;}});if(layers>1){$(obj).find("#img_preview #pn_preview a:last").show();}}
setImage=function(ob){cur_img=$(obj).find("#img_preview #prev_imgs a").index(ob);$(obj).find("#img_view #img_cont img").attr('src',imgs[cur_img]);if(cur_img==0){$(obj).find("#img_view #pn_view a:first").hide();if(imgs.length>1){$(obj).find("#img_view #pn_view a:last").show();}}else if(cur_img+1==imgs.length){$(obj).find("#img_view #pn_view a:first").show();$(obj).find("#img_view #pn_view a:last").hide();}else{$(obj).find("#img_view #pn_view a:first").show();$(obj).find("#img_view #pn_view a:last").show();}}
nextImage=function(){if(cur_img<imgs.length-1){$(obj).find("#img_view #img_cont img").attr('src',imgs[cur_img+1]);cur_img++;$(obj).find("#img_view #pn_view a:first").show();}
if(cur_img+1==imgs.length){$(obj).find("#img_view #pn_view a:last").hide();}}
prevImage=function(){if(cur_img>0){$(obj).find("#img_view #img_cont img").attr('src',imgs[cur_img-1]);cur_img--;$(obj).find("#img_view #pn_view a:last").show();}
if(cur_img==0){$(obj).find("#img_view #pn_view a:first").hide();}}
nextLayer=function(){if(cur_layer<layers){cur_layer++;$(obj).find("#img_preview #prev_imgs a").hide();$(obj).find("#img_preview #prev_imgs a.layer_"+cur_layer).show();$(obj).find("#img_preview #pn_preview a:first").show();}
if(cur_layer==layers-1){$(obj).find("#img_preview #pn_preview a:last").hide();}}
prevLayer=function(){if(cur_layer<layers){cur_layer--;$(obj).find("#img_preview #prev_imgs a").hide();$(obj).find("#img_preview #prev_imgs a.layer_"+cur_layer).show();$(obj).find("#img_preview #pn_preview a:last").show();}
if(cur_layer==0){$(obj).find("#img_preview #pn_preview a:first").hide();}}
bindsClicks=function(){$(obj).find("#img_view #pn_view a:first").bind('click',function(){prevImage();return false;});$(obj).find("#img_view #pn_view a:last").bind('click',function(){nextImage();return false;});$(obj).find("#img_preview #prev_imgs a").bind('click',function(){setImage(this);return false;})
$(obj).find("#img_preview #pn_preview a:first").bind('click',function(){prevLayer();return false;})
$(obj).find("#img_preview #pn_preview a:last").bind('click',function(){nextLayer();return false;})}
construct=function(){getImages();prepareLayers();bindsClicks();prepareLayers();if(imgs.length>1){$(obj).find("#img_view #pn_view a:last").show();}}
construct();return this;}
function changeTab(tab,obj){$(".tab_tarife").removeClass('activ');$("#tab_"+tab).addClass('activ');$('.tabs a').removeClass('activ');$(obj).addClass('activ');}
function showContainer(container){if($('#'+container).is(':hidden')){$('#'+container).slideDown();}else{$('#'+container).slideUp();}}
function verCautaForm(){var err="";if($("#id_destinatie").val()<=0){err+="Nu ati selectat o destinatie!\n";}
if($("#data_start").val()==''){err+="Nu introdus data de inceput!\n";}
if($("#data_end").val()==''){err+="Nu introdus data de sfarsit!\n";}
if(err!=''){alert(err);return false;}
return true;}
function changeCopii(e,reg){var nr_copii=$(e).val();if(nr_copii==0){$("#varsta_1_"+reg).css('display','none');$("#varsta_2_"+reg).css('display','none');}
if(nr_copii==1){$("#varsta_1_"+reg).css('display','inline');$("#varsta_2_"+reg).css('display','none');}
if(nr_copii==2){$("#varsta_1_"+reg).css('display','inline');$("#varsta_2_"+reg).css('display','inline');}}
function search_getStatiuni(e,ret_id,id_sel){var id_tara=$(e).val();var ref=$(e).attr('ref');$.ajax({type:"POST",url:PATH.root+'ajax/SearchGetStatiuni',data:'id_tara='+id_tara+'&ref='+ref+'&sel='+id_sel,success:function(rasp){$("#"+ret_id).html(rasp);}});}
function search_getStatiuni2(e,ret_id,id_sel){var id_reg=$(e).val();var ref=$(e).attr('ref');$.ajax({type:"POST",url:PATH.root+'ajax/SearchGetStatiuni',data:'id_reg='+id_reg+'&ref='+ref+'&sel='+id_sel,success:function(rasp){$("#"+ret_id).html(rasp);}});}
function loaderSearch(ajaxUrl,respContainer){$.ajax({type:"GET",url:ajaxUrl,success:function(rasp){$("#"+respContainer).html(rasp);}});}
function openS2F(){$.ajax({type:"POST",url:PATH.root+'ajax/send2friend/',data:"tpl=1",beforeSend:function(){$('#openS2F_div').html('<center><img src="pub/images/ajax-loader.gif" alt=""/></center>');},success:function(rasp){var box_html="";box_html=rasp;box_html='<div id="openS2F_div">'+box_html+'</div>';jQuery.facebox(box_html);}});}
function sendOferta(){var date=$('#send2F_form').serialize();date+='&hotel_nume='+$("input[name='hotel_nume']").val()+'&hotel_link='+$("input[name='hotel_link']").val();$.ajax({type:"POST",url:PATH.root+'ajax/send2friend/',data:date,beforeSend:function(){$('#openS2F_div').html('<center><img src="pub/images/ajax-loader.gif" alt=""/></center>');},success:function(rasp){$("#openS2F_div").html(rasp);}});}
