function feedbackClose() {	

	jQuery('#dialog').jqmHide();

}

function feedbackNext() {

	jQuery("#results").html('');

	jQuery("#results").css('display', 'none');

	jQuery("#feedbackForm").css('display', 'block');

	

	jQuery("#feedbackSubject").val('');

	jQuery("#feedbackMessage").val('');

	

}

function feedbackSendnotLogin() {	

	if (jQuery("#feedbackMessage").val() == '') {

		alert('Please, write you message to send');

		return false;

	}

	

	jQuery("#feedbackForm").css('display', 'none');

	jQuery("#results").css('display', 'block');

	jQuery("#results").addClass('loadedFedback');

	jQuery("#results").html('Wait while message sending ...');

	

	jQuery.ajax({

	   type: "POST",

	   url:  "ajax_feedback_not_register.php",

	   data: "txttitle=" + encodeURIComponent(jQuery("#feedbackSubject").val()) + "&txtcomments=" + encodeURIComponent(jQuery("#feedbackMessage").val()) + "&txtdepartment=" + encodeURIComponent(jQuery("#feedbackDepartment").val()) + "&feedback_personal_info=" + encodeURIComponent(jQuery("#feedback_personal_info").val()) + "&feedback_user_email=" + encodeURIComponent(jQuery("#feedback_user_email").val()),

	   success: function(msg){

		 jQuery("#results").removeClass('loadedFedback');

		 jQuery("#results").html('<div style="text-align:center; font-size:18px;">Message sended successfully!<br /><br /><a style="color:#009900" href="javascript:feedbackNext();">Send next message</a>&nbsp;&nbsp;&nbsp;or&nbsp;&nbsp;&nbsp;<a style="color:#990000" href="javascript:feedbackClose();">close</a>?</div>');

	   }

	});

}




function next_anketa() {	
	jQuery.ajax({
	  type: "GET",
	  url:  "ajax_show_preview_next.php",
	  data: 'age_start=' + age_start + '&age_end=' + jQuery.cookie('age_end') + '&online_status=' + jQuery.cookie('online_status') + '&register_date=' + jQuery.cookie('register_date') + '&model_id=' + window.userid,
	  success: function(data){
	  		response = eval("(" + data + ")");
			window.location.href = 'http://topmilady.com/index.php?ajaxian_page=ajaxian_showprofile&id=' + response.id_next;
	  }
	})
}


function previous_girls_list() {
	window.location.href = 'http://topmilady.com/index.php';
}


function before_anketa() {	
	jQuery.ajax({
	  type: "GET",
	  url:  "ajax_show_preview_next.php",
	  data: 'age_start=' + age_start + '&age_end=' + jQuery.cookie('age_end') + '&online_status=' + jQuery.cookie('online_status') + '&register_date=' + jQuery.cookie('register_date') + '&model_id=' + window.userid,
	  success: function(data){
	  		response = eval("(" + data + ")");
			window.location.href = 'http://topmilady.com/index.php?ajaxian_page=ajaxian_showprofile&id=' + response.id_prev;
	  }
	})
}






function set_age_parameters(minage, maxage) {
	resetStylesAndConstants();
	age_start = minage; age_end = maxage;
	jQuery.cookie('age_start', age_start, { expires: 365 * 10 }); jQuery.cookie('age_end', age_end, { expires: 365 * 10 });
	if ((age_start != '') && (age_end != '')) { jQuery("#age_" + age_start + "-" + age_end + "").addClass('selectedAge');}
	jQuery('.age_interval').blur();	
	if (((window.location.pathname == '/index.php')||(window.location.pathname == '/')||(window.location.pathname == '')) && (window.location.search == '') && (window.location.hash == '')) {
		updateUserpicsBig();
	} else {
		window.location.href = 'http://topmilady.com/index.php';
	}
}

window.urlUserpicsBig = 'ajax_show_models_for_unreg.php';
window.cur_page = 1;
window.pages = 1;
window.radius = 1;
window.age_start = '';
window.age_end = '';
window.time_start = '';
window.time_end = '';
window.online_status = '';
window.register_date = '';

