
// The preview images
panoramic_pr_bb = new Image();
panoramic_pr_bb.src = "../../shared/assets/images/panoramic_pr_bb.png";
panoramic_pr_wb = new Image();
panoramic_pr_wb.src = "../../shared/assets/images/panoramic_pr_wb.png";
panoramic_evo_bb = new Image();
panoramic_evo_bb.src = "../../shared/assets/images/panoramic_evo_bb.png";
panoramic_evo_wb = new Image();
panoramic_evo_wb.src = "../../shared/assets/images/panoramic_evo_wb.png";
panoramic_tra_bb = new Image();
panoramic_tra_bb.src = "../../shared/assets/images/panoramic_tra_bb.png";
panoramic_tra_wb = new Image();
panoramic_tra_wb.src = "../../shared/assets/images/panoramic_tra_wb.png";
panoramic_tra_dw = new Image();
panoramic_tra_dw.src = "../../shared/assets/images/panoramic_tra_dw.png";
panoramic_tra_cw = new Image();
panoramic_tra_cw.src = "../../shared/assets/images/panoramic_tra_cw.png";

panoramic31_pr_bb = new Image();
panoramic31_pr_bb.src = "../../shared/assets/images/panoramic31_pr_bb.png";
panoramic31_pr_wb = new Image();
panoramic31_pr_wb.src = "../../shared/assets/images/panoramic31_pr_wb.png";
panoramic31_evo_bb = new Image();
panoramic31_evo_bb.src = "../../shared/assets/images/panoramic31_evo_bb.png";
panoramic31_evo_wb = new Image();
panoramic31_evo_wb.src = "../../shared/assets/images/panoramic31_evo_wb.png";
panoramic31_tra_bb = new Image();
panoramic31_tra_bb.src = "../../shared/assets/images/panoramic31_tra_bb.png";
panoramic31_tra_wb = new Image();
panoramic31_tra_wb.src = "../../shared/assets/images/panoramic31_tra_wb.png";
panoramic31_tra_dw = new Image();
panoramic31_tra_dw.src = "../../shared/assets/images/panoramic31_tra_dw.png";
panoramic31_tra_cw = new Image();
panoramic31_tra_cw.src = "../../shared/assets/images/panoramic31_tra_cw.png";

portrait_pr_bb = new Image();
portrait_pr_bb.src = "../../shared/assets/images/portrait_pr_bb.png";
portrait_pr_wb = new Image();
portrait_pr_wb.src = "../../shared/assets/images/portrait_pr_wb.png";
portrait_evo_bb = new Image();
portrait_evo_bb.src = "../../shared/assets/images/portrait_evo_bb.png";
portrait_evo_wb = new Image();
portrait_evo_wb.src = "../../shared/assets/images/portrait_evo_wb.png";
portrait_tra_bb = new Image();
portrait_tra_bb.src = "../../shared/assets/images/portrait_tra_bb.png";
portrait_tra_wb = new Image();
portrait_tra_wb.src = "../../shared/assets/images/portrait_tra_wb.png";
portrait_tra_dw = new Image();
portrait_tra_dw.src = "../../shared/assets/images/portrait_tra_dw.png";
portrait_tra_cw = new Image();
portrait_tra_cw.src = "../../shared/assets/images/portrait_tra_cw.png";

landscape_pr_bb = new Image();
landscape_pr_bb.src = "../../shared/assets/images/landscape_pr_bb.png";
landscape_pr_wb = new Image();
landscape_pr_wb.src = "../../shared/assets/images/landscape_pr_wb.png";
landscape_evo_bb = new Image();
landscape_evo_bb.src = "../../shared/assets/images/landscape_evo_bb.png";
landscape_evo_wb = new Image();
landscape_evo_wb.src = "../../shared/assets/images/landscape_evo_wb.png";
landscape_tra_bb = new Image();
landscape_tra_bb.src = "../../shared/assets/images/landscape_tra_bb.png";
landscape_tra_wb = new Image();
landscape_tra_wb.src = "../../shared/assets/images/landscape_tra_wb.png";
landscape_tra_dw = new Image();
landscape_tra_dw.src = "../../shared/assets/images/landscape_tra_dw.png";
landscape_tra_cw = new Image();
landscape_tra_cw.src = "../../shared/assets/images/landscape_tra_cw.png";


// The picture format
// Values: landscape
//         portrait
//         panoramic
//         panoramic31
var PANORAMIC   = 0;
var PANORAMIC31 = 1;
var LANDSCAPE   = 2;
var PORTRAIT    = 3;
var pictFormat
var aPictFormat=new Array();
aPictFormat["panoramic"]   = PANORAMIC;
aPictFormat["panoramic31"] = PANORAMIC31;
aPictFormat["landscape"]   = LANDSCAPE;
aPictFormat["portrait"]    = PORTRAIT;

//main formats:
var PANO = 0;
var STD  = 1;
var aMainFormat=new Array();
aMainFormat["panoramic"]   = PANO;
aMainFormat["panoramic31"] = PANO;
aMainFormat["landscape"]   = STD;
aMainFormat["portrait"]    = STD;

// The print size
// Values: eva (evation)
//         art (artist)
//         nat (nature)
//         mas (master)
var EVA = 0;
var ART = 1;
var NAT = 2;
var MAS = 3;
var printSize
var aPrintSize=new Array();
aPrintSize["eva"] = EVA;
aPrintSize["art"] = ART;
aPrintSize["nat"] = NAT;
aPrintSize["mas"] = MAS;


// The background or mat colour
// Values: bb (black border)
//         wb (white border)
var printMat

// The frame type
// Values: pr (print)
//         evo (evolution)
//         tra (tradition)
var PR = 0;
var EVO = 1;
var TRA = 2;
var printFrameType
var aPrintFrameType=new Array();
aPrintFrameType["pr"] = PR;
aPrintFrameType["evo"] = EVO;
aPrintFrameType["tra"] = TRA;

//The Frame Colour
// Values: dw (dark wood)
//         cw (clear wood)
var printFrameColour

// The ID of the picture to be showed
var picture

// The calculationg of the print price
var printPrice
var postPrice

// Array for storing the princes according to dimensions and frame type
var aPrintPrices=new Array(2);
for(i=0;i<2;i++)
{
   aPrintPrices[i]=new Array(3);
   for(j=0;j<3;j++)
   { 
      aPrintPrices[i][j]=new Array(4);
   }
}
aPrintPrices[PANO][PR][EVA] = 260.00;
aPrintPrices[PANO][PR][ART] = 300.00;
aPrintPrices[PANO][PR][NAT] = 495.00;
aPrintPrices[PANO][PR][MAS] = 850.00;
aPrintPrices[PANO][EVO][EVA] = 460.00;
aPrintPrices[PANO][EVO][ART] = 620.00;
aPrintPrices[PANO][EVO][NAT] = 1100.00;
aPrintPrices[PANO][EVO][MAS] = 2100.00;
aPrintPrices[PANO][TRA][EVA] = 920.00;
aPrintPrices[PANO][TRA][ART] = 1200.00;
aPrintPrices[PANO][TRA][NAT] = 1900.00;
aPrintPrices[PANO][TRA][MAS] = 3200.00;
aPrintPrices[STD][PR][EVA] = 0.00;
aPrintPrices[STD][PR][ART] = 250.00;
aPrintPrices[STD][PR][NAT] = 310.00;
aPrintPrices[STD][PR][MAS] = 470.00;
aPrintPrices[STD][EVO][EVA] = 0.00;
aPrintPrices[STD][EVO][ART] = 420.00;
aPrintPrices[STD][EVO][NAT] = 600.00;
aPrintPrices[STD][EVO][MAS] = 1100.00;
aPrintPrices[STD][TRA][EVA] = 0.00;
aPrintPrices[STD][TRA][ART] = 900.00;
aPrintPrices[STD][TRA][NAT] = 1100.00;
aPrintPrices[STD][TRA][MAS] = 1700.00;

