// JavaScript Document
function getXimageCoords() {
 var w=(document.body.clientWidth/2)-420;
 document.getElementById("lineImageTitle").style.left=w+"px";
}

function validateMessageForm(frm) {
 re = new RegExp("^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$"); 
 if (frm.elements["email"].value=="") {
  alert(errTextMess[0]+" -"+errTextMess[1]+"-.");
  return false;
 }
 else if (!re.test(frm.elements["email"].value)) { 
  alert(errTextMess[3]+" -"+errTextMess[1]+"-.");
  return false;
  } 
 else if (frm.elements["text"].value=="") {
  alert(errTextMess[0]+" -"+errTextMess[2]+"-.");
  return false;
 }
 return true;
}

function validateContactForm(frm,code) {
 re = new RegExp("^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$"); 
 if (frm.elements["name"].value=="") {
  alert(errText[0]+" -"+errText[1]+"-.");
  return false;
 }
 else if (frm.elements["email"].value=="") {
  alert(errText[0]+" -"+errText[2]+"-.");
  return false;
 }
 else if (frm.elements["topic"].selectedIndex==0) {
  alert(errText[0]+" -"+errText[3]+"-.");
  return false;
 }
 else if (frm.elements["text"].value=="") {
  alert(errText[0]+" -"+errText[4]+"-.");
  return false;
 }
 else if (frm.elements["code"].value=="") {
  alert(errText[0]+" -"+errText[5]+"-.");
  return false;
 }
 else if (!re.test(frm.elements["email"].value)) { 
  alert(errText[6]+" -"+errText[2]+"-.");
  return false;
  } 
 else if (frm.elements["code"].value!=code) {
  alert(errText[6]+" -"+errText[5]+"-.");
  return false;
 }
 return true;
}

function validateNewsForm(frm) {
 re = new RegExp("^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$");
 if (!re.test(frm.elements["date"].value)) {
  alert("Špatně vyplněná položka!\nOpravte, prosím, položku -Datum-.");
  return false;
 }
 else if (frm.elements["date"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Datum-.");
  return false;
 }
 else if (frm.elements["shorttext"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Krátký text-.");
  return false;
 }
 else if (frm.elements["longtext"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Dlouhý text text-.");
  return false;
 }
 return true;
}

function validateProductsForm(frm) {
 var number=frm.elements["rank"].value;
 var number2=frm.elements["type"].value;
 if (frm.elements["company"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Firma-.");
  return false;
 }
 else if (frm.elements["rank"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Pořadí-.");
  return false;
 }
 else if (frm.elements["type"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Pořadí-.");
  return false;
 }
 else if (frm.elements["technology"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Technologie-.");
  return false;
 }
 else if (frm.elements["image"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Obrázek-.");
  return false;
 }
 else if (frm.elements["description"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Popis-.");
  return false;
 }
 else if (isNaN(parseInt(number))) {
  alert("Špatně vyplněná položka!\nOpravte, prosím, položku -Pořadí-.");
  return false;
 }
 else if (isNaN(parseInt(number2))) {
  alert("Špatně vyplněná položka!\nOpravte, prosím, položku -Typ-.");
  return false;
 }
 return true;
}

function validateSoftwareForm(frm) {
 if (frm.elements["title"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Název programu-.");
  return false;
 }
 else if (frm.elements["language"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Programovací jazyk-.");
  return false;
 }
 else if (frm.elements["zipfile"].value=="") {
  alert("Nevyplněná položka!\nVyplňte, prosím, položku -Zip soubor-.");
  return false;
 }
 return true;
}

