<!--
function form_validate(is_resume)
{
	//return true; // DEBUG

	error_string = "";
	
	ee = document.ad_form.elements;

	if (ee["result[p_title]"].value == "" || !check_space(ee["result[p_title]"])){
		error_string += " The title is not filled. \n";
	}
	if (ee["result[p_email]"].value == "" || !check_space(ee["result[p_email]"])){
		error_string += " The email is not filled.\n";
	}
    if (ee["result[p_email]"].value != ee["result[p_email2]"].value){
		error_string += " Check email spelling: two e-mails differ  \n";
	}
	
    if (!is_resume){
        if (ee["result[p_desc]"].value == "" || !check_space(ee["result[p_desc]"])){
			error_string += " The ad description is not filled. \n";
		}
        if (ee["result[p_compens]"].value == "" || !check_space(ee["result[p_compens]"])){
			error_string += " The compensation value is not set.\n";
		}
	}
	else{
		if (ee["result[p_spec_location]"].value == "" || !check_space(ee["result[p_spec_location]"])){
			error_string += " The value for Specific Location is not set.\n";
		}
	}

    if (error_string != ""){
    	alert("Errors:\n"+error_string);
    	return false;
    }
    else{
    	return true;
    }
}

// a function to check spaces
function check_space(ctrlvar)
{
   chkstr     = ctrlvar.value
   stlength   = chkstr.length
   spacecount = 0
   if (stlength >0)
   {
     for(i=0;i<=stlength;i++)
     {
       if ( chkstr.charAt(i)==" ")
       {
       		spacecount++;
       }
     }
     if (stlength == spacecount)
     	{
     		return false
     	}
   return true
   }
}

function set_area()
{
	h = "post_ad.php?sec_id="+document.post_form.sec_id.value;
    h += "&theme_id="+document.post_form.theme_id.value;
    h += "&area_id="+document.post_form.area_id.value;
	top.location.href=h;
	return true;
}

function fill_form(formname)
{
	ff = document.forms[formname];
	
	r = Math.floor(Math.random()*10000);
	//alert(r);
	
	for (i=0; i<ff.elements.length; i++){
        o = ff.elements[i];
        tt = o.type;
        //alert(tt);
        if (tt=="text" ){
            o.value = "test_"+r;
        }
        if (tt=="textarea" ){
            o.innerText = "test_"+r;
        }
        if (tt=="password"){
        	o.value="123456";
        }
        
        // emails
        if (o.name=="result[email]" ){
        	o.value="temp@site.com";
        }
        if (o.name=="result[phone_code]" || o.name=="result[fax_code]" || o.name=="result[mobilephone_code]"){
        	o.value="057";
        }
        if (o.name=="result[phone_number]" || o.name=="result[fax_number]" || o.name=="result[mobilephone_number]"){
        	o.value="1234567";
        }
       
    }
    return;		
}

-->