// Country Zones
var ZONE_CH = 0;
var ZONE_1 = 1;
var ZONE_2 = 2;
var ZONE_3 = 3;
var ZONE_4 = 4;
var ZONE_5 = 5;


// Zones according to countries
var aZone=new Array();
if(1 == language)
{
aZone["Afghanistan"]=ZONE_4;
aZone["Afrique du Sud"]=ZONE_4;
aZone["Albanie"]=ZONE_2;
aZone["Algérie"]=ZONE_3;
aZone["Allemagne"]=ZONE_1;
aZone["Andorre"]=ZONE_2;
aZone["Angola"]=ZONE_4;
aZone["Anguilla"]=ZONE_5;
aZone["Antigua et Barbuda"]=ZONE_5;
aZone["Antilles néerlandaises"]=ZONE_5;
aZone["Arabie saoudite"]=ZONE_4;
aZone["Argentine"]=ZONE_5;
aZone["Arménie"]=ZONE_4;
aZone["Aruba"]=ZONE_5;
aZone["Ascension"]=ZONE_4;
aZone["Australie"]=ZONE_5;
aZone["Autriche"]=ZONE_1;
aZone["Azerbaïdjan"]=ZONE_4;
aZone["Bahamas"]=ZONE_5;
aZone["Bahreïn"]=ZONE_4;
aZone["Bangladesh"]=ZONE_4;
aZone["Barbade"]=ZONE_5;
aZone["Bélarus"]=ZONE_2;
aZone["Belgique"]=ZONE_1;
aZone["Belize"]=ZONE_5;
aZone["Bénin"]=ZONE_4;
aZone["Bermuda"]=ZONE_5;
aZone["Bhutan"]=ZONE_4;
aZone["Bolivie"]=ZONE_5;
aZone["Bosnie-Herzégovine"]=ZONE_2;
aZone["Botswana"]=ZONE_4;
aZone["Brésil"]=ZONE_5;
aZone["Brunei"]=ZONE_5;
aZone["Bulgarie"]=ZONE_2;
aZone["Burkina Faso"]=ZONE_4;
aZone["Burundi"]=ZONE_4;
aZone["Cambodge"]=ZONE_4;
aZone["Cameroun"]=ZONE_4;
aZone["Canada"]=ZONE_3;
aZone["Cap Vert, îles"]=ZONE_4;
aZone["Cayman"]=ZONE_5;
aZone["Centrafrique"]=ZONE_4;
aZone["Chili"]=ZONE_5;
aZone["Chine, République populaire"]=ZONE_4;
aZone["Chine, Taiwan"]=ZONE_4;
aZone["Christmas, île"]=ZONE_5;
aZone["Chypre"]=ZONE_2;
aZone["Colombie"]=ZONE_5;
aZone["Comores"]=ZONE_4;
aZone["Congo, Rép."]=ZONE_4;
aZone["Congo, Rép. Démocratique (ex Zaïre)"]=ZONE_4;
aZone["Cook, îles"]=ZONE_5;
aZone["Corée, Rép. Populaire démocratique (Corée du Nord)"]=ZONE_4;
aZone["Corée, République (Corée du Sud)"]=ZONE_4;
aZone["Costa Rica"]=ZONE_5;
aZone["Côte d'Ivoire"]=ZONE_4;
aZone["Croatie"]=ZONE_2;
aZone["Cuba"]=ZONE_5;
aZone["Danemark"]=ZONE_2;
aZone["Djibouti"]=ZONE_4;
aZone["Dominicaine, République"]=ZONE_5;
aZone["Dominique"]=ZONE_5;
aZone["Egypte"]=ZONE_3;
aZone["El Salvador"]=ZONE_5;
aZone["Emirats arabes unis"]=ZONE_4;
aZone["Equateur"]=ZONE_5;
aZone["Erythrée"]=ZONE_4;
aZone["Espagne"]=ZONE_2;
aZone["Estonie"]=ZONE_2;
aZone["Etats-Unis d’Amérique"]=ZONE_3;
aZone["Ethiopie"]=ZONE_4;
aZone["Falkland"]=ZONE_5;
aZone["Féroé"]=ZONE_2;
aZone["Fidji"]=ZONE_5;
aZone["Finlande"]=ZONE_2;
aZone["France (sans Andorre, Corse et Monaco)"]=ZONE_1;
aZone["France, Corse seulement"]=ZONE_1;
aZone["Gabon"]=ZONE_4;
aZone["Gambie"]=ZONE_4;
aZone["Georgie"]=ZONE_4;
aZone["Ghana"]=ZONE_4;
aZone["Gibraltar"]=ZONE_2;
aZone["Grande Bretagne et Irlande du Nord (sans Jersey, Guernsey et Ile de Man)"]=ZONE_2;
aZone["Grèce"]=ZONE_2;
aZone["Grenada"]=ZONE_5;
aZone["Grenada"]=ZONE_5;
aZone["Griechenland"]=ZONE_2;
aZone["Groenland"]=ZONE_2;
aZone["Grönland"]=ZONE_2;
aZone["Guadeloupe"]=ZONE_5;
aZone["Guatemala"]=ZONE_5;
aZone["Guernsey"]=ZONE_2;
aZone["Guinée Equatoriale"]=ZONE_4;
aZone["Guinée, République"]=ZONE_4;
aZone["Guinée-Bissau"]=ZONE_4;
aZone["Guyana"]=ZONE_5;
aZone["Guyane française"]=ZONE_5;
aZone["Haïti"]=ZONE_5;
aZone["Honduras"]=ZONE_5;
aZone["Hongkong"]=ZONE_4;
aZone["Hongrie"]=ZONE_2;
aZone["Inde"]=ZONE_4;
aZone["Indonésie"]=ZONE_5;
aZone["Iran"]=ZONE_4;
aZone["Iraq"]=ZONE_4;
aZone["Irlande"]=ZONE_2;
aZone["Islande"]=ZONE_2;
aZone["Israël"]=ZONE_3;
aZone["Italie (sans St-Marin et Vatican)"]=ZONE_1;
aZone["Jamaïque"]=ZONE_5;
aZone["Japon"]=ZONE_4;
aZone["Jersey"]=ZONE_2;
aZone["Jordanie"]=ZONE_3;
aZone["Kazakhstan"]=ZONE_4;
aZone["Kenya"]=ZONE_4;
aZone["Kirghizistan"]=ZONE_4;
aZone["Kiribati"]=ZONE_5;
aZone["Kosovo"]=ZONE_2;
aZone["Kuwait"]=ZONE_4;
aZone["Laos"]=ZONE_4;
aZone["Lesotho"]=ZONE_4;
aZone["Lettonie"]=ZONE_2;
aZone["Liban"]=ZONE_3;
aZone["Libéria"]=ZONE_4;
aZone["Libye"]=ZONE_3;
aZone["Lituanie"]=ZONE_2;
aZone["Luxembourg"]=ZONE_1;
aZone["Macao"]=ZONE_4;
aZone["Macédonie"]=ZONE_2;
aZone["Madagascar"]=ZONE_4;
aZone["Malaisie"]=ZONE_4;
aZone["Malawi"]=ZONE_4;
aZone["Maldives"]=ZONE_4;
aZone["Mali"]=ZONE_4;
aZone["Malte"]=ZONE_2;
aZone["Man, Ile"]=ZONE_2;
aZone["Maroc"]=ZONE_3;
aZone["Martinique"]=ZONE_5;
aZone["Maurice, Ile"]=ZONE_4;
aZone["Mauritanie"]=ZONE_4;
aZone["Mayotte"]=ZONE_4;
aZone["Mexique"]=ZONE_3;
aZone["Moldavie"]=ZONE_2;
aZone["Monaco"]=ZONE_1;
aZone["Mongolie"]=ZONE_4;
aZone["Monténégro, République"]=ZONE_2;
aZone["Montserrat"]=ZONE_5;
aZone["Mozambique"]=ZONE_4;
aZone["Myanmar (Union)"]=ZONE_4;
aZone["Namibie"]=ZONE_4;
aZone["Nauru"]=ZONE_5;
aZone["Népal"]=ZONE_4;
aZone["Nicaragua"]=ZONE_5;
aZone["Niger"]=ZONE_4;
aZone["Nigéria"]=ZONE_4;
aZone["Norfolk"]=ZONE_5;
aZone["Norvège"]=ZONE_2;
aZone["Nouvelle Calédonie"]=ZONE_5;
aZone["Nouvelle Zélande"]=ZONE_5;
aZone["Oman"]=ZONE_4;
aZone["Ouganda"]=ZONE_4;
aZone["Ouzbékistan"]=ZONE_4;
aZone["Pakistan"]=ZONE_4;
aZone["Panama"]=ZONE_5;
aZone["Papouasie Nouvelle Guinée"]=ZONE_5;
aZone["Paraguay"]=ZONE_5;
aZone["Pays-Bas"]=ZONE_1;
aZone["Pérou"]=ZONE_5;
aZone["Philippines"]=ZONE_5;
aZone["Pitcairn"]=ZONE_5;
aZone["Pologne"]=ZONE_2;
aZone["Polynésie française"]=ZONE_5;
aZone["Portugal, Açores et Madére"]=ZONE_2;
aZone["Qatar"]=ZONE_4;
aZone["Réunion"]=ZONE_4;
aZone["Roumanie"]=ZONE_2;
aZone["Russie, Fédération de"]=ZONE_2;
aZone["Rwanda"]=ZONE_4;
aZone["Salomon Iles"]=ZONE_5;
aZone["Samoa"]=ZONE_5;
aZone["Santa Lucia"]=ZONE_5;
aZone["Sénégal"]=ZONE_4;
aZone["Serbie, République"]=ZONE_2;
aZone["Seychelles"]=ZONE_4;
aZone["Sierra Leone"]=ZONE_4;
aZone["Singapour"]=ZONE_4;
aZone["Slovaque, Républiqe"]=ZONE_2;
aZone["Slovénie"]=ZONE_2;
aZone["Somalie"]=ZONE_4;
aZone["Soudan"]=ZONE_4;
aZone["Sri Lanka"]=ZONE_4;
aZone["St-Christophe et Nevis"]=ZONE_5;
aZone["Ste-Hélène"]=ZONE_4;
aZone["St-Marin"]=ZONE_1;
aZone["St-Pierre et Miquelon"]=ZONE_3;
aZone["St-Thomas et Principe"]=ZONE_4;
aZone["St-Vincent et Grenadines"]=ZONE_5;
aZone["Suède"]=ZONE_2;
aZone["Suisse"]=ZONE_CH;
aZone["Suriname"]=ZONE_5;
aZone["Swaziland"]=ZONE_4;
aZone["Syrie"]=ZONE_3;
aZone["Tadjikistan"]=ZONE_4;
aZone["Tanzanie"]=ZONE_4;
aZone["Tchad"]=ZONE_4;
aZone["Tchèque Républiqe"]=ZONE_2;
aZone["Thaïlande"]=ZONE_4;
aZone["Timor"]=ZONE_5;
aZone["Togo"]=ZONE_4;
aZone["Tonga"]=ZONE_5;
aZone["Trinidad et Tobago"]=ZONE_5;
aZone["Tristan da Cunha"]=ZONE_4;
aZone["Tunisie"]=ZONE_3;
aZone["Turkménistan"]=ZONE_4;
aZone["Turks et Caïcos"]=ZONE_5;
aZone["Turquie"]=ZONE_2;
aZone["Tuvalu"]=ZONE_5;
aZone["Ukraine"]=ZONE_2;
aZone["Uruguay"]=ZONE_5;
aZone["Vanuatu"]=ZONE_5;
aZone["Vatican"]=ZONE_1;
aZone["Venezuela"]=ZONE_5;
aZone["Vierges, Iles"]=ZONE_5;
aZone["Vietnam"]=ZONE_4;
aZone["Wallis et Futuna"]=ZONE_5;
aZone["Yémen"]=ZONE_4;
aZone["Zambie"]=ZONE_4;
aZone["Zimbabwe"]=ZONE_4;
}
else
{
   aZone["Acension "]=ZONE_4;
   aZone["Afghanistan"]=ZONE_4;
   aZone["Albania"]=ZONE_2;
   aZone["Algeria"]=ZONE_3;
   aZone["Andorra"]=ZONE_2;
   aZone["Angola"]=ZONE_4;
   aZone["Anguilla"]=ZONE_5;
   aZone["Antigua and Barbuda"]=ZONE_5;
   aZone["Argentina"]=ZONE_5;
   aZone["Armenia"]=ZONE_4;
   aZone["Aruba"]=ZONE_5;
   aZone["Australia"]=ZONE_5;
   aZone["Austria"]=ZONE_1;
   aZone["Azerbaijan"]=ZONE_4;
   aZone["Bahamas"]=ZONE_5;
   aZone["Bahrain"]=ZONE_4;
   aZone["Bangladesh"]=ZONE_4;
   aZone["Barbados"]=ZONE_5;
   aZone["Belarus"]=ZONE_2;
   aZone["Belgium"]=ZONE_1;
   aZone["Belize"]=ZONE_5;
   aZone["Benin"]=ZONE_4;
   aZone["Bermuda"]=ZONE_5;
   aZone["Bhutan"]=ZONE_4;
   aZone["Bolivia"]=ZONE_5;
   aZone["Bosnia and Herzegovina"]=ZONE_2;
   aZone["Botswana"]=ZONE_4;
   aZone["Brazil"]=ZONE_5;
   aZone["Brunei "]=ZONE_5;
   aZone["Bulgaria"]=ZONE_2;
   aZone["Burkina Faso"]=ZONE_4;
   aZone["Burundi"]=ZONE_4;
   aZone["Cambodia"]=ZONE_4;
   aZone["Cameroon"]=ZONE_4;
   aZone["Canada"]=ZONE_3;
   aZone["Cape Verde"]=ZONE_4;
   aZone["Cayman"]=ZONE_5;
   aZone["Central Africa Rep."]=ZONE_4;
   aZone["Chile"]=ZONE_5;
   aZone["China, Dem. Rep."]=ZONE_4;
   aZone["China, Taiwan"]=ZONE_4;
   aZone["Christmas Island"]=ZONE_5;
   aZone["Columbia"]=ZONE_5;
   aZone["Comoros"]=ZONE_4;
   aZone["Congo, Dem. Rep. (ex Zairo)"]=ZONE_4;
   aZone["Congo, Rep"]=ZONE_4;
   aZone["Cook Islands"]=ZONE_5;
   aZone["Costa Rica"]=ZONE_5;
   aZone["Côte d'Ivoire"]=ZONE_4;
   aZone["Croatia"]=ZONE_2;
   aZone["Cuba"]=ZONE_5;
   aZone["Cyprus"]=ZONE_2;
   aZone["Czech Rep."]=ZONE_2;
   aZone["Denmark"]=ZONE_2;
   aZone["Djibouti"]=ZONE_4;
   aZone["Dominica"]=ZONE_5;
   aZone["Dominican Rep."]=ZONE_5;
   aZone["Ecuador"]=ZONE_5;
   aZone["Egypt"]=ZONE_3;
   aZone["El Salvador"]=ZONE_5;
   aZone["Equatorial Guinea"]=ZONE_4;
   aZone["Eritrea"]=ZONE_4;
   aZone["Estonia"]=ZONE_2;
   aZone["Ethiopia"]=ZONE_4;
   aZone["Faeroe"]=ZONE_2;
   aZone["Falkland"]=ZONE_5;
   aZone["Fiji"]=ZONE_5;
   aZone["Finland"]=ZONE_2;
   aZone["France (without Corsica and Monaco)"]=ZONE_1;
   aZone["France, just Corsica"]=ZONE_1;
   aZone["French Guyana"]=ZONE_5;
   aZone["French Polynesia"]=ZONE_5;
   aZone["Gabon"]=ZONE_4;
   aZone["Gambia"]=ZONE_4;
   aZone["Georgia"]=ZONE_4;
   aZone["Germany"]=ZONE_1;
   aZone["Ghana"]=ZONE_4;
   aZone["Gibraltar"]=ZONE_2;
   aZone["Great Britain and North Ireland"]=ZONE_2;
   aZone["Greece"]=ZONE_2;
   aZone["Greenland"]=ZONE_2;
   aZone["Grenada"]=ZONE_5;
   aZone["Guadeloupe"]=ZONE_5;
   aZone["Guatemala"]=ZONE_5;
   aZone["Guernsey"]=ZONE_2;
   aZone["Guinea, Rep."]=ZONE_4;
   aZone["Guinea-Bissau"]=ZONE_4;
   aZone["Guyana"]=ZONE_5;
   aZone["Haiti"]=ZONE_5;
   aZone["Honduras"]=ZONE_5;
   aZone["Hong-Kong"]=ZONE_4;
   aZone["Hungary"]=ZONE_2;
   aZone["Iceland"]=ZONE_2;
   aZone["India"]=ZONE_4;
   aZone["Indonesia"]=ZONE_5;
   aZone["Iran"]=ZONE_4;
   aZone["Iraq"]=ZONE_4;
   aZone["Ireland"]=ZONE_2;
   aZone["Israel"]=ZONE_3;
   aZone["Italiy (without San Marino and Vatican)"]=ZONE_1;
   aZone["Jamaica"]=ZONE_5;
   aZone["Japan"]=ZONE_4;
   aZone["Jersey"]=ZONE_2;
   aZone["Jordan"]=ZONE_3;
   aZone["Kazakhstan"]=ZONE_4;
   aZone["Kenya"]=ZONE_4;
   aZone["Kiribati"]=ZONE_5;
   aZone["Korea, Dem. Rep. (North Korea)"]=ZONE_4;
   aZone["Korea, Rep. (South Korea)"]=ZONE_4;
   aZone["Kosovo"]=ZONE_2;
   aZone["Kuwait"]=ZONE_4;
   aZone["Kyrgyzistan"]=ZONE_4;
   aZone["Laos"]=ZONE_4;
   aZone["Latvia"]=ZONE_2;
   aZone["Lebanon"]=ZONE_3;
   aZone["Lesotho"]=ZONE_4;
   aZone["Liberia"]=ZONE_4;
   aZone["Lithuania"]=ZONE_2;
   aZone["Luxembourg"]=ZONE_1;
   aZone["Lybia"]=ZONE_3;
   aZone["Macao"]=ZONE_4;
   aZone["Macedonia"]=ZONE_2;
   aZone["Madagascar"]=ZONE_4;
   aZone["Malawi"]=ZONE_4;
   aZone["Malaysia"]=ZONE_4;
   aZone["Maldives"]=ZONE_4;
   aZone["Mali"]=ZONE_4;
   aZone["Malta"]=ZONE_2;
   aZone["Man, Island"]=ZONE_2;
   aZone["Martinique"]=ZONE_5;
   aZone["Mauritania"]=ZONE_4;
   aZone["Mauritius"]=ZONE_4;
   aZone["Mayotte"]=ZONE_4;
   aZone["Mexico"]=ZONE_3;
   aZone["Moldova"]=ZONE_2;
   aZone["Monaco"]=ZONE_1;
   aZone["Mongolia"]=ZONE_4;
   aZone["Montenegro, Rep."]=ZONE_2;
   aZone["Montserrat"]=ZONE_5;
   aZone["Morocco"]=ZONE_3;
   aZone["Mozambique"]=ZONE_4;
   aZone["Myanmar (Union)"]=ZONE_4;
   aZone["Namibia"]=ZONE_4;
   aZone["Nauru"]=ZONE_5;
   aZone["Nepal"]=ZONE_4;
   aZone["Netherlands"]=ZONE_1;
   aZone["Netherlands Antilles"]=ZONE_5;
   aZone["New Caledonia"]=ZONE_5;
   aZone["New Zeeland"]=ZONE_5;
   aZone["Nicaragua"]=ZONE_5;
   aZone["Niger"]=ZONE_4;
   aZone["Nigeria"]=ZONE_4;
   aZone["Norfolk"]=ZONE_5;
   aZone["Norway"]=ZONE_2;
   aZone["Oman"]=ZONE_4;
   aZone["Pakistan"]=ZONE_4;
   aZone["Panama"]=ZONE_5;
   aZone["Papua New Guinea"]=ZONE_5;
   aZone["Paraguay"]=ZONE_5;
   aZone["Peru"]=ZONE_5;
   aZone["Philippines"]=ZONE_5;
   aZone["Pitcairn"]=ZONE_5;
   aZone["Poland"]=ZONE_2;
   aZone["Portugal with Azores and Madeira"]=ZONE_2;
   aZone["Qatar"]=ZONE_4;
   aZone["Reunion"]=ZONE_4;
   aZone["Romania"]=ZONE_2;
   aZone["Russian Federation"]=ZONE_2;
   aZone["Rwanda"]=ZONE_4;
   aZone["Samoa"]=ZONE_5;
   aZone["San Marino"]=ZONE_1;
   aZone["Santa Lucia"]=ZONE_5;
   aZone["Sao Tome and Principe"]=ZONE_4;
   aZone["Saudi Arabia"]=ZONE_4;
   aZone["Senegal"]=ZONE_4;
   aZone["Serbia, Rep."]=ZONE_2;
   aZone["Seychelles"]=ZONE_4;
   aZone["Sierra Leone"]=ZONE_4;
   aZone["Singapore"]=ZONE_4;
   aZone["Slovakia Rep."]=ZONE_2;
   aZone["Slovenia"]=ZONE_2;
   aZone["Solomon Islands"]=ZONE_5;
   aZone["Somalia"]=ZONE_4;
   aZone["South Africa"]=ZONE_4;
   aZone["Spain"]=ZONE_2;
   aZone["Sri Lanka"]=ZONE_4;
   aZone["St. Helen"]=ZONE_4;
   aZone["St. Kitts and Nevis"]=ZONE_5;
   aZone["St. Pierre and Miquelon"]=ZONE_3;
   aZone["St. Vincent and Grenadines"]=ZONE_5;
   aZone["Sudan"]=ZONE_4;
   aZone["Suriname"]=ZONE_5;
   aZone["Swaziland"]=ZONE_4;
   aZone["Sweden"]=ZONE_2;
   aZone["Syria"]=ZONE_3;
   aZone["Tajikistan"]=ZONE_4;
   aZone["Tanzania"]=ZONE_4;
   aZone["Tchad"]=ZONE_4;
   aZone["Thailand"]=ZONE_4;
   aZone["Timor"]=ZONE_5;
   aZone["Togo"]=ZONE_4;
   aZone["Tonga"]=ZONE_5;
   aZone["Trinidad and Tobago"]=ZONE_5;
   aZone["Tristan da Cunha"]=ZONE_4;
   aZone["Tunisia"]=ZONE_3;
   aZone["Turkey"]=ZONE_2;
   aZone["Turkmenistan"]=ZONE_4;
   aZone["Turks and Caicos"]=ZONE_5;
   aZone["Tuvalu"]=ZONE_5;
   aZone["Uganda"]=ZONE_4;
   aZone["Ukraine"]=ZONE_2;
   aZone["United Arab Emirates"]=ZONE_4;
   aZone["United States of America"]=ZONE_3;
   aZone["Uruguay"]=ZONE_5;
   aZone["Uzbekistan"]=ZONE_4;
   aZone["Vanuatu"]=ZONE_5;
   aZone["Vatican"]=ZONE_1;
   aZone["Venezuela"]=ZONE_5;
   aZone["Vietnam"]=ZONE_4;
   aZone["Virgin Islands"]=ZONE_5;
   aZone["Wallis and Futuna"]=ZONE_5;
   aZone["Yemen"]=ZONE_4;
   aZone["Zambia"]=ZONE_4;
   aZone["Zimbabwe"]=ZONE_4;   
}
// Post and Packaging prices according to print size and framing
var aPostPrices=new Array(2);
for(i=0;i<2;i++) // format
{
   aPostPrices[i]=new Array(3);
   for(j=0;j<3;j++) // frame types
   { 
      aPostPrices[i][j]=new Array(4);
      for(k=0;k<4;k++) // sizes
      { 
         aPostPrices[i][j][k]=new Array(6); // Zones
         
      }
   }
}
aPostPrices[PANO][PR][EVA][ZONE_CH]=12;   aPostPrices[PANO][PR][EVA][ZONE_1]=38; aPostPrices[PANO][PR][EVA][ZONE_2]=42; aPostPrices[PANO][PR][EVA][ZONE_3]=45; aPostPrices[PANO][PR][EVA][ZONE_4]=49; aPostPrices[PANO][PR][EVA][ZONE_5]=53;
aPostPrices[PANO][PR][ART][ZONE_CH]=12;   aPostPrices[PANO][PR][ART][ZONE_1]=38; aPostPrices[PANO][PR][ART][ZONE_2]=42; aPostPrices[PANO][PR][ART][ZONE_3]=45; aPostPrices[PANO][PR][ART][ZONE_4]=49; aPostPrices[PANO][PR][ART][ZONE_5]=53;
aPostPrices[PANO][PR][NAT][ZONE_CH]=12;   aPostPrices[PANO][PR][NAT][ZONE_1]=38; aPostPrices[PANO][PR][NAT][ZONE_2]=42; aPostPrices[PANO][PR][NAT][ZONE_3]=45; aPostPrices[PANO][PR][NAT][ZONE_4]=49; aPostPrices[PANO][PR][NAT][ZONE_5]=53;
aPostPrices[PANO][PR][MAS][ZONE_CH]=14;   aPostPrices[PANO][PR][MAS][ZONE_1]=45; aPostPrices[PANO][PR][MAS][ZONE_2]=53; aPostPrices[PANO][PR][MAS][ZONE_3]=58; aPostPrices[PANO][PR][MAS][ZONE_4]=65; aPostPrices[PANO][PR][MAS][ZONE_5]=76;
aPostPrices[PANO][EVO][EVA][ZONE_CH]=17;  aPostPrices[PANO][EVO][EVA][ZONE_1]=48;   aPostPrices[PANO][EVO][EVA][ZONE_2]=56;   aPostPrices[PANO][EVO][EVA][ZONE_3]=61;   aPostPrices[PANO][EVO][EVA][ZONE_4]=68;   aPostPrices[PANO][EVO][EVA][ZONE_5]=79;
aPostPrices[PANO][EVO][ART][ZONE_CH]=35;  aPostPrices[PANO][EVO][ART][ZONE_1]=67;   aPostPrices[PANO][EVO][ART][ZONE_2]=82;   aPostPrices[PANO][EVO][ART][ZONE_3]=94;   aPostPrices[PANO][EVO][ART][ZONE_4]=109;  aPostPrices[PANO][EVO][ART][ZONE_5]=129;
aPostPrices[PANO][EVO][NAT][ZONE_CH]=58;  aPostPrices[PANO][EVO][NAT][ZONE_1]=105;  aPostPrices[PANO][EVO][NAT][ZONE_2]=135;  aPostPrices[PANO][EVO][NAT][ZONE_3]=177;  aPostPrices[PANO][EVO][NAT][ZONE_4]=217;  aPostPrices[PANO][EVO][NAT][ZONE_5]=252;
aPostPrices[PANO][EVO][MAS][ZONE_CH]=0;   aPostPrices[PANO][EVO][MAS][ZONE_1]=0; aPostPrices[PANO][EVO][MAS][ZONE_2]=0; aPostPrices[PANO][EVO][MAS][ZONE_3]=0; aPostPrices[PANO][EVO][MAS][ZONE_4]=0; aPostPrices[PANO][EVO][MAS][ZONE_5]=0;
aPostPrices[PANO][TRA][EVA][ZONE_CH]=21;  aPostPrices[PANO][TRA][EVA][ZONE_1]=53;   aPostPrices[PANO][TRA][EVA][ZONE_2]=68;   aPostPrices[PANO][TRA][EVA][ZONE_3]=80;   aPostPrices[PANO][TRA][EVA][ZONE_4]=95;   aPostPrices[PANO][TRA][EVA][ZONE_5]=115;
aPostPrices[PANO][TRA][ART][ZONE_CH]=36;  aPostPrices[PANO][TRA][ART][ZONE_1]=68;   aPostPrices[PANO][TRA][ART][ZONE_2]=83;   aPostPrices[PANO][TRA][ART][ZONE_3]=95;   aPostPrices[PANO][TRA][ART][ZONE_4]=110;  aPostPrices[PANO][TRA][ART][ZONE_5]=130;
aPostPrices[PANO][TRA][NAT][ZONE_CH]=0;   aPostPrices[PANO][TRA][NAT][ZONE_1]=0; aPostPrices[PANO][TRA][NAT][ZONE_2]=0; aPostPrices[PANO][TRA][NAT][ZONE_3]=0; aPostPrices[PANO][TRA][NAT][ZONE_4]=0; aPostPrices[PANO][TRA][NAT][ZONE_5]=0;
aPostPrices[PANO][TRA][MAS][ZONE_CH]=0;   aPostPrices[PANO][TRA][MAS][ZONE_1]=0; aPostPrices[PANO][TRA][MAS][ZONE_2]=0; aPostPrices[PANO][TRA][MAS][ZONE_3]=0; aPostPrices[PANO][TRA][MAS][ZONE_4]=0; aPostPrices[PANO][TRA][MAS][ZONE_5]=0;
aPostPrices[STD][PR][ART][ZONE_CH]=12; aPostPrices[STD][PR][ART][ZONE_1]=38;  aPostPrices[STD][PR][ART][ZONE_2]=42;  aPostPrices[STD][PR][ART][ZONE_3]=45;  aPostPrices[STD][PR][ART][ZONE_4]=49;  aPostPrices[STD][PR][ART][ZONE_5]=53;
aPostPrices[STD][PR][NAT][ZONE_CH]=12; aPostPrices[STD][PR][NAT][ZONE_1]=38;  aPostPrices[STD][PR][NAT][ZONE_2]=42;  aPostPrices[STD][PR][NAT][ZONE_3]=45;  aPostPrices[STD][PR][NAT][ZONE_4]=49;  aPostPrices[STD][PR][NAT][ZONE_5]=53;
aPostPrices[STD][PR][MAS][ZONE_CH]=14; aPostPrices[STD][PR][MAS][ZONE_1]=45;  aPostPrices[STD][PR][MAS][ZONE_2]=53;  aPostPrices[STD][PR][MAS][ZONE_3]=58;  aPostPrices[STD][PR][MAS][ZONE_4]=65;  aPostPrices[STD][PR][MAS][ZONE_5]=76;
aPostPrices[STD][EVO][ART][ZONE_CH]=17;   aPostPrices[STD][EVO][ART][ZONE_1]=48; aPostPrices[STD][EVO][ART][ZONE_2]=56; aPostPrices[STD][EVO][ART][ZONE_3]=61; aPostPrices[STD][EVO][ART][ZONE_4]=68; aPostPrices[STD][EVO][ART][ZONE_5]=79;
aPostPrices[STD][EVO][NAT][ZONE_CH]=41;   aPostPrices[STD][EVO][NAT][ZONE_1]=73; aPostPrices[STD][EVO][NAT][ZONE_2]=88; aPostPrices[STD][EVO][NAT][ZONE_3]=100;   aPostPrices[STD][EVO][NAT][ZONE_4]=115;   aPostPrices[STD][EVO][NAT][ZONE_5]=135;
aPostPrices[STD][EVO][MAS][ZONE_CH]=63;   aPostPrices[STD][EVO][MAS][ZONE_1]=110;   aPostPrices[STD][EVO][MAS][ZONE_2]=140;   aPostPrices[STD][EVO][MAS][ZONE_3]=182;   aPostPrices[STD][EVO][MAS][ZONE_4]=222;   aPostPrices[STD][EVO][MAS][ZONE_5]=257;
aPostPrices[STD][TRA][ART][ZONE_CH]=21;   aPostPrices[STD][TRA][ART][ZONE_1]=53; aPostPrices[STD][TRA][ART][ZONE_2]=68; aPostPrices[STD][TRA][ART][ZONE_3]=80; aPostPrices[STD][TRA][ART][ZONE_4]=95; aPostPrices[STD][TRA][ART][ZONE_5]=115;
aPostPrices[STD][TRA][NAT][ZONE_CH]=56;   aPostPrices[STD][TRA][NAT][ZONE_1]=103;   aPostPrices[STD][TRA][NAT][ZONE_2]=133;   aPostPrices[STD][TRA][NAT][ZONE_3]=175;   aPostPrices[STD][TRA][NAT][ZONE_4]=215;   aPostPrices[STD][TRA][NAT][ZONE_5]=250;
aPostPrices[STD][TRA][MAS][ZONE_CH]=0; aPostPrices[STD][TRA][MAS][ZONE_1]=0;  aPostPrices[STD][TRA][MAS][ZONE_2]=0;  aPostPrices[STD][TRA][MAS][ZONE_3]=0;  aPostPrices[STD][TRA][MAS][ZONE_4]=0;  aPostPrices[STD][TRA][MAS][ZONE_5]=0;


