$(document).ready(function(){

    $("#top_menu li:not(.active)").hover(
		function () {
			$(this).addClass("active");
		},
		function () {
			$(this).removeClass("active");
		}
	);
	
	$('ul#toggle_foto_1').innerfade({
		speed: 2000,
		timeout: 3000,
		type: 'sequence'
	});
	
	$('ul#toggle_foto_2').innerfade({
		speed: 2000,
		timeout: 3000,
		type: 'sequence'
	});
	
	$('ul#toggle_foto_3').innerfade({
		speed: 2000,
		timeout: 3000,
		type: 'sequence'
	}); 
	
	$('ul#toggle_foto_4').innerfade({
		speed: 1000,
		timeout: 5000,
		type: 'sequence',
		containerheight: 460
	}); 
	
	$("#form_2-general_description").keyup(function(){
		//alert($("#form_1-general_description").val().length);
		var count = $("#form_2-general_description").val().length;
		if (count<140) {
			$("#form_2-action_2___1-button").attr("disabled","disabled");
			$("#error-join-stein-general_description").addClass("form_field_error");
		} else {
			$("#form_2-action_2___1-button").removeAttr("disabled");
			$("#error-join-stein-general_description").removeClass("form_field_error");
		}
	});
	$("#form_2-ideal_first_date").keyup(function(){
		//alert($("#form_1-general_description").val().length);
		var count = $("#form_2-ideal_first_date").val().length;
		if (count<140) {
			$("#form_2-action_2___1-button").attr("disabled","disabled");
			$("#error-join-stein-ideal_first_date").addClass("form_field_error");
		} else {
			$("#form_2-action_2___1-button").removeAttr("disabled");
			$("#error-join-stein-ideal_first_date").removeClass("form_field_error");
		}
	});
	$("#form_2-what_looking_for").keyup(function(){
		//alert($("#form_1-general_description").val().length);
		var count = $("#form_2-what_looking_for").val().length;
		if (count<140) {
			$("#form_2-action_2___1-button").attr("disabled","disabled");
			$("#error-join-stein-what_looking_for").addClass("form_field_error");
		} else {
			$("#form_2-action_2___1-button").removeAttr("disabled");
			$("#error-join-stein-what_looking_for").removeClass("form_field_error");
		}
	});
	
	//alert(document.location.href+'||'+location.hostname);
	var url1 = 'http://'+location.hostname+'/';
	var url2 = 'http://'+location.hostname+'/member/join.php';
	var url3 = 'http://'+location.hostname+'/index.php';
	if (document.location.href==url2) {
		mju_do('play');
	}
	else if (document.location.href==url3) {
		mju_do('play');
	}
	else if (document.location.href==url1) {
		mju_do('play');
	} else {
		mju_do('stop');
	}
	/*
	$("#x_address").keyup(function(){
		if ($('#x_address').val()=='') {
			$('#x_address').val(" ");
		}
	});
	$("#x_country").keyup(function(){
		if ($('#x_country').val()=='') {
			$('#x_country').val(" ");
		}
	});
	$("#x_state").keyup(function(){
		if ($('#x_state').val()=='') {
			$('#x_state').val(" ");
		}
	});
	$("#x_city").keyup(function(){
		if ($('#x_city').val()=='') {
			$('#x_city').val(" ");
		}
	});
	$("#x_zip").keyup(function(){
		if ($('#x_zip').val()=='') {
			$('#x_zip').val(" ");
		}
	});
	*/
});	
function showList(id) {
	$('#'+id+'-toggle').toggle("slow");
}
function copyText(id) {
	//alert($("#"+id).val());
	document.getElementById(id+'-copy').innerHTML = $("#"+id).val();
	//$("#"+id+'-copy').val() = $("#"+id).val();
}
function addFavorites(id,profile_id,act) {
	$.ajax({
		type: "POST",
	    url: "/addfavorites.php",
	    data: [{name:"profile_id",value:profile_id}, {name:"act",value:act}],
	    //data: formData,
		dataType: "html",
	    success: function(answ){
	    	$("#"+id).text("");
	    	$("#"+id).append(answ);
	    }
    });
}

function KeyPress(e,id) {
  var kk = navigator.appName == 'Netscape' ? e.which : e.keyCode;
  if (kk == 13)
  {
     //alert(document.getElementById('text-copy').innerHTML);
     //document.getElementById('text-copy').innerHTML = document.getElementById('text-copy').innerHTML+'<121212br>';
     document.getElementById(id).value = document.getElementById(id).value + '<br>';
     return false
  }
  copyText(id);
  return true
}

function hideProfile(id,profile_id,act) {
	$.ajax({
		type: "POST",
	    url: "/hideprofile.php",
	    data: [{name:"profile_id",value:profile_id}, {name:"act",value:act}],
	    //data: formData,
		dataType: "html",
	    success: function(answ){
	    	$("#"+id).text("");
	    	$("#"+id).append(answ);
	    }
    });
}
function showBigImage() {
	popupWin = window.open('/popterms.php','','width='+733+', height='+684+', left=200, top=200, directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no');
	popupWin.focus();
}