function resetStylesAndConstants() {

	register_date = '';
	online_status = '';
	age_start = '';
	age_end = '';	

	jQuery.cookie("register_date", null);
	jQuery.cookie("online_status", null);
	jQuery.cookie("age_start", null);
	jQuery.cookie("age_end", null);	

	jQuery(".selectedAge").removeClass('selectedAge');
	jQuery(".selectedType").removeClass('selectedType');

	p = 1; cur_page = 1; jQuery.cookie('mainPagePage', p, { expires: 365 * 10 });

}









function show_all() {
	resetStylesAndConstants();
	if (((window.location.pathname == '/index.php')||(window.location.pathname == '/')||(window.location.pathname == '')) && (window.location.search == '') && (window.location.hash == '')) {
		updateUserpicsBig();
	} else {
		window.location.href = 'http://topmilady.com/index.php';
	}
	jQuery("#showAllLink").addClass('selectedType');
}



function show_online() {
	resetStylesAndConstants();
	online_status = 1;
	jQuery.cookie('online_status', online_status, { expires: 365 * 10 });
	if (((window.location.pathname == '/index.php') || (window.location.pathname == '/') || (window.location.pathname == '')) && (window.location.search == '') && (window.location.hash == '')) {
		updateUserpicsBig();
	} else {		
		window.location.href = 'http://topmilady.com/index.php';	
	}
	jQuery("#showOnlineLink").addClass('selectedType');
}



function show_last() {
	resetStylesAndConstants();
	register_date = 1;
	jQuery.cookie('register_date', register_date, { expires: 365 * 10 });
	if (((window.location.pathname == '/index.php')||(window.location.pathname == '/')||(window.location.pathname == '')) && (window.location.search == '') && (window.location.hash == '')) {
		updateUserpicsBig();
	} else {			
		window.location.href = 'http://topmilady.com/index.php';		
	}
	jQuery("#showLastLink").addClass('selectedType');
}









function updateUserpicsBig() {	
	
	
	jQuery("#hidder").css('display', 'none');	
    jQuery('#shtorkaFullLoader').css({'position':'fixed', 'top':'0px', 'left':'0px', 'width':'100%', 'height':'100%', 'visibility':'visible'});


	jQuery.ajax({
		type: "GET",
		url:  urlUserpicsBig,
		data: "p=" + p + '&age_start=' + age_start + '&age_end=' + age_end + '&online_status=' + online_status + '&register_date=' + register_date,
		success: function(response_jsoned){

			var response = eval('(' + response_jsoned + ')');

			jQuery('.userpicsBig').html(response.text);	

			cur_page = 	1 * response.cur_page;

			pages = 1 * response.pages;

			//paginator_create();

			jQuery('#paginatorPages').html(response.paginator_str);
						

			

			jQuery("a[rel^='prettyPhoto']").prettyPhoto({
				animationSpeed: 'normal', 
				opacity: 0.80
			});
			
			jQuery("a[rel^='prettyPhoto']").each(function (i) {
				
				var source = '';
				if (jQuery(this).hasClass('view_photo_link')) {
					var source = 'view_photo_link';
				}
				jQuery(this).click(function () {
					jQuery.ajax({
						type: "GET",
						url: 'clicks_stats.php?ref=pretty_photo&source=' + source + '&scaled_photo=' + jQuery(this).attr('href')
					});
				});											
			})
			
			jQuery(".login_dialog").each(function (i) {
				var povod = '';
				if (jQuery(this).hasClass('want_gift')) {
					var povod = 'want_gift';
				}
				if (jQuery(this).hasClass('want_letter')) {
					var povod = 'want_letter';
				}
				if (jQuery(this).hasClass('want_chat_active')) {
					var povod = 'want_chat_active';
				}
				if (jQuery(this).hasClass('want_chat_passive')) {
					var povod = 'want_chat_passive';
				}
				if (jQuery(this).hasClass('want_contact_info')) {
					var povod = 'want_contact_info';
				}
				jQuery(this).click(function () {
					jQuery.ajax({
						type: "GET",
						url: 'clicks_stats.php?ref=login_dialog&povod=' + povod + '&details=' + jQuery(this).next().val()
					});
				});	
			})
			
			jQuery(".signup_dialog").each(function (i) {
				var povod = '';
				if (jQuery(this).hasClass('want_gift')) {
					var povod = 'want_gift';
				}
				if (jQuery(this).hasClass('want_letter')) {
					var povod = 'want_letter';
				}
				if (jQuery(this).hasClass('want_chat_active')) {
					var povod = 'want_chat_active';
				}
				if (jQuery(this).hasClass('want_chat_passive')) {
					var povod = 'want_chat_passive';
				}
				if (jQuery(this).hasClass('want_contact_info')) {
					var povod = 'want_contact_info';
				}
				jQuery(this).click(function () {
					jQuery.ajax({
						type: "GET",
						url: 'clicks_stats.php?ref=signup_dialog&povod=' + povod + '&details=' + jQuery(this).next().val()
					});
				});	
			})
			
			
			
			
			jQuery("body").scrollTop(0);
			jQuery("html").scrollTop(0);
			
			jQuery('#shtorkaFullLoader').css('visibility', 'hidden');
			jQuery('#hidder').css('display', 'block');

			
		}	

	})
}