//=======================
//THIS IS FOR DEBUG ONLY
//=======================
onerror=handleErr
//=======================

/* The following functions are to avoid yellow background on the input fields
* which Google toolbar changes automatically */
if(window.attachEvent)
{
window.attachEvent("onload",setListeners);
}

function setListeners()
{
inputList = document.getElementsByTagName("INPUT");
for(i=0;i<inputList.length;i++)
{
inputList[i].attachEvent("onpropertychange",restoreStyles);
inputList[i].style.backgroundColor = "";
}
selectList = document.getElementsByTagName("SELECT");
for(i=0;i<selectList.length;i++)
{
selectList[i].attachEvent("onpropertychange",restoreStyles);
selectList[i].style.backgroundColor = "";
}
}

function restoreStyles()
{
if(event.srcElement.style.backgroundColor != "")
event.srcElement.style.backgroundColor = "";
}

/******************************************************************************
 *
 * Project:     Samuel Bitton Photography Website      
 * Author:      Samuel Bitton
 * Date:        22 Feb 2006
 * Description: Contains scripts for the services page.
 *
 *****************************************************************************/


/******************************************************************************
 *
 * Function:
 *
 * Parameters:
 *
 * Returns:
 *
 * Description:
 *
 *****************************************************************************/
// =======================
// THIS IS FOR DEBUG ONLY
// =======================
function handleErr(msg,url,l)
{
   var txt=""
   txt="There was an error on this page.\n\n"
   txt+="Error: " + msg + "\n"
   txt+="URL: " + url + "\n"
   txt+="Line: " + l + "\n\n"
   txt+="Click OK to continue.\n\n"
   alert(txt)
   return true
} /* END HandleErr */
// =======================

