
function validate_wills() {

if ( document.getElementById('your_name_wills').value.length < 2 ) {
    alert("Please provide a real name");
    return false;
    }

if (document.forms[0].your_email_wills.value.indexOf('@')==-1  || document.forms[0].your_email_wills.value.indexOf('.')==-1  || document.forms[0].your_email_wills.value.length <= 7 )
    {
    alert("Please provide your email");
    return false;
    }


if (document.getElementById("questions_wills").value.length < 5 )	{
    alert("Please write a message ");
    return false;
    }
}



function validate_properties() {

if ( document.getElementById('your_name_properties').value.length < 2 ) {
    alert("Please provide a real name");
    return false;
    }

if (document.forms[1].your_email_properties.value.indexOf('@')==-1  || document.forms[1].your_email_properties.value.indexOf('.')==-1  || document.forms[1].your_email_properties.value.length <= 7 )
    {
    alert("Please provide your email");
    return false;
    }


if (document.getElementById("questions_properties").value.length < 5 )	{
    alert("Please write a message ");
    return false;
    }
}



function request( id ) {
show('loading');
req_dev('d');
}

function change_search( id) {
show('loading');

document.getElementById('curr').innerHTML='';



if ( id == 'development') {
	document.getElementById('tp').value='d';

	req_country('d');
	}

else	{
	document.getElementById('tp').value='r';
var man = document.getElementById('region');
man.innerHTML='';
man.options[0] = new Option('Any', '0');

	req_country('r')
	}

}
 


function req_currency(id,tp) {
var url = "get_currency.php?id="+id+"&tp="+tp;
	if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	
	{
		req = new XMLHttpRequest();
	}

if (req) {
        req.onreadystatechange = function() 
	{
        
	if (req.readyState == 4) 
	{
            var a  = req.responseText;

document.getElementById('curr').innerHTML=a;
hide('loading');


	}
 
       } ;
    	req.open("POST", url, true);
  	req.send("");

    }





}


function req_country(tp) {

if ( tp == 'd')
	var url="dev_country.php";
else if ( tp == 'r')
	var url="res_country.php";



	if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	
	{
		req = new XMLHttpRequest();
	}

if (req) {
        req.onreadystatechange = function() 
	{
        
	if (req.readyState == 4) 
	{
            var a  = req.responseText;

document.getElementById('country').innerHTML='';
var list = a.split('\n');
var man = document.getElementById('country');
	man.options[0] = new Option('ALL', '0');

for ( i=0;i<list.length-1;i++) {
		var txt = (list[i].split('||'))[1];
		var val = (list[i].split('||'))[0];
		man.options[i+1] = new Option(txt, val);
		}
man.selectedIndex = 0;	
hide('loading');


	}
 
       } ;
    	req.open("POST", url, true);
  	req.send("");

    }



}









function req_region(id,tp) {
show('loading');
if ( tp == 'd')
	var url="dev_region.php?id="+id;
else if ( tp == 'r')
	var url="res_region.php?id="+id;



	if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	
	{
		req = new XMLHttpRequest();
	}

if (req) {
        req.onreadystatechange = function() 
	{
        
	if (req.readyState == 4) 
	{
            var a  = req.responseText;

document.getElementById('region').innerHTML='';
var list = a.split('\n');
var man = document.getElementById('region');
	man.options[0] = new Option('Any', '0');



for ( i=0;i<( list.length-1 ) ;i++) {
		var txt = (list[i].split('||'))[1];
		var val = (list[i].split('||'))[0];
		man.options[i+1] = new Option(txt, val);
		}
man.selectedIndex = 0;	
hide('loading');

req_currency(id,tp);
	}
 
       } ;
    	req.open("POST", url, true);
  	req.send("");

    }



}





function show(id) {
    document.getElementById(id).style.display='block';
}
function hide(id) {
    document.getElementById(id).style.display='none';
}





