function findPosition(obj) {
    var cur_left = cur_top =  cur_height = cur_width = 1;
	cur_height =obj.offsetHeight;
	cur_width = obj.offsetWidth;	
   if (obj.offsetParent) {
        do {
            cur_left += obj.offsetLeft;
            cur_top += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    return [cur_left,cur_top,cur_width , cur_height];
} 
function WDAjaxWithFacebox(param , extJs){
	
	var tag = document.getElementById('popstatus');
	
	tag.innerHTML ="<div id='loading'></div>";
			
			
	xmlHttp=new XMLHttpRequest();
	try{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	}catch (e){
	  // Internet Explorer
		try{
	    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }catch (e){
			try{
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		    }catch (e){
		      alert("Your browser does not support AJAX!");
		      return false;
		    }
	    }
	}
	
	xmlHttp.onreadystatechange=function(){
	 if(xmlHttp.readyState==4){
     	document.getElementById('popstatus').innerHTML=xmlHttp.responseText ;
		if(extJS !='') eval(extJS);
		//document.body.removeChild(document.getElementById("loading"));
     }
    }
	var val='AjaxProcess.php?'+param;
	
	xmlHttp.open("GET",val,true);
	xmlHttp.send(null);
	
	
}


function WDAjax(param , output , extJS ){
	var xmlHttp;
	var nd = document.createElement("div");
	var tag =document.getElementById(output);
	nd.setAttribute("id", "loading");
	nd.className = "loading";
	nd.style.height = "50px";
	pos = findPosition(tag);	
	nd.style.position="relative";

	tag.innerHTML ="<div id='loading'></div>";
	tag.appendChild(nd); 
			
			
	xmlHttp=new XMLHttpRequest();
	try{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	}catch (e){
	  // Internet Explorer
		try{
	    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }catch (e){
			try{
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		    }catch (e){
		      alert("Your browser does not support AJAX!");
		      return false;
		    }
	    }
	}
	
	xmlHttp.onreadystatechange=function(){
	 if(xmlHttp.readyState==4){
     	document.getElementById(output).innerHTML=xmlHttp.responseText ;
		if(extJS !='') eval(extJS);
		document.body.removeChild(document.getElementById("loading"));
     }
    }
	var val='seotools.php?'+param;
	alert(val);
	xmlHttp.open("GET",val,true);
	xmlHttp.send(null);
}
