function IncludeJavaScript(jsFile)
{document.write('<script type="text/javascript" src="'
+jsFile+'"></scr'+'ipt>');}
$(function(){$('a[rel=lightbox]').lightBox();$("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();});});var countInput=0;function adauga_inp_file(id,maxInputs){var obj=document.getElementById(id);var new_input=document.createElement('input');new_input.setAttribute('type','file');new_input.setAttribute('name','foto[]');new_input.setAttribute('style','width:200px');new_input.setAttribute('size','20');if(countInput<maxInputs){obj.appendChild(new_input);var new_input=document.createElement('br');new_input.setAttribute('style','clear:both');obj.appendChild(new_input);countInput++;}}
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 send2friend(){$.ajax({type:"POST",url:PATH.root+PATH.link.a+"/trimite-oferta",data:'nume='+$('#s2f_nume').val()+'&email_1='+$('#s2f_email_1').val()+'&email_2='+$('#s2f_email_2').val(),success:function(rasp){$(".trimite_prieten").html(rasp);}});}