function SetWallColour(colour)
{
   document.getElementById("wall").style.background = colour;
}

/******************************************************************************
 *
 * Function:
 *
 * Parameters:
 *
 * Returns:
 *
 * Description:
 *
 *****************************************************************************/
function InitPrintsPage()
{
	// Extract the picture details from the URL if specified otherwise
   // Try to retreive them from the previous one used set in a cookie
	// otherwise set the default to be for a standard picture
	if(window.location.search.length != 0)
	{
	   // picture is specified in the URL
	   
      picture = window.location.search.split("?")[1];
      pictFormat = window.location.search.split("?")[2];
      pictGallery = window.location.search.split("?")[3];
    
      // Set the picture ID in the order form
      document.getElementById("picture_id").value = picture.substring(3)

	   // Enable the appropriate picture sizes
      if( pictFormat == "panoramic31" ||
          pictFormat == "panoramic" )
		{
         document.getElementById("pano_eva_pr").checked = "checked";
         
		   document.getElementById("std_art_pr").disabled = true
         document.getElementById("std_art_evo").disabled = true
		   document.getElementById("std_art_tra").disabled = true

		   document.getElementById("std_nat_pr").disabled = true
		   document.getElementById("std_nat_evo").disabled = true
         document.getElementById("std_nat_tra").disabled = true

         document.getElementById("std_mas_pr").disabled = true
         document.getElementById("std_mas_evo").disabled = true
         document.getElementById("std_mas_tra").disabled = true
         
         if( pictFormat == "panoramic" )
         {
            // set the sizes appropriatelly
            document.getElementById("size_eva_pr").innerHTML = "32x83";
            document.getElementById("size_art_pr").innerHTML = "42x108";
            document.getElementById("size_nat_pr").innerHTML = "60x155";
            document.getElementById("size_mas_pr").innerHTML = "88x227";

            document.getElementById("size_eva_evo").innerHTML = "32x83";
            document.getElementById("size_art_evo").innerHTML = "42x108";
            document.getElementById("size_nat_evo").innerHTML = "60x155";
            document.getElementById("size_mas_evo").innerHTML = "88x227";

            document.getElementById("size_eva_tra").innerHTML = "38x90";
            document.getElementById("size_art_tra").innerHTML = "50x116";
            document.getElementById("size_nat_tra").innerHTML = "72x161";
            document.getElementById("size_mas_tra").innerHTML = "102x240";

            document.getElementById("size_eva_pho").innerHTML = "22x72";
            document.getElementById("size_art_pho").innerHTML = "29x94";
            document.getElementById("size_nat_pho").innerHTML = "40x132";
            document.getElementById("size_mas_pho").innerHTML = "60x196";
         }

		   // Update the link to the language versions
		   document.getElementById("a_en_version").href = 
		      "../../en/services/prints.php?" +
		      picture + "?" +
		      pictFormat + "?" +
		      pictGallery
		   document.getElementById("a_fr_version").href = 
		      "../../fr/services/prints.php?" +
		      picture + "?" +
		      pictFormat + "?" +
		      pictGallery
		}
		else
		{
         document.getElementById("std_art_pr").checked = "checked";

		   document.getElementById("pano_eva_pr").disabled = true
         document.getElementById("pano_eva_evo").disabled = true
         document.getElementById("pano_eva_tra").disabled = true

         document.getElementById("pano_art_pr").disabled = true
         document.getElementById("pano_art_evo").disabled = true
         document.getElementById("pano_art_tra").disabled = true

         document.getElementById("pano_nat_pr").disabled = true
         document.getElementById("pano_nat_evo").disabled = true
         document.getElementById("pano_nat_tra").disabled = true

         document.getElementById("pano_mas_pr").disabled = true
         document.getElementById("pano_mas_evo").disabled = true
         document.getElementById("pano_mas_tra").disabled = true

		}
   }
   else
   {
      // No picture is specified in the URL
      
		// set default values:
      picture = "none";
      pictFormat = "panoramic31";
      pictGallery = "";

      // Enable all sizes as no picture was specified
      document.getElementById("pano_eva_pr").checked = "checked";

      document.getElementById("std_art_pr").disabled = false
      document.getElementById("std_art_evo").disabled = false
      document.getElementById("std_art_tra").disabled = false

      document.getElementById("std_nat_pr").disabled = false
      document.getElementById("std_nat_evo").disabled = false
      document.getElementById("std_nat_tra").disabled = false

      document.getElementById("std_mas_pr").disabled = false
      document.getElementById("std_mas_evo").disabled = false
      document.getElementById("std_mas_tra").disabled = false

      document.getElementById("pano_eva_pr").disabled = false
      document.getElementById("pano_eva_evo").disabled = false
      document.getElementById("pano_eva_tra").disabled = false

      document.getElementById("pano_art_pr").disabled = false
      document.getElementById("pano_art_evo").disabled = false
      document.getElementById("pano_art_tra").disabled = false

      document.getElementById("pano_nat_pr").disabled = false
      document.getElementById("pano_nat_evo").disabled = false
      document.getElementById("pano_nat_tra").disabled = false

      document.getElementById("pano_mas_pr").disabled = false
      document.getElementById("pano_mas_evo").disabled = false
      document.getElementById("pano_mas_tra").disabled = false

      // Update the link to the language versions
      document.getElementById("a_en_version").href = 
         "../../en/services/prints.php"
      document.getElementById("a_fr_version").href = 
         "../../fr/services/prints.php"
   }

   // adjust the hight of the preview if it is a portrait picture
	AdjustPreviewHeight()
	
   // Set the default background colour as black
   if( (pictFormat == "panoramic") ||
       (pictFormat == "panoramic31") )
   {
      printSize  = "eva";
   }
   else
   {
      printSize  = "art";
   }
	printMat = "bb";
   printFrameType = "pr";
   printFrameColour = "dw";

   // Update the preview
   UpdatePreview();

   // Make sure the finish option buttons are enabled as appropriate
   UpdateOptionsSelection();
}