function paginator_create() {

	

	var temp_content = '';

	

	

	

		radius = 5;	

	

	

	

	

		

	if (cur_page - radius > 0) {

		start = cur_page - radius;	

	} else {

		start = 1;	

	}

	

	

	if (cur_page + radius < pages) {

		end = cur_page + radius;	

	} else {

		end = pages;	

	}

	

	

	

	for (i = start; i < cur_page; i++) {

		

		temp_content = temp_content + ' <a href="javascript:setpage(' + i + ')">' + i + '</a> ';

	}

	temp_content = temp_content + ' <span class="selected">' + cur_page + '</span> ';

	for (i = cur_page + 1; i <= end; i++) {

		

		temp_content = temp_content + ' <a href="javascript:setpage(' + i + ')">' + i + '</a> ';

	}

	if (start > 1)  {

		if (start > 2)  {

			temp_content = ' ... ' + temp_content;

		}

		temp_content = ' <a href="javascript:setpage(' + 1 + ')">' + 1 + '</a>' + temp_content;

	}

	if (end < pages) {

		var temp = '<a href="javascript:setpage(' + pages + ')">' + pages + '</a>';

		if (end < (pages - 1)) {

			temp = ' ... ' + temp;				

		}

		temp_content = temp_content + temp;

	}

	if (pages < 2) {

		temp_content = '';

	}

	

	jQuery("#paginatorPages").html(temp_content);

	if (jQuery("#paginatorPages").css('visibility') == 'hidden') {

		jQuery("#paginatorPages").css('visibility', 'visible');

	}

}

function setpage(i) {

	p = i;	

	jQuery.cookie('mainPagePage', p, { expires: 365 * 10 });	

	updateUserpicsBig();	

}

function setpage2(i) {
	resetStylesAndConstants();
	p = i;	

	jQuery.cookie('mainPagePage', p, { expires: 365 * 10 });	

	document.location.href="http://topmilady.com";

}




