var ComponentsDropdowns=function(){var handleSelect2=function(){$('#select2_sample1').select2({placeholder:"Select an option",allowClear:true});$('#select2_sample2').select2({placeholder:"Select a State",allowClear:true});$("#select2_sample3").select2({placeholder:"Select...",allowClear:true,minimumInputLength:1,query:function(query){var data={results:[]},i,j,s;for(i=1;i<5;i++){s="";for(j=0;j<i;j++){s=s+query.term;}
data.results.push({id:query.term+i,text:s});}
query.callback(data);}});function format(state){if(!state.id)return state.text;return "<img class='flag' src='"+Metronic.getGlobalImgPath()+"flags/"+state.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+state.text;}
$("#select2_sample4").select2({placeholder:"Select a Country",allowClear:true,formatResult:format,formatSelection:format,escapeMarkup:function(m){return m;}});$("#select2_sample5").select2({tags:["red","green","blue","yellow","pink"]});function movieFormatResult(movie){var markup="<table class='movie-result'><tr>";if(movie.posters!==undefined&&movie.posters.thumbnail!==undefined){markup+="<td valign='top'><img src='"+movie.posters.thumbnail+"'/></td>";}
markup+="<td valign='top'><h5>"+movie.title+"</h5>";if(movie.critics_consensus!==undefined){markup+="<div class='movie-synopsis'>"+movie.critics_consensus+"</div>";}else if(movie.synopsis!==undefined){markup+="<div class='movie-synopsis'>"+movie.synopsis+"</div>";}
markup+="</td></tr></table>"
return markup;}
function movieFormatSelection(movie){return movie.title;}
$("#select2_sample6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:'jsonp',data:function(term,page){return{q:term,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"};},results:function(data,page){return{results:data.movies};}},initSelection:function(element,callback){var id=$(element).val();if(id!==""){$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+id+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(data){callback(data);});}},formatResult:movieFormatResult,formatSelection:movieFormatSelection,dropdownCssClass:"bigdrop",escapeMarkup:function(m){return m;}});}
var handleSelect2Modal=function(){$('#select2_sample_modal_1').select2({placeholder:"Select an option",allowClear:true});$('#select2_sample_modal_2').select2({placeholder:"Select a State",allowClear:true});$("#select2_sample_modal_3").select2({allowClear:true,minimumInputLength:1,query:function(query){var data={results:[]},i,j,s;for(i=1;i<5;i++){s="";for(j=0;j<i;j++){s=s+query.term;}
data.results.push({id:query.term+i,text:s});}
query.callback(data);}});function format(state){if(!state.id)return state.text;return "<img class='flag' src='"+Metronic.getGlobalImgPath()+"flags/"+state.id.toLowerCase()+".png'/>&nbsp;&nbsp;"+state.text;}
$("#select2_sample_modal_4").select2({allowClear:true,formatResult:format,formatSelection:format,escapeMarkup:function(m){return m;}});$("#select2_sample_modal_5").select2({tags:["red","green","blue","yellow","pink"]});function movieFormatResult(movie){var markup="<table class='movie-result'><tr>";if(movie.posters!==undefined&&movie.posters.thumbnail!==undefined){markup+="<td valign='top'><img src='"+movie.posters.thumbnail+"'/></td>";}
markup+="<td valign='top'><h5>"+movie.title+"</h5>";if(movie.critics_consensus!==undefined){markup+="<div class='movie-synopsis'>"+movie.critics_consensus+"</div>";}else if(movie.synopsis!==undefined){markup+="<div class='movie-synopsis'>"+movie.synopsis+"</div>";}
markup+="</td></tr></table>"
return markup;}
function movieFormatSelection(movie){return movie.title;}
$("#select2_sample_modal_6").select2({placeholder:"Search for a movie",minimumInputLength:1,ajax:{url:"http://api.rottentomatoes.com/api/public/v1.0/movies.json",dataType:'jsonp',data:function(term,page){return{q:term,page_limit:10,apikey:"ju6z9mjyajq2djue3gbvv26t"};},results:function(data,page){//
return{results:data.movies};}},initSelection:function(element,callback){var id=$(element).val();if(id!==""){$.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+id+".json",{data:{apikey:"ju6z9mjyajq2djue3gbvv26t"},dataType:"jsonp"}).done(function(data){callback(data);});}},formatResult:movieFormatResult,formatSelection:movieFormatSelection,dropdownCssClass:"bigdrop",escapeMarkup:function(m){return m;}});}
var handleBootstrapSelect=function(){$('.bs-select').selectpicker({iconBase:'fa',tickIcon:'fa-check'});}
var handleMultiSelect=function(){$('#my_multi_select1').multiSelect();$('#my_multi_select2').multiSelect({selectableOptgroup:true});}
return{init:function(){handleSelect2();handleSelect2Modal();handleMultiSelect();handleBootstrapSelect();}};}();