function AdjustPreviewHeight()
{
   if( pictFormat == "portrait" )
   {
      document.getElementById("wall").style.height = "600px"
   }
   else if( pictFormat =="landscape")
   {
      document.getElementById("wall").style.height = "460px"
   }
   else
   {
      document.getElementById("wall").style.height = "460px"
   }
}

// This function updates the preview based on the currently set picture details
function UpdatePreview()
{
   
   // Set the picture
   if( picture != "none" )
   {
      // a picture is specified so use it.
      document.getElementById("preview_pict").src = 
         "../../shared/assets/images/" + picture + "m.jpg"
      document.getElementById("preview_pict").style.visibility="visible";

      // Set the link to go back to the picture in the gallery
      if(language == 1)
      {
         lang="fr";
      }
      else
      {
         lang="en";
      }
      document.getElementById("a_preview_pict").href = 
         "../../shared/gallery/gal.php?gal=" + pictGallery + "&lang=" + lang + "&pictId=" + picture;
   }
   
   // set the frame
   if( printFrameType == "tra" )
   {
    // Frame tradition
      document.getElementById("preview_tra").src = eval(pictFormat + "_tra_" + printFrameColour + ".src") 
      document.getElementById("preview_tra").style.visibility="visible";
      if( picture != "none" )
      {
         /* only show the signature if a picture is selected */
         document.getElementById("preview_sign").style.visibility="visible";
      }
   }
   else
   {
      document.getElementById("preview_tra").style.visibility="hidden";
      document.getElementById("preview_sign").style.visibility="hidden";
   }
   document.getElementById("preview_mat").src = eval(pictFormat + "_" + printFrameType + "_" + printMat + ".src")

   UpdatePreviewPosition()
   UpdatePhotoPrice();
}

