if(!Array.prototype.indexOf)

	Array.prototype.indexOf = function(searchElement, fromIndex){

	for(var i = fromIndex||0, length = this.length; i<length; i++)

	if(this[i] === searchElement) return i;

	return -1

};







function to_letter(user_id) {
	jQuery.cookie('js_todo','compose_attempt(' + user_id + ')');
	window.location.href = 'http://' + window.location.hostname + '/index2.php';
}


function to_search(jsontext) {
	jQuery.cookie('js_todo',"search_attempt('" + jsontext + "')");
	window.location.href = 'http://' + window.location.hostname + '/index2.php';
}


function to_gift(user_id) {

	jQuery.cookie('js_todo','gift_attempt(' + user_id + ')');

	window.location.href = 'http://' + window.location.hostname + '/index2.php';

}

function to_videochat(username) {		
	jQuery.cookie('videochat_exclusive_start', username);
	window.location.href = 'http://' + window.location.hostname + '/index2.php';
}


function check_videochat_exclusive_start() {
	var videochat_exclusive_start = jQuery.cookie('videochat_exclusive_start');	
	if ((videochat_exclusive_start != null) && (videochat_exclusive_start != '')) {
		 jQuery.cookie('videochat_exclusive_start', '');		
		 start_videochat_with(videochat_exclusive_start);
	}
}

function to_contacts(user_id) {	

	jQuery.cookie('js_todo','profile_attempt(\'' + user_id + '\')');

	window.location.href = 'http://' + window.location.hostname + '/index2.php';

}









function getHashParams() {

    var hashParams = {};

    var e,

        a = /\+/g, 

        r = /([^&;=]+)=?([^&;]*)/g,

        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },

        q = window.location.hash.substring(1);



    while (e = r.exec(q))

       hashParams[d(e[1])] = d(e[2]);



    return hashParams;

}



function getHashParams2(string) {

    var hashParams = {};

    var e,

        a = /\+/g, 

        r = /([^&;=]+)=?([^&;]*)/g,

        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },

        q = string.substring(1);



    while (e = r.exec(q)) {

       hashParams[d(e[1])] = d(e[2]);

	   alert(d(e[1]) + ' = ' + d(e[2]));

	}

	   

    return hashParams;

}





function showChpassDialog(procedures_to_do) {

	jQuery("#ajaxchpassdialog .bubbleMessage").html('<span>&nbsp;</span>');

	

	

	jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberpasswordForm").css('display', 'none');	

	jQuery("#ajaxchpassdialog .rememberByEmailForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberByLoginForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .incorrectLogin").css('display', 'none'); 

	jQuery("#ajaxchpassdialog .ajaxloginForm").css('display', 'block');

	jQuery("#ajaxchpassdialog .rememberToggler").css('display', 'block');

	

	jQuery("#ajaxchpassdialog .txtajaxoldpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpasswordrep").val('');	

		

	jQuery('#ajaxchpassdialog').jqmShow();	

	jQuery("#ajaxchpassdialog .submitAjaxLogin").unbind('click');

	jQuery("#ajaxchpassdialog .submitAjaxLogin").click(function() {				

				jQuery("#ajaxchpassdialog .ajaxloginForm").css('display', 'none');

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'block');

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").addClass('loadedFedback');

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").html('Wait while message sending ...');

				jQuery.ajax({

				   type: "POST",

				   url:  "ajax_chpass.php",

				   data: "txtajaxoldpassword=" + encodeURIComponent(jQuery("#ajaxchpassdialog .txtajaxoldpassword").val()) + "&txtajaxnewpassword=" + encodeURIComponent(jQuery("#ajaxchpassdialog .txtajaxnewpassword").val()) + "&txtajaxnewpasswordrep=" + encodeURIComponent(jQuery("#ajaxchpassdialog .txtajaxnewpasswordrep").val()),

				   success: function(response_json){

					 

					 jQuery('#ajaxchpassdialog .bubbleMessage').html('<span>&nbsp;</span>');

					 

					 topmiladyresponse = eval('(' + response_json + ')');

					 jQuery("#ajaxchpassdialog .resultsAjaxLogin").removeClass('loadedFedback');

					 jQuery("#ajaxchpassdialog .resultsAjaxLogin").html('<div style="text-align:center; font-size:18px;">You login to site successfully!<br />');

					 

						 jQuery("#ajaxchpassdialog .resultsAjaxLogin").html('');

						 

						 

						 if (topmiladyresponse.result == 1) {

							jQuery("#ajaxchpassdialog .resultsAjaxLogin").html('<div style="text-align: center; font-size: 18px;"><br><span class="successfull">Password changed successfully!</span><br></div>');

							jQuery("#ajaxchpassdialog .rememberToggler").html('');

							

							eval(procedures_to_do);

						 } else {

							jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');

						 	jQuery("#ajaxchpassdialog .ajaxloginForm").css('display', 'block');

							jQuery("#ajaxchpassdialog .txtajaxoldpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpasswordrep").val('');

							jQuery('#ajaxchpassdialog .bubbleMessage').html('<span class="error">' + topmiladyresponse.msg + '</span>');							

						 }						 

				   }

				});

			})

}



function showLoginDialog(procedures_to_do) {

	jQuery("#ajaxlogindialog .bubbleMessage").html('<span>&nbsp;</span>');

	

	

	jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberpasswordForm").css('display', 'none');	

	jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'none');

	jQuery("#ajaxlogindialog .incorrectLogin").css('display', 'none'); 

	jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'block');

	jQuery("#ajaxlogindialog .rememberToggler").css('display', 'block');

	

	

	

	if (timer_clients_for_model_started == 1) {

		timer_clients_for_model_started = 0;

		jQuery(document).stopTime("clients_for_model");

	}

	

	jQuery('#ajaxlogindialog').jqmShow();	

	jQuery("#ajaxlogindialog .submitAjaxLogin").unbind('click');

	jQuery("#ajaxlogindialog .submitAjaxLogin").click(function() {

											  

				jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'none');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'block');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").addClass('loadedFedback');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").html('Wait while message sending ...');

				jQuery.ajax({

				   type: "POST",

				   url:  "ajax_midlogin.php",

				   data: "txtajaxlogin=" + encodeURIComponent(jQuery("#ajaxlogindialog .txtajaxlogin").val()) + "&txtajaxpassword=" + encodeURIComponent(jQuery("#ajaxlogindialog .txtajaxpassword").val()),

				   success: function(msg){

					 var response = eval('(' + msg + ')');

					 jQuery("#ajaxlogindialog .resultsAjaxLogin").removeClass('loadedFedback');

					 jQuery("#ajaxlogindialog .resultsAjaxLogin").html('<div style="text-align:center; font-size:18px;">You login to site successfully!<br />');

					 

						 jQuery("#ajaxlogindialog .resultsAjaxLogin").html('');

						 jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

						 jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'block');

						 

						  if (response.status == 'ok') {

							jQuery('#ajaxlogindialog').jqmHide();

							eval(procedures_to_do);

						 } else {

							jQuery('#ajaxlogindialog .bubbleMessage').html('<span class="error">Incorrect login or password, try again</span>');

							

						 }

						 

					

						 

				   }

				});

			})

}





