var Hledat = new Array();
Hledat[Hledat.length] = new Array("searchstring", "value.length > 2", "The string must be at least 3 characters long!");

var okplusKonto = new Array();
okplusKonto[okplusKonto.length] = new Array("csano", "value > ''", "Please enter a valid Membership Number!");
okplusKonto[okplusKonto.length] = new Array("csano", "isValidCSAno(value)", "Please enter a valid Membership Number!");
okplusKonto[okplusKonto.length] = new Array("sitano_pom", "value.length >= 5", "Please enter a valid PIN!");
okplusKonto[okplusKonto.length] = new Array("sitano_pom", "value.length <= 10", "Please enter a valid PIN!");

var okplusCorp = new Array();
okplusCorp[okplusCorp.length] = new Array("login", "value > ''", "Please enter a Corporate number!");
okplusCorp[okplusCorp.length] = new Array("pwd_pom", "value > ''", "Please enter a Password!");
okplusCorp[okplusCorp.length] = new Array("language", "value > ''", "Please choose your language!");

var checkmytrip = new Array();
checkmytrip[checkmytrip.length] = new Array("name", "value > ''", "Please enter Passenger`s surname!");
checkmytrip[checkmytrip.length] = new Array("locator", "value > ''", "Please enter a Booking locator!");

/*var internetCheckin = new Array();
internetCheckin[internetCheckin.length] = new Array("identNumber", "value > ''", "Please enter a E-ticket number!");
internetCheckin[internetCheckin.length] = new Array("identFlightNumber", "value > ''", "Please enter a Flight number!");*/

var regTicketNumber = new RegExp("^[0-9]{13,14}$");
var regFlightCode = new RegExp("^[A-Z]{2}$");
var regFlightNumber = new RegExp("^[0-9]{2,4}$");

var internetCheckin = new Array();
internetCheckin[internetCheckin.length] = new Array("ticketNumber", "regTicketNumber.test(value)", "Please enter a E-ticket number!");
internetCheckin[internetCheckin.length] = new Array("flightCode", "testFlightCode()", "Please enter a Flight number!");
internetCheckin[internetCheckin.length] = new Array("flightNumber", "regFlightNumber.test(value)", "Please enter a Flight number!");

function testFlightCode() {
    var flightCode = jQ("select[@name = 'flightCode']").val();
    if(regFlightCode.test(flightCode)) return true;
    else return false;
}

var kibslogin = new Array();
kibslogin[kibslogin.length] = new Array("login", "value > ''", "Please enter an Event name!");
kibslogin[kibslogin.length] = new Array("password", "value > ''", "Please enter an Event code!");

//Exbag
var login_excess_baggage = new Array();
login_excess_baggage[login_excess_baggage.length] = new Array("locator", "value > ''", "Please enter a Booking locator!");
login_excess_baggage[login_excess_baggage.length] = new Array("passenger_surname", "value > ''", "Please enter Passenger`s surname!");
login_excess_baggage[login_excess_baggage.length] = new Array("passenger_name", "value > ''", "Please fill the First Name field!");

/**
* Funkce pro zmenu action na formulari login do FBP
*/
function changeActionFBP() {
    var frm = document.forms['okplusCorp'];
    var actionStart = frm.actionStart.value;
    var actionEnd = frm.actionEnd.value;
    var choosenLng = frm.language.options[frm.language.selectedIndex].value;
    frm.action = actionStart+choosenLng+actionEnd;
}

function zmenZalozku(name, prefix){
	var obj_body, obj_butA, obj_butP;
	var active = '';
	eval('active = '+prefix+'Active;');
	if (active != name) {
        try {
            obj_butA = document.getElementById(prefix+'A_'+active);
            obj_butP = document.getElementById(prefix+'P_'+active);
            obj_body = document.getElementById(prefix+'Body_'+active);
            obj_butA.style.display = 'none';
            obj_butP.style.display = 'block';
            obj_body.style.display = 'none';
            obj_butA = document.getElementById(prefix+'A_'+name);
            obj_butP = document.getElementById(prefix+'P_'+name);
            obj_body = document.getElementById(prefix+'Body_'+name);
            obj_butA.style.display = 'block';
            obj_butP.style.display = 'none';
            obj_body.style.display = 'block';
            eval(prefix+"Active = '"+name+"';");
            //mn_init();
        } catch(eException) {}
	}
}

function tickethotel(link, target) {
    //alert(target+'<<<<'+link);
    frames[target].location.href = link;
}

/// vanocni Pf ///
var jQ = jQuery.noConflict();
function pf2009close(){
    jQ('#pf_iframe').hide();
    jQ('#hp_box_levy').show();
    jQ('#hp_box_pravy_obal').show();
}

/*jQ(document).ready(function(){
  jQ('#hp_box_levy').hide();
  jQ('#hp_box_pravy_obal').hide();
});
*/

/**
 * Volani AJAX - specialni nabidky
 */
function callSpecialOffers(url, zastoupeni, isBoardLink) {
  jQ.ajax({
   type: "GET",
   async: true,
   url: url,
   data: 'zastoupeni='+zastoupeni+'&boardLink='+isBoardLink,
   dataType: "xml",
   success: function(dgData){
   		xmlData = dgData;
   		drawSpecialOffersHtml(isBoardLink);
    } ,
   error: function(xmlObject, errorMsg, exception) { 
    //alert('AJAX error');
   } 
 });
}

function drawSpecialOffersHtml(isBoardLink) {
    var item, aProduct;
    var sToOptgr;
    if (!xmlData) return;
    
    var htmlSpecialOffers = jQ(xmlData).find('page');
    jQ("#specialOfferWaiting").hide();
    jQ("#specialOfferAjaxTarget").append( htmlSpecialOffers.text() );
    
    //je nastaven board link ve vlastnostech dokumentu a je ulozen v property - specialframe/specialoffer
    if(isBoardLink == 'true') {
        jQ("#board_link_combo_filter").removeAttr('action');
        jQ("#board_link_combo_filter").attr('action', boardLink);
        
        jQ("#board_link_all_offers").removeAttr('href');
        jQ("#board_link_all_offers").attr('href', boardLink);    
    }
        
    return true;
}