function nyit(tartalom,x,y) {
z=window.open(tartalom,"popupablak","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+(x)+",height="+(y));
z.moveTo(screen.width/2-(x/2),screen.height/2-(y/2));
}
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_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_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];}
}

function evalTrip() {
    if (document.afpForm.triptype.selectedIndex ==2) {
	
	window.location.href = window.location.href = "http://www.travelstoremaker.com/cgit/porch?agentid=morton&command=multiflights&do_multiprefs=yes&leg1fromcity="+document.afpForm.fromcity.value+"&leg1tocity="+document.afpForm.tocity.value;    
    } else if (document.afpForm.triptype.selectedIndex ==0) {
        document.afpForm.retmonth.disabled = true;
	document.afpForm.retday.disabled = true;
        document.afpForm.rethour.disabled = true;
   } else if (document.afpForm.triptype.selectedIndex ==1) {
        document.afpForm.retmonth.disabled = false;
        document.afpForm.retday.disabled = false;
        document.afpForm.rethour.disabled = false;
   }
}

function set_date() {
	var outday=document.afpForm.outday.selectedIndex;
	var outmonth=document.afpForm.outmonth.selectedIndex;
	var calendar=new Date();
	var advpurchase=1+2;
	calendar.setDate(calendar.getDate()+advpurchase);
	document.afpForm.outday.selectedIndex=calendar.getDate()-1;
	document.afpForm.outmonth.selectedIndex=calendar.getMonth();
	calendar.setDate(calendar.getDate()+7);
	document.afpForm.retday.selectedIndex=calendar.getDate()-1;
	document.afpForm.retmonth.selectedIndex=calendar.getMonth();
}
function progress() {
document.afpForm.action="http://www.travelstoremaker.com/cgit/runhttl";
document.afpForm.method="get";
document.afpForm.submit();
return false;
}

function newPopup(winLink, winName, winWidth, winHeight, scrollbar, resizable) {
if (scrollbar) { scrollbar = ',scrollbars'; };
if (resizable) { resizable = ',resizable'; };
var winX = (window.screen.width / 2) - (winWidth / 2);
var winY = (window.screen.height / 2) - (winHeight / 2) - 25;
popup=window.open("", winName, "width="+winWidth+" ,height="+winHeight+resizable+scrollbar+",left="+winX+",top="+winY);
popup.document.location = winLink;
popup.self.focus();
};

function pic_open(data)
{
window.open ('main/foto_big.php?id='+data+'', 'newwin', 'width=500, height=555, top=0, left=0');
}

function pic_replace(data,text,data2,data3)
{
    document.getElementById('fenykep').src = data;
	document.getElementById("galeria_szov").innerHTML = text;	
    document.getElementById('kep_1para').href = data2;
    document.getElementById('kep_2para').href = data3;
//    document.getElementById('nagyit_para').href = "JavaScript:nyit('" + data2 + "')";
}

function pic_replace_linkel(data, data2)
{
    document.getElementById('fenykep').src = data;
    document.getElementById('kep_para').href = "JavaScript:nyit('" + data2 + "')";
    document.getElementById('nagyit_para').href = "JavaScript:nyit('" + data2 + "')";
}

function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789-/").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}
