// JavaScript Document
var number = 1;
var lastWrap = 1;
var hiding = false;
var canBlur = true;

var img1 = new Image();
var img2 = new Image();
var img3 = new Image();
var img4 = new Image();
var img5 = new Image();
var img6 = new Image();
var img7 = new Image();
var img8 = new Image();
var img9 = new Image();
var img10 = new Image();
var img11 = new Image();
var img12 = new Image();
var img01 = new Image();
var img02 = new Image();
var img03 = new Image();
var img04 = new Image();
var img05 = new Image();
var img06 = new Image();
var img07 = new Image();
var img08 = new Image();
var img09 = new Image();
var img010 = new Image();
var img011 = new Image();
var img012 = new Image();
var img13 = new Image();
var img013 = new Image();
var img14 = new Image();
var img014 = new Image();
	


img1.src = "images/1.jpg";
img2.src = "images/2.jpg";
img3.src = "images/3.jpg";
img4.src = "images/4.jpg";
img5.src = "images/5.jpg";
img6.src = "images/6.jpg";
img7.src = "images/7.jpg";
img8.src = "images/8.jpg";
img9.src = "images/9.jpg";
img10.src = "images/10.jpg";
img11.src = "images/11.jpg";
img12.src = "images/12.jpg";
img13.src = "images/sprzet.jpg";
img14.src = "images/event.jpg";
img01.src = "images/1_b.jpg";
img02.src = "images/2_b.jpg";
img03.src = "images/3_b.jpg";
img04.src = "images/4_b.jpg";
img05.src = "images/5_b.jpg";
img06.src = "images/6_b.jpg";
img07.src = "images/7_b.jpg";
img08.src = "images/8_b.jpg";
img09.src = "images/9_b.jpg";
img010.src = "images/10_b.jpg";
img011.src = "images/11_b.jpg";
img012.src = "images/12_b.jpg";
img013.src = "images/sprzet_b.jpg";
img014.src = "images/event_b.jpg";

$(window).load(function(){
	
   // Load the classic theme
   Galleria.loadTheme('galleria.classic.min.js');

	canBlur = true;
	
	$("#sliders>*").show();
	
	number = Math.floor(Math.random()*7+1);
	eval("document['picture'].src = img"+number+".src");
	eval("document['picture2'].src = img0"+number+".src");

	$(this).delay(500,function(){
		$("#logo").animate(
           {"opacity": "1"},
           "slow");
	});
	$(this).delay(6000,function(){
           $("#cover1").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover2").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover3").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover4").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover5").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover6").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover7").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover8").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover9").animate(	
           {"opacity": "0"},"fast",
           function(){
           $("#cover10").animate(	
           {"opacity": "0"},"fast"
           , function(){
           $("#cover11").animate(	
           {"opacity": "0"},"fast"
           , function(){
           $("#cover12").animate(	
           {"opacity": "0"});
           });
           });
           });
           });
           });
           });
           });
           });
           });
           });
           });
	});
	
	$(this).delay(1500,function(){
		
		//Show the elements	
		$("#photo-anim").stop().animate({"left": "0px"}, {queue:false,
duration:1000});
		
		$buildingup = true;	
		
   });

   $(this).delay(3000,function(){
		
		//Show the elements	
		$("#foreground").stop().animate({top:'-500px'}, {queue:false, duration:2000});
		$("#underground").stop().animate({top:'1000px'}, {queue:false,
duration:2000});
		$buildingup = true;	
		
   });

    $(this).delay(4000,function(){
		
		$('#gradient').animate({'opacity' : "1"}, 'slow');
				$('#gradient').animate({'filter': "alpha(opacity=30)"}, 'slow');

		
   });
   $(this).delay(4600,function(){
		loadNewsPanel(1);
		
		$("#like1").animate({"left": "-0px"},"slow");
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
       });	
   });
});
	
function loadHome(){
	canBlur = true;
	
	cleanDesk(0);
	cleanArtist();
	cleanEquipment();
	wrappers(1);
	
	
	$(this).delay(2100,function(){
	
		loadPhotoAnim(-1); // -1 jest żeby nie fadowało brazu bo itak sie wsuwa
	
		document.getElementById('photo-anim').style.left = '-1920px';
		document.getElementById('foreground').style.top = '2px';
		document.getElementById('photo-anim').style.opacity = '1';
		document.getElementById('photo-anim').style.display = 'inline';
	
		document.getElementById('underground').style.top = '450px';
	
		$("#photo-anim").stop().animate({"left": "0px"}, {duration:2000});
	});
	
	$(this).delay(4500,function(){
		
		//Show the elements	
		$("#foreground").stop().animate({top:'-500px'}, {queue:false, duration:2000});
		$("#underground").stop().animate({top:'1000px'}, {queue:false,
duration:2000});
		$buildingup = true;	
		
	});
	
	 $(this).delay(5500,function(){
		
		$("#like1").animate({"left": "-0px"},"slow");
		$('#gradient').animate({"opacity" : "1"}, 'slow');
		loadNewsPanel(1);
		
	});
	
	$(this).delay(6500,function(){
		
		$("#text1").animate(	
	        {"opacity": "1"},"slow",
	        function(){
	        $("#text2").animate(	
	        {"opacity": "1"},"slow",
	        function(){
       	constructed();
	        $("#text3").animate(	
	        {"opacity": "1"});"slow"
	        });
	        });
		
	});
		
}
function loadPhotographers(){
	
	cleanDesk(0);
	cleanArtist();
	cleanEquipment();
	canBlur = true;
	wrappers(2);
	
	$(this).delay(2100,function(){
		
		loadPhotoAnim(0);
		
//		var newHTML = "MAKATA reprezentuje czołowych  fotografów, których zdjęcia ukazują się w polskich i zagranicznych magazynach.";
	var newHTML = "";
		document.getElementById('text1').innerHTML = newHTML;	
		//newHTML = "Ich prace zdobią billboardy renomowanych marek w całej Europie.";
		newHTML = "";
		document.getElementById('text2').innerHTML = newHTML;
		document.getElementById('text3').innerHTML = "";	
	});
	
	/*
   $(this).delay(4500,function(){
		
		//Show the elements	
		$("#foreground").stop().animate({top:'-500px'}, {queue:false, duration:2000});
		$("#underground").stop().animate({top:'1000px'}, {queue:false,
duration:2000});
		$buildingup = true;	
		
   });
   */

    $(this).delay(2100,function(){
		
		//Show the elements	
		$('#gradient').animate({'opacity' : "1"}, 'slow');
		//$("#gradient").stop().animate({top:'2px'}, {queue:false, duration:2000});
		
   });
  $(this).delay(3000,function(){
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
           });
   });

	$(this).delay(4000,function(){
		
		$("#subMenu1").animate(	
           {"left": "-1px"},"slow");
   	});
   	
   	$(this).delay(4200,function(){	
	        loadArtists();
   	});
};