function hideLoginForm() {

	jQuery('#ajaxlogindialog').jqmHide();

}



function rememberPassword() {

	jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'none');

	jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberToggler").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberpasswordForm").css('display', 'block');

	jQuery("#ajaxlogindialog .bubbleHtext").text('Password resend form');

	jQuery("#ajaxlogindialog .bubbleMessage").html('<span>&nbsp;</span>');

	

}



function rememberPassword_chpass() {

	jQuery("#ajaxchpassdialog .ajaxloginForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberToggler").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberpasswordForm").css('display', 'block');

	jQuery("#ajaxchpassdialog .bubbleHtext").text('Password resend form');

	jQuery("#ajaxchpassdialog .bubbleMessage").html('<span>&nbsp;</span>');

}



function rememberByLogin() {

	jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberpasswordForm").css('display', 'none');	

	jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'block');

}

function rememberByEmail() {

	jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberpasswordForm").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'block');

}



function rememberByLogin_chpass() {

	jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberpasswordForm").css('display', 'none');	

	jQuery("#ajaxchpassdialog .rememberByEmailForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberByLoginForm").css('display', 'block');

}

function rememberByEmail_chpass() {

	jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberpasswordForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberByLoginForm").css('display', 'none');

	jQuery("#ajaxchpassdialog .rememberByEmailForm").css('display', 'block');

}



function remembermySend_chpass(type) {

				var data_add = '';

				if (type == 'email') {

					data_add = 	"type=email&remember_email=" + encodeURIComponent(jQuery("#ajaxchpassdialog .remember_email").val());

				}

				if (type == 'login') {

					data_add = 	"type=login&remember_login=" + encodeURIComponent(jQuery("#ajaxchpassdialog .remember_login").val());

				}

				jQuery("#ajaxchpassdialog .rememberByLoginForm").css('display', 'none');

				jQuery("#ajaxchpassdialog .rememberByEmailForm").css('display', 'none');

				

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'block');

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").addClass('loadedFedback');

				jQuery("#ajaxchpassdialog .resultsAjaxLogin").html('Подождите, запрос обрабатывается ...');

				jQuery.ajax({

				   type: "POST",

				   url:  "ajax_remember_password.php",

				   data: data_add,

				   success: function(msg){

					 	topmiladyresponse = eval("(" + msg + ")");

						jQuery("#ajaxchpassdialog .resultsAjaxLogin").removeClass('loadedFedback');

						jQuery("#ajaxchpassdialog .resultsAjaxLogin").css('display', 'none');											

						

						if (topmiladyresponse.result == 0) {	

							if (type == 'email') {

								jQuery("#ajaxchpassdialog .rememberByEmailForm").css('display', 'block');

							}

							if (type == 'login') {

								jQuery("#ajaxchpassdialog .rememberByLoginForm").css('display', 'block');

							}

							jQuery('#ajaxchpassdialog .bubbleMessage').html(topmiladyresponse.msg);	

						} else {

							jQuery('#ajaxchpassdialog .bubbleMessage').html(topmiladyresponse.msg);

							

							jQuery("#ajaxchpassdialog .txtajaxoldpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpassword").val('');jQuery("#ajaxchpassdialog .txtajaxnewpasswordrep").val('');

							

							jQuery("#ajaxchpassdialog .rememberToggler").css('display', 'block');							

							jQuery("#ajaxchpassdialog .ajaxloginForm").css('display', 'block');

							jQuery("#ajaxchpassdialog .bubbleHtext").html('Change password form');

							

							

							jQuery("#ajaxchpassdialog .txtajaxoldpassword").val('');

							jQuery("#ajaxchpassdialog .txtajaxnewpassword").val('');

							jQuery("#ajaxchpassdialog .txtajaxnewpasswordrep").val('');

							

							

							

						}

						

					 	//jQuery("#ajaxlogindialog .resultsAjaxLogin").html(msg);						 					 

				   }

				});

}







function remembermySend(type) {

				var data_add = '';

				if (type == 'email') {

					data_add = 	"type=email&remember_email=" + encodeURIComponent(jQuery("#ajaxlogindialog .remember_email").val());

				}

				if (type == 'login') {

					data_add = 	"type=login&remember_login=" + encodeURIComponent(jQuery("#ajaxlogindialog .remember_login").val());

				}

				jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'none');

				jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'none');

				

				jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'block');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").addClass('loadedFedback');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").html('Wait while message sending ...');

				jQuery.ajax({

				   type: "POST",

				   url:  "ajax_remember_password.php",

				   data: data_add,

				   success: function(msg){

					 	topmiladyresponse = eval("(" + msg + ")");

						jQuery("#ajaxlogindialog .resultsAjaxLogin").removeClass('loadedFedback');

						jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');											

						

						if (topmiladyresponse.result == 0) {	

							if (type == 'email') {

								jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'block');

							}

							if (type == 'login') {

								jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'block');

							}

							jQuery('#ajaxlogindialog .bubbleMessage').html(topmiladyresponse.msg);	

						} else {

							jQuery('#ajaxlogindialog .bubbleMessage').html(topmiladyresponse.msg);

							

							jQuery("#ajaxlogindialog .txtajaxlogin").val('');

							jQuery("#ajaxlogindialog .txtajaxpassword").val('');

							

							jQuery("#ajaxlogindialog .rememberToggler").css('display', 'block');							

							jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'block');

						}

						

					 	//jQuery("#ajaxlogindialog .resultsAjaxLogin").html(msg);						 					 

				   }

				});

}


