// JavaScript Document

var myX = 0;
var myY = 0;
var theWidth, theHeight;

$(document).ready(function(){
						   addElement();
						   $("#vlightbox_resim").click(function(){vlightbox_kapat()});
						   $("#vlightbox").click(function(){vlightbox_kapat()});
						   
						   $(document).mousemove(function(e){
							  myX=e.pageX;
							  myY=e.pageY;
						   }); 
						   
						   $(document).scroll(function(){
							mymargin = myY-theHeight;
							$("#vlightbox_resim").css("margin-top",mymargin+"px");
						   }); 
						   });



function addElement()
{

if (window.innerWidth) {
theWidth=window.innerWidth;
}
else if (document.documentElement && document.documentElement.clientWidth) {
theWidth=document.documentElement.clientWidth;
}
else if (document.body) {
theWidth=document.body.clientWidth;
}
if (window.innerHeight) {
theHeight=window.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) {
theHeight=document.documentElement.clientHeight;
}
else if (document.body) {theHeight=document.body.clientHeight;}

  newDiv = document.createElement("div");
  newDiv.innerHTML = " ";
  newDiv.setAttribute('id','vlightbox');
  my_div = document.getElementById("tasiyici");
  document.body.insertBefore(newDiv, my_div);
document.getElementById("vlightbox").style.height = theHeight+"px";

document.getElementById("vlightbox").style.display="none";
$("#vlightbox_resim").css("display","none");
}

function vlightbox_ac(my_src)
{
document.getElementById("vlightbox").style.display="block";
my_src = my_src.replace("images","images/buyuk");
$("#vlightbox_resim").css("display","block");
$("#vlightbox_resim_").attr("src",my_src);
var mymargin = $("#vlightbox_resim_").css("width").replace("px","");
mymargin=mymargin-33;
$("#kapat_btn").css("padding-Left",mymargin+"px");

mymargin = myY-theHeight;
if(myY>theHeight)
{
$("#vlightbox_resim").css("margin-top",mymargin+"px");
document.getElementById("vlightbox").style.height = $("#tasiyici").css("height");
}
}

function vlightbox_kapat()
{
document.getElementById("vlightbox").style.display="none";
document.getElementById("vlightbox_resim").style.display="none";
}

