Facebook

Advanced Search

'; criteria +='
'; criteria +=''; criteria +='
'; criteria +='
'; criteria +=''; criteria +='
'; criteria +='
'; criteria +=''; criteria +='
'; criteria +='
'; criteria +='
'; criteria +=''; criteria +='
'; criteria +='
'; var comma = ''; if(joms.jQuery('#key-list').val()!="") { var comma = ','; } joms.jQuery('#key-list').val(joms.jQuery('#key-list').val()+comma+keynum); joms.jQuery('#criteriaContainer').append(criteria); jsAdvanceSearch.action.changeField(keynum); jsAdvanceSearch.action.keynum++; }, removeCriteria: function ( id ) { var inputs = []; var _id, _id2; _id = joms.jQuery('#key-list').val(); _id2 = _id.split(','); joms.jQuery(_id2).each(function() { if ( this != id && this != "") { // re-populate inputs.push(this); } }); joms.jQuery("#criteria"+id).remove(); joms.jQuery('#key-list').val(inputs.join(',')); }, getFieldType: function ( fieldcode ) { var type; switch(fieldcode) { case "FIELD_JOINED": type = "text"; break; case "XIPT_PROFILETYPE": type = "singleselect"; break; case "FIELD_ABOUTME": type = "textarea"; break; case "FIELD_MOBILE": type = "text"; break; case "FIELD_LANDPHONE": type = "text"; break; case "FIELD_CITY": type = "text"; break; case "FIELD_STATE": type = "text"; break; case "FIELD_COUNTRY": type = "country"; break; case "FIELD_WEBSITE": type = "url"; break; case "username": type = "text"; break; case "useremail": type = "email"; break; default : type = "default"; } return type; }, getListValue: function ( id, fieldcode ) { var list; switch(fieldcode) { case "XIPT_PROFILETYPE": list = ''; break; case "FIELD_COUNTRY": list = ''; break; default : list = ''; } return list; }, changeField: function ( id ) { var value, type, condHTML, listValue; var cond = []; var conditions = new Array(); conditions['contain'] = "Contains"; conditions['between'] = "Between"; conditions['equal'] = "Equal"; conditions['notequal'] = "Not Equal"; conditions['lessthanorequal'] = "Less Than or Equal to"; conditions['greaterthanorequal'] = "Greater Than or Equal to"; value = joms.jQuery('#field'+id).val(); type = jsAdvanceSearch.action.getFieldType(value); this.changeFieldType(type, id); switch(type) { case 'date' : cond = ['between', 'equal', 'notequal', 'lessthanorequal', 'greaterthanorequal']; listValue = 0; break; case 'birthdate': cond = ['between', 'equal', 'lessthanorequal', 'greaterthanorequal']; listValue = 0; break; case 'checkbox' : case 'radio' : case 'singleselect' : case 'select' : case 'list' : cond = ['equal', 'notequal']; listValue = this.getListValue(id, value); break; case 'email' : cond = ['equal']; listValue = 0; break; case 'country' : cond = ['equal', 'notequal']; listValue = this.getListValue(id, value); break; case 'gender' : cond = ['equal', 'notequal']; listValue = this.getListValue(id, value); break; case 'textarea' : case 'text' : default : if(value == 'useremail') { cond = ['equal']; } else { cond = ['contain', 'equal', 'notequal']; } listValue = 0; break; } condHTML = ''; joms.jQuery('#selectcondition'+id).html(condHTML); jsAdvanceSearch.action.changeCondition(id); jsAdvanceSearch.action.calendar(type, id); if(listValue!=0){ joms.jQuery('#valueinput'+id).html(listValue); } }, addAltInputField: function(type, id) { var cond = joms.jQuery('#condition'+id).val(); var inputField; if(cond == "between"){ if(type=='birthdate' || type=='date'){ inputField = 'calendar'; }else{ inputField = ''; } }else{ inputField = ''; } joms.jQuery('#valueinput'+id+'_2').html(inputField); if(cond == "between"){ if(type=='birthdate' || type=='date'){ Calendar.setup({ inputField: 'value'+id+'_2', // id of the input field ifFormat: '%Y-%m-%d', // format of the input field button: 'value'+id+'_2_img', // trigger for the calendar (button ID) align: 'Tl', // alignment (defaults to "Bl") singleClick: true }); } } }, calendar: function(type, id) { var inputField; if(type=='birthdate' || type=='date'){ inputField = ' Date calendar'; }else{ inputField = ''; } joms.jQuery('#valueinput'+id).html(inputField); //setup calendar widget if type is 'date' if(type=='birthdate' || type=='date'){ Calendar.setup({ inputField: 'value'+id, // id of the input field ifFormat: '%Y-%m-%d', // format of the input field button: 'value'+id+'_img', // trigger for the calendar (button ID) align: 'Tl', // alignment (defaults to "Bl") singleClick: true }); } }, changeFieldType: function(type, id) { joms.jQuery('#fieldType'+id).val(type); }, changeCondition: function(id) { var type = joms.jQuery('#fieldType'+id).val(); this.addAltInputField(type, id); }, toggleAgeSearch: function(id,mode) { var cond = joms.jQuery('#condition'+id).val(); if(mode == 1){ inputField = ' Age'; joms.jQuery('#valueinput'+id).html(inputField); if(cond == "between"){ inputField = ''; joms.jQuery('#valueinput'+id+'_2').html(inputField); } } else { jsAdvanceSearch.action.calendar('birthdate',id); jsAdvanceSearch.action.addAltInputField('birthdate',id); } } } } joms.jQuery(document).ready( function() { var searchHistory, operator; searchHistory = eval([]); joms.jQuery('#memberlist-save').click( function(){ joms.memberlist.showSaveForm('' , searchHistory ); }); if(searchHistory != ''){ var keylist = searchHistory['key-list'].split(','); var num; joms.jQuery(keylist).each(function(){ num = jsAdvanceSearch.action.keynum; jsAdvanceSearch.action.addCriteria(); joms.jQuery('#field'+num).val(searchHistory['field'+this]); jsAdvanceSearch.action.changeField(num); joms.jQuery('#condition'+num).val(searchHistory['condition'+this]); jsAdvanceSearch.action.changeCondition(num); if(searchHistory['datingsearch_agefrom'] && searchHistory['datingsearch_ageto'] ) { jsAdvanceSearch.action.toggleAgeSearch(num,1); } if(searchHistory['fieldType'+this] == 'checkbox') { var myVal = searchHistory['value'+this]; if(joms.jQuery.isArray(myVal)) { joms.jQuery.each(myVal, function(i, chkVal) { joms.jQuery('input[name=value'+num+'[]]').each(function() { if(this.value == chkVal) { this.checked = "checked"; } }); }); } } else { joms.jQuery('#value'+num).val(searchHistory['value'+this]); } if(searchHistory['condition'+this] == 'between'){ joms.jQuery('#value'+num+'_2').val(searchHistory['value'+this+'_2']); } }) if(searchHistory.operator == 'and'){ operator = 'operator_all'; }else{ operator = 'operator_any'; } }else{ operator = 'operator_all'; jsAdvanceSearch.action.addCriteria(); } joms.jQuery('#'+operator).attr("checked", true); });