//<!--
/*************************** GENERAL INFO ***************************
 Descript.:  Flynet JavaScript Functions - "pole"   
 Copyright:  © Flynet s.r.o., www.flynet.cz. All Rights Reserved. 
 Version ID : 1.2.1.7 / 1.9.2010 22:06:26 / FlynetLAN
*********************************************************************/

function pole(cis, kod, nazev, cena, sdph, sleva, mj, ks_max, ks_step, pop_text,
 obr, prodsearch, vzornik1, barva2, vzornik2, barva3, vzornik3,
 novinka, vpriprave, sklad, hmotnost, zaruka, zar_typ, vyrobce,
 popis_s, obrL, cena2, sdph2, sleva2, mj2, id, ks, vyprodej, vesleve,
 zakaz, uziv1, uziv2, uziv3, objem, eucena, eusdph, vybrano, zobr,
 ean, ean2, poradi, ks2, obrXL, obj_sl, popis, mj_typ, 
 points_rec, points_rec_t, points_give, points_give_t, points_kind, points_type,
 uziv_par, kompot, dat_cena_zm, group_id, kategorie, ipages)
{
 this.length = 64;
 this.id = 0;
 this.cis = 0;
 this.kod = "0";
 this.nazev = "";
 this.eucena = 0;
 this.eusdph = 0;
 this.pcena = 0;
 this.psdph = 0;
 this.cena = 0;
 this.sdph = 0;
 this.sleva = 0;
 this.mj = "";
 this.cena2 = 0;
 this.sdph2 = 0;
 this.sleva2 = 0;
 this.mj2 = "";
 this.ks = 0;
 this.ks2 = 0;
 this.ks_max = 10;
 this.ks_step = 1;
 this.novinka = 0;
 this.vpriprave = 0;
 this.vyprodej = 0;
 this.vesleve = 0;
 this.zakaz = 0;
 this.uziv1 = 0;
 this.uziv2 = 0;
 this.uziv3 = 0;
 this.sklad = "";
 this.hmotnost = 0;
 this.objem = 0;
 this.zaruka = 0;
 this.zar_typ = "";
 this.vyrobce = 0;
 this.obr = "";
 this.obrL = ""
 this.obrXL = "";
 this.popis = "";
 this.pop_text = "";
 this.popis_s = "";
 this.prodsearch = 0;
 this.vzornik1 = 0;
 this.barva2 = "";
 this.vzornik2 = 0;
 this.barva3 = "";
 this.vzornik3 = 0;
 this.vybrano = 0;
 this.zobr = 0;
 this.ean = "";
 this.ean2 = "";
 this.poradi = 0;
 this.obj_sl = 1;
 this.mj_typ = 0;
 this.points_rec = 0;
 this.points_rec_t = "";
 this.points_give = 0;
 this.points_give_t = "";
 this.points_kind = 0;
 this.points_type = "";
 this.uziv_par = new Array();
 this.kompot = new Array();
 this.dat_cena_zm = "";
 this.group_id = "";
 this.kategorie = "";
 this.ipages = new Array();

 if (id != null && typeof id == "number")
  this.id = id;
 if (cis != null && typeof cis == "number")
  this.cis = cis;
 if (kod != null)
  this.kod = kod;
 if (nazev != null)
  this.nazev = nazev;
 if (eucena != null && typeof eucena == "number")
  this.eucena = eucena;
 if (eusdph != null && typeof eusdph == "number")
  this.eusdph = eusdph;
 if (cena != null && typeof cena == "number")
  this.pcena = cena;
 if (sdph != null && typeof sdph == "number")
  this.psdph = sdph;
 if (cena != null && typeof cena == "number")
  this.cena = cena;
 if (sdph != null && typeof sdph == "number")
  this.sdph = sdph;
 if (sleva != null && typeof sleva == "number")
  this.sleva = sleva;
 if (mj != null)
  this.mj = mj;
 if (cena2 != null && typeof cena2 == "number")
  this.cena2 = cena2;
 if (sdph2 != null && typeof sdph2 == "number")
  this.sdph2 = sdph2;
 if (sleva2 != null && typeof sleva2 == "number")
  this.sleva2 = sleva2;
 if (mj2 != null)
  this.mj2 = mj2;
 if (ks != null && typeof ks == "number")
  this.ks = ks;
 if (ks2 != null && typeof ks2 == "number")
  this.ks2 = ks2;
 if (ks_max != null && typeof ks_max == "number")
  this.ks_max = ks_max;
 if (ks_step != null && typeof ks_step == "number")
  this.ks_step = ks_step;
 if (novinka != null && typeof novinka == "number")
  this.novinka = novinka;
 if (vpriprave != null && typeof vpriprave == "number")
  this.vpriprave = vpriprave;
 if (vyprodej != null && typeof vyprodej == "number")
  this.vyprodej = vyprodej;
 if (vesleve != null && typeof vesleve == "number")
  this.vesleve = vesleve;
 if (zakaz != null && typeof zakaz == "number")
  this.zakaz = zakaz;
 if (uziv1 != null && typeof uziv1 == "number")
  this.uziv1 = uziv1;
 if (uziv2 != null && typeof uziv2 == "number")
  this.uziv2 = uziv2;
 if (uziv3 != null && typeof uziv3 == "number")
  this.uziv3 = uziv3;
 if (sklad != null)
  this.sklad = sklad;
 if (hmotnost != null && typeof hmotnost == "number")
  this.hmotnost = hmotnost;
 if (objem != null && typeof objem == "number")
  this.objem = objem;
 if (zaruka != null && typeof zaruka == "number")
  this.zaruka = zaruka;
 if (zar_typ != null)
  this.zar_typ = zar_typ;
 if (vyrobce != null)
  this.vyrobce = vyrobce;
 if (obr != null)
  this.obr = obr;
 if (obrL != null)
  this.obrL = obrL;
 if (obrXL != null)
  this.obrXL = obrXL;
 if (popis != null)
  this.popis = popis;
 if (pop_text != null)
  this.pop_text = pop_text;
 if (popis_s != null)
  this.popis_s = popis_s;
 if (prodsearch != null && typeof prodsearch == "number")
  this.prodsearch = 1;
 if (vzornik1 != null && typeof vzornik1 == "number")
  this.vzornik1 = vzornik1;
 if (barva2 != null)
  this.barva2 = barva2;
 if (vzornik2 != null && typeof vzornik2 == "number")
  this.vzornik2 = vzornik2;
 if (barva3 != null)
  this.barva3 = barva3;
 if (vzornik3 != null && typeof vzornik3 == "number")
  this.vzornik3 = vzornik3;
 if (vybrano != null && typeof vybrano == "number")
  this.vybrano = 1;
 if (zobr != null && typeof zobr == "number")
  this.zobr = 1;
 if (ean != null)
  this.ean = ean;
 if (ean2 != null)
  this.ean2 = ean2;
 if (poradi != null && typeof poradi == "number")
  this.poradi = poradi;
 if (obj_sl != null && typeof obj_sl == "number")
  this.obj_sl = obj_sl;
 if (mj_typ != null && typeof mj_typ == "number")
  this.mj_typ = mj_typ;
 if (points_rec != null && typeof points_rec == "number")
  this.points_rec = points_rec;
 if (points_rec_t != null)
  this.points_rec_t = points_rec_t;
 if (points_give != null && typeof points_give == "number")
  this.points_give = points_give;
 if (points_give_t != null)
  this.points_give_t = points_give_t;
 if (points_kind != null)
  this.points_kind = points_kind;
 if (points_type != null)
  this.points_type = points_type;
 if (dat_cena_zm != null)
  this.dat_cena_zm = dat_cena_zm;
 if (group_id != null)
  this.group_id = group_id;
 if (kategorie != null)
  this.kategorie = kategorie;

 return this;
}