function loadArtists(){
	hiding = true;
	$("#wyswietl_artystow").animate({"left": "-350px"},"slow");
	
	canBlur = true;
	
	$("#artist0").animate({"left": "-1px"},"slow");
	$("#artist0_w").animate({"left": "-1px"},"slow");
	
	$(this).delay(200,function(){
		$("#artist1").animate({"left": "-1px"},"slow");
		$("#artist1_w").animate({"left": "-1px"},"slow");
   });
	
	$(this).delay(400,function(){
		$("#artist2").animate({"left": "-1px"},"slow");
		$("#artist2_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(600,function(){
		$("#artist4").animate({"left": "-1px"},"slow");
		$("#artist4_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(800,function(){
		$("#artist5").animate({"left": "-1px"},"slow");
		$("#artist5_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1000,function(){
		$("#artist6").animate({"left": "-1px"},"slow");
		$("#artist6_w").animate({"left": "-1px"},"slow");
   });
    $(this).delay(1200,function(){
		$("#artist7").animate({"left": "-1px"},"slow");
		$("#artist7_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1400,function(){
		$("#artist8").animate({"left": "-1px"},"slow");
		$("#artist8_w").animate({"left": "-1px"},"slow");
		constructed();
		hiding = false;
   });
}

function loadEquipmentCategories(){
	hiding = true;
	
	//$("#subMenu4").animate({"left": "-1px"},"slow");
	
	canBlur = true;
	
	$("#equipment0").animate({"left": "-1px"},"slow");
	$("#equipment0_w").animate({"left": "-1px"},"slow");
	
	$(this).delay(200,function(){
		$("#equipment1").animate({"left": "-1px"},"slow");
		$("#equipment1_w").animate({"left": "-1px"},"slow");
   });
	
	$(this).delay(400,function(){
		$("#equipment2").animate({"left": "-1px"},"slow");
		$("#equipment2_w").animate({"left": "-1px"},"slow");
   });
  $(this).delay(600,function(){
		$("#equipment3").animate({"left": "-1px"},"slow");
		$("#equipment3_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(800,function(){
		$("#equipment4").animate({"left": "-1px"},"slow");
		$("#equipment4_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1000,function(){
		$("#equipment5").animate({"left": "-1px"},"slow");
		$("#equipment5_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1200,function(){
		$("#equipment6").animate({"left": "-1px"},"slow");
		$("#equipment6_w").animate({"left": "-1px"},"slow");
   });
    $(this).delay(1400,function(){
		$("#equipment7").animate({"left": "-1px"},"slow");
		$("#equipment7_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1600,function(){
		$("#equipment8").animate({"left": "-1px"},"slow");
		$("#equipment8_w").animate({"left": "-1px"},"slow");
   });
   $(this).delay(1800,function(){
		$("#equipment9").animate({"left": "-1px"},"slow");
		$("#equipment9_w").animate({"left": "-1px"},"slow");
		constructed();
		hiding = false;
   });
}

function loadProduction(){
	cleanDesk(0);
	cleanArtist();
	cleanEquipment();
	canBlur = true;
	wrappers(3);
	
	$(this).delay(2100,function(){

		loadPhotoAnim(0);		
		
		var newHTML = "MAKATA zajmuje się produkcją sesji zdjęciowych i materiałów filmowych.";
		document.getElementById('text1').innerHTML = newHTML;
		newHTML = "Zdjęcia tworzymy począwszy od koncepcji kreatywnej po oddanie gotowego materiału klientowi.";
		document.getElementById('text2').innerHTML = newHTML;	
		newHTML = "Od wielu lat z Makatą pracują ekipy światowej klasy specjalistów. Realizujemy wszelkiego rodzaju produkcje zarówno w kraju jak i poza jego granicami.";
		document.getElementById('text3').innerHTML = newHTML;	
	});

    $(this).delay(2100,function(){
		
		//Show the elements	
		$('#gradient').animate({'opacity' : "1"}, 'slow');
		//$("#gradient").stop().animate({top:'2px'}, {queue:false, duration:2000});
		
   });
  $(this).delay(3000,function(){
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
           });
   });

	$(this).delay(4000,function(){
		
		$("#subMenu2").animate(	
           {"left": "-1px"},"slow");
       $("#like1").animate({"left": "-0px"},"slow");
       constructed();

   });
}

function loadStudio(){
		cleanDesk(0);
		cleanArtist();
		cleanEquipment();
		canBlur = true;
		wrappers(4);
	
	$(this).delay(2100,function(){

		loadPhotoAnim(3);
		
		var newHTML = "Studia MAKATA są najnowocześniejszą i najlepiej wyposażoną przestrzenią fotograficzną w Polsce.";
		document.getElementById('text1').innerHTML = newHTML;	
		newHTML = "Dzięki doskonałemu designowi i nieograniczonym możliwościom aranżacji odbywają się tu nie tylko";
		document.getElementById('text2').innerHTML = newHTML;
		newHTML = "sesje fotograficzne i nagrania filmowe, ale również eventy ekskluzywnych marek."
		document.getElementById('text3').innerHTML = newHTML;	
	});
	
	/*
   $(this).delay(4500,function(){
		
		//Show the elements	
		$("#foreground").stop().animate({top:'-500px'}, {queue:false, duration:2000});
		$("#underground").stop().animate({top:'1000px'}, {queue:false,
duration:2000});
		$buildingup = true;	
		
   });
   */

    $(this).delay(2100,function(){
		
		//Show the elements	
		$('#gradient').animate({'opacity' : "1"}, 'slow');
		//$("#gradient").stop().animate({top:'2px'}, {queue:false, duration:2000});
		
   });
  $(this).delay(3000,function(){
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
           });
   });

	$(this).delay(4000,function(){
		
		$("#subMenu3").animate(	
           {"left": "-1px"},"slow");
           $("#like2").animate({"left": "-0px"},"slow");
           constructed();
   });
}

function loadEquipment(){
	
		cleanDesk(0);
		cleanArtist();
		canBlur = true;
		wrappers(5);
		
	$(this).delay(2100,function(){
		
		loadPhotoAnim(13);
		
		$('#gradient').animate({'opacity' : "1"}, 'slow');
		//$("#gradient").stop().animate({top:'2px'}, {queue:false, duration:2000});
		
		var newHTML = "W MAKATA Rental można wynająć najnowocześniejszy sprzętu fotograficzny renomowanych marek: Profoto, Broncolor, PhaseOne, Hasselblad i wielu innych.";
		document.getElementById('text1').innerHTML = newHTML;	
		newHTML = "";
		document.getElementById('text2').innerHTML = newHTML;
		document.getElementById('text3').innerHTML = newHTML;	
		
   });
  $(this).delay(3000,function(){
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
           });
   });

	$(this).delay(4000,function(){
		
		$("#like2").animate({"left": "-0px"},"slow");
		loadEquipmentCategories();
   });
}

function loadEquipmentTable(table){
	
	var ajaxRequest;  // The variable that makes Ajax possible!
			
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke in the loadPopup function!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			document.getElementById('lista').innerHTML = ajaxRequest.responseText;
			popup();
		}
	}

	ajaxRequest.open("GET", "equipment_tables.php?category="+table, true);
	ajaxRequest.send(null);	
}

