var projects = new Array();
var potfolioCategoriesStart = new Array();
var projectsCategoriesStart = new Array();
var presentation = new Array(19, 8, 2, 0, 7, 10, 6, 11, 14, 22, 17, 9, 12, 15, 18, 13, 1, 5, 3, 4);
var projArr = new Array(28,27,26,17,20,19,15,13,11,2,0,34,24,22,18,16,10,9,6,7,36,4,8,-1,1,3,5,12,14,21,23,25,29,30,31,32,33,35);                        
var fullProjects = new Array();
var imgWidths = new Array(512,320,576,575,575,576,704,576,561,213,562,320,544,552,576,427,545,213,563,576,600,562,562,513,600,600,600,600,600,600,600,600,600,600,600,600,600,600);
var loadedItems = 0;
var itemsToLoad = 170;

// nulty projekt musim definovat uz tu
projects.push(new Project('Center of the culture and arts', 8, 1, 8)); 

$(document).ready(function () {

  // jednotlive projekty  
  projects.push(new Project('Exhibition stand - Prague quadrennial', 4, 1, 7));
  projects.push(new Project('Offices omnia - Facade', 2, 1, 7));
  projects.push(new Project('Exhibition stand for vital', 4, 1, 7));
  projects.push(new Project('House Mayo', 5, 1, 7));
  projects.push(new Project('House K', 8, 1, 7));
  projects.push(new Project('Apartments Nova Lesna', 10, 1, 6));
  projects.push(new Project('House Kraliky', 7, 1, 6));
  projects.push(new Project('Center of contemporary arts', 5, 1, 6));
  projects.push(new Project('Gaarden passage', 3, 1, 5));
  projects.push(new Project('Xella', 4, 1, 5));
  projects.push(new Project('Exhibition hall - Art center', 8, 2, 8));
  projects.push(new Project('Offices - Forza', 8, 2, 7));
  projects.push(new Project('Offices enterprise investors', 3, 2, 7));
  projects.push(new Project('Apartment Erdbergstrasse', 8, 2, 7));
  projects.push(new Project('Lecture hall - Neurological clinic', 6, 2, 7));
  projects.push(new Project('Zamocka mezonet', 5, 2, 6));
  projects.push(new Project('Zamocka 3 + 1', 10, 2, 6));
  projects.push(new Project('Digital library', 3, 2, 6));
  projects.push(new Project('Hair design studio', 4, 2, 6));
  projects.push(new Project('Burnt mirror', 0, 3, 8));
  projects.push(new Project('Reception - Wellness Santovka', 3, 3, 5));
  projects.push(new Project('Desk - Hair design', 2, 3, 6));
  projects.push(new Project('', 5, 4, 0));
  
  fullProjects.push(projects[10]);
  fullProjects.push(new Project('Hotel Bratislava', 0, 0, 5));
  fullProjects.push(projects[9]);
  fullProjects.push(new Project('Fitness centre Mlyny E', 0, 0, 5));
  fullProjects.push(projects[21]);
  fullProjects.push(new Project('Fitness centre Mlyny K+M', 0, 0, 6));
  fullProjects.push(projects[18]);
  fullProjects.push(projects[19]);
  fullProjects.push(projects[22]);
  fullProjects.push(projects[17]);
  fullProjects.push(projects[16]);
  fullProjects.push(projects[8]);
  fullProjects.push(new Project('Apartment house - Martin', 0, 0, 6));
  fullProjects.push(projects[7]);
  fullProjects.push(new Project('Apartment Modra', 0, 0, 6));
  fullProjects.push(projects[6]);
  fullProjects.push(projects[15]);
  fullProjects.push(projects[3]);
  fullProjects.push(projects[14]);
  fullProjects.push(projects[5]);
  fullProjects.push(projects[4]);
  fullProjects.push(new Project('Oáza Sibirských tigrov', 0, 0, 7));
  fullProjects.push(projects[13]);
  fullProjects.push(new Project('House Slovensky Grob', 0, 0, 7));
  fullProjects.push(projects[12]);
  fullProjects.push(new Project('House Rusovce', 0, 0, 7));
  fullProjects.push(projects[2]);
  fullProjects.push(projects[1]);
  fullProjects.push(projects[0]);
  fullProjects.push(new Project('Offices Istrokapital', 0, 0, 8));
  fullProjects.push(new Project('Apartement - River Park', 0, 0, 8));
  fullProjects.push(new Project('Polyfunction Trenčín', 0, 0, 8));
  fullProjects.push(new Project('House Mojmírovce', 0, 0, 8));
  fullProjects.push(new Project('Apartment Hurbanova', 0, 0, 8));
  fullProjects.push(projects[11]);
  fullProjects.push(new Project('House Sokolce', 0, 0, 8));
  fullProjects.push(projects[20]);
  
  potfolioCategoriesStart[1] = 0;
  potfolioCategoriesStart[2] = 11;
  potfolioCategoriesStart[3] = 20;
  potfolioCategoriesStart[4] = 23;
  
  projectsCategoriesStart[5] = 10;
  projectsCategoriesStart[6] = 26;
  projectsCategoriesStart[7] = 15;
  projectsCategoriesStart[8] = 0;  
  
  activeProjectsProject = fullProjects[0].id;
  activeProjectsProjectTemp = activeProjectsProject;
  
});

/*
var projInd = 0;
$.get('texts/' + projInd + '.html', loadNextAboutText);
  
// nacitavanie textov
function loadNextAboutText(data) {       
  projects[projInd].aboutText = data;
  if (projInd < (projects.length - 1)) {
    projInd++;
    $.get('texts/' + projInd + '.html', loadNextAboutText);
  } 
}       
*/

function loadText(obj) {
  $.get('texts/' + obj.id + '.html', function(data) {
    obj.aboutText = data;
    nextItemLoaded();
  });
}

function nextItemLoaded() {
  loadedItems++; 
  $('#loader-percent').html(((loadedItems / itemsToLoad)*100).toFixed(0) + '%');
  $('#loader-slider').css({width:  ((loadedItems / itemsToLoad)*100).toFixed(0) + 'px'});
}
