function newsCarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function jAuth(){
	document.fAuth.submit();
}

function jAuth_2(){
	document.fAuth_2.submit();
}

function keyDown(event) {
	if (document.fAuth_2 != null){
	  	if (document.fAuth_2.login.value.length >0 && document.fAuth_2.password.value.length >0) {jAuth_2();}
	}
	else if (document.getElementById('panel-2_c').style.visibility == 'visible'){ //document.fAuth_2 != null
		if (document.fAuth.login.value.length > 0 && document.fAuth.password.value.length >0) {jAuth();}
	}
	else if (document.registr != null){
		if (event.keyCode==13) full_check();
	}
}

jQuery(document).ready(function(){
    //jQuery("a#fancy").fancybox();
    jQuery('#chb-all').click(function(){
      var checked = jQuery('#chb-all').attr('checked');
      if(checked == true ) {
        jQuery('#header-rcontainer input:checkbox').attr("checked","checked");
      } else {
       jQuery('#header-rcontainer input:checkbox').removeAttr("checked");
      }
    });
 
})



function wo_img(height_img, width_img, model_id, chapterIn)
{
      price_block_width = 360;
      min_height = 700;

      if (height_img < min_height)
      {
          height_window = min_height;
      }
      else
      {
          height_window = 280 + height_img;
      }
      width_window = width_img + price_block_width;
                 
      link_open = "/big_img.php?mod_id=" + model_id + "&chIn=" + chapterIn;
      window.open( link_open, "new", "width=" + width_window + ", height=" + height_window + ", toolbar=0, resizable=1, scrollbars=0, menubar=0" );
}



function openLinkNoIndex(link)
{
      window.location.href=link;
}



if(document.getElementsByClassName) {
    getElementsByClass = function(classList, node) {   
        return (node || document).getElementsByClassName(classList)
    }
} else {
    getElementsByClass = function(classList, node) {           
        var node = node || document,
        list = node.getElementsByTagName('*'),
        length = list.length, 
        classArray = classList.split(/\s+/),
        classes = classArray.length,
        result = [], i,j
        for(i = 0; i < length; i++) {
            for(j = 0; j < classes; j++)  {
                if(list[i].className.search('\\b' + classArray[j] + '\\b') != -1) {
                    result.push(list[i])
                    break
                }
            }
        }
        return result
    }
}



var info = function(img) {
   if(img.height > 60)
   {
       img.height = 60;
   }

   if(img.width > 120)
   {
        img.width = 120;
   }
}



function submitFilterForm(url, server_web)
{
    document.filter_form.action = "http://" + server_web + url;
    document.filter_form.submit();
}


function open_shop_link(url_tovar)
{      
      width_window = 1200;
      height_window = 800;

      open_p = window.open(url_tovar);
      //open_p = window.open( url_tovar, "new", "width=" + width_window + ", height=" + height_window + ", toolbar=1, resizable=1, scrollbars=1, menubar=1" );
}