var my_procedure_to_do_after_login = ''
function showLoginDialogNotChat(procedures_to_do) {
	my_procedure_to_do_after_login = procedures_to_do;
	if (VideochatType == '1') {
		new_login_man();
	}
	if (VideochatType == '2') {
		new_login_girl();
	}
}









function showLoginDialogNotChat2(procedures_to_do) {

	jQuery('.pp_close').click();

	jQuery(".bubbleMessage").html('<span>&nbsp;</span>');

	

	jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberpasswordForm").css('display', 'none');	

	jQuery("#ajaxlogindialog .rememberByEmailForm").css('display', 'none');

	jQuery("#ajaxlogindialog .rememberByLoginForm").css('display', 'none');

	jQuery("#ajaxlogindialog .incorrectLogin").css('display', 'none'); 

	jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'block');

	jQuery("#ajaxlogindialog .rememberToggler").css('display', 'block');

	

	jQuery('#ajaxlogindialog').jqmShow();	

	jQuery("#ajaxlogindialog .submitAjaxLogin").unbind('click');

	jQuery("#ajaxlogindialog .submitAjaxLogin").click(function() {		

				jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'none');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'block');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").addClass('loadedFedback');

				jQuery("#ajaxlogindialog .resultsAjaxLogin").html('Wait while message sending ...');

				jQuery.ajax({

				   type: "POST",

				   url:  "ajax_midlogin.php",

				   data: "txtajaxlogin=" + encodeURIComponent(jQuery("#ajaxlogindialog .txtajaxlogin").val()) + "&txtajaxpassword=" + encodeURIComponent(jQuery("#ajaxlogindialog .txtajaxpassword").val()),

				   success: function(msg){

					

					 var response = eval('(' + msg + ')');

					

					 jQuery("#ajaxlogindialog .resultsAjaxLogin").removeClass('loadedFedback');

					 jQuery("#ajaxlogindialog .resultsAjaxLogin").html('<div style="text-align:center; font-size:18px;">You login to site successfully!<br />');

					 

						 jQuery("#ajaxlogindialog .resultsAjaxLogin").html('');

						 jQuery("#ajaxlogindialog .resultsAjaxLogin").css('display', 'none');

						 jQuery("#ajaxlogindialog .ajaxloginForm").css('display', 'block');

						 if (response.status == 'ok') {

							jQuery('#ajaxlogindialog').jqmHide();

							

							eval(procedures_to_do);							

						 }	else {

							 jQuery('#ajaxlogindialog .bubbleMessage').html('<span class="error">Incorrect login or password, try again</span>');

						 }

						 

					

						 

				   }

				});

	})

}





function chpassToSite() {

	jQuery('#ajaxchpassdialog .bubbleMessage').html('<span>&nbsp;</span>');

	showChpassDialog('');

}



function loginToSite() {

	jQuery('.bubbleMessage').html('<span>&nbsp;</span>');

	jQuery('#ajaxlogindialog .txtajaxlogin').val('');

	jQuery('#ajaxlogindialog .txtajaxpassword').val('');

	if (VideochatType == 1) {

		showLoginDialogNotChat('window.location = "index2.php"');

	}

	if (VideochatType == 2) {

		showLoginDialogNotChat('window.location = "videochat.php"');

	}

	

}



if ( use_popups == undefined ) {

	var use_popups = true;

}



// captcha reload

function reloadCaptcha() {

	now = new Date();

	var capObj = document.getElementById('spam_code_img');

	if (capObj) {

		capObj.src = capObj.src + (capObj.src.indexOf('?') > -1 ? '&' : '?') + Math.ceil(Math.random()*(now.getTime()));

	}

}



function setCookie (name, value, expires, path, domain, secure) {

      document.cookie = name + "=" + escape(value) +

        ((expires) ? "; expires=" + expires : "") +

        ((path) ? "; path=" + path : "") +

        ((domain) ? "; domain=" + domain : "") +

        ((secure) ? "; secure" : "");

}



function getCookie(name) {

	var cookie = " " + document.cookie;

	var search = " " + name + "=";

	var setStr = null;

	var offset = 0;

	var end = 0;

	if (cookie.length > 0) {

		offset = cookie.indexOf(search);

		if (offset != -1) {

			offset += search.length;

			end = cookie.indexOf(";", offset)

			if (end == -1) {

				end = cookie.length;

			}

			setStr = unescape(cookie.substring(offset, end));

		}

	}

	return(setStr);

}



//validating

