/*******************************************************************************
DHTML knihovna
==============
Version:	1.1 (9.6.2004)
*******************************************************************************/

var jsDOM0 = (document.all);
var jsDOM1 = (document.getElementById);
var jsDOM = jsDOM0 || jsDOM1;
var jsDebug = 0;

function getObj (name) {
    if (typeof name == "object") return name;
    if (jsDOM1) return document.getElementById(name);
    if (jsDOM0) return eval('document.all.'+name);
    else return null;
    }

function objSetStyle (obj, prop, val) {
    var o = objGet(obj);
    if (o && o.style) {
	eval ('o.style.'+prop+'="'+val+'"');
	return true;
    }
    else return false;
}

function objShow (obj, on) {
    return objSetStyle(obj, 'visibility', (on) ? 'visible':'hidden');
}

function objDisplay (obj, on, type) {
    if (on && !type) type = 'block';
    return objSetStyle(obj, 'display', (on) ? type: 'none');
}


function imagepopup(p,x,y) {
photopop = window.open('../../../imagepopup.php?photo='+p,'photopop','resizable=0,status=0,menubar=0,toolbar=0,top=50,left=150,scrollbars=0,location=0,directories=0,width='+x+',height='+y);
photopop.focus();
}

function imagepopup2(p,x,y,pozn,titulek) {
photopop = window.open('imagepopup.php?photo='+p+'&titulek='+titulek+'&poznamka='+pozn,'photopop','resizable=0,status=0,menubar=0,toolbar=0,top=0,left=0,scrollbars=0,location=0,directories=0,width='+x+',height='+y);
photopop.focus();
}

function prihlaseni() {
photopop = window.open('http://www.peacecafe.cz/prihlaseni.html','photopop','resizable=1,top=50,left=50,status=1,menubar=1,toolbar=1,scrollbars=1,location=1,directories=0,width=910,height=500');
photopop.focus();
}

function newwin(p,x,y) {
newwinpop = window.open('index.php?Mode=4&popup='+p,'newwinpop','resizable=0,status=0,menubar=0,toolbar=0,scrollbars=0,location=0,directories=0,width='+x+',height='+y);
newwinpop.focus();
}

function validContactForm() {
errText = "Pro odeslání formuláře musíte vyplnit:\n\n";
errFlag = false;

if(getObj('name').value == "") {
  errFlag = true;
  errText = errText + "Jméno\n";
}

if(getObj('street').value == "") {
	errFlag = true;
	errText = errText + "Ulici\n";
}

if(getObj('city').value == "") {
	errFlag = true;
	errText = errText + "Město\n";
}

if(getObj('phone').value == "") {
	if(getObj('email').value == "") {
   errFlag = true;
	 errText = errText + "Telefon nebo e-mail\n";
	}
}

if(errFlag) {
	alert(errText);
	return false;
} else {
	return true;
}
}

function validSearchForm(form) {
 if (form.search.value == "Hledej zboží") {
   alert ("Zadejte výraz ke hledání!");
   return (false);
 }
}

function validObjForm(form) {
 if (form.obj.value == "") {
   alert ("Zadejte emailovou adresu!");
   return (false);
 }
 else
 {
   inp=form.obj.value;
   mail=/^.+@.+\..{2,4}$/
   if (mail.test(inp)==false) {
     window.alert("Nesprávný tvar emailové adresy!");
   return (false);
   }
 }
}

function updatePayments() {
    var url = baseRSPath+'/ajax.php';
    var params = 'task=paymentOptions&shipping=' + $F('shipping');
    var ajax = new Ajax.Updater(
	{success: 'payment'},
	url,
	{method: 'get', parameters: params});
}

function popupOdkazy() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("pop")) {
      links[i].onclick = function() { return !window.open(this.href); }
    }
  }  return true;
}
window.onload = popupOdkazy;
