window.onload = function(){$('show').hide();}
window.onload = function(){$('llenartodo').hide();}

function sendRequest() {
	var typeValue = document.getElementById("subject");
	var n = typeValue.selectedIndex;
	var txt = typeValue[n].text;
	var val = typeValue[n].value;
	
        if($F('email').strip() == '' || $F('name').strip() == '' || $F('message').strip() == ''){
              $('llenartodo').show();
              return false;
        }else{
              $('llenartodo').hide();
        }
         
       
	new Ajax.Request('modules/contacto/sendmail.php', 
	{ 
    	method: 'post', 
        postBody: 'email='+ $F('email') + '&name='+ $F('name') + '&subject='+ txt + '&to='+ val + '&message='+ $F('message'),
        onCreate: function (){
        	$('email_form').hide();
        	$('show').show();
        	$('show').innerHTML= '<div style="background:url(theme/images/Loading.gif) center no-repeat; height:450px">&nbsp;</div>';
        },
        onComplete: function (req){
        	$('show').show();
    		$('show').innerHTML = req.responseText;
    	} 
        });
       
}

function back(){
	$('name').value = "";
	$('message').value = "";
	$('email').value = "";
	
	var typeValue = document.getElementById("subject");
	typeValue.selectedIndex = 0;
	
	$('email_form').show();
	$('show').hide();
}