function doSubmit() {

	var mfrm = document.frmSignup;

	if ( mfrm.txtusername.value == '' ) {

		alert ( 'Username is missing' );

		mfrm.txtusername.focus();

		return false;

	} else if ( isNumeric ( mfrm.txtusername.value.charAt(0) ) ) {

		alert ( 'Username must start with alphabet' );

		mfrm.txtusername.focus();

		return false;				

	} else if ( mfrm.txtpassword.value == '' ) {

		alert ( 'Please input password' );

		mfrm.txtpassword.focus();

		return false;

	} else if ( isNumeric( mfrm.txtpassword.value.charAt(0) ) ) {

		alert ( 'Password must start with alphabet' );

		mfrm.txtpassword.focus();

		return false;				

	} else if ( mfrm.txtpassword2.value == '' ) {

		alert ( 'Please input confirm password' );

		mfrm.txtpassword2.focus();

		return false;

	} else if ( isNumeric( mfrm.txtpassword2.value.charAt(0) ) ) {

		alert ( 'Confirm Password must start with alphabet' );

		mfrm.txtpassword2.focus();

		return false;				

	} else if ( mfrm.txtpassword.value != mfrm.txtpassword2.value ) {

		alert ( 'Password and Confirm Password must be same' );

		mfrm.txtpassword2.focus();

		return false;				

	} else if ( mfrm.txtfirstname.value == '' ) {

		alert ( 'Please input first name' );

		mfrm.txtfirstname.focus();

		return false;

	} else if ( isNumeric( mfrm.txtfirstname.value.charAt(0) ) ) {

		alert ( 'First name must start with alphabet' );

		mfrm.txtfirstname.focus();

		return false;				

	} else if ( !isAlphabetic( mfrm.txtfirstname.value ) ) {

		alert ( 'First name should be alphabetic' );

		mfrm.txtfirstname.focus();

		return false;				

	} else if ( mfrm.txtlastname.value == '' ) {

		alert ( 'Please input last name' );

		mfrm.txtlastname.focus();

		return false;

	} else if ( isNumeric( mfrm.txtlastname.value.charAt(0) ) ) {

		alert ( 'Last name must start with alphabet' );

		mfrm.txtlastname.focus();

		return false;				

	} else if ( !isAlphabetic( mfrm.txtlastname.value ) ) {

		alert ( 'Last name should be alphabetic' );

		mfrm.txtlastname.focus();

		return false;				

	} else if ( mfrm.txtemail.value == '' ) {

		alert ( 'Please input email' );

		mfrm.txtemail.focus();

		return false;

	} else if ( !isValidEmail( mfrm.txtemail.value ) ) {

		alert ( 'Please input valid email' );

		mfrm.txtemail.focus();

		return false;

	} else if ( mfrm.txtcity.value == '' ) {

		alert ( 'Please input city' );

		mfrm.txtcity.focus();

		return false;

	} else if ( isNumeric( mfrm.txtcity.value.charAt(0) ) ) {

		alert ( 'City name must start with alphabet' );

		mfrm.txtcity.focus();

		return false;				

	} else if ( mfrm.txtstateprovince.value == '' ) {

		alert ( 'Please input state or province' );

		mfrm.txtstateprovince.focus();

		return false;

	} else if ( mfrm.txtzip.value == '' ) {

		alert ( 'Please input zip code' );

		mfrm.txtzip.focus();

		return false;

	} else if ( mfrm.txtaddress1.value == '' ) {

		alert ( 'Please input address line 1' );

		mfrm.txtaddress1.focus();

		return false;

	} else {

		return true;

	}

	return false;

}







window.notifications = new Array();



function loadtooltips() {

	jQuery('.wTooltip_topmiladyHelp').remove();

	jQuery('.topmiladyToolTipped').wTooltip({className:"wTooltip_topmiladyHelp", style: false});

}















jQuery(document).ready(function(){





loadtooltips();

jQuery('#ajaxlogindialog').jqm({

	closeClass: 'ajaxloginJqmClose',

	trigger: '.ajaxloginJqModal'						   

});



jQuery('#ajaxtranslator').jqm({

	closeClass: 'ajaxTranslateJqmClose',

	trigger: '.ajaxTranslateJqModal'

});



jQuery('#ajaxtranslator_tab').jqm({

	closeClass: 'ajaxTranslateTabJqmClose',

	trigger: '.ajaxTranslateJqModal'

});



jQuery('#alertWindow').jqm({

		closeClass: 'alertJqmClose',

		trigger: '.alertJqModal',

		onHide: newAlertHide

});

jQuery('#alertWindow2').jqm({

		closeClass: 'alert2JqmClose',

		trigger: '.alert2JqModal'

});

jQuery('#alertWindow4').jqm({

		closeClass: 'alert4JqmClose',

		trigger: '.alert4JqModal',
		
		onHide: alertWindowwww

});




jQuery('#simple_alertWindow').jqm({

		closeClass: 'simple_alertJqmClose',

		trigger: '.simple_alertJqModal'

});





jQuery('#ajaxtranslator').jqm({

	closeClass: 'ajaxTranslateJqmClose',

	trigger: '.ajaxTranslateJqModal'

});





jQuery('#ajaxchpassdialog').jqm({

			closeClass: 'ajaxchpassJqmClose',

			trigger: '.ajaxchpassJqModal'						   

});	


jQuery('#ajaxRegistrationDialog').jqm({

	closeClass: 'ajaxRegistrationJqmClose',

	trigger: '.ajaxRegisterJqModal'						   

});




jQuery(".hoveredButton").hover(

  function () {

    this.src = this.src.replace("_off", "_on");

  }, 

  function () {

    this.src = this.src.replace("_on","_off");

  }

);





jQuery("tr.oddrow").hover(

					  function () {

						jQuery(this).addClass("oddrow_hover");

					  },

					  function () {

						jQuery(this).removeClass("oddrow_hover");

					  }

					);



jQuery("tr.evenrow").hover(

					  function () {

						jQuery(this).addClass("evenrow_hover");

					  },

					  function () {

						jQuery(this).removeClass("evenrow_hover");

					  }

					);



	jQuery('#dialog').jqm({

		closeClass: 'jqmClose',
		trigger: '.ajaxDialogWinJqModal'						   

	});
	
	jQuery('#opros').jqm({

		closeClass: 'jqmClose',
		trigger: '.ajaxOprosWinJqModal'						   

	});


	
	

	jQuery("#modalShower").click(function() {

		feedbackNext();						  

	});	







	
	

	


})

var alertWindowwww = function(hash) {
	
	window.block_do_girls_search = 1;
						jQuery('#adopted_age_start').val(window.last_srp.adopted_age_start);
						jQuery('#adopted_age_end').val(window.last_srp.adopted_age_end);
						jQuery('#online_status').val(window.last_srp.online_status);
						jQuery('#invite_me').val(window.last_srp.invite_me);
						jQuery('#common_favorites').val(window.last_srp.common_favorites);
						jQuery('#question_hair').val(window.last_srp.question_hair);
						jQuery('#question_eye_color').val(window.last_srp.question_eye_color);
						jQuery('#adopted_height_start').val(window.last_srp.adopted_height_start);
						jQuery('#adopted_height_end').val(window.last_srp.adopted_height_end);
						jQuery('#adopted_weight_pounds_start').val(window.last_srp.adopted_weight_pounds_start);
						jQuery('#adopted_weight_pounds_end').val(window.last_srp.adopted_weight_pounds_end);
						jQuery('#question_have_children').val(window.last_srp.question_have_children);
						jQuery('#question_marital_status').val(window.last_srp.question_marital_status);
						jQuery('#firstname').val(window.last_srp.firstname);
						jQuery('#forNameVal').val(window.last_srp.firstname);
						
						
						
						query_array_change2();
						
						jQuery('#clients').css('visibility', 'visible');
						jQuery('#myClientsWrapper').removeClass('loadedWindow');
						
						jQuery.each(jQuery('.menupanel select'), function(i) { 											
								jQuery(this).removeAttr('disabled');
						});	
						jQuery.each(jQuery('.menupanel input'), function(i) { 											
								jQuery(this).removeAttr('disabled');
						});
						jQuery('#show_search_results img').attr('src', 'images/enter_on.jpg');
						
						jQuery("#psize").removeAttr('disabled');
						jQuery('#show_search_results').attr('href', 'javascript:do_girls_search()');
						jQuery('#reset_parameters_label').attr('href', 'javascript:reset_search()');
						window.paginator_blocked = 0;
						window.block_do_girls_search = 0;
	
	
	hash.w.fadeOut('2000',function(){ hash.o.remove(); }); 

}; 


