// euro2007.ktklm.sk
function reloadImage() {
   img = document.getElementById('theimage');
   img.src = 'http://213.215.80.5/wktkcam/ktkavs.jpg?' + Math.random();
 }


function webcam1() {
  var myString = 'http://www.euro2007.ktklm.sk/pages/webcam.php?idf=1'; 
//  alert(obrazok); 
	myWindow = window.open( myString,"a","toolbar=0,location=0, directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=640, height=500"); 
	//myWindow.location = "http://www.mikulas.sk/webcam.php"; 
	myWindow.focus();
} 


function kontrola_inzercia(form){
refno1 =/^[0-9]+$/; //aspon jedno cislo
refno =/^[0-9]*$/;
//zipcode =/^[0-9]{3} [0-9]{2}$/;

if(form.text.value == "" ){
	alert("Nezadali ste text inzerátu");
	form.text.focus();
	return false;
}else if(form.meno.value == "" ){
	alert("Nezadali ste  meno");
	form.meno.focus();
	return false;
}else if(form.priezvisko.value == "" ){
	alert("Nezadali ste  priezvisko");
	form.priezvisko.focus();
	return false;
}else if(form.adresa.value == "" ){
	alert("Nezadali ste  adresu");
	form.adresa.focus();
	return false;
}else if(form.mesto.value == "" ){
	alert("Nezadali ste  mesto");
	form.mesto.focus();
	return false;
} else if(!refno1.test(form.psc.value) ) {
	alert ("Nezadali ste psc alebo má zlý formát");
	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");
	form.email.focus();
	return false;
}else if(!refno1.test(form.tel.value) ){
	alert("Nezadali ste telefonický kontakt alebo má zlý formát /xxx xx/");
	form.tel.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 typ;
if(form.typ.value == '1') typ = "1- Kúpa/Hľadám";
else typ = "2 - Predaj/Ponuka";

var suhlas;
if(form.suhlas.checked == true) suhlas = "Áno";
else suhlas = "Nie";

decision= confirm("S tieto údaje správne?\n\n" +
"Súhlas s podmienkami:\t" + suhlas + "\n\n" +
"Meno:\t" + form.meno.value + " " +  form.priezvisko.value + "\n" + 
"Adresa:\t" + form.adresa.value + "\n" + 
"Mesto:\t" + form.mesto.value + " " + form.psc.value + "\n" +
"Email:\t\t" + form.email.value + "\n" + 
"Telefon:\t" + form.tel.value + "\n\n" +
"Typ:\t\t" + typ + "\n" +
"Trvanie:\t" + form.trvanie.value + "\n" +
"Rubrika:\t" + form.rubrika.value + "\n" +
"Text:\t\t" + form.text.value + "\n"
);

if (!decision	) { return false;}
else {form.submit();}
}

}




function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('Dosiahli ste hraničnú dĺžku.\nĽutujeme nemôžete viac vložiť.');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
}





function ViewImage(ifile,ix,iy,ititle) {
var win;
win = window.open("","imageviewer","width="+ix+",height="+iy+", scrollbars=0, menubar=no,toolbar=no,resizable=yes");
win.document.open();
win.resizeTo(ix+13,iy+33); // 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 view2(ifile,ix,iy,ititle) {
var win;
win = window.open("","imageviewer","width="+ix+",height="+iy+", scrollbars=0, menubar=no,toolbar=no,resizable=yes");
win.document.open();
win.resizeTo(ix+13,iy+33); // 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 cam(ifile,ix,iy,ititle) {
var win;
win = window.open("","imageviewer","width="+ix+",height="+iy+", scrollbars=0, menubar=no,toolbar=no");
win.document.open();
win.resizeTo(ix+13,iy); // kvoli oknu a liste v nom
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("<meta http-equiv='refresh' content='60'></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 webcam() { 
myWindow = window.open("./pages/webcam.php","a","toolbar=0,location=0," +
"directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=640, height=485"); 
//myWindow.location = "http://www.mikulas.sk/webcam.php"; 
myWindow.focus();
} 

//function fetch(url) { 
//rootWin.location = url; 
//}




function pop1(page, okno, w, h) { 
w+=45;
h+=20;
w=window.open(page, okno, "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+", left=20, top=130"); 
if (window.focus) {w.focus()}
} 



/* funkcia pre mapku mesta 
*/
var w;
function otvor( file,okno,w,h ) {
//w+=23; h+=33;
w = window.open(file,okno,'height='+h+',width='+w+',scrollbars=0, menubar=no, toolbar=no');
if (window.focus) {w.focus()}
//win.document.open();
}
//  End -->