function polePar(cis, id, par_title, par_type, par_value, id_param,
 pre_value, par_note, sorder, t_desc, disp_title, is_active,
 is_display1, is_display2, is_display3, is_display4, is_display5,
 is_show_old, par_val_n, par_val_n2, par_val_l, par_val_picy, par_val_picn,
 par_val_d, par_val_d2, valid_from, valid_to, grp_id, grp_parent, grp_title, grp_sorder)
{
 this.length = 32;
 this.cis = 0;
 this.id = 0;
 this.par_title = "";
 this.par_type = "";
 this.par_value = "";
 this.id_param = 0;
 this.pre_value = "";
 this.par_note = "";
 this.sorder = 0;
 this.t_desc = "";
 this.disp_title = "";
 this.is_active = 1;
 this.is_display1 = 0;
 this.is_display2 = 0;
 this.is_display3 = 0;
 this.is_display4 = 0;
 this.is_display5 = 0;
 this.is_show_old = 0;
 this.par_val_n = 0;
 this.par_val_n2 = 0;
 this.par_val_l = 0;
 this.par_val_picy = "";
 this.par_val_picn = "";
 this.par_val_d = "";
 this.par_val_d2 = "";
 this.valid_from = "";
 this.valid_to = "";
 this.grp_id = 0;
 this.grp_parent = 0;
 this.grp_title = "";
 this.grp_sorder = 0;

 if (cis != null && typeof cis == "number")
  this.cis = cis;
 if (id != null && typeof id == "number")
  this.id = id;
 if (par_title != null)
  this.par_title = par_title;
 if (par_type != null)
  this.par_type = par_type;
 if (par_value != null)
  this.par_value = par_value;
 if (id_param != null && typeof id_param == "number")
  this.id_param = id_param;
 if (pre_value != null)
  this.pre_value = pre_value;
 if (par_note != null)
  this.par_note = par_note;
 if (sorder != null && typeof sorder == "number")
  this.sorder = sorder;
 if (t_desc != null)
  this.t_desc = t_desc;
 if (disp_title != null)
  this.disp_title = disp_title;
 if (is_active != null && typeof is_active == "number")
  this.is_active = is_active;
 if (is_display1 != null && typeof is_display1 == "number")
  this.is_display1 = is_display1;
 if (is_display2 != null && typeof is_display2 == "number")
  this.is_display2 = is_display2;
 if (is_display3 != null && typeof is_display3 == "number")
  this.is_display3 = is_display3;
 if (is_display4 != null && typeof is_display4 == "number")
  this.is_display4 = is_display4;
 if (is_display5 != null && typeof is_display5 == "number")
  this.is_display5 = is_display5;
 if (is_show_old != null && typeof is_show_old == "number")
  this.is_show_old = is_show_old;
 if (par_val_n != null && typeof par_val_n == "number")
  this.par_val_n = par_val_n;
 if (par_val_n2 != null && typeof par_val_n2 == "number")
  this.par_val_n2 = par_val_n2;
 if (par_val_l != null && typeof par_val_l == "number")
  this.par_val_l = par_val_l;
 if (par_val_picy != null)
  this.par_val_picy = par_val_picy;
 if (par_val_picn != null)
  this.par_val_picn = par_val_picn;
 if (par_val_d != null)
  this.par_val_d = par_val_d;
 if (par_val_d2 != null)
  this.par_val_d2 = par_val_d2;
 if (valid_from != null)
  this.valid_from = valid_from;
 if (valid_to != null)
  this.valid_to = valid_to;
 if (grp_id != null && typeof grp_id == "number")
  this.grp_id = grp_id;
 if (grp_parent != null && typeof grp_parent == "number")
  this.grp_parent = grp_parent;
 if (grp_title != null)
  this.grp_title = grp_title;
 if (grp_sorder != null && typeof grp_sorder == "number")
  this.grp_sorder = grp_sorder;

 return this;
}