function setCursorAtEnd(sTextboxID) {

    var oTextbox = document.all.item(sTextboxID);

    if (oTextbox .createTextRange) {

        var r = (oTextbox.createTextRange());

        r.moveStart('character', (oTextbox.value.length));

        r.collapse();

        r.select();

    }

}



function newAlertHide(hash) {

	 var tinyEl = tinyMCE.get('' + window.replaceRussianSymbolArea);	 

	 var tempCont = "";

	 tempCont = tempCont + tinyEl.getContent();

	 jQuery.each(window.replaceRussianSymbol, function(i, val) {

     	var tempKey = val;

		tempCont = tempCont.replace(tempKey, '');

     });

	 hash.w.fadeOut('2000',function(){		

		var emptyLabel = false;

		if ((tempCont == '') || (tempCont == '&nbsp;') || (tempCont == '<p></p>') || (tempCont == '<p>&nbsp;</p>') || (tempCont == '<p> </p>') || (tempCont == ' ') || (tempCont == 'Write in English here ...') || (tempCont == '<p>Write in English here ...</p>')) {

			tempCont = 'Write in English here ...';

			emptyLabel = true;

		} else {

			tinyEl.focus(false);

		}		

		hash.o.remove(); 

		if (emptyLabel == true) {

			tinyEl.setContent(tempCont);

			jQuery('#alertWindowForBluring').focus();

			

		} else {

			tinyEl.setContent(''); 

			tinyEl.execCommand("mceInsertContent",false, tempCont);	

			tinyEl.execCommand('mceFocus', false);

		}		

	 }); 	 

};



function openChatPage() {

	chat_trigger();

}















function createRequestObject() {

	if (window.XMLHttpRequest && !(window.ActiveXObject)) {

		return new XMLHttpRequest();

	} else if (window.ActiveXObject){

		try {

			return new ActiveXObject('MSXML2.XMLHTTP');  

		} catch (e) {

			return new ActiveXObject('Microsoft.XMLHTTP');

		}

	} 

}

var http = createRequestObject();

function handleResponse() {

    if(http.readyState == 4){

	var topmiladyresponse = http.responseText;

	if (topmiladyresponse != 'undefined' && topmiladyresponse != '') {

		var update = new Array();

		var up2 = new Array();

		if(topmiladyresponse.indexOf('|||' != -1)  ) {

		    update = topmiladyresponse.split('|||');

  		    for (var i = 1; i<update.length; i++) {

		        up2 = update[i].split("|:|");

		        if (up2[0] != 'undefined' && up2[0] != '' && document.getElementById(up2[0]) ) {

			    document.getElementById(up2[0]).innerHTML = up2[1];

		        } 

		    }

		}

	}

    }

}

function shtorka2_on() {
	//jQuery("#hidder").css('display', 'none');	
    jQuery('#shtorkaFullLoader').css({'position':'fixed', 'top':'0px', 'left':'0px', 'width':'100%', 'height':'100%', 'visibility':'visible'});
}



function shtorka2_off() {
	jQuery('#shtorkaFullLoader').css('visibility', 'hidden');
	jQuery('#hidder').css('display', 'block');
}





jQuery("#lang").change(function () {

		jQuery('#langopt').submit();									 

})





function compose_attempt(recipientid) {

var offset = jQuery('#contents').offset();	
	jQuery.ajax({

		type: "GET",

		url:  'how_to_compose.php?recipientid=' + recipientid,

		data: '',

		success: function(topmiladyresponse){					  

			var topmiladyresults = eval("(" + topmiladyresponse + ")");

			if (topmiladyresults.need_action == 'continue') {

				gotopage(topmiladyresults.goto_url);

			}

		}		

	})

}

function man_compose_attempt(recipientid) {

var offset = jQuery('#contents').offset();	
	jQuery.ajax({

		type: "GET",

		url:  'man_how_to_compose.php?recipientid=' + recipientid,

		data: '',

		success: function(topmiladyresponse){					  

			var topmiladyresults = eval("(" + topmiladyresponse + ")");

			if (topmiladyresults.need_action == 'continue') {

				gotopage(topmiladyresults.goto_url);

			}

		}		

	})

}






function search_attempt(jsontext) {
	window.shtorka2_is_open = 1; shtorka2_on(); 
	jsonobj = eval('(' + jsontext + ')');
	jQuery('#question_hair').val(jsonobj.question_hair);
	jQuery('#question_eye_color').val(jsonobj.question_eye_color);
	jQuery('#question_marital_status').val(jsonobj.question_marital_status);
	jQuery('#question_have_children').val(jsonobj.question_have_children);
	jQuery('#firstname').val(jsonobj.firstname);
	jQuery('#adopted_age_start').val(jsonobj.adopted_age_start);
	jQuery('#adopted_age_end').val(jsonobj.adopted_age_end);
	jQuery('#adopted_height_start').val(jsonobj.adopted_height_start);
	jQuery('#adopted_height_end').val(jsonobj.adopted_height_end);
	
	jQuery('#adopted_weight_pounds_start').val(jsonobj.adopted_weight_pounds_start);
	jQuery('#adopted_weight_pounds_end').val(jsonobj.adopted_weight_pounds_end);
	
	
	
	
	
	
	
	
	
	
	setTimeout(function() { 
							query_array_change();
							clients_for_model_loader_json('models_for_client.php');
							
							
							
							
							jQuery(".newstyle").html('<img src="images/arrow-up-icon2.png" title="HIDE other parameters" style="margin:0px 0px -10px 0px;" />');
							
							add_search_showed = 1;
							
						}, 
				1100);	
}