// Sets the picture, mat and frame positions according to the format and frame type.
function UpdatePreviewPosition()
{
   if( printFrameType == "tra" )
   {
      if( pictFormat == "panoramic31" )
      {
         document.getElementById("preview_pict").style.top = "-150px"; 
         document.getElementById("preview_pict").style.left = "110px"; 
         document.getElementById("preview_pict").style.height = "174px";
         document.getElementById("preview_mat").style.top = "-193px";
         document.getElementById("preview_mat").style.left = "60px";
         document.getElementById("preview_mat").style.height = "265px";
         document.getElementById("preview_tra").style.top = "-225px";
         document.getElementById("preview_tra").style.left = "29px";
         document.getElementById("preview_tra").style.height = "339px";
         document.getElementById("preview_sign").style.top = "13px";
         document.getElementById("preview_sign").style.left = "600px";
      }
      else if( pictFormat == "panoramic" )
      {
         document.getElementById("preview_pict").style.top = "-141px"; 
         document.getElementById("preview_pict").style.left = "112px"; 
         document.getElementById("preview_pict").style.height = "157px";
         document.getElementById("preview_mat").style.top = "-180px";
         document.getElementById("preview_mat").style.left = "61px";
         document.getElementById("preview_mat").style.height = "240px";
         document.getElementById("preview_tra").style.top = "-209px";
         document.getElementById("preview_tra").style.left = "31px";
         document.getElementById("preview_tra").style.height = "307px";
         document.getElementById("preview_sign").style.top = "6px";
         document.getElementById("preview_sign").style.left = "593px";
      }
      else if ( pictFormat == "landscape" )
      {
         document.getElementById("preview_pict").style.top = "-162px"; 
         document.getElementById("preview_pict").style.left = "217px"; 
         document.getElementById("preview_pict").style.height = "205px";
         document.getElementById("preview_mat").style.top = "-212px";
         document.getElementById("preview_mat").style.left = "156px";
         document.getElementById("preview_mat").style.height = "313px";
         document.getElementById("preview_tra").style.top = "-245px";
         document.getElementById("preview_tra").style.left = "125px";
         document.getElementById("preview_tra").style.height = "392px";
         document.getElementById("preview_sign").style.top = "33px";
         document.getElementById("preview_sign").style.left = "492px";
      }
      else
      {
         // portrait
         document.getElementById("preview_pict").style.top = "-213px"; 
         document.getElementById("preview_pict").style.left = "265px"; 
         document.getElementById("preview_pict").style.height = "310px";
         document.getElementById("preview_mat").style.top = "-265px";
         document.getElementById("preview_mat").style.left = "200px";
         document.getElementById("preview_mat").style.height = "423px";
         document.getElementById("preview_tra").style.top = "-299px";
         document.getElementById("preview_tra").style.left = "165px";
         document.getElementById("preview_tra").style.height = "513px";
         document.getElementById("preview_sign").style.top = "87px";
         document.getElementById("preview_sign").style.left = "440px";
      }  
      document.getElementById("preview_pict").style.border = "0px"
   }
   else
   {
      // evolution or print only
      if( pictFormat == "panoramic31" )
      {
         document.getElementById("preview_pict").style.top = "-151px"; 
         document.getElementById("preview_pict").style.left = "109px"; 
         document.getElementById("preview_pict").style.height = "174px"; 
         document.getElementById("preview_mat").style.top = "-198px";
         document.getElementById("preview_mat").style.left = "55px";
         document.getElementById("preview_mat").style.height = "287px";
      }
      else if( pictFormat == "panoramic" )
      {
         document.getElementById("preview_pict").style.top = "-142px"; 
         document.getElementById("preview_pict").style.left = "111px"; 
         document.getElementById("preview_pict").style.height = "157px"; 
         document.getElementById("preview_mat").style.top = "-183px";
         document.getElementById("preview_mat").style.left = "62px";
         document.getElementById("preview_mat").style.height = "258px";
      }
      else if ( pictFormat == "landscape" )
      {
         document.getElementById("preview_pict").style.top = "-163px"; 
         document.getElementById("preview_pict").style.left = "216px"; 
         document.getElementById("preview_pict").style.height = "205px";
         document.getElementById("preview_mat").style.top = "-220px";
         document.getElementById("preview_mat").style.left = "151px";
         document.getElementById("preview_mat").style.height = "341px";
      }
      else
      {
         // portrait
         document.getElementById("preview_pict").style.top = "-214px"; 
         document.getElementById("preview_pict").style.left = "264px"; 
         document.getElementById("preview_pict").style.height = "310px"; 
         document.getElementById("preview_mat").style.top = "-274px";
         document.getElementById("preview_mat").style.left = "198px";
         document.getElementById("preview_mat").style.height = "450px";
      }  
      if( printMat == "bb" )
      {
         document.getElementById("preview_pict").style.border = "solid 1px rgb(50,50,50)"
      }
      else
      {
         document.getElementById("preview_pict").style.border = "solid 1px rgb(180,180,180)"
      }
   }
}