function loadEvents(){
	
		cleanDesk(0);
		cleanArtist();
		cleanEquipment();
		canBlur = true;
		wrappers(6);
	
		
	$(this).delay(2100,function(){
		
		loadPhotoAnim(14);
		
		var newHTML = "Dzięki nieograniczonym możliwościom aranżacji w studiach MAKATA organizowane są wszelkiego rodzaju eventy.";
		document.getElementById('text1').innerHTML = newHTML;	
		newHTML = "";
		document.getElementById('text2').innerHTML = newHTML;
		document.getElementById('text3').innerHTML = newHTML;
		
	});
	

    $(this).delay(2100,function(){
		
		//Show the elements	
		$('#gradient').animate({'opacity' : "1"}, 'slow');
		//$("#gradient").stop().animate({top:'2px'}, {queue:false, duration:2000});
		
   });
  $(this).delay(3000,function(){
		
		$("#text1").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text2").animate(	
           {"opacity": "1"},"slow",
           function(){
           $("#text3").animate(	
           {"opacity": "1"});"slow"
           });
           });
   });

	$(this).delay(4000,function(){
		
		$("#subMenu5").animate(	
           {"left": "-1px"},"slow");
           constructed();
   });

	
}

function loadClients(){
	
	
		
		cleanDesk(0);
		cleanArtist();
		cleanEquipment();
		canBlur = true;
		wrappers(7);
	
		var myString = [
			 	'<table id="klienci">',
          		'<tr>',
              '<td width="180">',
   				'ACTION IMAGES<br>',
				'ALIOR BANK<br>',
				'ARIP<br>',
				'AVON<br> ',
				'AXEL SPFIINGER<br>',
				'BATA<br>',
				'BBDO<br> ',
				'BRAUN<br> BRE BANK<br>',
				'BURDA PUBLISHING<br>',
				'CANAL PLUS<br> ',
				'COLGATE-PALMOLIVE<br>',
				'COSMOPOLITAN<br> ',
				'COYOCO',
				'DAVIDOFF<br>',
				'DDB<br> ',
				'DOVE <br>EDIPRESSE<br>',
				'ELLE<br> ',
				'ERIS<br> ',
				'FUTU<br> ',
				'G+J MEDIA<br>',
				'G7<br> ',
				'GALA<br>',
              'GATTA<br>',
              'GENERALI<br>',
				'GLAMOUR<br>',
				'GONNABE <br>',
				'GREY GROUP<br>',
				'GRUNER +    JAHR<br>',
				'GUTENBERG ON  LINE<br>',
				
              '</td>',
              '<td width="180">',
              
				
				'HEAD&SHOULDERRS<br>',
				'IN STYLE<br>',
				'JUST<br> ',
				'KAZAR<br>',
				'KOLEDZY<br>',
				'KROPKA BORDO<br>',	
				'LED BURNETT<br>',
				'LEVI`S v<br>',
				'L`OREAL <br>',
				'LACIBIOS FEMINA<br>',
				'LOTOS<br>',
				'ŁOMŻA<br>',
				'MAC <br>',
				'MARQUARD MEDIA<br>',
				'MBANK <br>',
				'MILLENIUM BANK<br>',
				'MORI LEE<br> ',
				'MTV<br> ',
				'NIKE<br> ',
				'NIVEA<br> ',
				'ORANGE <br>',
				'ORLEN<br>',
              	'PANI <br>',
              	'PAOLA<br>',
              	'PEUGEOT<br>',
				'PLAY <br>',
				'PLAYBOY<br>',
				'PLUS GSM<br>',
              	'POLSAT<br>',
              	'PZL<br>',
				
				
               '               </td>',
              '<td width="180">',
              	
              	'REDWORKS<br> ',
				'REDDS<br>',
				'RENAULT<br>',
				'RMF CLASSIC<br>',
				'ROCHSTAR <br>',
				'RONALD JOYCE<br>',
				'SAMO ZDROWIE<br> ',
				'SAATCHI&SAATCHI<br>',
				'SENS<br>',
				'SEPHORA <br>',
				'SMASH BOX <br>',
				'SODEXO<br>',
				'SORAYA<br> ',
				'STEROLEA<br>',
				'SUNSILK <br>',
				'TEATR MUZYCZNY ROMA<br>',
				'TESTARDO RED CELL<br> ',
				'TBWA<br>',
				'TVN <br>',
				'TVP <br>',
				'TWÓJ STYL<br>',
				'UPC<br>',
				'URODA VICHY<br> ',
				'VEET<br>',
				'VIVA<br>',
				'VOLVO<br>',
				'WBK BANK<br>',
				'W.KRUK<br>',
				'WOLA PARK<br>',
				'ZELMER<br>',
				'ZWIERCIADŁO<br>',
              '</td>',
          '</tr>',
      '</table>',
		  ].join('\n');
		
	$(this).delay(2100,function(){
		
		document.getElementById('photo-anim').innerHTML = myString;
		$("#photo-anim").fadeIn("1000", function(){
			document.getElementById('photo-anim').style.opacity = '1';
			document.getElementById('photo-anim').style.display = 'inline';	
			constructed();	
		});
		
	});
	
}

function loadNewsletter(){
	cleanDesk(0);
	$(this).delay(500,function(){
		loadNewsletters();
	});
}

function loadWorkshops(){
	 	cleanDesk(0);
		cleanArtist();
		cleanEquipment();
		canBlur = true;
		wrappers(10);
	
		var myString = [
			 	'<table id="linki">',
			 	'<tr>',
              '<td id="artist_name" align="center" height="90" width="100">',
              '<a href="http://facebook.com/skulmak" target="_blank"><img src="images/skulmak2.png"alt="skulmak.pl"/></a>',
				

              '<td id="artist_name" align="center" height="90" width="100">',
              '<a href="http://www.rentdesign.pl"target="_blank"><img src="images/rent.png" alt="logo makata"/></a>',
				'</tr>',

          		'<tr>',

              '<td id="artist_name" align="center" height="90" width="100">',
              '<a href="http://www.emilbilinski.com/"target="_blank"><img src="images/emil.png" alt="logo makata"/></a>',
				

              '<td id="artist_name" align="center" height="90"  width="100">',
              '<a href="http://www.fotobongo.com"target="_blank"><img src="images/fotobongo.jpg" alt="logomakata"/></a>',
				'</tr>',
				'<tr>',

              '<td id="artist_name" align="center" height="90" width="100">',
              '<a href="http://www.jolaskora.com"target="_blank"><imgsrc="images/skora.png" alt="logo makata"/></a>',
				

              '<td id="artist_name" align="center" height="90"  width="100">',
              '<a href="http://www.piekrzewski.com" target="_blank"><img src="images/piekrzewski.png" alt="logo makata"/></a>',
				'</tr>',
			   '<tr>',

              '<td id="artist_name" align="center" height="90"  width="100">',
              '<a href="http://www.campusgirls.pl"target="_blank"><img src="images/campusgirls.jpg" alt=" campusgirls"/></a>',
				'</tr>',
				
				
              '</td>',

          '</tr>',
      '</table>',
		  ].join('\n');
		
	$(this).delay(2100,function(){
		
		document.getElementById('photo-anim').innerHTML = myString;
		$("#photo-anim").fadeIn("1000", function(){
			document.getElementById('photo-anim').style.opacity = '1';
			document.getElementById('photo-anim').style.display = 'inline';	
			constructed();	
		});
		
	});
	

}

