  var keyCode = 0;
  window.onbeforeunload = confirmExit;
  function confirmExit(oEvent) 
  {
        if (window.event){
                if (window.event.clientY < 0 && window.event.clientX > 400 && !(keyCode == 116)){
                        return return_str;
                }
        }
  }
  function whatKey(oEvent) {
        if (window.event){
                keyCode = window.event.keyCode;
        }
  }
  
  function a_hover(id)
  {
	var alrt_id = id;
	if (!id.length) return;
	alrt_id = alrt_id.replace('_a', '_alrt');
	
	var offset = $("#" + id).find("img").position();
        
        $(".alrt").hide();
	
        $("#" + alrt_id).css({position: "absolute", left: offset.left - 30, top: offset.top - 30});
        $("#" + alrt_id).show();
        
        
	
  }
  function alrt_out(id)
  {
	var a_id = id;	
	if (!id.length) return;
	a_id = a_id.replace('_alrt', '_a');
	$("#" + id).hide();
  }
  
  function fill_filter_regions(cur_filter_region_id)
  {
          var region_data = new Array();
          var res_text = '';
          for (i=1;i<regions_filter_arr.length;++i)
          {
		region_data = regions_filter_arr[i].split("|");
                res_text += '<option value="' + region_data[0] + '"';
                if (cur_filter_region_id == region_data[0])
                {
                        res_text += " selected ";
                }
                res_text += '>' + region_data[1] + '</option>';
          }
          $("#city").html(res_text);
  }
  
  $(document).ready(function() {
        $('div.ln_photo_list a')
            .hover(function() {
        	    id = $(this).attr('id');
        	    a_hover(id);
                }
        );
        $('div.ln_photo_list div.alrt').bind("mouseleave",
    		function() 
    		{
    		
        	    id = $(this).attr('id');
        	    if (id.indexOf("_alrt") != -1)
        	    {
        		    alrt_out(id);
        	    }
                }
        );
        fill_filter_regions('');
  });
  
  function reg_form_submit()
  {
	document.forms["regform"].rpass.value = $("#pass").val();
	document.forms["regform"].rlogin.value = $("#email").val();
	document.forms["regform"].submit();
  }