function new_login_man() {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	jQuery('#simple_alertFormWrapper').css('height', 'auto');
	jQuery('#simple_alertWindow').css({'width':'800px','margin-left':'-400px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Login loading ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	jQuery.ajax({
				url: "ajax_new_midlogin_man.php",
				type: "GET",				
				success: function(data) {
					res = eval('(' + data + ')');
					jQuery('#simple_alertFormWrapper').css('background-image','none');
					jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);					
					jQuery('#simple_alertWindow .bubbleMessage').html(res.content);	
				}
	})
}
function new_login_man_do(model_id) {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	var height_old = jQuery('#simple_alertFormWrapper').height();
	jQuery('#simple_alertFormWrapper').height(height_old);
	jQuery('#simple_alertWindow').css({'width':'800px','margin-left':'-400px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Login sending ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	var data = 	'&new_login=' + encodeURIComponent(jQuery('#new_login').val()) + 
				'&new_password=' + encodeURIComponent(jQuery('#new_password').val());
	jQuery.ajax({
				url: "ajax_new_midlogin_man.php?action=do",
				type: "GET",
				data: data,
				success: function(res_pre) {
					res = eval('(' + res_pre + ')');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);		
					if (res.directiva == 'go_to') {
						if (my_procedure_to_do_after_login != '') {
							eval(my_procedure_to_do_after_login);	
						} else {
							document.location.href = res.directivas_url;
						}
					} else {					
						jQuery('#simple_alertFormWrapper').css('background-image','none');
						jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');									
						jQuery('#simple_alertWindow .bubbleMessage').html(res.content);
					}
				}
	})
}



function new_login_girl() {	
	jQuery('#simple_alertWindow').css({'width':'420px','margin-left':'-210px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Login loading ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	jQuery.ajax({
				url: "ajax_new_midlogin_girl.php",
				type: "GET",				
				success: function(data) {
					res = eval('(' + data + ')');
					jQuery('#simple_alertFormWrapper').css('background-image','none');
					jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);					
					jQuery('#simple_alertWindow .bubbleMessage').html(res.content);	
				}
	})
}
function new_login_girl_do(model_id) {	
	jQuery('#simple_alertWindow').css({'width':'420px','margin-left':'-210px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Login sending ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	var data = 	'&new_login=' + encodeURIComponent(jQuery('#new_login').val()) + 
				'&new_password=' + encodeURIComponent(jQuery('#new_password').val());
	jQuery.ajax({
				url: "ajax_new_midlogin_girl.php?action=do",
				type: "GET",
				data: data,
				success: function(res_pre) {
					res = eval('(' + res_pre + ')');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);		
					if (res.directiva == 'go_to') {
						document.location.href = res.directivas_url;
					} else {					
						jQuery('#simple_alertFormWrapper').css('background-image','none');
						jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');									
						jQuery('#simple_alertWindow .bubbleMessage').html(res.content);
					}
				}
	})
}




function new_register_man() {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	jQuery('#simple_alertFormWrapper').css('height', 'auto');
	jQuery('#simple_alertWindow').css({'width':'800px','margin-left':'-400px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Registration loading ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	jQuery.ajax({
				url: "ajax_new_register_man.php",
				type: "GET",				
				success: function(data) {
					res = eval('(' + data + ')');
					jQuery('#simple_alertFormWrapper').css('background-image','none');
					jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);					
					jQuery('#simple_alertWindow .bubbleMessage').html(res.content);	
				}
	})
}
function new_register_man_do(model_id) {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	var height_old = jQuery('#simple_alertFormWrapper').height();
	jQuery('#simple_alertFormWrapper').height(height_old);
	jQuery('#simple_alertWindow').css({'width':'800px','margin-left':'-400px'});
	jQuery('#simple_alertWindow .bubbleHtext').html('Registration sending ...');
	jQuery('#simple_alertWindow .bubbleMessage').css('display', 'none');
	jQuery('#simple_alertFormWrapper').css('background-image', 'url(images/ajax-loader-red.gif)').css('background-repeat', 'no-repeat').css('background-position', 'center');
	
	jQuery('#simple_alertWindow').jqmShow();
	
	if (jQuery('#new_client_tos').attr('checked')) {
		var new_client_tos = 1;
	} else {
		var new_client_tos = 0;	
	}
	
	
	
	if (jQuery('#new_client_newsletter').attr('checked')) {
		var new_client_newsletter = 1;
	} else {
		var new_client_newsletter = 0;	
	}
	
	
	
	var data = 	'&new_email=' + encodeURIComponent(jQuery('#new_email').val()) + 
				'&new_firstname=' + encodeURIComponent(jQuery('#new_firstname').val()) +
				'&new_password=' + encodeURIComponent(jQuery('#new_password').val()) +
				'&new_password2=' + encodeURIComponent(jQuery('#new_password2').val()) +
				'&new_client_newsletter=' + new_client_newsletter +
				'&new_client_tos=' + new_client_tos;
	jQuery.ajax({
				url: "ajax_new_register_man.php?action=do",
				type: "GET",
				data: data,
				success: function(res_pre) {
					res = eval('(' + res_pre + ')');
					jQuery('#simple_alertWindow .bubbleHtext').html(res.header);		
					if (res.directiva == 'go_to') {
						document.location.href = res.directivas_url;
					} else {					
						jQuery('#simple_alertFormWrapper').css('background-image','none');
						jQuery('#simple_alertWindow .bubbleMessage').css('display', 'block');									
						jQuery('#simple_alertWindow .bubbleMessage').html(res.content);
					}
				}
	})
}