function gift_attempt(model_id) {

var offset = jQuery('#contents').offset();	





	jQuery.ajax({

		type: "GET",

		url:  'how_to_gift.php?model_id=' + model_id,

		data: '',

		success: function(topmiladyresponse){					  

			var topmiladyresults = eval("(" + topmiladyresponse + ")");			

				gotopage(topmiladyresults.goto_url);			

		}		

	})

}















function gotopage(url, params) {
	window.curpage = '';
	jQuery('.pp_close').click();
	jQuery('#ajaxRegistrationDialog').jqmHide();
	jQuery('#ajaxlogindialog').jqmHide();	
	if ((window.location.hash == '#page=' + encodeURIComponent(url)) || (window.location.hash == '#page=' + url)) { 
		window.location.hash = '#page=' + encodeURIComponent(url) + '&rand=' + Math.random() + '_' + Math.random();	
	} else {
		window.location.hash = '#page=' + encodeURIComponent(url);	
	}
}



function gotopage2(pageurl) {
	chat_trigger();
	gotopage(pageurl);
}



function real_gotopage(url, addparams) {



var offset = jQuery('#contents').offset();	

//jQuery('#shtorka2').css('visibility', 'visible').css('z-index', 10000000).css('top',offset.top).css('left',offset.left).css('opacity', 0.8).width(jQuery('#contents').width()).height(jQuery(document).height() - 152 - 152);

    //jQuery("#hidder").css('display', 'none');	
    jQuery('#shtorkaFullLoader').css({'position':'fixed', 'top':'0px', 'left':'0px', 'width':'100%', 'height':'100%', 'visibility':'visible'});



		

	jQuery('#leftcolumn_wr a').blur();

	jQuery('#searchProfileWrapper a').blur();	

	eval(string_to_do_when_close);

	var old_height = jQuery('#contents').height();

	jQuery('#contents').html('');

	jQuery('#contents').height(old_height);

	
	
	jQuery.ajax({

				   type: "POST",

				   url:  url,

				   data: '',

				   success: function(topmiladyresponse){					  

					

					  
					
					 

					  

					  var topmiladyresults = eval('(' + topmiladyresponse + ')');	

					  if (topmiladyresults.pageTitle != null) {
						jQuery('title').text(topmiladyresults.pageTitle);	  
					  }

					  jQuery('.loaded_css').remove();					  

					  jQuery.each(topmiladyresults.addtional_css_toload, function() {							

							jQuery("<link/>", {

							   rel: "stylesheet",

							   type: "text/css",

							   href: this

							}).appendTo("head");

							

					  })

					

						

						

					

					  jQuery('#contents').html(topmiladyresults.page);

					 	var cnt = 0;

					 	

						jQuery.each(topmiladyresults.additional_javascript_load, function() {

								cnt++; 													

						})

																		

												

						var loaded_cnt = 0;

					  

					  	jQuery.each(topmiladyresults.additional_javascript_load, function() {

							

							jQuery.ajax({

							   type: "GET",

							   url: "" + this,

							   dataType: "script",

							   success: function(){

							   		loaded_cnt++;

									if (loaded_cnt == cnt) {

										do_after_scripts_loaded(topmiladyresults)

																			

									}

							   }

							 });							

					  	});					   

					  	if (cnt == 0) {

							
							do_after_scripts_loaded(topmiladyresults)

					  	}

						

						
							
						

					 						  

				   }

				})

}


function check_if_all_need_loaded() {
	window.need_to_preloadCount = window.need_to_preloadCount - 1;
	if (window.need_to_preloadCount == 0) {
			do_when_all_loaded();		  
	}
}


function do_when_all_loaded() {
	
	var topmiladyresults = window.need_to_preload_parameters.topmiladyresults;
					  eval(topmiladyresults.additional_javascript_execute);

							actionWhenLoad();							
							submit_stats_data();
					 		jQuery('#contents').css('height', 'auto');

							
							jQuery('#shtorkaFullLoader').css('visibility', 'hidden');
							jQuery('#hidder').css('display', 'block');
							
							if (window.is_it_r_client == 1) {
								if (window.tmthloaded == 0) {
									window.tmthloaded = 1;
									common_client_updates_starter();
								}
							}
							

										if (topmiladyresults.menuHeadingActive != null) {

											var temp_h = topmiladyresults.menuHeadingActive;

											

											
											

											jQuery.each(jQuery('.ActiveHeading'), function(i) { 

												if (jQuery(this).attr('id') != "#heading-" + temp_h + "") {

													jQuery(this).removeClass('ActiveHeading');

												}

											});

											

																					

										}

										if (topmiladyresults.menuBoxActive != null) {

											var temp_b = topmiladyresults.menuBoxActive;

											

											jQuery.each(jQuery('.lblock_content'), function(i) { 

												if (jQuery(this).attr('id') != "#lblock-" + temp_b + "") {

													

													if (jQuery(this).hasClass('ActiveBox')) {

														jQuery(this).removeClass('ActiveBox');

													}

												}

											});	

											

											jQuery("#lblock-" + temp_b + "").addClass('ActiveBox');

										}

										if (topmiladyresults.menuLinkActive != null) {

											var temp_l = topmiladyresults.menuLinkActive;

											jQuery.each(jQuery('.ActiveLink'), function(i) { 

												if (jQuery(this).attr('id') != "#link-" + temp_l + "") {

													jQuery(this).removeClass('ActiveLink');

												}

											});

											jQuery("#link-" + temp_l + "").addClass('ActiveLink');

										}

										if (topmiladyresults.pageHeading != null) {

											jQuery('#pageHeading').html(topmiladyresults.pageHeading);											

										}
										
}




function do_after_scripts_loaded(topmiladyresults) {
	window.need_to_preload_parameters = [];
	window.need_to_preload_parameters.topmiladyresults = topmiladyresults;
	
	if ((topmiladyresults.need_to_preload_arr != null) && (topmiladyresults.need_to_preload_arr != 'undefined')) {
		var need_to_preload_arr = topmiladyresults.need_to_preload_arr;	
		window.need_to_preloadCount = need_to_preload_arr.length;
		if (window.need_to_preloadCount > 0) {
		jQuery.each(need_to_preload_arr, function(i, val) {								
				jQuery('<img />').attr('src', val).load(function(){
					check_if_all_need_loaded();      
				});								
			});
		} else {
			do_when_all_loaded();
		}
	} else {
		do_when_all_loaded();	
	}
}

