function checkRegister()
{
	if (document.getElementById('register_name').value.length == 0)
	{
		alert('U heeft geen naam ingevuld!');
		return false;	
	}
	if (document.getElementById('register_email').value.length < 6)
	{
		alert('U heeft geen geldig e-mail adres ingevuld!');
		return false;	
	}
	if (document.getElementById('register_pass').value.length == 0)
	{
		alert('U heeft geen wachtwoord ingevuld!');
		return false;	
	}
	return true;
}

var xmlhttp;
var scrollpos;

function showAdvert(id)
{
	document.getElementById('inline_popup').style.display = 'none';
    document.getElementById('inline_popup').innerHTML = '';
    	
	xmlhttp=null;
	if (window.XMLHttpRequest)
  	{
  		xmlhttp=new XMLHttpRequest();
  	}
	else if (window.ActiveXObject)
  	{
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	if (xmlhttp!=null)
  	{
  		xmlhttp.onreadystatechange = advertLoaded;
  		xmlhttp.open("GET",'inline_popup.php?id='+id,true);
  		xmlhttp.send(null);
  	}
}

function advertLoaded()
{
	if (xmlhttp.readyState==4)
  	{
  		if (xmlhttp.status==200)
    	{
    		if (typeof window.innerWidth != 'undefined')
		 	{
				//check_width = window.innerWidth;
		    	//check_height = window.innerHeight;
                check_width = document.body.offsetWidth;
		    	check_height = document.body.offsetHeight;
                scrollpos = document.body.scrollTop;
                document.body.scrollTop = 0;
		 	}
		 	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
		 	{
				//check_width = document.documentElement.clientWidth;
		    	//check_height = document.documentElement.clientHeight;
                check_width = document.documentElement.scrollWidth;
		    	check_height = document.documentElement.scrollHeight;
                scrollpos = document.documentElement.scrollTop;
                document.documentElement.scrollTop = 0;
		 	}
		 	else
		 	{
		 		//check_width = document.getElementsByTagName('body')[0].clientWidth;
		    	//check_height = document.getElementsByTagName('body')[0].clientHeight;
                check_width = document.body.offsetWidth;
		    	check_height = document.body.offsetHeight;
                scrollpos = document.body.scrollTop;
                document.body.scrollTop = 0;
		 	}
			document.getElementById('inline_screen').style.width = check_width + 'px';
			document.getElementById('inline_screen').style.height = check_height + 'px';
    		document.getElementById('inline_popup').innerHTML = xmlhttp.responseText;
    		document.getElementById('inline_popup').style.display = 'block';
    	}
  	}
}

function hideAdvert()
{
	document.getElementById('inline_screen').style.width = '0px';
	document.getElementById('inline_screen').style.height = '0px';
	document.getElementById('inline_popup').style.display = 'none';
	document.getElementById('inline_popup').innerHTML = '';
    if (typeof window.innerWidth != 'undefined')
    {
		document.body.scrollTop = scrollpos;
    }
    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
    {
        document.documentElement.scrollTop = scrollpos;
    }
    else
    {
        document.body.scrollTop = scrollpos;
    }
}

function showPhoto(url,width,height)
{
	var pop_width = width;
	var pop_height = height;
	var check_width = 0;
	var check_height = 0;
	
 	if (typeof window.innerWidth != 'undefined')
 	{
		check_width = window.innerWidth,
    	check_height = window.innerHeight
 	}
 	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
 	{
		check_width = document.documentElement.clientWidth,
    	check_height = document.documentElement.clientHeight
 	}
 	else
 	{
 		check_width = document.getElementsByTagName('body')[0].clientWidth,
    	check_height = document.getElementsByTagName('body')[0].clientHeight
 	}
	check_width -= 50;
	check_height -= 50;
		
	if (pop_width > check_width)
	{
		pop_width = check_width;
		pop_height = parseInt(pop_height-(pop_height*((width-check_width)/width)));
	}
	if (pop_height > check_height)
	{
		pop_width = parseInt(pop_width-(pop_width*((pop_height-check_height)/pop_height)));
		pop_height = check_height;
	}
    document.getElementById('inline_photo').style.display = 'none';
    document.getElementById('inline_photo').style.width = pop_width + 'px';
    document.getElementById('inline_photo').style.height = pop_height + 'px';
    document.getElementById('inline_photo').innerHTML = '<img src="' +url+ '" width="' + pop_width + 'px" height="' + pop_height + 'px" alt="Servizissimmo Snc"/>';
   	document.getElementById('inline_photo').style.top = (((check_height/2)-(pop_height/2))+25) + 'px';
    document.getElementById('inline_photo').style.left = (((check_width/2)-(pop_width/2))+25) + 'px';
    document.getElementById('inline_photo').style.display = 'block';
}

function hidePhoto()
{
	document.getElementById('inline_photo').style.display = 'none';
    document.getElementById('inline_photo').innerHTML = '';
}