/* validate email address*/
function CheckName(Prvek) {
 var Reg = /^[a-zA-Zpří‘erněžluťoučkýkůňpělďábelskéódyPŘÍŠERNĚŽLUŤOUČKÝKŮŇPĚLĎÁBELSKÉÓDY]*$/;
 var Patt = Prvek;
 
 if (Reg.test(Patt))
  {
   return true;
  }
 else
  {
   return false;
  } 
}

function CheckPhone(Prvek) {
 var Reg = /^\d{9}$/;
 var Patt = Prvek;
 
 if (Reg.test(Patt))
  {
   return true;
  }
 else
  {
   return false;
  } 
}


function CheckPSC(Prvek) {
 var Reg = /^[0-9]{3} ?[0-9]{2}$/;
 var Patt = Prvek;
 
 if (Reg.test(Patt))
  {
   return true;
  }
 else
  {
   return false;
  } 
}


function CheckCP(Prvek) {

 var Reg = /^([0-9]{1,8})([-,/]{0,1})([a-zA-Z]{0,1})$/;
 var Patt = Prvek;
 
 if (Reg.test(Patt))
  {
   return true;
  }
 else
  {
   return false;
  } 
}


function isValidEmail(strValue)
{
  
  if (!strValue.match("^([0-9a-zA-Z-]+)([._-]([0-9a-zA-Z-]+))*[@]([0-9a-zA-Z]+)([._-]([0-9a-zA-Z]+))*[.]([a-zA-Z]){2,4}$")) 
  {
  		return false;
	}
	else{
		return true;
	}
  
  prazdne += "základní údaje - e-mail, neexistující e-mail\n";
  
  //1.must have 5 chars
  /*
  var blnLength = false;
  if (strValue.length >= 5){
	blnLength = true;
  }
  var strVLength = strValue.length;

  //2.must have '@' sign in str
  var blnAt = false;
  for (var x = 0; x < strVLength; x++)
  {
    if (strValue.charAt(x) == "@"){
	blnAt = true;
    }
  }

  //3. must have a period after the at but not first and last character
  var isAt = strValue.indexOf("@");
  var afterAt = strValue.substr(isAt + 1);
  var blnPeriod = false;
			    
  // make sure string exists
  if (afterAt.length > 0){
	if ((afterAt.charAt(0) == ".")||		
	    (afterAt.charAt(afterAt.length-1) == ".")){
	    	blnPeriod = false;
	    }
		//if string is greater than 2 
		//(else previous if statement would have assigned a value to blnPeriod)
						
		if (afterAt.length > 2){
			for (var x = 1; x < afterAt.length-1; x++){
				if (afterAt.charAt(x) == "."){
					blnPeriod = true;
				}
			}
		}				
	}
			 
			
	if ( (blnAt) && (blnPeriod) && (blnLength) ){
		return true;
	}
	else{
		return false;
	}
	*/		 
}


function isValidTelNew(strValue)
{
	
	var reg = new RegExp("/^\d{9}$/");
	
	if (reg.test(strValue))
	{
   return true;
	}
	else{
		return false;
	}
	
}


function isValidTel(strValue)
{
	var strInteger;
	var re = /\*|\)|\(|\-|\s/;

	strInteger = strValue.split(re).join("");
	strInteger;
	
	if  (isNaN(strInteger) || (strInteger.length <= 0)){
		return false;
	}
	else{
		return true;
	}
}


function isValidPostcode(strPostcode){
   // Postcode must be of the form <char>[<char>]*<digit><char><char>
   if ((strPostcode.length == 0) || (strPostcode.replace(" ", "").match(/^[A-Z]{1,2}([A-Z]|\d){1,3}\d{1}[A-Z]{2}$/i) == null)){
        return false;
   }
   else{
   	return true;
   }
}


function isValidName(strValue)
{
	var strInteger;
	var re = /\*|\)|\(|\-|\s/;

	strInteger = strValue.split(re).join("");
	strInteger;
	
	if  (isNaN(strInteger) || (strInteger.length <= 0)){
		return false;
	}
	else{
		return true;
	}
}






// **********************************************
// used to restrict length of entry in text areas
// **********************************************
function checkLength(objTextarea){
	var strText
	
	strText=new String(objTextarea.value);
	
	if((strText.length)>254){
		objTextarea.blur();
	}
}




function radiocheck(objRadio){
	var blnChecked = false

	for(i = 0; i < (objRadio.length); i++){
		if(objRadio[i].checked){
			blnChecked = true;
		}
	}
	if(blnChecked){
		return true;
	}
	else{
		return false;
	}
}







