Просмотр файла js/functions.js

Размер файла: 5.12Kb
function getXmlHttp() {
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
};




function select_region() {
   var id_country = $('#sel_country').val();
   
   $('#select_city').html('<select class="select" style="width:200px;" id="sel_city" name="city" disabled="disabled"><option value="">-- Выберите город --</option></select>');
   if (!id_country) {
   $('#select_region').html('<select class="select" style="width:200px;" id="sel_region" name="region" disabled="disabled"><option value="">-- Выберите регион --</option></select>');
   $('#select_city').html('<select class="select" style="width:200px;" id="sel_city" name="city" disabled="disabled"><option value="">-- Выберите город --</option></select>');
   }
   else
   {
   $.ajax({
   type: "POST",
   url: "moduls/city.php",
   data: { act: 1, id_country: id_country },
   beforeSend: function() {
      $('#select_region').html('<select class="select" style="width:200px;" id="sel_city" disabled="disabled"><option value="">Загрузка...</option></select>');
      $('.region_info').addClass('reg_help');
      $('.region_info').fadeTo(700, 0.8);
      $('.region_info').css({'margin-left':'50px', 'padding':'6px 10px'});
      $('.region_info').html('<img src="../images/load.gif" alt="" />');
   },
   success: function(data) {
      $('#select_region').html(data);
      $('.region_info').empty();
      $('.region_info').css({'margin':'0', 'padding':'0'});
   }
   });
   }
}


function select_city() {
   var id_region = $('#sel_region').val();
   
   if (!id_region) {
   $('#select_city').html('<select class="select" style="width:200px;" id="sel_city" name="city" disabled="disabled"><option value="">-- Выберите город --</option></select>');
   }
   else
   {
   $.ajax({
   type: "POST",
   url: "moduls/city.php",
   data: { act: 2, id_country: $('#sel_country').val(), id_region: id_region },
   beforeSend: function() {
      $('#select_city').html('<select class="select" style="width:200px;" id="sel_city" disabled="disabled"><option value="">Загрузка...</option></select>');
      $('.city_info').addClass('reg_help');
      $('.city_info').fadeTo(700, 0.8);
      $('.city_info').css({'margin-left':'50px', 'padding':'6px 10px'});
      $('.city_info').html('<img src="../images/load.gif" alt="" />');
   },
   success: function(data) {
      $('#select_city').html(data);
      $('.city_info').empty();
      $('.city_info').css({'margin':'0', 'padding':'0'});
   }
   });
   }
}





/* JavaScript htmlspecialchars */
function htmlspecialchars(html) {
      // Сначала необходимо заменить &
      html = html.replace(/&/g, "&amp;");
      // А затем всё остальное в любой последовательности
      html = html.replace(/</g, "&lt;");
      html = html.replace(/>/g, "&gt;");
      html = html.replace(/"/g, "&quot;");
      // Возвращаем полученное значение
      return html;
}




function NoAuth() {
     u_auth();
};

this.title_help = function() {    
    this.xOffset = -20; // x distance from mouse
    this.yOffset = 20; // y distance from mouse       
    
    $(".title_help").unbind().hover(
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset);
	    this.left = (e.pageX + xOffset);
            
            $('body').append( '<p id="title_help">' + this.t + '</p>' );
            $('#title_help').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
            $("#title_help").fadeTo(700, 0.7);
        },
        function() {
            this.title = this.t;
            $("#title_help").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);
            $("#title_help").css("top", this.top+"px").css("left", this.left+"px");
        }
    );            
    
}
jQuery(document).ready(function($){title_help();});



/* Advertising Slider */
// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};
$(function( $ ){
	if ($('#newusers #slideshow').length != 0) {
		$('#newusers #slideshow').serialScroll({
			items:'li',
			prev:'#newusers a.prev',
			next:'#newusers a.next',
			offset:-5,
			start:0,
			duration: 1500,
			force:true,
			stop:true,
			lock:false,
			cycle:false,
			step:5,
			easing:'easeOutQuart',
			jump: false,
			exclude: 4
		});
	}
});
/* /Advertising Slider */







$(document).ready(function() {
   $('#sup').click(function() {
      location="/feedback.php"
   });
});