function polePages(cis, id, parent, level, title, a_title, src, sorder, tab, navigace, id_article)
{
 this.length = 11;
 this.cis = 0;
 this.id = 0;
 this.parent = 0;
 this.level = 0;
 this.title = "";
 this.a_title = "";
 this.src = "";
 this.sorder = 0;
 this.tab = 0;
 this.navigace = 0;
 this.id_article = 0;

 if (cis != null && typeof cis == "number")
  this.cis = cis;
 if (id != null && typeof id == "number")
  this.id = id;
 if (parent != null && typeof parent == "number")
  this.parent = parent;
 if (level != null && typeof level == "number")
  this.level = level;
 if (title != null)
  this.title = title;
 if (a_title != null)
  this.a_title = a_title;
 if (src != null)
  this.src = src;
 if (sorder != null && typeof sorder == "number")
  this.sorder = sorder;
 if (tab != null && typeof tab == "number")
  this.tab = tab;
 if (navigace != null && typeof navigace == "number")
  this.navigace = navigace;
 if (id_article != null && typeof id_article == "number")
  this.id_article = id_article;

 return this;
}


function poleSub(id_zb, id_sub, kod_sub, typ, kod, nazev, cena, sdph, sleva, vybran, text1, text2, id)
{
 this.length = 14;
 this.id_zb = id_zb;
 this.id_sub = id_sub;
 this.kod_sub = kod_sub;
 this.typ = typ;
 this.kod = kod;
 this.nazev = nazev;
 this.cena = cena;
 this.sdph = sdph;
 this.sleva = sleva;
 this.vybran = vybran;
 this.text1 = text1;
 this.text2 = text2;
 this.id = id;
 return this;
}