function do_after_scripts_loaded_r_client(topmiladyresults) {
	window.need_to_preload_parameters = [];
	window.need_to_preload_parameters.topmiladyresults = topmiladyresults;
	
	if ((topmiladyresults.need_to_preload_arr != null) && (topmiladyresults.need_to_preload_arr != 'undefined')) {
		var need_to_preload_arr = topmiladyresults.need_to_preload_arr;	
		window.need_to_preloadCount = need_to_preload_arr.length;
		if (window.need_to_preloadCount > 0) {
		jQuery.each(need_to_preload_arr, function(i, val) {								
				jQuery('<img />').attr('src', val).load(function(){
					check_if_all_need_loaded_r_client();      
				});								
			});
		} else {
			do_when_all_loaded_r_client();
		}
	} else {
		do_when_all_loaded_r_client();	
	}
}





					 
					 
					  










jQuery(document).bind('hashChange', function(e, newHash) {

	res = getHashParams();		

	var urltogo = '';

	var temp_string = '';

	

	jQuery.each(res, function(index, value) { 	

			//alert(value);

			if (index != 'page') {

				temp_string = temp_string + '&' + index + '=' + value;

			}		

	});

	urltogo = decodeURIComponent(res.page);

		

	if ((temp_string != '') && (temp_string != '') && (temp_string != 'undefined')) {

		

		

		if (urltogo.indexOf('?') == -1) {

			urltogo = urltogo + '?' + temp_string.substring(1);

		} else {

			urltogo = urltogo + temp_string;

		}

	}



	//alert('urltogo = ' + urltogo);





	if (window.block_redirect != 1) {	

			if ( (urltogo != null) && (urltogo != '') && (urltogo != 'undefined') ) {				
	
						real_gotopage(urltogo, '');

			} else {

						if ((session.UserId != 'undefined') && (session.UserId != null)) {

							if (session.VideochatType == 1) {

								window.location.hash = '#page=' + encodeURIComponent('ajaxian_girls_gallery2.php');

							} else {								

								window.location.search = '';

								window.location.hash = '';

								window.location.pathname = '/main_girl.php';

							}							

						} else {

							if (session.VideochatType == 1) {

								window.location.search = '';

								window.location.hash = '';

								window.location.pathname = '/index.php';

							} else {

								window.location.search = '';

								window.location.hash = '';

								window.location.pathname = '/index.php';

							}

						}

						

			}

	}

});




var menu_is_open = 1;

window.additional_parameters = new Array();

window.string_to_do_when_close = '';



var old_page = '';



function focusByName(name) {

	jQuery('.activeField').removeClass('activeField');

	jQuery('input[name="' + name + '"]').removeAttr("disabled");

	jQuery('input[name="' + name + '"]').focus().addClass('activeField');

	jQuery('textarea[name="' + name + '"]').focus().addClass('activeField');	

	jQuery('textarea[name="' + name + '[adding_part]"]').focus().addClass('activeField');	

	jQuery('select[name="' + name + '"]').focus().addClass('activeField');	

	

	

	jQuery('.activeField').blur(function() {

		jQuery(this).removeClass('activeField');								   

    });

}



function my_add_money(ref_id, ref_username, ref_action) {
	chat_trigger();
	gotopage('ajaxian_mymoney.php?message=payment_start&ref_id=' + ref_id + '&ref_username=' + ref_username + '&ref_action=' + ref_action);
}

function submit_stats_data() {
		jQuery.ajax({
				   type: "POST",
				   url:  "browser_stats.php",
				   data: "analytic_s_id=" + window.analytic_s_id + '&width=' + jQuery(window).width() + '&height=' + jQuery(window).height() + '&location=' + document.location.href + '&hash=' + document.location.hash,
				   success: function(){				      
				   }
		})
}

jQuery(document).ready(function(){
	submit_stats_data();							
})


function saveSignup() {
	jQuery('#ajaxRegistrationDialog .content').css('visibility', 'hidden');
	var cellHeight = jQuery('#ajaxRegistrationDialog').parent().height();
	jQuery('#ajaxRegistrationDialog .popupsShtora').css('visibility', 'visible').height(cellHeight);
	jQuery('#ajaxRegistrationDialog .popupsShtora img').css('margin-top', '150px')
	jQuery.ajax({
				   type: "POST",
				   url:  "ajax_savesignup.php",
				   data: 	'txtusername=' + jQuery('#txtusername').val() + 
				   			'&txtpassword=' + jQuery('#txtpassword').val()  + 
							'&txtpassword2=' + jQuery('#txtpassword2').val() + 
							'&txtfirstname=' + jQuery('#txtfirstname').val() + 
							'&txtlastname=' + jQuery('#txtlastname').val() + 
							'&txtemail=' + jQuery('#txtemail').val() + 
							'&txtfrom=' + jQuery('#txtfrom').val() + 
							
							'&txtbirthYear=' + jQuery('#txtbirthYear').val() +  
							'&txtbirthMonth=' + jQuery('#txtbirthMonth').val() +  
							'&txtbirthDay=' + jQuery('#txtbirthDay').val(), 
				   success: function(topmiladyresponse){	
				   		jQuery('#ajaxRegistrationDialog .popupsShtora img').css('margin-top', '0px')
						jQuery('#ajaxRegistrationDialog .popupsShtora').css('visibility', 'hidden').height(0);
					
						var topmiladyresults = eval("(" + topmiladyresponse + ")");
						if (topmiladyresults.result == 1) {
							jQuery('#ajaxRegistrationDialog .content').html('<div style="text-align:center; padding-top:50px; font-weight:bold; color:#009900;">You register succesfull and redirecting now</div>');
							if (window.next_act_action == '') {
								
							} else {
								var cur_next_act_id = window.next_act_id;
								var cur_next_act_action = window.next_act_action;
								var cur_next_act_username = window.next_act_username;
								var cur_next_act_jsoned = window.next_act_jsoned;
								window.next_act_id = '';
								window.next_act_action = '';
								window.next_act_username = '';
								window.next_act_jsoned = '';
								
								if (cur_next_act_action == 'to_gift') {
									jQuery.cookie('js_todo','gift_attempt(' + cur_next_act_id + ')');
								}
								if (cur_next_act_action == 'to_letter') {									
									jQuery.cookie('js_todo','compose_attempt(' + cur_next_act_id + ')');
								}
								if (cur_next_act_action == 'to_videochat') {
									jQuery.cookie('js_todo','start_videochat_with(\'' + cur_next_act_username + '\')');
								}
								if (cur_next_act_action == 'to_profile') {
									jQuery.cookie('js_todo','profile_attempt(\'' + cur_next_act_id + '\')');
								}
								if (cur_next_act_action == 'to_contacts') {
									jQuery.cookie('js_todo','profile_attempt(\'' + cur_next_act_id + '\')');
								}
								if (cur_next_act_action == 'to_search') {
									jQuery.cookie('js_todo','search_attempt(\'' + cur_next_act_jsoned + '\')');
								}
								
								
							}
							location.replace(topmiladyresults.page_after_register);
							
						} else {
							jQuery('.bubbleRegErr').each(function(index, domEle) {
									jQuery(domEle).html('&nbsp;<img style="margin:0px 0px -7px 0px;  padding:0px;"  src="images/accept.png" height="24px" title="Ok" />');								
							});
							var errs = topmiladyresults.base_errmessages_arr;
							jQuery.each(errs, function(index, value) {						  
							  jQuery('.' + value.link + '_Alert').html('&nbsp;<img style="margin:0px 0px -7px 0px;  padding:0px;"  src="images/h_s_32.png" height="24px" title="' + value.text + '" />');
							});							
						}						
						jQuery('#ajaxRegistrationDialog .content').css('visibility', 'visible');
						
				   }
	})	
}