function loadVideo(){
		cleanDesk(0);
		cleanArtist();
		cleanEquipment();
		canBlur = true;
		wrappers(8);
		
		document.getElementById('tdg').style.display = 'none';		
		

	
	$(this).delay(500,function(){
		//alert('mnmkm');
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			document.getElementById('tdg').innerHTML = ajaxRequest.responseText;
			// Initialize Galleria
			<!-- videoThumb is a css class found in the foreach list class="videoThumb". ytvideo is the holder ID set as div ID-->
						$(".videoThumb2").ytplaylist({
							hd:true,
							html5: false,
							autoPlay: true,
							autoHide: false,
							playOnLoad: false,
							holderId: 'ytvideo2',
							playerColor: 'F2F2F2',
							modestbranding: false,
							playerversion: '&amp;version=3'
						});
						$(this).delay(2000, function(){
							$('#tdg').fadeIn("slow");
							constructed();
						});
					}
				}

	ajaxRequest.open("GET", "youtube_generator.php", true);
	ajaxRequest.send(null);
		
		$("#subMenu7").animate({"left": "-1px"},"slow");
		
		/*
		document.getElementById('photo-anim').innerHTML = myString;
		$("#photo-anim").fadeIn("1000", function(){
			document.getElementById('photo-anim').style.opacity = '1';
			document.getElementById('photo-anim').style.display = 'inline';		
		});
		*/
		
	});



}

function loadContact(){
	wrappers(11);
	cleanDesk(0);
	cleanArtist();
	cleanEquipment();
	$(this).delay(2100,function(){
		var myString = [
		'<div id="page-wrap-map">',
		   '<ul id="locations">',
	        '<li data-geo-lat="52.256631" data-geo-long="20.969127" multiple="0">',
	          '<h3>MAKATA</h3>',
	          '<p>Agencja, Eventy</p>',
	          '<p class="longdesc">',
	          'AGENCJA:</br>Wiktor Zbroja<br>PRODUCENT</br>tel. +48 609 480 412<br>wiktor@makata.com.pl</br></br>Jan Szczeniowski<br>AGENT/PRODUCENT<br>',
	          'tel. +48 500 238 033<br>jan@makata.com.pl</br></br>',
	          'Joanna Suszek</br>AGENT/ JUNIOR PRODUCENT</br>tel. +48 512 233 117</br>asia@makata.com.pl</br></br>',
	           'Aleksandra Zaranek</br>AGENT/ JUNIOR PRODUCENT</br>tel.+48 512 233 185</br>ola@makata.com.pl</br></br>',
	           'EVENTY:</br>Jacek Żerdziński</br>EVENT MANAGER</br>tel.+48 506 151 642</br>jacek@makata.com.pl</br></br>STUDIO:</br>Paweł Ryczkowski</br>STUDIO MANAGER</br>tel.+48 609 924 455</br>rental@makata.com.pl</p>',
	        '</li></br></br></br></br><h3>&nbsp&nbsp&nbspSTUDIA:</h3></br>',
	
	        '<li data-geo-lat="52.172135" data-geo-long="20.992126" multiple="0">',
	          '<h3>Studio TrzyA</h3>',
	          '<p>Postępu 3A</p>',
	          '<p class="longdesc">Postępu 3A<br>01-001 Warszawa<br><br>',
	          'Studio:<br>Paweł Ryczkowski<br>tel. 609 924 455<br>rental@makata.com.pl</p>',
	        '</li>',
	        '<li data-geo-lat="52.187004" data-geo-long="21.005334" multiple="0">',
	          '<h3>Studio 3, Studio 4</h3>',
	          '<p>Garażowa 5</p>',
	          '<p class="longdesc">Garażowa 5<br>02-651 Warszawa<br><br>',
	          'Studio:<br>Paweł Ryczkowski<br>tel. 609 924 455<br>rental@makata.com.pl</p>',
	        '</li>',
	        '<li data-geo-lat="52.187836" data-geo-long="21.003837" multiple="0">',
	          '<h3>Studio Milk</h3>',
	          '<p>Garażowa 4</p>',
	          '<p class="longdesc">Garażowa 4<br>02-651 Warszawa<br><br>',
	          'Studio:<br>Paweł Ryczkowski<br>tel. 609 924 455<br>rental@makata.com.pl</p>',
	        '</li>',
	        '<li data-geo-lat="52.260485" data-geo-long="20.975973" multiple="0">',
	          '<h3>Studio 2</h3>',
	          '<p>Rydygiera 8 bud. 20B</p>',
	          '<p class="longdesc">Rydygiera 8 bud. 20B<br>01-793 Warszawa<br><br>',
	          'Studio:<br>Paweł Ryczkowski<br>tel. 609 924 455<br>rental@makata.com.pl</p>',
	        '</li>',
	     '</ul>',
	     '<div id="map_canvas"></div>',
	     '<div id="more-info"><div>',
	        '<h2>More Info</h2>',
	        '<p>Hover over location on the left. (JavaScript must be enabled)</p>',
	     '</div></div>',
		  ].join('\n');
		document.getElementById('photo-anim').innerHTML = myString;

	var trzyA = new google.maps.LatLng(52.172135, 20.992126),
	          pointToMoveTo,
	          first = true,
	          curMarker = new google.maps.Marker({}),
	          $el;
	
	      var myOptions = {
	          zoom: 15,
	          center: trzyA,
	          mapTypeId: google.maps.MapTypeId.ROADMAP
	        };
	
	      var map = new google.maps.Map($("#map_canvas")[0], myOptions);	
	
	      $("#locations li").mouseenter(function() {
	
	        $el = $(this);
	
	        if (!$el.hasClass("hover")) {
	
	          $("#locations li").removeClass("hover");
	          $el.addClass("hover");
	
	          if (!first) {
	
	            // Clear current marker
	            curMarker.setMap();
	
	            // Set zoom back to duchnicka level
	            // map.setZoom(10);
	          }
	          if ($el.attr("data-geo-lat") == undefined) {
	          /*
	          	map.setZoom(11);
	          	
	          	pointToMoveTo = new google.maps.LatLng(52.234029,20.983458);
		        map.panTo(pointToMoveTo);
		
		        // Add new marker
		        curMarker = new google.maps.Marker({
		        	position: new google.maps.LatLng(52.25672,20.969226),
		        	map: map,
		        	icon: "images/marker.png"
		          });
		          curMarker = new google.maps.Marker({
		        	position: new google.maps.LatLng(52.25672,20.969226),
		        	map: map,
		        	icon: "images/marker.png"
		          });
		          curMarker = new google.maps.Marker({
		        	position: new google.maps.LatLng(52.187836,21.003837),
		        	map: map,
		        	icon: "images/marker.png"
		          });
		          curMarker = new google.maps.Marker({
		        	position: new google.maps.LatLng(52.260485,20.975973),
		        	map: map,
		        	icon: "images/marker.png"
		          });
	          */
	          } else {
	          	// Move (pan) map to new location
		        pointToMoveTo = new
google.maps.LatLng($el.attr("data-geo-lat"),
$el.attr("data-geo-long"));
		        map.panTo(pointToMoveTo);
		
		        map.setZoom(15);
		
		        // Add new marker
		        curMarker = new google.maps.Marker({
		        	position: pointToMoveTo,
		        	map: map,
		        	icon: "images/marker.png"
		          });
	          }
	
	          // On click, zoom map
	          google.maps.event.addListener(curMarker, 'click', function() {
	             map.setZoom(14);
	          });
	
	          // Fill more info area
	          $("#more-info")
	            .find("h2")
	              .html($el.find("h3").html())
	              .end()
	            .find("p")
	              .html($el.find(".longdesc").html());
	
	          // No longer the first time through (re: marker clearing)
	          first = false;
	        }
	
	      });
	
	      $("#locations li:first").trigger("mouseenter");
	
		
		
		$("#photo-anim").fadeIn("1000", function(){
			document.getElementById('photo-anim').style.opacity = '1';
			document.getElementById('photo-anim').style.display = 'inline';	
			constructed();	
		});
		
	});
	
}

