function show_mt_caste_data(E,D){var F=$("#"+E+" #frm-community");var B=$("#"+E+" #frm-mothertongue");var A=$("#"+E+" #frm-caste");var C=$("#"+E+" [name=gender]:checked");if(typeof $(C).val()==="undefined"){var C=$("#"+E+" [name=gender]")}if(typeof D==="undefined"){D=""}$(A).empty();$(A).append('<option value="">Doesn\'t Matter</option>');if(!$.trim($(F).val())||!$.trim($(C).val())){$("#loading-caste").html("");$(A).attr("disabled",false);return false}$(A).attr("disabled",true);$("#loading-caste").html('<img src="http://img.shaadi.com/imgs/loading.gif" align="absmiddle">');$.ajax({url:"/ajax/show-mt-caste?community="+escape($(F).val())+"&mothertongue="+escape($(B).val())+"&gender="+escape($(C).val()),success:function(G){if(!G||G.search(/no matches/i)>-1){$("#loading-caste").html("");return false}splitString=G.split("@");$.each(splitString,function(H,I){arr_caste_val=I.split("|");if(I.indexOf("|")==-1){I=I.replace(/\|/,"");if(I=="Spiritual - not religious"){I="Spiritual"}caste_display_label=I;if(I.indexOf(":")>0){arr_caste_label=Array();arr_caste_label=I.split(":");caste_display_label=arr_caste_label[0]}}check_selected_caste_spilt_string=D.split("|");$.each(arr_caste_val,function(J,K){K=$.trim(K);caste_display_txt="";if(K.indexOf(":")>0){arr_caste_txt=Array();arr_caste_txt=K.split(":");if(arr_caste_txt[0]==arr_caste_txt[1]){K=arr_caste_txt[0]}caste_display_txt=arr_caste_txt[1]}else{caste_display_txt=K}text_is_selected="";if(caste_display_txt&&$.inArray(caste_display_txt,check_selected_caste_spilt_string)>-1){text_is_selected="selected"}if(J){$(A).append('<option value="'+K+'" '+text_is_selected+">"+caste_display_txt+"</option>")}})});$("#loading-caste").html("");$(A).attr("disabled",false)},error:function(I,G,H){$("#loading-caste").html("");$(A).attr("disabled",false);alert("Error!\nStatusText="+I.status+"\nContents="+H)}})};
