jQuery(document).ready(function (){
jQuery(function () {
var scrollDiv = document.createElement('div');
jQuery(scrollDiv).attr('id', 'toTop').html('НАВЕРХ').appendTo('body');
scrollDiv.style.background = 'url("/images/M_images/totop.png") no-repeat scroll center top transparent';
scrollDiv.style.border = 'medium none';
scrollDiv.style.color = '#0098CA';
scrollDiv.style.cursor = 'pointer';
scrollDiv.style.margin = '6px 0 0';
scrollDiv.style.padding = '20px 0 0';
scrollDiv.style.position = 'fixed'; //absolute
scrollDiv.style.top = 0;
scrollDiv.style.display = 'none';
if(innerWidth <= 1065){
scrollDiv.style.left = '200px';
}else{
scrollDiv.style.left = ((innerWidth-1065)/2+200) +'px';
}
window.onresize = function(){
if (innerWidth <= 1065){
scrollDiv.style.left = 200 + 'px';
}
if (innerWidth <= 1065 && pageXOffset > 0){
scrollDiv.style.left = (200-pageXOffset) + 'px';
}
if (innerWidth <= 1065 && pageXOffset == 0){
scrollDiv.style.left = 200 + 'px';
}
if (innerWidth > 1065){
scrollDiv.style.left = ((innerWidth-1065)/2+200) +'px';
}
}
window.onscroll = function(){
if (pageYOffset <= 1000){
scrollDiv.style.display = 'none';
}
if (pageYOffset > 1000){
scrollDiv.style.display = 'block';
}
if (pageXOffset > 0){
scrollDiv.style.left = (200-pageXOffset) + 'px';
}
if (pageXOffset == 0 && innerWidth <= 1065){
scrollDiv.style.left = 200 + 'px';
}
}
jQuery('#toTop').click(function () {
jQuery('body,html').animate({scrollTop: 0}, 800);
});
});
});
window.addEvent('domready', function() {
SqueezeBox.initialize({});
$$('a.modal').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
SqueezeBox.fromElement(el);
});
});
});