function opacitiAnim(objekt){
	$(objekt).animate({"opacity":"1"}, "fast");
	
}
function opacitiAnimIE(objekt){
	$(objekt).animate({'filter': "alpha(opacity = 50)"}, "fast");
	
}
function deOpacityAnim(objekt, to){
	if ( to === undefined ) {
     to = 0;
  	}

	$(objekt).animate({"opacity":to}, "slow");
}
function deOpacityAnimIE(objekt){
	$(objekt).animate({'filter': "alpha(opacity=00)"}, "fast");

}
function cleanDesk(leave){
	
	constructing();
	disablePopup();
	
	if(canBlur){
		$('#photo-anim_b').animate({"opacity":"1"}, "slow", function(){
			document.getElementById('photo-anim').innerHTML = "";
			document.getElementById('photo-anim').style.opacity = '0';
			$('#photo-anim_b').animate({"opacity":"0"}, "slow", function(){	
				document.getElementById('photo-anim_b').innerHTML = "";
			});
		})
	}
	
	$('#tdg').fadeOut('slow', function(){
		document.getElementById('tdg').innerHTML = "";
	});
	
   $('#gradient').fadeOut('slow');

   $(this).delay(50,function(){
				$("#news5").fadeOut("slow");
				$("#nextLast").fadeOut("slow");
			});
			
			$(this).delay(200,function(){
				$("#news4").fadeOut("slow");
		    });
			
			$(this).delay(400,function(){
				$("#news3").fadeOut("slow");
		    });
		    $(this).delay(600,function(){
				$("#news2").fadeOut("slow");
		    });
		    $(this).delay(800,function(){
				$("#news1").fadeOut("slow");
				hiding = false;
		    });
	
	$(this).delay(50,function(){
		//document.getElementById('white_big').style.zIndex = "15";
		//document.getElementById('white_big').style.display = "inline";
		$('#text3').fadeOut('slow', function() {
		    $('#text2').fadeOut('slow', function() {
			    $('#text1').fadeOut('slow', function(){
			    	document.getElementById('text1').innerHTML = "";
			    	document.getElementById('text2').innerHTML = "";
			    	document.getElementById('text3').innerHTML = "";	
			    });
		  	});
	  	});
});

	 	if(leave != 10 && leave != 1){
			$('#artist_gallery_name').animate({"opacity":"0"}, "slow");
			$("#like1").animate({"left": "-500px"},"slow");
	    }

	
 	
	$(this).delay(200,function(){
		if(leave != 1){
			hiding = true;
			$("#fotograficy_artysta").animate({"left": "-350px"},"slow");
			$("#wyswietl_artystow").animate({"left": "-350px"},"slow");
			// hiding = false; jest powyrzej w fadeout #news1
		}
		if(leave != 10){
			
			$('#photo-anim').fadeOut('slow', function() {				
				document.getElementById('photo-anim').innerHTML = "";
				document.getElementById('photo-anim_b').innerHTML = "";
				//document.getElementById('wrap1').style.display = 'inline';
		  	});
	    }
	});
	
   $(this).delay(200,function(){
   	
   	if(leave != 1){
			$("#subMenu1").animate({"left": "-300px"},"slow");
		}
   	
   	if(leave != 2){
			$("#subMenu2").animate({"left": "-300px"},"slow");
		}
		if(leave != 3){
			$("#subMenu3").animate({"left": "-350px"},"slow");
			$("#like2").animate({"left": "-500px"},"slow");
		}
		if(leave != 4){
			$("#subMenu4").animate({"left": "-300px"},"slow");
		}
		if(leave != 5){
			$("#subMenu5").animate({"left": "-350px"},"slow");
		}
		if(leave != 6){
			$("#subMenu6").animate({"left": "-300px"},"slow");
		}
		if(leave != 7){
			$("#subMenu7").animate({"left": "-300px"},"slow");
		}
		//$('#white_big').fadeOut('slow');
		
		

   });
}

