var catalog = new fConnector('catalog'); var get_page_size = function(){ var xScroll, yScroll; if(window.innerHeight && window.scrollMaxY){ xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if(document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if(self.innerHeight){ // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if(document.documentElement && document.documentElement.clientHeight){ // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if(document.body){ // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; } return [pageWidth,pageHeight]; } var mouseY = 0; $(function(){ $(document).click(function(){ $('div.popup').hide(); $('.popup-wrap').fadeOut('slow'); }); $('body').mousemove(function(e){mouseY = e.pageY;}); $('a.f-button').attr('href', window.location.href + '#up'); if($($('ul.menu > li > div > ul > li a.selected').length)) $($('ul.menu > li > div > ul > li a.selected').parents()[3]).addClass('selected'); $('ul.menu > li').hover(function(){ $(this).addClass('selected'); $(this).find('div').stop(true, true).slideDown('fast'); },function(){ if(!$('a[href=' + window.location.href + ']', this).length){ $(this).removeClass('selected'); } $(this).find('div').slideUp('fast'); }); }); $(function(){ $('a.f-button').show(); $('a.tovar').click(function(evn){ evn.preventDefault(); evn.stopPropagation(); //$('div.preloader').show(); pHeight = get_page_size()[1]; $('.popup-wrap').height($(document).height()).fadeTo('slow', 0.7); catalog.execute({show_obj:{id:$(this).attr('id'),lang:$(this).attr('lang')}}); if(catalog.result.object) { $('div.popup').html(catalog.result.object); if(mouseY > Math.floor(pHeight / 2)){ //divTop = Math.floor(pHeight - ($('div.popup').height() + 180)); divTop = Math.floor(mouseY - $('div.popup').height()); animTop = ['plus', Math.floor($('div.popup').height() / 5)]; $('div.popup').css('top', divTop + 'px'); } else { divTop = mouseY; animTop = ['minus', Math.floor($('div.popup').height() / 5)]; $('div.popup').css('top', mouseY + 'px'); } //$('div.preloader').hide(); if(animTop[0] == 'plus') $('div.popup').show().animate({top:Math.floor(divTop + animTop[1])}, 500, function(){}); else $('div.popup').show().animate({top:Math.floor(divTop - animTop[1])}, 500, function(){}); $('a.close').live('click', function(evn){ evn.preventDefault(); evn.stopPropagation(); $('div.popup').hide(); $('.popup-wrap').fadeOut('slow'); }); } }); });