function SearchLove(page_act)
{
//! default values
this.current_page = 0;
this.current_sort_field = 'age';
this.current_sort_direction = 'asc';
this.search_script = "http://www.enablelove.com/love/search/ajax_search.php";
this.del_from_favorites_script = "http://www.enablelove.com/love/account/ajax_del_from_favorites.php";
this.del_from_sent_script = "http://www.enablelove.com/love/mailbox/ajax_del_from_sent.php";
this.del_from_inbox_script = "http://www.enablelove.com/love/mailbox/ajax_del_from_inbox.php";
this.current_list = new Array();
this.current_count = 0;
this.current_pages_count = 0;
//! текущие параметры поиска
this.current_sp   = {};
this.act = page_act;
this.sort_fields_search = new Array('age','new');
this.sort_fields_favorites = new Array('date_added','name','age');
this.sort_fields_inbox = new Array('date');
this.sort_fields_looked = new Array('date');
this.sort_fields_sent = new Array('date');
this.sort_fields_admin_search = new Array('signup','lastlogin','sent_emails','mail_to','mail_from','photos','refsource','sub','rec');
this.sort_index = -1;
this.scroll_top = 0;
this.sent_count = 0;
this.inbox_count = 0;
this.get_sort_fields = function()
{
switch(this.act)
{
case 'advanced_search': return this.sort_fields_search; break;
case 'quick_search': return this.sort_fields_search; break;
case 'my_favorites': return this.sort_fields_favorites; break;
case 'who_added_me': return this.sort_fields_favorites; break;
case 'inbox': return this.sort_fields_inbox; break;
case 'looked': return this.sort_fields_looked; break;
case 'sent': return this.sort_fields_sent; break;
}
}
this.set_sort_index=function(sort_index, reload)
{
this.sort_index=sort_index;
var sfields=this.get_sort_fields();
this.current_sort_field=sfields[sort_index];
if (document.getElementById('sort_fields'))
document.getElementById('sort_fields').selectedIndex = sort_index;
if (reload)
this.load_page(this.current_page);
}
this.change_sort_field = function(reload)
{
var sfields=this.get_sort_fields();
if (this.sort_index < sfields.length - 1) this.sort_index++;
else this.sort_index=0;
this.set_sort_index(this.sort_index);
if (reload)
this.load_page(this.current_page);
}
this.set_parameters = function(sp)
{
this.current_sp = sp;
}
this.set_sort = function(sort_field, sort_direction)
{
this.current_sort_field 	= sort_field;
this.current_sort_direction = sort_direction;
}
this.make_nav = function(start, end, count, pages_count, scr, vertical)
{
var sort_fields;
if (vertical=='top')
{
sort_fields='sort_fields';
}
else
{
sort_fields='sort_fields_bottom';
}
if (count > 0)
{
document.getElementById("search_pane_top").style.display="block";
document.getElementById("search_pane_bottom").style.display="block";
}
else
{
document.getElementById("search_pane_top").style.display="none";
document.getElementById("search_pane_bottom").style.display="none";
}
if (this.act=='admin_search' || this.act=='advanced_search_admin')
{
document.getElementById("count_informer_top").innerHTML = start + ' - ' + end + ' of ' + count;
document.getElementById("count_informer_bottom").innerHTML = start + ' - ' + end + ' of ' + count;
}
html='';
if (pages_count > 1)
{
prev = this.current_page - 1;
next = this.current_page + 1;
last = pages_count;
if (this.act!='admin_search' &&  this.act!='advanced_search_admin')
{
html += 'Page ' + this.current_page+ ' &nbsp;&nbsp;&nbsp;&nbsp;';
}
var prev_flag = 0;
if (prev > 0)
{
if (this.act=='admin_search' || this.act=='advanced_search_admin')
{
html += 	'	<a href="javascript:search.load_page(1,0,'+scr+')" title="First">&laquo; First</a>	' ;
html +=	'  	<a href="javascript:search.load_page('+prev+',0,'+scr+')" title="Prev">&lt; Prev</a>        ';
}
else
{
html += ' <a href="javascript:search.load_page('+prev+',0,'+scr+')" title="Previous 10">Previous 10</a>';
prev_flag=1;
}
}
else
{
if (this.act=='admin_search' || this.act=='advanced_search_admin')
{
html += '	&laquo; First' ;
html +=	'  	&lt; Prev  ';
}
}
if (next <= pages_count)
{
if (this.act=='admin_search' || this.act=='advanced_search_admin')
{
html +=	'  	<a href="javascript:search.load_page('+next+',0,'+scr+')" title="Next">Next &gt;</a>' ;
html += '  	<a href="javascript:search.load_page('+last+',0,'+scr+')" title="Last">Last &raquo;</a>';
}
else
{
if (prev_flag) html += ' | ';
html += ' <a href="javascript:search.load_page('+next+',0,'+scr+')" title="Next 10">Next 10</a>';
}
}
else
{
if (this.act=='admin_search' || this.act=='advanced_search_admin')
{
html +=	'  	Next &gt;  ' ;
html += '  	Last &raquo;';
}
}
}
if (this.current_sp.report || this.act == 'advanced_search_admin')
{
var is_select0="";
var is_select1="";
var is_select2="";
var is_select3="";
var is_select4="";
var is_select5="";
var is_select6="";
var is_select7="";
var is_select8="";
if (this.sort_index=="0") is_select0=" selected"
if (this.sort_index=="1") is_select1=" selected"
if (this.sort_index=="2") is_select2=" selected"
if (this.sort_index=="3") is_select3=" selected"
if (this.sort_index=="4") is_select4=" selected"
if (this.sort_index=="5") is_select5=" selected"
if (this.sort_index=="6") is_select6=" selected"
if (this.sort_index=="7") is_select7=" selected"
if (this.sort_index=="8") is_select8=" selected"
html +=' &nbsp; &nbsp; Order by: &nbsp;<select name="" id='+sort_fields+' class="sort_select">';
html +='<option value="0"'+is_select0+'>SignUp Date</option><option value="1"'+is_select1+'>Last Login</option>';
if (this.current_sp.report == 'love_spread')
{
html+='<option value="2"'+is_select2+'>The sent emails</option>';
}
if (this.current_sp.report == 'mailbox')
{
html+='<option value="3"'+is_select3+'>Inbox</option><option value="4"'+is_select4+'>Sent</option>';
}
if (this.current_sp.report == 'photos')
{
html+='<option value="5"'+is_select5+'>Number of Photos</option>';
}
if (this.current_sp.report == 'refsource')
{
html+='<option value="6"'+is_select6+'>Source</option>';
}
if (this.current_sp.report == 'concerns')
{
html+='<option value="7"'+is_select8+'>Concerns submitted</option><option value="8"'+is_select8+'>Concerns received</option>';
}
html += '</select> &nbsp; <a href="javascript:search.set_sort_index(document.getElementById(\''+sort_fields+'\').value , true)">Sort</a>';
html += ' &nbsp; &nbsp; &nbsp; <a href="export.html">Export to Excel</a>';
}
return html;
}
this.make_navigation = function(start, end, count, pages_count)
{
document.getElementById("navigation_top").innerHTML = this.make_nav(start,end, count,pages_count, 0, 'top');
document.getElementById("navigation_bottom").innerHTML = this.make_nav(start,end, count,pages_count, 1, 'bottom');
}
this.field = function(field,value,where)
{
/*
if (field!='city' && field != 'country')
{
value='11111';
}
else if (field=='city') value="Cityyyyyy";
else if (field=='country') value='Country';
*/
if (value == 0 ||  value == null || value == '')
{
if (field != 'about' && field != 'screen_name' )
{       if (field =='challenge' || field == 'age' || field== 'city_mailbox')
return 'I will tell later';
else return "";
}
else
{
if (field=='screen_name')
return '<br/>';
if (field=='about')
{
return '<u>About me</u>:<br/>'+'I will tell later';
}
else return '';
}
} else
{
if (field=='screen_name')
{
/*
if (where =='inbox')
return 'From: '+'<b>'+value+'</b>';
else if (where == 'sent')
return 'To: '+'<b>'+value+'</b>';
else
*/
return 'Screen name: '+'<b>'+value+'</b>';
}
else if (field  == 'about')
{
//	value='1jkdhkjd skjds jdskdjs ksdj sdkj dskjjds djk djds kdsj dskj sdkjsd kksdj kdsj sdk sdkjds kjds dsk jksdk sdjksd jksd ksdj sdkj dskj dskjs kjsdjjk jwekjwkju3kj4 34 34j 34jk 34kj 4k3j 34kj fekjfdkj fdkf jdfk fk fj fdjkfd jkdf jdkdf';
return '<u>About me:</u><br/>'+value;
}
else if (field == 'city')
{
return '<b>'+value+'</b>, ';
}
else if (field == 'country')
{
return '<b>'+value+'</b>';
}
else return value;
}
}
this.make_item_for_search = function(item)
{
var html='';
html =
''+
'<div class="profile">'+
'<div class="img">'+item.image1_html+
'<div class="img_link">'+item.more_photos+'</div>'+
'</div>'+
'<div class="info">'+
'<div> ' + this.field('screen_name', item.screen_name ) + ' </div>'+
'<div> Age: <b>' + this.field('age', item.age ) + '</b> </div>'+
'<div> Gender: <b>' + this.field('gender', item.gender ) + '</b> </div>'+
'<div> Challenge: <b>' + this.field('challenge', item.challenge ) + '</b> </div>'+
'<div class="location_search"> Location: ' + this.field('city', item.city ) + this.field('country', item.country ) + ' </div>'+
'<div class="about">' + this.field('about', item.about ) + '</div>'+
'</div>'+
'<div class="links"> <img class="email_me" src="../../project/modules/root/_images/email_me.gif"><a href="javascript:search.email_me('+item.user_id+',\'search\')" title="Email this person">Email Me</a><img class="add_to_fav" src="../../project/modules/root/_images/add_to_fav.gif"><a href="javascript:search.add_to_favorites('+item.user_id+')" title="Add this person to your Favorites">Add to Favorites</a> </div>'+
'<div class="more"><span><a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">More</a></span></div>'+
'</div>'+
'';
return html;
}
this.make_item_for_inbox = function(item, num)
{
var html='';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
var stat='';
if (parseInt(item.unreaded))
{
stat='<span style="color:red;font-weight:bold">New</span>';
}
else
{
stat='Already Read';
}
if (!item.deleted_user_id)
{
html +=
'<div class="row_table3">'+
'<div class="status" id="status_'+item.mail_id+'">'+stat+'</div>'+
'<div class="img">'+
'<table class="outer" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'  <div class="info">'+
'    <div> '+this.field('screen_name', item.screen_name,'inbox' )+' </div>'+
'    <div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'    <div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'    <div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'    <div> City: <b>'+this.field('city_mailbox', item.city )+'</b> </div>'+
'    <div> Country: <b>'+this.field('country', item.country )+'</b> </div>'+
'    <a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
'</div>'+
'<div class="subject">'+
'<table border="0">'+
'<tr><td align="center" class="subject_td">'+  item.subject +
'<a href="javascript:search.view_email(' + item.mail_id + ',\'inbox\')" class="read">Click here to read</a>'+
'</td></tr></table>'+
'</div>'+
'<div class="date">'+item.date+'</div>'+
'<div class="delete"><input type="checkbox" name="list[' + item.mail_id + ']" value="' + item.mail_id + '"/></div></div>';
}
else
{
html +=
'<div class="row_table3">'+
'<div class="status" id="status_'+item.mail_id+'">'+stat+'</div>'+
'<div class="img">'+
'<table class="outer" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'  <div class="info">'+
'<div> From: <b>'+item.deleted_screen_name+'</b> </div>'+
'<div> Profile inactive </div>'+
/*              '    <div> '+this.field('screen_name', item.screen_name )+' </div>'+
'    <div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'    <div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'    <div> City: <b>'+this.field('city', item.city )+'</b> </div>'+
'    <a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
*/
'</div></div>'+
'<div class="subject">'+
'<table>'+
'<tr><td align="center" class="subject_td">'+  item.subject +
'<a href="javascript:search.view_email(' + item.mail_id + ',\'inbox\')" class="read">Click here to read</a>'+
'</td></tr></table>'+
'</div>'+
'<div class="date">'+item.date+'</div>'+
'<div class="delete"><input type="checkbox" name="list[' + item.mail_id + ']" value="' + item.mail_id + '"/></div></div>';
}
return html;
}
this.make_item_for_sent = function(item,num)
{
var html='';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
if (!item.deleted_user_id)
{
html +=
'<div class="row_table3">'+
'<div class="status"></div>'+
'<div class="img">'+
'<table class="outer" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'  <div class="info">'+
'    <div> '+this.field('screen_name', item.screen_name,'sent' )+' </div>'+
'    <div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'    <div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'    <div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'    <div> City: <b>'+this.field('city_mailbox', item.city )+'</b> </div>'+
'    <div> Country: <b>'+this.field('country', item.country )+'</b> </div>'+
'    <a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
'</div>'+
'<div class="subject">'+
'<table>'+
'<tr><td align="center" class="subject_td">'+  item.subject +
'<a href="javascript:search.view_email(' + item.mail_id + ',\'sent\')" class="read">Click here to read</a>'+
'</td></tr></table>'+
'</div>'+
'<div class="date">'+item.date+'</div>'+
'<div class="delete"><input type="checkbox" name="list[' + item.mail_id + ']" value="' + item.mail_id + '"/></div></div>';
}
else
{
html +=
'<div class="row_table3">'+
'<div class="status"></div>'+
'<div class="img">'+
'<table class="outer" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'  <div class="info">'+
'<div> To: <b>'+item.deleted_screen_name+'</b> </div>'+
'<div> Profile inactive </div>'+
/**                '    <div> '+this.field('screen_name', item.screen_name )+' </div>'+
'    <div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'    <div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'    <div> City: <b>'+this.field('city', item.city )+'</b> </div>'+
'    <a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
**/
'</div></div>'+
'<div class="subject">'+
'<table>'+
'<tr><td align="center" class="subject_td">'+  item.subject +
'<a href="javascript:search.view_email(' + item.mail_id + ',\'sent\')" class="read">Click here to read</a>'+
'</td></tr></table>'+
'</div>'+
'<div class="date">'+item.date+'</div>'+
'<div class="delete"><input type="checkbox" name="list[' + item.mail_id + ']" value="' + item.mail_id + '"/></div></div>';
}
return html;
}
this.make_item_for_who_added_me = function(item, num)
{
var html='';
html+=  '';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
html+=  ''+
'<div class="row_table">'+
'<div class="img">'+
'<table cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'<div class="info">'+
'<div> '+this.field('screen_name', item.screen_name )+' </div>'+
'<div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'<div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'<div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'    <div> City: <b>'+this.field('city_mailbox', item.city )+'</b> </div>'+
'    <div> Country: <b>'+this.field('country', item.country )+'</b> </div>'+
'<a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
'</div>'+
'<div class="date">'+item.date_added+'</div>'+
'</div>'+
'';
return html;
}
this.make_item_for_favorites = function(item, num)
{
var html='';
if (!item.deleted_user_id)
{
html+=  '';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
html+=  ''+
'<div class="row_table2">'+
'<div class="img">'+
'<table cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'<div class="info">'+
'<div> '+this.field('screen_name', item.screen_name )+' </div>'+
'<div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'<div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'<div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'    <div> City: <b>'+this.field('city_mailbox', item.city )+'</b> </div>'+
'    <div> Country: <b>'+this.field('country', item.country )+'</b> </div>'+
'<a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
'</div>'+
'<div class="date">'+item.date_added+'</div>'+
'<div class="delete">'+'<input type="checkbox" name="list[' + item.user_id + ']" value="' + item.user_id + '"/>'+'</div>'+
'</div>'+
'';
}
else
{
html+=  '';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
html+=  ''+
'<div class="row_table2">'+
'<div class="img">'+
'<table cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'<div class="info">'+
'<div> Profile: <b>'+item.deleted_screen_name+'</b> </div>'+
'<div> Profile inactive </div>'+
'<div> </div>'+
'<div> </div>'+
'</div>'+
'</div>'+
'<div class="date">'+item.date_added+'</div>'+
'<div class="delete">'+'<input type="checkbox" name="list[' + item.deleted_user_id + ']" value="' + item.deleted_user_id + '"/>'+'</div>'+
'</div>'+
'';
}
return html;
}
this.make_item_for_looked = function(item, num)
{
var html='';
html+=  '';
if (num > 0)
{
html+='<img src="../../project/modules/root/_images/small_fav_back.gif" class="top_row">';
}
if (!item.deleted_user_id)
{
html+=  ''+
'<div class="row_table">'+
'<div class="img">'+
'<table cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'<div class="info">'+
'<div> '+this.field('screen_name', item.screen_name )+' </div>'+
'<div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'<div> Gender: <b>'+this.field('gender', item.gender )+'</b> </div>'+
'<div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'<div class="location_looked"> Location: '+this.field('city', item.city )+this.field('country', item.country )+' </div>'+
'<a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
'</div>'+
'<div class="date">'+item.date+'</div>'+
'</div>'+
'';
}
else
{
html+=  ''+
'<div class="row_table">'+
'<div class="img">'+
'<table cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td class="img_td">'+item.image1_html+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div class="information">'+
'<div class="info">'+
'<div> Profile: <b>'+item.deleted_screen_name+'</b> </div>'+
'<div> Profile inactive </div>'+
/*
'<div> '+this.field('screen_name', item.screen_name )+' </div>'+
'<div> Age: <b>'+this.field('age', item.age )+'</b> </div>'+
'<div> City: <b>'+this.field('city', item.city )+'</b> </div>'+
'<div> Challenge: <b>'+this.field('challenge', item.challenge )+'</b> </div>'+
'<a href="javascript:search.show_profile('+item.user_id+')" title="Click to view full profile">View Full Profile</a> </div>'+
*/
'</div></div>'+
'<div class="date">'+item.date+'</div>'+
'</div>'+
'';
}
return html;
}
this.nothing_found_message = function()
{
//alert(this.act);
switch(this.act)
{
case 'quick_search':
html = '<div class="no_found">No profiles match your search criteria. Please change the search criteria and try again.</div>';
break;
case 'advanced_search':
html = '<div class="no_found">No matches found. To expand your search results check "Any" checkbox on the <br/>Advanced Search page for the criteria which are of less importance for you.</div>';
break;
case 'my_favorites':
html = '<font color=red><b>You do not have anyone in your Favotires list.</b></font>';
break;
case 'who_added_me':
html = '<div class="no_found">No one has added you to their Favorites list yet.</div>';
break;
case 'inbox':
html = '<div class="no_messages">You do not have any messages in your Inbox.</div>';
break;
case 'looked':
html = '<div class="no_found">No one has been looking at your profile since the last time you logged in. Please check again soon.</div>';
break;
case 'sent':
html = '<div class="no_messages">You do not have any messages in your Sent.</div>';
break;
case 'admin_search':
case 'advanced_search_admin':
html = '<font color="red"><big><b>Nothing is found.</b></big></font>';
break;
}
return html;
}
this.show_list = function( list, start, end, count, pages_count)
{
this.current_list = list;
this.current_count = count;
this.current_pages_count = pages_count;
len =  list.length;
this.make_navigation(start, end, count, pages_count);
//! update count
if (this.act == 'sent') this.set_sent_count(count);
else
if (this.act == 'inbox') this.set_inbox_count(count);
if (len)
{
html='';
if (this.act == 'my_favorites' || this.act == 'sent' || this.act == 'inbox')
{
html+= '<form name="list">';
}
if (this.act == 'my_favorites')
{
html+='<center><div class="top_table2">';
}
if (this.act == 'sent')
{
html+='<center><div class="top_table4">';
}
if (this.act == 'inbox')
{
html+='<center><div class="top_table3">';
}
if (this.act == 'who_added_me')
{
html+='<center><div class="top_table">';
}
if (this.act == 'looked')
{
html+='<center><div class="top_table" id="looked">';
}
// alert (this.current_sp.report);
for (i=0;i<len;i++)
{
//================================================================================================
// формирование отображения одной анкеты
list[i]['more_photos']=list[i]['image1_html']=image1=image2=image3='';
if (list[i].image_approved == '1')
{
if (list[i].image1)
{
list[i]['image1_html'] ='<table align="center" cellspacing="0" cellpadding="0" class="loveimage"><tr><td><a href="javascript:search.more_photos('+list[i].user_id+')"><img border="0" src="' + list[i].image1 + '"></a></td></tr></table>';
}
else
{
if (list[i].gender == 'male')
{
image_path="../../project/modules/root/_images/male.jpg";
}
else
{
image_path="../../project/modules/root/_images/female.jpg";
}
if (list[i].image2 || list[i].image3)
{
list[i]['image1_html'] ='<table align="center" cellspacing="0" cellpadding="0" class="loveimage"><tr><td><a href="javascript:search.more_photos('+list[i].user_id+')"><img border="0" src="' + image_path + '"></a></td></tr></table>';
}
else
{
list[i]['image1_html'] ='<table align="center" cellspacing="0" cellpadding="0" class="loveimage"><tr><td><img border="0" src="' + image_path + '"></td></tr></table>';
}
}
if (list[i].image2 || list[i].image3)
{
list[i]['more_photos'] = ' <a href="javascript:search.more_photos('+list[i].user_id+')">More Photos</a> <br/>';
}
else
{
if (list[i].image1)
{
list[i]['more_photos'] = ' <a href="javascript:search.more_photos('+list[i].user_id+')">Click to Enlarge</a> <br/>';
}
}
}
else
{
/*
if (list[i].image1)
{
list[i]['image1_html'] ='<span style="color:red;font-weight:bold;font-size:14px">Photo Not Approved</span> <br/>';
}
*/
if (list[i].gender == 'male')
{
image_path="../../project/modules/root/_images/male.jpg";
}
else
{
image_path="../../project/modules/root/_images/female.jpg";
}
if (list[i].image2 || list[i].image3)
{
list[i]['image1_html'] ='<table align="center" cellspacing="0" cellpadding="0" class="loveimage"><tr><td><a href="javascript:search.more_photos('+list[i].user_id+')"><img border="0" src="' + image_path + '"></a></td></tr></table>';
}
else
{
list[i]['image1_html'] ='<table align="center" cellspacing="0" cellpadding="0" class="loveimage"><tr><td><img border="0" src="' + image_path + '"></td></tr></table>';
}
if (list[i].image2 || list[i].image3)
{
list[i]['more_photos'] = '';
}
}
switch (this.act)
{
case 'quick_search':
case 'advanced_search':
html += this.make_item_for_search(list[i], i);
break;
case 'my_favorites':
html += this.make_item_for_favorites(list[i], i);
break;
case 'who_added_me':
html += this.make_item_for_who_added_me(list[i], i);
break;
case 'inbox':
html += this.make_item_for_inbox(list[i], i);
break;
case 'looked':
html += this.make_item_for_looked(list[i], i);
break;
case 'sent':
html += this.make_item_for_sent(list[i], i);
break;
}
//================================================================================================
}
/*
if (this.act == 'my_favorites')
html += '<br/><input type="button" value="Delete" onclick="search.del_from_favorites()"/><br/><br/>';
*/
/*
if (this.act == 'sent')
html += '<br/><input type="button" value="Delete" onclick="search.del_from_sent()"/><br/><br/>';
if (this.act == 'inbox')
html += '<br/><input type="button" value="Delete" onclick="search.del_from_inbox()"/><br/><br/>';
*/
if (this.act == 'my_favorites')
{
html+='</div></center>';
}
if (this.act == 'who_added_me')
{
html+='</div></center>';
}
if (this.act == 'looked')
{
html+='</div></center>';
}
if (this.act == 'my_favorites' || this.act == 'sent' || this.act == 'inbox')
{
html += '</form>';
}
}
else
{
html = this.nothing_found_message();
//	alert(html);
}
document.getElementById("search_result").innerHTML = html;
}
this.del_from_favorites = function()
{
var el = get_form_elements(document.list);
var count = 0;
for (var a in el)
{
if (a.indexOf("list") != -1) count++;
}
if ( count == 0 )
{
alert("Please select member(s) you wish to delete from your Favorites list.");
return;
}
if (!confirm("Are you sure?"))
{
return;
}
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
req.link.load_page( req.link.current_page );
finish_progress_no_scroll();
}
}
req.caching = false;
req.open( 'POST' , this.del_from_favorites_script , true );
start_progress();
req.send( el );
}
this.del_from_inbox = function()
{
var el = get_form_elements(document.list);
var count = 0;
for (var a in el)
{
if (a.indexOf("list") != -1) count++;
}
if ( count == 0 )
{
alert("Please select email(s) you wish to delete from your Mailbox.");
return;
}
if (!confirm("Are you sure?"))
{
return;
}
//		alert(el.toJSONString());
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
//				alert(req.responseJS.count_new_in_inbox);
document.getElementById("new_count").innerHTML=req.responseJS.count_new_in_inbox;
req.link.load_page( req.link.current_page );
finish_progress_no_scroll();
}
}
req.caching = false;
req.open( 'POST' , this.del_from_inbox_script , true );
start_progress();
req.send( el );
}
this.del_from_sent = function()
{
var el = get_form_elements(document.list);
var count = 0;
for (var a in el)
{
if (a.indexOf("list") != -1) count++;
}
if ( count == 0 )
{
alert("Please select email(s) you wish to delete from your Mailbox.");
return;
}
if (!confirm("Are you sure?"))
{
return;
}
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
req.link.load_page( req.link.current_page );
finish_progress_no_scroll();
}
}
req.caching = false;
req.open( 'POST' , this.del_from_sent_script , true );
start_progress();
req.send( el );
}
this.refresh = function(func)
{
this.load_page(this.current_page,func);
}
this.load_page = function(page,func,scr)
{
this.current_page = page;
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.responseJS && req.responseJS.count_new_in_inbox)
{
document.getElementById("new_count").innerHTML=req.responseJS.count_new_in_inbox;
}
if (scr)
{
finish_progress();
}
else
{
finish_progress_no_scroll();
}
if (req.responseJS) {
req.link.show_list( req.responseJS.list, req.responseJS.start, req.responseJS.end, req.responseJS.count, req.responseJS.pages_count);
if (func) func();
}
if (req.link.act == 'inbox' || req.link.act == 'sent')
{
document.getElementById("mailbox_top").style.display="block";
}
//				alert(">"+req.responseText+"!");
}
}
req.caching = false;
req.open( 'POST' , this.search_script , true );
start_progress();
sp = this.current_sp;
sp['act']  = this.act;
sp['page'] = page;
sp['sort'] = this.current_sort_field;
sp['sort_direction'] = this.current_sort_direction;
req.send( sp );
}
this.update_search = function(sp)
{
this.act = 'quick_search';
this.set_parameters(sp);
this.load_page(1);
this.show_search_result();
}
this.store=function()
{
return {sort_index: this.sort_index, sp: this.current_sp, scroll_top: getBodyScrollTop()};
}
this.restore = function(data)
{
this.act  = data.sp.act;
this.set_sort_index(data.sort_index);
this.current_page = data.sp.page;
this.current_sp   = data.sp;
this.load_page(this.current_page);
window.scrollTo(0, data.scroll_top);
}
this.set_params_in_form = function()
{
document.search_form.age_from.value = this.current_sp.age_from;
document.search_form.age_to.value = this.current_sp.age_to;
document.search_form.country.value = this.current_sp.country;
document.search_form.iam.value = this.current_sp.iam;
document.search_form.seeking.value = this.current_sp.seeking;
}
this.show_profile = function (id)
{
this.scroll_top = getBodyScrollTop();
var stored = this.store();
var params={id: id};
//! добавить проверку залогинены или нет
params['stored'] = stored;
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.responseJS && req.responseJS.message)
{
finish_progress_no_scroll();
alert(req.responseJS.message);
}
else
{
insertHTML(req.responseText,'profile_pane');
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
finish_progress();
}
}
}
req.caching = true;
req.open( 'GET' , "http://www.enablelove.com/love/account/ajax_show_profile.php" , true );
start_progress();
req.send( params );
}
this.view_email = function (id, where)
{
this.scroll_top = getBodyScrollTop();
var stored = this.store();
var params={id: id, where: where};
//! добавить проверку залогинены или нет
params['stored'] = stored;
load_inner_content("http://www.enablelove.com/love/mailbox/ajax_show_email.php","profile_pane", params,
f = function(req)
{
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
if (where == 'inbox')
{
document.getElementById("status_"+id).innerHTML="Already Viewed";
document.getElementById("new_count").innerHTML=req.responseJS.count_new_in_inbox;
}
}
);
}
this.more_photos = function (id)
{
var stored = this.store();
var params={id: id};
//! добавить проверку залогинены или нет
params['stored'] = stored;
//$_RESULT['authorized'] = 'NO';
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
insertHTML(req.responseText,'profile_pane');
if (req.responseJS.authorized == 'NO')
{
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
}
finish_progress_no_scroll();
}
}
req.caching = false;
req.open( 'GET' , "http://www.enablelove.com/love/account/ajax_more_photos.php" , true );
start_progress();
req.send( params );
/*
load_content("http://www.enablelove.com/love/account/ajax_more_photos.php","profile_pane", params,
f = function()
{
//document.getElementById("search_list").style.display="none";
//document.getElementById("detailed").style.display="block";
}
);
*/
}
this.email_me = function(id,from)
{
current_user_id="";
if (parseInt(id) == parseInt(current_user_id))
{
alert("You can not send an email to yourself");
return;
}
this.scroll_top = getBodyScrollTop();
var stored = this.store();
var params={id: id};
params['stored'] = stored;
params['act']	 = this.act;
params['from']   = from;
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
//			            alert(req.responseText);
if (req.responseJS && req.responseJS.message)
{
finish_progress_no_scroll();
alert(req.responseJS.message);
}
else
{
insertHTML(req.responseText,"profile_pane");
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
finish_progress();
}
/*
if (req.responseJS)
{
alert(req.responseJS.message);
} else
{
insertHTML(req.responseText,"profile_pane");
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
}
*/
/* finish_progress_no_scroll(); */
}
}
req.caching = true;
req.open( 'GET' , "http://www.enablelove.com/love/mailbox/ajax_send_email.php" , true );
start_progress();
req.send( params );
}
this.add_to_favorites = function(id)
{
var stored = this.store();
var params={id: id};
//! добавить проверку залогинены или нет
params['stored'] = stored;
var req = new Subsys_JsHttpRequest_Js();
req.link = this;
req.onreadystatechange = function() {
if (req.readyState == 4) {
finish_progress_no_scroll();
if (req.responseJS && req.responseJS.message)
{
alert(req.responseJS.message);
} else
{
insertHTML(req.responseText,"profile_pane");
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
}
}
}
req.caching = false;
req.open( 'GET' , "http://www.enablelove.com/love/account/ajax_add_to_favorites.php" , true );
start_progress();
req.send( params );
}
this.show_search_result = function()
{
document.getElementById("detailed").style.display="none";
document.getElementById("search_list").style.display="block";
window.scrollTo(0,this.scroll_top);
}
this.show_detailed = function()
{
document.getElementById("search_list").style.display="none";
document.getElementById("detailed").style.display="block";
window.scrollTo(0,this.scroll_top);
}
this.favorites_home = function()
{
document.getElementById("favorites").style.display="none";
document.getElementById("favorites_home").style.display="block";
}
this.change_act = function(act)
{
this.sort_index = -1;
this.act = act;
this.change_sort_field(false);
}
this.my_favorites = function()
{
this.change_act('my_favorites');
this.set_parameters({});
this.load_page(1, func = function() {
document.getElementById("delete_button").style.display="block";
document.getElementById("favorites_home").style.display="none";
document.getElementById("favorites").style.display="block";
});
}
this.who_added_me = function()
{
this.change_act('who_added_me');
this.set_parameters({});
this.load_page(1, func = function() {
document.getElementById("delete_button").style.display="none";
document.getElementById("favorites_home").style.display="none";
document.getElementById("favorites").style.display="block";
});
}
this.quick_search = function()
{
this.change_act('quick_search');
//	this.change_sort_field(false);
}
this.inbox = function()
{
this.change_act('inbox');
document.getElementById("mailbox_header").innerHTML="Mailbox - Inbox";
document.getElementById("mailbox_delete_link").href="javascript:search.del_from_inbox()";
document.getElementById("inbox_button").className="button_active";
document.getElementById("sent_button").className="button_unactive";
}
this.who_looked_me = function()
{
this.change_act('looked');
}
this.sent = function()
{
this.change_act('sent');
document.getElementById("mailbox_header").innerHTML="Mailbox - Sent";
document.getElementById("mailbox_delete_link").href="javascript:search.del_from_sent()";
document.getElementById("inbox_button").className="button_unactive";
document.getElementById("sent_button").className="button_active";
}
this.advanced_search = function()
{
this.change_act('advanced_search');
//	this.change_sort_field(false);
}
this.advanced_search_admin = function()
{
this.change_act('advanced_search_admin');
//	this.change_sort_field(false);
}
this.set_inbox_count = function(count)
{
this.inbox_count = count;
document.getElementById("inbox_button").title = document.getElementById("inbox_button").value = "Inbox ("+count+")";
}
this.set_sent_count = function(count)
{
this.sent_count = count;
document.getElementById("sent_button").title = document.getElementById("sent_button").value = "Sent ("+count+")";
}
this.increment_sent_count = function(count)
{
this.set_sent_count(parseInt(this.sent_count)+1);
}
this.report_concern = function(user_id)
{
load_content("http://www.enablelove.com/love/account/ajax_report_concern.php","profile_pane",{user_id: user_id})
}
//!!!!
}