function cleanArtist(){
	
	$(this).delay(0,function(){
		$("#artist8").animate({"left": "-300px"},"slow");
		$("#artist8_w").animate({"left": "-300px"},"slow");
   });
   $(this).delay(50,function(){
		$("#artist7").animate({"left": "-300px"},"slow");
		$("#artist7_w").animate({"left": "-300px"},"slow");
   });
	
	$(this).delay(250,function(){
		$("#artist6").animate({"left": "-300px"},"slow");
		$("#artist6_w").animate({"left": "-300px"},"slow");
   });
	
	$(this).delay(450,function(){
		$("#artist5").animate({"left": "-300px"},"slow");
		$("#artist5_w").animate({"left": "-300px"},"slow");
   });
	
	$(this).delay(650,function(){
		$("#artist4").animate({"left": "-300px"},"slow");
		$("#artist4_w").animate({"left": "-300px"},"slow");
   });
   //$(this).delay(450,function(){
		//$("#artist3").animate({"left": "-300px"},"slow");
		//$("#artist3_w").animate({"left": "-300px"},"slow");
   //});
   $(this).delay(850,function(){
		$("#artist2").animate({"left": "-300px"},"slow");
		$("#artist2_w").animate({"left": "-300px"},"slow");
   });
   $(this).delay(1050,function(){
		$("#artist1").animate({"left": "-300px"},"slow");
		$("#artist1_w").animate({"left": "-300px"},"slow");
   });
   $(this).delay(1250,function(){
		$("#artist0").animate({"left": "-300px"},"slow");
		$("#artist0_w").animate({"left": "-300px"},"slow");
		$("#subMenu1").animate({"left": "-300px"},"slow");
   });
}
function cleanEquipment(){
	
	$(this).delay(0,function(){
		$("#equipment9").animate({"left": "-350px"},"slow");
		$("#equipment9_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(50,function(){
		$("#equipment8").animate({"left": "-350px"},"slow");
		$("#equipment8_w").animate({"left": "-350px"},"slow");
   });
	
	$(this).delay(250,function(){
		$("#equipment7").animate({"left": "-350px"},"slow");
		$("#equipment7_w").animate({"left": "-350px"},"slow");
   });
	
	$(this).delay(450,function(){
		$("#equipment6").animate({"left": "-350px"},"slow");
		$("#equipment6_w").animate({"left": "-350px"},"slow");
   });
	
	$(this).delay(650,function(){
		$("#equipment5").animate({"left": "-350px"},"slow");
		$("#equipment5_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(450,function(){
		$("#equipment4").animate({"left": "-350px"},"slow");
		$("#equipment4_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(850,function(){
		$("#equipment3").animate({"left": "-350px"},"slow");
		$("#equipment3_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(1050,function(){
		$("#equipment2").animate({"left": "-350px"},"slow");
		$("#equipment2_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(1250,function(){
		$("#equipment1").animate({"left": "-350px"},"slow");
		$("#equipment1_w").animate({"left": "-350px"},"slow");
   });
   $(this).delay(1450,function(){
		$("#equipment0").animate({"left": "-350px"},"slow");
		$("#equipment0_w").animate({"left": "-350px"},"slow");
   });
}

function loadGalleria(gallery){
		
		
		$(this).delay(1000,function(){
			getGallery(gallery);
		});
		
		switch(gallery)
		{
		case 18:
		case 19:
		case 20:
		case 21:
		case 37:
		case 38:
		case 39:
		  document.getElementById('artist_name').innerHTML = 'Kasia<br>Kifert';
		
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	[
			 	
			 	'<a href="#" id="fashion" onClick="loadGalleria(18), setGalleryName(\'Kasia Kifert : fashion\');">fashion',
			    '<a href="#" id="beauty" onClick="loadGalleria(20), setGalleryName(\'Kasia Kifert : beauty\')">beauty<br>',
			    '<a href="#" id="celebrities" onClick="loadGalleria(21), setGalleryName(\'Kasia Kifert : celebrities\')">celebrities',
			    '<a href="#" id="advert" onClick="loadGalleria(19), setGalleryName(\'Kasia Kifert > advert\')">advert<br>',
			    '<a href="#" id="personal" onClick="loadGalleria(39), setGalleryName(\'Kasia Kifert : personal\')">personal',
			    '<a href="#" id="mens\\\'s fashion" onClick="loadGalleria(38), setGalleryName(\'Kasia Kifert : men\\\'s fashion\')">men\'s fashion<br>',
			    '<a href="#" id="fashion 2" onClick="loadGalleria(37), setGalleryName(\'Kasia Kifert : fashion 2\')">fashion 2'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		  $("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		  $("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		  $("#like1").animate({"left": "-0px"},"slow");
		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
	  case 43:
	  case 44:
	  case 45:
		  document.getElementById('artist_name').innerHTML = 'Paweł<br>Pyrz';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			 	'<a href="#" id="advert" onClick="loadGalleria(43), setGalleryName( \'Paweł Pyrz : advert\')">advert',
			    '<a href="#" id="celebrities" onClick="loadGalleria(44), setGalleryName( \'Paweł Pyrz : celebrities\')">celebrities<br>',
			    '<a href="#" id="fashion" onClick="loadGalleria(45), setGalleryName( \'Paweł Pyrz : fashion\')">fashion',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
		case 40:
	 	case 41:
	 	case 42:
		  document.getElementById('artist_name').innerHTML = 'Jacek<br>Piekarzewski';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			 	'<a href="#" id="advert" onClick="loadGalleria(40), setGalleryName( \'Jacek Piekarzewski : advert\');">advert<br>',
			    '<a href="#" id="advert2" onClick="loadGalleria(41), setGalleryName( \'Jacek Piekarzewski : advert2\')">advert2<br>',
			    '<a href="#" id="cars" onClick="loadGalleria(42), setGalleryName( \'Jacek Piekarzewski : cars\')">cars',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
	  	case 30:
	  	case 31:
	 	case 32:
	 	case 33:
		  document.getElementById('artist_name').innerHTML = 'Iza<br>Grzybowska';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			 	'<a href="#" id="advert" onClick="loadGalleria(30), setGalleryName( \'Iza Grzybowska : advert\');">advert',
			    '<a href="#" id="beauty" onClick="loadGalleria(31), setGalleryName( \'Iza Grzybowska : beauty\')">beauty<br>',
			    '<a href="#" id="celebrities" onClick="loadGalleria(32), setGalleryName( \'Iza Grzybowska : celebrities\')">celebrities',
			    '<a href="#" id="fashion" onClick="loadGalleria(33), setGalleryName( \'Iza Grzybowska : fashion\')">fashion',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
		case 22:
	 	case 23:
	 	case 24:
		  document.getElementById('artist_name').innerHTML = 'Marlena<br>Bielinska';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	[
			 	'<a href="#" id="beauty" onClick="loadGalleria(22), setGalleryName( \'Marlena Bielinska : beauty\');">beauty<br>',
			    '<a href="#" id="celebrities" onClick="loadGalleria(23), setGalleryName( \'Marlena Bielinska : celebrities\')">celebrities<br>',
			    '<a href="#" id="fashion" onClick="loadGalleria(24), setGalleryName( \'Marlena Bielinska : fashion\')">fashion'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
	  	case 49:
	 	case 50:
	 	case 51:
	 	case 52:
	 	case 53:
	 	case 74:
		  document.getElementById('artist_name').innerHTML = 'Wojtek<br>Wozniak';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			 	'<a href="#" id="advert" onClick="loadGalleria(49), setGalleryName( \'Wojtek Woźniak : advert\')">advert',
			    '<a href="#" id="cars" onClick="loadGalleria(50), setGalleryName( \'Wojtek Woźniak : cars\')">cars<br>',
			    '<a href="#" id="cityscapes" onClick="loadGalleria(51), setGalleryName( \'Wojtek Woźniak : cityscapes\')">cityscapes',
			    '<a href="#" id="people" onClick="loadGalleria(52), setGalleryName( \'Wojtek Woźniak : people\')">people<br>',
			    '<a href="#" id="still life" align="left" onClick="loadGalleria(53), setGalleryName( \'Wojtek Woźniak : still life\')">still&thinsp;life',
			    '<a href="#" id="interiors" align="left" onClick="loadGalleria(74), setGalleryName( \'Wojtek Woźniak : interiors\')">interiors',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
	  	case 25:
	 	case 26:
	 	case 27:
	 	case 28:
	 	case 71:
		  document.getElementById('artist_name').innerHTML = 'Emil<br>Bilinski';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			 	'<a href="#" id="advert" onClick="loadGalleria(25), setGalleryName( \'Emil Bilinski : advert\');">advert',
			    '<a href="#" id="beauty" onClick="loadGalleria(26), setGalleryName( \'Emil Bilinski : beauty\');">beauty<br>',
			    '<a href="#" id="fashion" onClick="loadGalleria(27), setGalleryName(\'Emil Bilinski : fashion\');">fashion',
			    '<a href="#" id="nudes" onClick="loadGalleria(28), setGalleryName(\'Emil Bilinski : nudes\');">nudes<br>',
			    '<a href="#" id="celebrities" onClick="loadGalleria(71), setGalleryName(\'Emil Bilinski : celebrities\');">celebrities',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
	 	case 65:
	 	case 66:
	 	case 73:
	 	case 90:
		  document.getElementById('artist_name').innerHTML = 'Magdalena<br>Łuniewska';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			    '<a href="#" id="fashion" onClick="loadGalleria(65), setGalleryName(\'Magdalena Łuniewska : fashion\');">fashion',
			    '<a href="#" id="people" onClick="loadGalleria(66), setGalleryName(\'Magdalena Łuniewska : people\');">people<br>',
			    '<a href="#" id="advert" onClick="loadGalleria(73), setGalleryName(\'Magdalena Łuniewska : advert\');">advert',
			    '<a href="#" id="advert" onClick="loadGalleria(90), setGalleryName(\'Magdalena Łuniewska : portraits\');">portraits',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
 	 	case 67:
	 	case 68:
	 	case 69:
	 	case 70:
	 	case 72:
		  document.getElementById('artist_name').innerHTML = 'Jola<br>Skóra';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			    '<a href="#" id="architecture" onClick="loadGalleria(70), setGalleryName(\'Jola Skóra : architecture\');">architecture',
			    '<a href="#" id="beauty" onClick="loadGalleria(69), setGalleryName(\'Jola Skóra : beauty\');">beauty<br>',
			    '<a href="#" id="fashion" onClick="loadGalleria(67), setGalleryName(\'Jola Skóra : fashion\');">fashion',
			    '<a href="#" id="portrait" onClick="loadGalleria(68), setGalleryName(\'Jola Skóra :  portrait\');">portrait<br>',
			    '<a href="#" id="personal" onClick="loadGalleria(72), setGalleryName(\'Jola Skóra :  personal\');">personal',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
	    case 75:
	 	case 76:
	 	case 77:
	 	case 78:
	 	case 82:
	 	case 84:

		  document.getElementById('artist_name').innerHTML = 'Antonina<br>Dolani';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
			    '<a href="#" id="fashion" onClick="loadGalleria(75), setGalleryName(\'Antonina Dolani : fashion location\');">fashion&thinsp;location<br>',
			    '<a href="#" id="fashion2" onClick="loadGalleria(82), setGalleryName(\'Antonina Dolani :  fashion studio\');">fashion&thinsp;studio',
			    '</br><a href="#" id="fashion_com" onClick="loadGalleria(84), setGalleryName(\'Antonina Dolani :  fashion</br> commercial\');">fashion&thinsp;commercial<br>',
			    '<a href="#" id="beauty" onClick="loadGalleria(76), setGalleryName(\'Antonina Dolani : beauty\');">beauty<br>',
			    //'<a href="#" id="akty" onClick="loadGalleria(77), setGalleryName(\'Antonina Dolani : nudes\');">nudes',
				//'<a href="#" id="portrait" onClick="loadGalleria(78), setGalleryName(\'Antonina Dolani :  portrait\');">portrait<br>',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
 	    case 79:
	 	case 80:
	 	case 81:
	 	case 83:
	 	case 85:
		  document.getElementById('artist_name').innerHTML = 'Justyna<br>Dudek';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',
		  		'<a href="#" id="beauty" onClick="loadGalleria(81), setGalleryName(\'Justyna Dudek : beauty\');">beauty<br>',
			    '<a href="#" id="fashion" onClick="loadGalleria(80), setGalleryName(\'Justyna Dudek : fashion\');">fashion',
			    '<a href="#" id="fashion" onClick="loadGalleria(85), setGalleryName(\'Justyna Dudek : fashion 2\');">fashion&thinsp;2</br>',
			    '<a href="#" id="advert" onClick="loadGalleria(79), setGalleryName(\'Justyna Dudek : advert\');">advert',

		    '</form>'
		    //			    '<!--<a href="#" id="fashion2" onClick="loadGalleria(83) setGalleryName(\'Justyna Dudek :  fashion</br>commercial\');">fashion&thinsp;commercial</br>-->',

		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		

	 	case 86:
	 	case 87:
	 	case 88:
	 	case 89:
		  document.getElementById('artist_name').innerHTML = 'Greg<br>Adamski';
		  cleanDesk(1);
		  cleanArtist();
		  cleanEquipment();
		  var myString =
		  	['<form>',		  		
			    '<a href="#" id="fashion" onClick="loadGalleria(87), setGalleryName(\'Greg Adamski  : fashion\');">fashion<br/>',
			    '<a href="#" id="fashion" onClick="loadGalleria(86), setGalleryName(\'Greg Adamski  : fashion 2\');">fashion&thinsp;2<br/>',
			    '<a href="#" id="portraits" onClick="loadGalleria(88), setGalleryName(\'Greg Adamski : portraits\');">portraits<br/>',
			    '<a href="#" id="portraits" onClick="loadGalleria(89), setGalleryName(\'Greg Adamski : people\');">people',
		    '</form>'
		  ].join('\n');
		  //styleRadio();
		  document.getElementById('gallerie').innerHTML = myString;
		  $(this).delay(1000,function(){
		$("#fotograficy_artysta").animate({"left": "-35px"},"slow");
		$("#wyswietl_artystow").animate({"left": "-10px"},"slow");
		$("#like1").animate({"left": "-0px"},"slow");

		
		//$('#photo-anim').fadeOut('slow', function() {});
		//$('#white_big').fadeOut('slow');
   	});
		  break;
		
	  case 54:
	  case 55:
	
	  	cleanDesk(2);
	  	
	  break;
		
	  case 56:
	  case 57:
	  case 58:
	  case 59:
	  case 60:
	  case 61:
	  case 62:
	
	  	cleanDesk(3);
	
	  break;
	
 	  case 63:
	
	  	cleanDesk(5);
	
	  break;
		
		default:
		  cleanDesk(0);
		}
	   	
	   	canBlur = false;
		
}

function removeElement(parentDiv, childDiv){
    if (childDiv == parentDiv) {
         alert("The parent div cannot be removed.");
    }
    else if (document.getElementById(childDiv)) {
         var child = document.getElementById(childDiv);
         var parent = document.getElementById(parentDiv);
         parent.removeChild(child);
    }
    else {
         //alert(childDiv +" has already been removed or does not exist.");
         return false;
    }
}
function getGallery(kind_id)
{
	//alert('mnmkm');
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke when getting the gallery!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			document.getElementById('tdg').innerHTML = ajaxRequest.responseText;
			// Initialize Galleria
		    $('#tdg').galleria({
			    preload: 10,
			    transition: 'flash',
			    transitionSpeed: '900',
			    fullscreenDoubleTap: true,
			
				extend: function(options) {

			        Galleria.log(this) // the gallery instance
			        Galleria.log(options) // the gallery options
			
			        // listen to when an image is shown
			        this.bind('image', function(e) {
			
			            Galleria.log(e) // the event object may contain custom objects, in this case the main image
			            Galleria.log(e.imageTarget) // the current image
			
			            // lets make galleria open a lightbox when clicking the main image:
			            $(e.imageTarget).click(this.proxy(function() {
			               this.openLightbox();
			            }));
			        });
			    }
			});
			$('#tdg').fadeIn('slow');
			constructed();
		}
	}

	ajaxRequest.open("GET", "gallery_generator.php?subset="+kind_id, true);
	ajaxRequest.send(null);
	
}

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;


//loading popup with jQuery magic!
function loadPopup(panel){
	//loads popup only if it is disabled
	if(popupStatus==0){
		if(panel == undefined){
			var popup =  '#popupContact';
		} else {
			var popup = '#popupNews';
			var ajaxRequest;  // The variable that makes Ajax possible!
			
			try{
				// Opera 8.0+, Firefox, Safari
				ajaxRequest = new XMLHttpRequest();
			} catch (e){
				// Internet Explorer Browsers
				try{
					ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try{
						ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e){
						// Something went wrong
						alert("Your browser broke in the loadPopup function!");
						return false;
					}
				}
			}
			// Create a function that will receive data sent from the server
			ajaxRequest.onreadystatechange = function(){
				
				if(ajaxRequest.readyState == 4){
					document.getElementById('popupNews').innerHTML = ajaxRequest.responseText;
							}
						}
		
			ajaxRequest.open("GET", "news_generator.php?post_id="+panel, true);
			ajaxRequest.send(null);
		}
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$(popup).fadeIn("slow");
	 	$("#backgroundPopup").css({
			"visibility": "visible"
		});
		$(popup).css({
			"visibility": "visible"
		});

		popupStatus = 1;
	}
}
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupNews").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		$("#popupNews").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupContactHeight = $("#popupContact").height();
	var popupContactWidth = $("#popupContact").width();
	var popupNewsHeight = $("#popupNews").height();
	var popupNewsWidth = $("#popupNews").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupContactHeight/2-30,
		"left": windowWidth/2-popupContactWidth/2
	});
	$("#popupNews").css({
		"position": "absolute",
		"top": windowHeight/2-popupNewsHeight/2,
		"left": windowWidth/2-popupNewsWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
}

function popup(panel){
	//centering with css
	centerPopup();
	//load popup
	loadPopup(panel);
	
	
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keyup(function(e){
		if(e.keyCode==27 & popupStatus==1){
			disablePopup();
		}
	});
}


function blurImage() {
	for (i=0;i<=5;i++){
		Pixastic.process(document.getElementById("tbm"), "blurfast", {
			amount : 5
		});
	}
}
function loadPhotoAnim(picture){
	
		document.getElementById('photo-anim').innerHTML = '<img name="picture" src="images/white_big.png" width="100%">';
		document.getElementById('photo-anim_b').innerHTML = '<img name="picture2" src="images/white_big.png" width="100%">';
		
		if(picture==0 || picture==-1){
			picture = Math.floor(Math.random()*7+1)
		}
		eval("document['picture'].src = img"+picture+".src");
		eval("document['picture2'].src = img0"+picture+".src");
		
		//$('#white_big').animate({"opacity" : "0"}, "slow");
		if(picture!=-1){
			document.getElementById('photo-anim').style.left = '0px';
			$("#photo-anim").fadeIn("1000", function(){
				document.getElementById('photo-anim').style.opacity = '1';
				document.getElementById('photo-anim').style.display = 'inline';		
			});
		} else {
			document.getElementById('photo-anim').style.opacity = '1';
			document.getElementById('photo-anim').style.display = 'inline';
		}
		document.getElementById('photo-anim_b').style.opacity = '0';
		document.getElementById('photo-anim_b').style.left = '0px';
		document.getElementById('photo-anim_b').style.display = 'inline';
		document.getElementById('photo-anim_b').style.zIndex = '9';
		//document.getElementById('foreground').style.top = '2px';
		//document.getElementById('underground').style.top = '450px';
		document.getElementById('text1').style.display = "inline";
		document.getElementById('text1').style.opacity = "0";
		document.getElementById('text2').style.display = "inline";
		document.getElementById('text2').style.opacity = "0";
		document.getElementById('text3').style.display = "inline";
		document.getElementById('text3').style.opacity = "0";
		document.getElementById('gradient').style.display = "inline";
		document.getElementById('gradient').style.opacity = "0";
}

function setGalleryName(text){
	$('#artist_gallery_name').animate({"opacity":"0"}, "slow", function(){
		document.getElementById('artist_gallery_name').innerHTML = text;
		$('#artist_gallery_name').animate({"opacity":"1"}, "slow");
	});
}

function loadNewsPanel(page){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke in the loadNewsPanel function!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			document.getElementById('news_panel').innerHTML = ajaxRequest.responseText;
			$(this).delay(50,function(){
				$("#news1").fadeIn("slow");
			});
			
			$(this).delay(200,function(){
				$("#news2").fadeIn("slow");
		    });
			
			$(this).delay(400,function(){
				$("#news3").fadeIn("slow");
		    });
		    $(this).delay(600,function(){
				$("#news4").fadeIn("slow");
		    });
		    $(this).delay(800,function(){
				$("#news5").fadeIn("slow");
				$("#nextLast").fadeIn("slow");
		    });

			
		}
	}

	ajaxRequest.open("GET", "news_generator.php?page="+page, true);
	ajaxRequest.send(null);
}

function constructing(){
	document.getElementById('wrap1').style.display = 'none';
	document.getElementById('wrap2').style.display = 'none';
	document.getElementById('wrap3').style.display = 'none';
	document.getElementById('wrap4').style.display = 'none';
	document.getElementById('wrap5').style.display = 'none';
	document.getElementById('wrap6').style.display = 'none';
	document.getElementById('wrap7').style.display = 'none';
	document.getElementById('wrap8').style.display = 'none';
	document.getElementById('wrap9').style.display = 'none';
	document.getElementById('wrap10').style.display = 'none';
	document.getElementById('wrap11').style.display = 'none';
	
}

function constructed(){
	document.getElementById('wrap1').style.display = 'inline';
	document.getElementById('wrap2').style.display = 'inline';
	document.getElementById('wrap3').style.display = 'inline';
	document.getElementById('wrap4').style.display = 'inline';
	document.getElementById('wrap5').style.display = 'inline';
	document.getElementById('wrap6').style.display = 'inline';
	document.getElementById('wrap7').style.display = 'inline';
	document.getElementById('wrap8').style.display = 'inline';
	document.getElementById('wrap9').style.display = 'inline';
	document.getElementById('wrap10').style.display = 'inline';
	document.getElementById('wrap11').style.display = 'inline';
	
}

function wrappers(aktualny){
	
		var strg = "wrap" + lastWrap + "_b";
		document.getElementById(strg).getElementsByTagName('img')[0].style.display
= 'none';
		strg = "wrap" + aktualny + "_b";
		document.getElementById(strg).getElementsByTagName('img')[0].style.display
= 'inline';
		lastWrap = aktualny;
}

function loadNewsletters(){
	cleanDesk(0);
	cleanArtist();
	cleanEquipment();
	wrappers(9);
	
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			$(this).delay(500,function(){
				document.getElementById('tdg').innerHTML = ajaxRequest.responseText;
				$('#tdg').fadeIn('slow');
				
				constructed();
			});
			
		}
	}

	ajaxRequest.open("GET", "/newsletter.php", true);
	ajaxRequest.send(null);
}

function moveOut() {
	if(!hiding)
	$("#wyswietl_artystow").animate({"left": "-5px"},"fast");

}

function moveIn(){
	if(!hiding)
	$("#wyswietl_artystow").animate({"left": "-10px"},"fast");
	
}


