var sia=0;
function loadIframe(theURL) {
	document.getElementById("mainContent").src=theURL;
}

// resizes Iframe according to content
function resizeMe(obj){ 
docHeight = document.body.scrollHeight
 obj.style.height = docHeight + 'px'
 } 
function changedom(){
	if(document.forms.jform.domeniu.value=="altul"){
		 document.getElementById("domdiv").innerHTML='<INPUT type=\"text\" name=\"adom\" value=\"'+adom+'\">';
		 document.getElementById("domtext").innerHTML='<B><font color=\"#000066\">Alt domeniu </font><font class=\"error\"> *</font></B>:';
	} else {
		 document.getElementById("domdiv").innerHTML='';
		 document.getElementById("domtext").innerHTML='';
	}
}
function closeme(){
	document.getElementById('addiv').style.visibility='hidden';
}
function startpresentation(){
	if(sia==0){
	sia=1;
	iw = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth );
	ih = ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight );
	divobj=document.getElementById('addiv');
	getajax("ads/ad1.php",divobj);
	divobj.style.left=(iw/3)+'px';
	divobj.style.top=(ih/4+document.documentElement.scrollTop)+'px';
	divobj.style.visibility='visible';
	}
}
function attachevt(obj){
	if(document.addEventListener){
	obj.addEventListener('mouseout',handlemousemove,true);
	} else {
	obj.attachEvent("onmouseout", handlemousemove);
	}
}
function handlemousemove(e){
	if (!e) var e = window.event;
	if(e.x){
	posx = e.x;
	posy = e.y;
	} else {
	posx = e.clientX;
	posy = e.clientY;
	}
	iw = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth );
	ih = ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight );
	obj=document.getElementById('cont');
	if((posy<3)||(posy>ih-16))startpresentation();
}
function updateobj(id){
	obj=document.getElementById(id);
	attachevt(obj);
}
function getajax(strURL,divid) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			if(self.xmlHttpReq.status  == 200) {
						document.getElementById(divid).innerHTML=self.xmlHttpReq.responseText;
			}
        }
    }
	self.xmlHttpReq.send(null);
}
function postajax(strURL,postvars,respdiv) {
    var xmlHttpReq = false;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlHttpReq.open('POST', strURL, true);
    xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpReq.onreadystatechange = function() {
        if (xmlHttpReq.readyState == 4) {
           document.getElementById(respdiv).innerHTML=xmlHttpReq.responseText;
        }
    }
	xmlHttpReq.send(postvars);
}