function SetPrevFormatFrame( format, size, frame )
{
   printFrameType = frame;
   printSize = size;
   switch( pictFormat )
   {
      case "panoramic":
      case "panoramic31":
         if(format == "land")
         {
            pictFormat = "landscape";
         }
         break;
         
      case "landscape":
      case "portrait":
         if(format == "pano")
         {
            pictFormat = "panoramic31"
         }
   }
   AdjustPreviewHeight();
   UpdatePreview();
   UpdateOptionsSelection();
}

function UpdateOptionsSelection()
{
   // move the selection of the options to the corresponding frame type
   document.getElementById("black_pr").checked = ""; 
   document.getElementById("white_pr").checked = ""; 
   document.getElementById("black_evo").checked = ""; 
   document.getElementById("white_evo").checked = ""; 
   document.getElementById("black_tra").checked = ""; 
   document.getElementById("white_tra").checked = "";
   switch(printFrameType)
   {
      case "pr":
         if( printMat == "bb" )
         {
            document.getElementById("black_pr").checked = "checked";
         }
         else
         {
            document.getElementById("white_pr").checked = "checked";
         }
         // enable/disable the options according to the frame type
         document.getElementById("black_pr").disabled = false;
         document.getElementById("white_pr").disabled = false;
         document.getElementById("black_evo").disabled = true;
         document.getElementById("white_evo").disabled = true;
         document.getElementById("black_tra").disabled = true;
         document.getElementById("white_tra").disabled = true;
         document.getElementById("dark").disabled = true;
         document.getElementById("clear").disabled = true;
         break;

      case "evo":
         if( printMat == "bb" )
         {
            document.getElementById("black_evo").checked = "checked";
         }
         else
         {
            document.getElementById("white_evo").checked = "checked";
         }
         // enable/disable the options according to the frame type
         document.getElementById("black_pr").disabled = true;
         document.getElementById("white_pr").disabled = true;
         document.getElementById("black_evo").disabled = false;
         document.getElementById("white_evo").disabled = false;
         document.getElementById("black_tra").disabled = true;
         document.getElementById("white_tra").disabled = true;
         document.getElementById("dark").disabled = true;
         document.getElementById("clear").disabled = true;
         break;
      
      case "tra":
         if( printMat == "bb" )
         {
            document.getElementById("black_tra").checked = "checked";
         }
         else
         {
            document.getElementById("white_tra").checked = "checked";
         }
         // enable/disable the options according to the frame type
         document.getElementById("black_pr").disabled = true;
         document.getElementById("white_pr").disabled = true;
         document.getElementById("black_evo").disabled = true;
         document.getElementById("white_evo").disabled = true;
         document.getElementById("black_tra").disabled = false;
         document.getElementById("white_tra").disabled = false;
         document.getElementById("dark").disabled = false;
         document.getElementById("clear").disabled = false;
         break;
   }   
}