window.next_act_id = '';
window.next_act_action = '';
window.next_act_username = '';
window.next_act_jsoned = '';


function signup_funct(next_act_id, next_act_action, next_act_username) {
	new_register_man();
}

function profile_attempt(id) {
	 gotopage('ajaxian_showprofile.php?id=' + id);	
}
function unregister_search(has_account) {
	var jsontext = '{';
	jsontext += '"question_hair":"' + jQuery('#question_hair').val() + '",';
	jsontext += '"question_eye_color":"' + jQuery('#question_eye_color').val() + '",';
	jsontext += '"question_marital_status":"' + jQuery('#question_marital_status').val() + '",';
	jsontext += '"question_have_children":"' + jQuery('#question_have_children').val() + '",';
	jsontext += '"firstname":"' + jQuery('#firstname').val() + '",';
	jsontext += '"adopted_age_start":"' + jQuery('#adopted_age_start').val() + '",';
	jsontext += '"adopted_age_end":"' + jQuery('#adopted_age_end').val() + '",';
	jsontext += '"adopted_height_start":"' + jQuery('#adopted_height_start').val() + '",';
	jsontext += '"adopted_height_end":"' + jQuery('#adopted_height_end').val() + '",';
	
	jsontext += '"adopted_weight_pounds_start":"' + jQuery('#adopted_weight_pounds_start').val() + '",';
	jsontext += '"adopted_weight_pounds_end":"' + jQuery('#adopted_weight_pounds_end').val() + '",';
	
	jsontext += '}';
	
	if (has_account == 1) {
		showLoginDialogNotChat("to_search('" + jsontext + "')");
	} else {
		signup_funct('','to_search', jsontext);
	}
	
}

function show_feedback() {
	jQuery('#dialog').jqmShow();
	feedbackNext();
}

function feedbackClose() {	
	jQuery('#dialog').jqmHide();
}

function changeformto_login() {	
	jQuery('#ajaxRegistrationDialog').jqmHide();
	jQuery('#ajaxlogindialog').jqmShow();	
}
function changeformto_register() {	
	jQuery('#ajaxlogindialog').jqmHide();
	jQuery('#ajaxRegistrationDialog').jqmShow();		
}

function tryst(model_id) {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	jQuery('#simple_alertFormWrapper').css('height', 'auto');
	
	jQuery('#simple_alertWindow .bubbleHtext').html('Tryst 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_tryst_send.php?model_id=" + model_id,
				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 send_tryst_unlogined(model_id) {	
	jQuery('#simple_alertWindow').addClass('loginWindow');
	
	var height_old = jQuery('#simple_alertFormWrapper').height();
	jQuery('#simple_alertFormWrapper').height(height_old);
	
	jQuery('#simple_alertWindow .bubbleHtext').html('Invitation 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 = 	'&svidanka_interval_type=' + encodeURIComponent(jQuery('#svidanka_interval_type').val()) + 
				'&svidanka_time_from_hours=' + encodeURIComponent(jQuery('#svidanka_time_from_hours').val()) +
				'&svidanka_time_from_minutes=' + encodeURIComponent(jQuery('#svidanka_time_from_minutes').val()) +
				'&svidanka_time_to_hours=' + encodeURIComponent(jQuery('#svidanka_time_to_hours').val()) +
				'&svidanka_time_to_minutes=' + encodeURIComponent(jQuery('#svidanka_time_to_minutes').val()) +
				'&svidanka_time_gmt=' + encodeURIComponent(jQuery('#svidanka_time_gmt').val()) +
				'&svidanka_message=' + encodeURIComponent(jQuery('#svidanka_message').val()) +
				'&svidanka_date_year=' + encodeURIComponent(jQuery('#svidanka_date_year').val()) +
				'&svidanka_date_month=' + encodeURIComponent(jQuery('#svidanka_date_month').val()) +
				'&email=' + encodeURIComponent(jQuery('#email').val()) +
				'&firstname=' + encodeURIComponent(jQuery('#firstname').val()) +
				'&svidanka_date_day=' + encodeURIComponent(jQuery('#svidanka_date_day').val());
	jQuery.ajax({
				url: "ajax_tryst_send.php?model_id=" + model_id + '&action=do&unlogined=1',
				type: "GET",
				data: data,
				success: function(res_pre) {
					res = eval('(' + res_pre + ')');
					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 display_tryst_date() {
	var svidanka_interval_type = jQuery('#svidanka_interval_type').val();
	if (svidanka_interval_type == 'date') {
		jQuery("#svidanka_date_wrapper").css('display', 'block');
	} else {
		jQuery("#svidanka_date_wrapper").css('display', 'none');	
	}
}
