$(document).ready(function(){
    $('a[rel]').click(function(){
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        var heightWindow = document.body.clientHeight;
        var pathImage = $(this).attr('href');
        //var actImg = $("#fotoCatalog a").index($(this));
        var size = parseInt($(this).attr('rel'));

        $('body').prepend('<div id="shadow"></div>');
        $('#shadow').css('opacity',0.6)
                .css('height',$('#divOut').height());

        $('body').prepend('<div id="viewFoto">' +
                          '<table style="width:'+(size+40)+'px"><tr><td class="td1"></td><td class="td2"></td><td class="td3"></td></tr>' +
                          '<tr><td class="td4"></td><td class="td5">' +
                          '<img src="'+pathImage+'" alt=""/>' +
                          '</td><td class="td6"></td></tr>' +
                          '<tr><td class="td7"></td><td class="td8"></td><td class="td9"></td></tr></table>' +
                          '<img src="/img/close.gif" alt="" id="closeFoto"/>' +
                          '</div>');
        $('#viewFoto').css('marginLeft',(-1)*$('#viewFoto').width()/2)
                    .css('top',scrollTop+20);   

        return false;
    });

    $('#closeFoto').live('click',function(){
        $('#shadow').remove();
        $('#viewFoto').remove();
    });
});

//координаты курсора на странице
function mousePageXY(e)
{
  var x = 0, y = 0;

  if (!e) e = window.event;

  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }

  return {"x":x, "y":y};
}


/*min-width для ie*/
/*var d = document;
var winIE = (navigator.userAgent.indexOf('Opera')==-1 && (d.getElementById && d.documentElement.behaviorUrns)) ? true : false;

function bodySize(){
    if(winIE && d.documentElement.clientWidth) {
    sObj = d.getElementById('divOut').style;
        if(d.documentElement.clientWidth<1000) {
            sObj.width = '1000px';
        }
        else{
            if(d.documentElement.clientWidth>1160) {
                sObj.width = '1160px';
            }
            else {
                sObj.width = '100%';
                sObj2.width = '100%';
            }
        }
    }
}

function init(){
    if(winIE) { bodySize(); }
}
onload = init;
if(winIE) { onresize = bodySize; }  */
