  function ds_getleft(el) {
	var tmp = el.offsetLeft;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetLeft;
		el = el.offsetParent;
	}
	return tmp;
}
function ds_gettop(el) {
	var tmp = el.offsetTop;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetTop;
		el = el.offsetParent;
	}
	return tmp;
}
  
  
  
  var patt;
  function displaySubs(odpr,pat){
patt=pat;
 value=document.getElementById("inp").value;
  imes="a"; 
    var url=pat+"/write_email.php?email="+value+"&odpr="+odpr+"&ime="+imes;
   
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponse;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)
      
//}
}
function AJAXresponse(){

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
   document.getElementById("result").innerHTML=xmlHttp.responseText;
}
    else{
        document.getElementById("result").innerHTML = '<img src='+patt+'/images/16.gif width="26" height="26" alt="">';
    }
}
function whichElement(e)
{
var targ;
if (!e)
  {
  var e=window.event;
  }
if (e.target)
  {
  targ=e.target;
  }
else if (e.srcElement)
  {
  targ=e.srcElement;
  }
if (targ.nodeType==3) // defeat Safari bug
  {
  targ = targ.parentNode;
  }
var tname;
tname=targ.tagName;
if(tname=="DIV" || tname=="IMG"){
document.getElementById("clo").style.display="none";
}


}


  function yotube_see(id,i,t){
  if(i>15) min=530; else min=350;
  the_left = ds_getleft(t);
	the_top = ds_gettop(t) + t.offsetHeight;
  element=document.getElementById("resulti")
	element.style.top=the_top-min + 'px';
	element.style.left=the_left-720 + 'px';
	
	
   var url="youtube_see.php?id="+id;
   
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponseD;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)
      
//}
}
function AJAXresponseD(){

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
   document.getElementById("resulti").innerHTML=xmlHttp.responseText;
}
    else{
        document.getElementById("resulti").innerHTML = '<img src=images/16.gif width="26" height="26" alt="">';
    }
}
 function yotube_see1(id,i){
 
  element=document.getElementById("resulti")

	
	
   var url="youtube_see.php?id="+id;
   
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponseDD;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)
      
//}
}
function AJAXresponseDD(){

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
   document.getElementById("resulti").innerHTML=xmlHttp.responseText;
}
    else{
        document.getElementById("resulti").innerHTML = '<img src=images/16.gif width="26" height="26" alt="">';
    }
}
////////// open popup ////////

function lol(path,id,width,height)
{
var path;
var xPos;
var yPos;

xPos = (window.screen.width/2) - (width/2 + 10);
yPos = (window.screen.height/2) - (height/2 + 50);
var win2 = window.open(path+"/youtube.php?id="+id,"Window2","status=no,height="+height+",width="+width+",resizable=yes,left=" + xPos + ",top=" + yPos + ",screenX=" + xPos + ",screenY=" + yPos + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
win2.focus();
}



