function addone2(qt){
    var num;
    if ((qt.value=='') || (isNaN(qt.value))){
    qt.value=1;
    qt.select();
    return }
else{
    qt.value++;
    qt.select()
    }
}

function minusone(qt){
   if (!isNaN(qt.value) && qt.value>1) qt.value--;
   else qt.value=''; qt.select();return false;
 }

function isNetscape(){
  if (navigator.appName == "Netscape") {
    return true
  }else{
    return false
  }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

if (isNetscape()) {
  layerRef="document.layers";
  styleSwitch="";
  netscape=1;
}else{
  layerRef="document.all";
  styleSwitch=".style";
  netscape=0;
}

$(function(){  // левое меню 0
  $("a.item").hover(
	function(){ $(this).stop().animate({marginLeft: '4'},200); },
	function(){ $(this).stop().animate({marginLeft: '0'},100); }
	);

  // левое меню 1
  $("a.item1").hover(
	function(){ $(this).stop().animate({marginLeft: '3'},200); },
	function(){ $(this).stop().animate({marginLeft: '10'},100); }
	);

  // левое меню 1 - новый вариант
  $("#left_menu a").hover(
	function(){ $(this).stop().animate({marginLeft: '3'},200); },
	function(){ $(this).stop().animate({marginLeft: '0'},100); }
	);

  // верхнее меню - новый вариант
  $("#topmenu a").hover(
	function(){ $(this).stop().animate({marginTop: '1'},200); },
	function(){ $(this).stop().animate({marginTop: '0'},100); }
	);


  $('.search_text').focus(function(){  if($(this).val() == 'Поиск по сайту') $(this).val('');  });
  $('.search_text').blur(function(){  if($(this).val() == '') $(this).val('Поиск по сайту');  });


  // онлайн крутилка ответов
/*
  $('#online').load('/img/online_info.php',  function() { $('#online').show();});
  $('.online_ctl a').live('click',  function(event){
      var page = $(event.target).attr('page');
      $('#online').fadeOut(100).load('/img/online_info.php', {page: page}, function(){$(this).fadeIn(200)});});
*/

  // верхнее меню
/*
  $(".td_head22 td a").hover(
	function(){ $(this).stop().animate({marginLeft: '10', marginRight: '4',  marginTop: '4'},200); },
	function(){ $(this).stop().animate({marginLeft: '7', marginRight: '7',  marginTop: '4'},100); }
	);
*/

 // Dialog comment
 $('#comment_dialog').dialog({
	autoOpen: false,
	width: 430,
	title: "Вы можете добавить свой комментарий к товару",
	resizable: false,
	buttons: {
	"Добавить комментарий": function() {
		var comment_name=$("#comment_name").val();
		var comment_email=$("#comment_email").val();
		var comment_text=$("#comment_text").val();
		var code=$("#code").val();
		var antispam_code=$("input[name=antispam_code]").val();
		var user_vote=$('input[name="user_vote"]:checked').val();
		var comment_url=$("#comment_url").val();
		if(comment_name=='') { $("#comment_name").focus();alert('Пожалуйста введите имя.');return false; }
		if(comment_email=='') {$("#comment_email").focus(); alert('Пожалуйста введите емайл.');return false; }
		if(user_vote!=1 && user_vote!=2 && user_vote!=3 && user_vote!=4 && user_vote!=5) { $("input[name=user_vote]").focus();alert('Пожалуйста поставьте Вашу оценку.');return false; }
		if(comment_text=='') { $("#comment_text").focus();alert('Пожалуйста введите комментарий.');return false; }
		if(code=='') { $("#code").focus();alert('Пожалуйста введите цифровой код.');return false; }
        $('#comment_dialog').load("/img/user_comment_add.php", {comment_name:comment_name, comment_email:comment_email, comment_text:comment_text, code:code, save:1, antispam_code:antispam_code,comment_url:comment_url,user_vote:user_vote}, function() {
		     $(this).dialog("close");
			 alert('Спасибо '+comment_name+', Ваш комментарий успешно добавлен.\nПосле проверки администратором он будет опубликован.');
		     });
			},
	"Закрыть": function() {
		$(this).dialog("close");
		}
	}
});
 $('#dialog_link').click(function(){
 var comment_url1=$("#comment_url").val();
 $( "#comment_dialog" ).dialog( "option", "position", 'center' );
 $('#comment_dialog').load("/img/user_comment_add.php", {comment_url: comment_url1}, function() { $('#comment_dialog').dialog('open');  }); return false; });

 // FAQ comment
 $('#faq_dialog').dialog({
	autoOpen: false,
	width: 430,
	title: "Вы можете задать свой вопрос нашим менеджерам",
	resizable: false,
	buttons: {
	"Задать свой вопрос": function() {
		var comment_name=$("#comment_name").val();
		var comment_email=$("#comment_email").val();
		var comment_phone=$("#comment_phone").val();
		var comment_text=$("#comment_text").val();
		var code=$("#code").val();
		var antispam_code=$("input[name=antispam_code]").val();
		if(comment_name=='') { $("#comment_name").focus();alert('Пожалуйста введите имя.');return false; }
		if(comment_email+comment_phone=='') {$("#comment_email").focus(); alert('Пожалуйста введите Ваш емайл или телефон (на сайте не показываются).');return false; }
		if(comment_text=='') { $("#comment_text").focus();alert('Пожалуйста введите Ваш вопрос.');return false; }
		if(code=='') { $("#code").focus();alert('Пожалуйста введите цифровой код.');return false; }
        $('#faq_dialog').load("/img/user_faq_add.php", {comment_name:comment_name, comment_email:comment_email, comment_text:comment_text, code:code, save:1, antispam_code:antispam_code,comment_phone:comment_phone}, function() {
		     $(this).dialog("close");
			 alert('Спасибо '+comment_name+', Ваш вопрос успешно добавлен.\nПосле ответа он будет опубликован на этой странице.');
		     });
			},
	"Закрыть": function() {
		$(this).dialog("close");
		}
	}
 });

 $('#faq_link').click(function(){ $( "#faq_dialog" ).dialog( "option", "position", 'center' );
 $('#faq_dialog').load("/img/user_faq_add.php", {}, function() {
   $('#faq_dialog').dialog('open');
    });
	return false;
 });

});

