function uzXmlHttp(){
	var xmlhttp = false;
	try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(E){
	try{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(E){
	xmlhttp = false;
	}
	}
	
	if(!xmlhttp && document.createElement){
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
		curleft += obj.offsetLeft;
		curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);
	//document.Show.x.value = curleft;
 	//document.Show.y.value = curtop;
	return [curtop,curleft];
	}
}

function popup(id_popup,type,curent){
var pop_content =document.getElementById('pop_content');
if(id_popup=="close"){
pop_content.style.visibility = "hidden";

}
else{
		if(type=="testimonials"){
		var position = findPos(curent);
		var y = position[0]-90;
		pop_content.style.top= y+'px';
			/*if(position[1]<750){
				var x  = position[1]+90;
				pop_content.style.left = x+'px';
			}else{*/
				var x  = position[1]-350;
				pop_content.style.left = x+'px';
			/*}*/
		}else if(type=="before_after"){
		var position = findPos(curent);
		var y = position[0]-90;
		pop_content.style.top= y+'px';
			if(position[1]<700){
				var x  = position[1]+90;
				pop_content.style.left = x+'px';
			}else{
				var x  = position[1]-530;
				pop_content.style.left = x+'px';
			}
		}else{
		var position = findPos(curent);
		var y = position[0] +48;
		pop_content.style.top= y+'px';
			/*if(position[1]<900){
				var x  = position[1]+30;
				pop_content.style.left = x+'px';	
			}else{*/
				var x  = position[1]-280;
				pop_content.style.left = x+'px';
			/*}*/
		}
		
var result;
var url = 'includes/popup.php?id_popup='+id_popup+'&type='+type; 
xmlhttp = uzXmlHttp();
xmlhttp.open("GET", url, false);
xmlhttp.send(null); 

result = xmlhttp.responseText;


 var resultarea= document.getElementById('pop_content');
   resultarea.innerHTML = xmlhttp.responseText;
   
pop_content.style.visibility= "visible";
//pop_content.filters.RevealTrans.play();
}
}

function popup_vdo(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
newwindow=window.open(href, windowname, 'width=300,height=270,scrollbars=yes');
newwindow.moveTo(200,200);
return false;
}

function popup_ads(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
newwindow=window.open(href, windowname, 'width=538,height=570,scrollbars=no');
newwindow.moveTo(200,200);
return false;
}


