//subor funkcii pre zima VRATNA.SK
//<script type="text/javascript" language="JavaScript">


function predaj_kontrola(form){

refno1 =/^[0-9]+$/; //aspon jedno cislo
refno =/^[0-9]*$/;

if(form.meno.value == "" ){
	alert("Nezadali ste meno /Name is missing/");
	form.meno.focus();
	return false;
} else if( (form.kto[1].checked == true) && form.firma.value == "" ) {
  alert("Nezadali ste meno spoločnosti /Company name is missing/");
	form.firma.focus();
	return false;

} else if(form.ulica.value == "" ){
	alert("Nezadali ste ulicu /Street is missing/");
	form.ulica.focus();
	return false;
}else if(form.mesto.value == "" ){
	alert("Nezadali ste mesto /City is missing/");
	form.mesto.focus();
	return false;
}else if(!refno1.test(form.psc.value) ){
	alert("Nezadali ste PSČ /ZIP code is missing/");
	form.psc.focus();
	return false;
}else if (form.email.value == "" || form.email.value.indexOf('@')== -1 || form.email.value.indexOf('.')== -1){
	alert("Nezadali ste emailovú adresu /Email address is missing/");
	form.email.focus();
	return false;

}else if(form.tel.value == ""){
	alert("Nezadali ste telefonický kontakt /Phone is missing/");
	form.tel.focus();
	return false;
} else if( (form.kto[1].checked == true) && form.ico.value == "" ) {
  alert("Nezadali ste meno IČO");
	form.firma.focus();
	return false;	
} else if( (form.kto[1].checked == true) && form.dico.value == "" ) {
  alert("Nezadali ste meno DIČO");
	form.firma.focus();
	return false;	
	
}else if(form.suhlas.value == "false" ){
	alert("Bez súhlasu nemôžete zadať inzerát");
	form.suhlas.focus();
	return false;
			
}

else {

var suhlas;
var dodavka1;
var odberatel;
if(form.suhlas.checked == true) suhlas = "Ano, yes";
else suhlas = "Nie, No";
if(form.dodavka[0].checked == true) dodavka1 = "Poštou /Send by post/";
else dodavka1 = "Osobný odber /on site/";
if(form.kto[0].checked == true) odberatel = "FO /Person/";
else odberatel = "PO /Company/";


decision= confirm(
"Sú tieto údaje správne?" + " " +
"Are these information right?" + "\n" +
"---------------------------------------------------------" + "\n" +
"Súhlas s obch. podmienkami:\t" + suhlas + "\n\n" +
"Odberateľ (Customer):\t" + odberatel + "\n" +
"Meno (Name):\t" + form.meno.value + "\n" +
"Ulica (Street):\t" + form.ulica.value + "\n" +
"Mesto (City):\t" + form.mesto.value + ", " + "PSC (ZIP code):\t" + form.psc.value + "\n" +
"Telefon (Phone):\t" + form.tel.value + "\n" +
"Email:\t\t\t" + form.email.value + "\n" +
"---------------------------------------------------------" + "\n" +
"Obch.meno spoločnosti (Company):\t" + form.firma.value + "\n" +
"IČO:\t\t\t" + form.ico.value + "\n" +
"DIČO:\t\t" + form.dico.value + "\n" +
"---------------------------------------------------------" + "\n" +
"Spôsob odberu (Taking-in):\t" + dodavka1 + "\n" +
"Poznámka (Notice):\t" + form.poznamka.value + "\n"
);

if (!decision	) { return false;}
else {form.submit();}
}

}
//</script>


function red(url) {// Re-direct the browser to the url value
	window.location.href =  url 
}

function ViewImage(ifile,ix,iy,ititle) {
  var win;
  win = window.open("","imageviewer","width="+ix+",height="+iy+", scrollbars=1, menubar=no,toolbar=no, resizable=1");
  win.document.open();
  win.resizeTo(ix+25,iy+43); //kvoli oknu a liste v nom
  win.document.write("<html><head><title>"+ititle+"</title>");
  win.document.write("</head><body>");
  win.document.write('<span style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
  win.document.write("<img src="+ifile+" width="+ix+" height="+iy+"></span></body></html>");
  win.focus();
  win.document.close();
}



function otvor( file, okno, w,h ) {
  var wi;
  w+=23; h+=33;
  wi = window.open(file,okno,'height='+h+',width='+w+',scrollbars=yes, menubar=yes, toolbar=no,resizable=yes');
  wi.focus();
  //win.document.open();
}



//function otvor1( file,okno,w,h ) {
//w+=23; h+=33;
//var z;
// window.open(file,okno,'height='+h+',width='+w+',toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes, resizable=no');
//z.focus();
//win.document.open();
//}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