function vynulujSub(n, init)
{
 this.length = n;
 for (var i = 1; i < n; i++)
 {
  this[i] = new poleSub("", "", 0, 0);
 }
 return this;
}


function vynuluj(n,init)
{
 this.length = n;
 for (var i =1 ; i < n; i++)
 {
  this[i] = new pole("", "", 0, 0);
 }
 return this;
}


function Opt(z, y, h)
{
 var
  x = '';
 if (h == 0)
  x = '<option selected="selected" value="0">0</option>';
 else
  x = '<option value="0">0</option>';
 for (var i = y; i <= z; i += y)
 {
  x += '<option ';
  if (i == h)
   x += 'selected="selected" ';
  x += 'value="' + i + '">' + i + '</option>';
 }
 return x;
}


function delNationalChars(x, y)
{
 if (y == null)
  return par.delNationalChars(x, "cz");
 else
  return par.delNationalChars(x, y);
}

function sortTxtValue(x, y)
{
 x = delNationalChars(x, "CZ");
 y = delNationalChars(y, "CZ");
 x = x.toLowerCase();
 y = y.toLowerCase();

 if (x < y)
  return -1;
 else
  return 1;
}

function _prodSortId(a, b)
{
 return a.cis - b.cis;
}

function _prodSortPrice(a, b)
{
 return a.cena - b.cena;
}

function _prodSortPriceVAT(a, b)
{
 return a.sdph - b.sdph;
}

function _prodSortTitle(a, b)
{
 return sortTxtValue(a.nazev, b.nazev);
}

function _prodSortManufacturer(a, b)
{
 return sortTxtValue(a.vyrobce, b.vyrobce);
}

function _prodSortCode(a, b)
{
 return sortTxtValue(a.kod, b.kod);
}

function _prodSort()
{
 //sorting (par.fs2 = 0 -> default; 1 -> title; 2 -> price; 3 -> manufacturer; 4 -> code)
 if (par.fs2 == 0)
  seznam.sort(_prodSortId);
 else if (par.fs2 == 1)
  seznam.sort(_prodSortTitle);
 else if (par.fs2 == 2)
  seznam.sort(_prodSortPrice);
 else if (par.fs2 == 3)
  seznam.sort(_prodSortManufacturer);
 else if (par.fs2 == 4)
  seznam.sort(_prodSortCode);
}


//-->
