var isDOM=(document.getElementById)?true:false;
var isMSIE=(document.all)?true:false;

function getElement(arg) {
  if (isDOM) { return(document.getElementById(arg)); }
  else if (isMSIE) { return(document.all[arg]); }
  else { return(false); }
}

function canDelete(url) {
   if (confirm("Opravdu si přejete provést požadovanou akci?")) {
      location.href=url;
   }
}

function validateSearchForm (theForm) {
  if (theForm.q.value =="") {
    alert("Je nutné zadat hledaný výraz...");
    theForm.q.focus();
    return(false);
  }
  return(true);
}

function respond(id_inz) {
 window.open("/rubriky/respond.php?id="+id_inz,"response","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=700,left=50,top=50");
}

function checkmail(arg){
  if (!/^[a-zA-Z0-9\.\-_]+@+[a-zA-Z0-9\.\-_]+\.\w{2,4}/.test(arg.value)) {
    alert("Nesprávně zadaná e-mailová adresa!");
    arg.focus();
    return (false);
  }
  return (true);
}

function getCheckedRadioValue(radio) {
  for (var i=0; i < radio.length; i++) {
   if (radio[i].checked) {return radio[i].value};
  }
  return -1;
}

function createFlashObject(src,width,height){

 var embed = document.createElement('embed');
 embed.setAttribute('width',width);
 embed.setAttribute('height',height);
 embed.setAttribute('src',src);
 embed.setAttribute('type','application/x-shockwave-flash');
 embed.setAttribute('allowScriptAccess','always');
 embed.setAttribute('movie',src);
 embed.setAttribute('quality','high');
 embed.setAttribute('bgcolor','#FFFFFF');

 var div = getElement('flashobject');
 var holder = getElement('flashholder');
 holder.replaceChild(embed,div);

}