function SetPrintBorder(colour)
{
   printMat = colour;
   UpdatePreview();
}

function SetFrameColour(colour)
{
   printFrameColour = colour;
   UpdatePreview();
}
 /******************************************************************************
 *
 * Function:
 *
 * Parameters:
 *
 * Returns:
 *
 * Description:
 *
 *****************************************************************************/
function UpdatePictId()
{
   /* Set the picture ID in the order form */
   document.getElementById("picture_id").value = picture.substring(3)
}

function UpdatePostPrice()
{
   SetPostPrice();
   UpdateTotalPrice();
}

function UpdatePhotoPrice()
{
   printPrice = aPrintPrices[aMainFormat[pictFormat]][aPrintFrameType[printFrameType]][aPrintSize[printSize]];
   document.getElementById("print_price").value = printPrice.toFixed(2)
   SetPostPrice();
   UpdateTotalPrice();
}

function SetPostPrice()
{
   if( true == document.getElementById("pickup").checked )
   {
      postPrice = 0.00
      document.getElementById("post_price").value = postPrice.toFixed(2)
   }
   else if(document.getElementById("countr").value != "Sélectionnez Pays")
   {
      postPrice = aPostPrices[aMainFormat[pictFormat]][aPrintFrameType[printFrameType]][aPrintSize[printSize]][aZone[document.getElementById("countr").value]];
      if(0 == postPrice)
      {
         document.getElementById("post_price").value = "(sur demande)"
      }
      else
      {
         document.getElementById("post_price").value = postPrice.toFixed(2)
      }
   }
   else
   {
      postPrice = 0
   }
}

function UpdateTotalPrice()
{
   total = printPrice + postPrice
   document.getElementById("total_price").value = total.toFixed(2);
}

function UpdatePictIdHelp()
{
   if( 1 == language )
   {
   	alert("Pour spécifier le numéro de référence de la photo de votre choix, retournez dans la GALERIE et cliquez sur la photo, alors, ce champ se remplira automatiquement avec le numéro désiré.");
   }
   else
   {
      alert("In order to set the picture ID, when viewing the picture of your choice in the GALLERY pages simply click on the main picture. This field will then be updated automatically with the correct ID.");
   }
}

/******************************************************************************
 *
 * Description: Functions to validates various fields of the print order form
 *
 *****************************************************************************/

/******************************************************************************
 *
 * Function:
 *
 * Parameters:
 *
 * Returns:
 *
 * Description: Validates the whole print order form
 *
 *****************************************************************************/
function ValidateForm( thisForm )
{
   var errTxt

   if( ValidateRefPhoto( thisForm.picture_id ) == false )
   {
      thisForm.picture_id.focus();
      return false;
   }

   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre titre."
   }
   else
   {
      errTxt = "Please, specify your title."
   }
   if( ValidateField( thisForm.cust_title, errTxt ) == false )
   {
      thisForm.cust_title.focus();
      return false;
   }

   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre Prénom."
   }
   else
   {
      errTxt = "Please, specify your first name."
   }
   if( ValidateField( thisForm.firstname, errTxt ) == false )
   {
      thisForm.firstname.focus();
      return false;
   }
  
   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre Nom."
   }
   else
   {
      errTxt = "Please, specify your surname"
   }
   if( ValidateField( thisForm.surname, errTxt ) == false )
   {
      thisForm.surname.focus();
      return false;
   }
   
   if( ValidateEmail( thisForm.email ) == false )
   {
      thisForm.email.focus();
      return false;
   }

   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre adresse."
   }
   else
   {
      errTxt = "Please specify your address"
   }
   if( ValidateField( thisForm.address, errTxt ) == false )
   {
      thisForm.address.focus();
      return false;
   }
   
   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre ville."
   }
   else
   {
      errTxt = "Please, specify your town"
   }
   if( ValidateField( thisForm.town, errTxt ) == false )
   {
      thisForm.town.focus();
      return false;
   }

   if(1 == language)
   {
      errTxt = "Veuillez s'il vous plait spécifier votre code postal."
   }
   else
   {
      errTxt = "Please specify your post code"
   }
   if( ValidateField( thisForm.post_code, errTxt ) == false )
   {
      thisForm.post_code.focus();
      return false;
   }

   if( ValidateCountry( thisForm.countr ) == false )
   {
      thisForm.countr.focus();
      return false;
   }

   /* Ensure at least one phone number is entered */
   if( ((thisForm.phone.value == null)  || (thisForm.phone.value=="")) &&
       ((thisForm.mobile.value == null) || (thisForm.mobile.value=="")) )
   {
      if(1 == language)
      {
         alert("Veuillez s'il vous plait spécifier soit votre numéro de téléphone\nsoit votre numéro de natel, soit les deux.")
      }
      else
      {
         alert("Please specify either your phone number or your mobile number, or both.")
      }
      thisForm.phone.focus();
      return false
   }
   
   if( ValidatePhone( thisForm.phone ) == false )
   {
      thisForm.phone.focus();
      return false;
   }

   if( ValidatePhone( thisForm.mobile ) == false )
   {
      thisForm.mobile.focus();
      return false;
   }
}
