var Hledat = new Array();
Hledat[Hledat.length] = new Array("searchstring", "value.length > 2", "The string must be at least 3 characters long!");

var Tracing = new Array();
Tracing[Tracing.length] = new Array("awbpre", "parseInt(value,10) != 'NaN' && value > 0", "Invalid AWB number!");
Tracing[Tracing.length] = new Array("awbnum", "parseInt(value,10) != 'NaN' && value > 0", "Invalid AWB number!");

var Schedule = new Array();
Schedule[Schedule.length] = new Array("from", "value > '' && value.length==3 && testChars(value)","Invalid Airport of Origin! Must be 3 characters!");
Schedule[Schedule.length] = new Array("to", "value > '' && value.length==3 && testChars(value)","Invalid Airport of Destination! Must be 3 characters!");
Schedule[Schedule.length] = new Array("earlyday", "parseInt(value,10) != 'NaN' && value > '' && value.length == 2","Invalid day of departure! Must be 2 digits!");
Schedule[Schedule.length] = new Array("earlymonth", "value > '' && value.length == 3 && testChars(value)","Invalid month of departure! Must be 3 characters!");

function testChars(value) {
    ret = true;
    for(i=0; i<3; i++) {
       if(!isNaN(parseInt(new String(value.charAt(i)),10))) {
           ret = false;
           break;
       }
    }
    return ret;
}
var stringDep = 'Departure date';

//univerzal funkce pro otevreni formulare do noveho okna
var wIndou52;
function goLocation(href,formular,width,height,scroll,left,top) {
    var x
    var para = "";
    if(wIndou52 && ! wIndou52.closed) wIndou52.close();

    if(!width) width=640;
    if(!height) height=480;
    if(!scroll) scroll='no';
    else scroll='yes';
    if(!left) left=Math.floor((screen.width-10-width)/2);
    if(!top) top=Math.floor((screen.height-30-height)/2);
    if (formular != "") {
        x = eval("document."+formular+".length");
        for(i=0;i<x;i++) {
            para = para + eval("document."+formular+".elements["+i+"].name") + "=" + eval("document."+formular+".elements["+i+"].value") + "&";
        }
        href = href + "?" + para;
    }
    wIndou52 = window.open(href, "wIndou"+Math.floor(Math.random()*1000), "resizable=yes,toolbar=no,location=no,scrollbars="+scroll+",width="+width+",height="+height+",left="+left+",top="+top);
    if (wIndou52) wIndou52.focus();
}

function changeActionForm(num) {
    var frm = document.forms['Schedule'];
    var el;
    eval('el = frm.action'+num+';');
    if (el) frm.action = el.value;
}