function iView(img,w,h,title) {
    var cx=screen.width/2-(w/2);
    var cy=screen.height/2-(h/2);
    var param="width="+w+",height="+h+",location=no,menubar=no,scrollbars=no,top="+cy+",left="+cx;
    var tw = window.open(null,null,param);
    //tw.document.open();
    tw.document.write("<html><head><title>"+title+"</title></head><body style=\'margin:0;padding:0\'>"+"<a href=\'javascript: self.close();\'><img src=\'"+img+"\' border=0 alt=\'Закрыть окно\' title=\'Закрыть окно\'></a></body></html>");
    //tw.document.close();
}

function iView2(img,w,h,title) {
      cx=screen.width/2-(w/2);
      cy=screen.height/2-(h/2);
      param="width="+w+",height="+h+",location=no,menubar=no,scrollbars=no,top="+cy+",left="+cx;
      tw = window.open("","",param);
      tw.document.open();
      tw.document.write("<html><head><title>"+title+"</title></head><body style=\'margin:0;padding:0\'>"+
      "<a href=\'javascript: window.close();\'><img src=\'"+img+"\' border=0 alt=\'Закрыть окно\' title=\'Закрыть окно\'></a></body></html>");
      tw.document.close();
  }

function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.mail.value)){
return (true)
}
alert("Проверьте правильность написания email.")
return (false)
}

function popswindows(url,name,width,height,scrollbars,status,menubar,toolbar,resizable){
paramstp="height="+height+",width="+width+",scrollbars="+scrollbars+",directories=no,status="+status+",menubar="+menubar+",toolbar="+toolbar+",resizable="+resizable;
    pop=window.open(url,name,paramstp);
}

function swap_images(big, small)
{
 big_src = big.src.replace('.jpg', 'l.jpg');
 small_src = small.src.replace('l.jpg', '.jpg');
 small.src = big_src;
 big.src = small_src;
}

function checkSearch(myForm)
{
	if(myForm.my_keyword.value == 'ключевое слово')
	{
		myForm.my_keyword.value = '';
	}
	return true;
	if ((myForm.my_keyword.value!='ключевое слово')&& (myForm.my_keyword.value!=''))
	{
		return (true)
	}
	alert("Пожалуйста, введите текст для поиска")
	return (false)
}

var current_banner_main = 0;
function init_baner_slider(run){
    var ul = $(".slide_banner_main");
    var ul_width = $("li",ul).eq(0).width();
  if(run == true){
    if(current_banner_main >= ($("li",ul).length-2)){
      current_banner_main = $("li",ul).length-1;
      ul.animate({"marginLeft":-1*current_banner_main*ul_width},function(){
        current_banner_main = 1;
        ul.css({"margin-left":-1*current_banner_main*ul_width});
      });
    }else{
      current_banner_main = current_banner_main+1;
      ul.animate({"marginLeft":-1*current_banner_main*ul_width});
    }
  }else{
    ul.prepend($('li:last',ul).clone());
    ul.append($('li:eq(1)',ul).clone());
    current_banner_main = 1;
    ul.css({"margin-left":-1*current_banner_main*ul_width});
  }
  setTimeout(function(){
    init_baner_slider(true);
  },3000);
}
