/**
 * @author Alsy
 */

// PageLoaded handler
function PageLoadedHandler(sender, args)
{
    if(isPostBack)
    {
        var panels = args.get_panelsUpdated();
        for(var i=0; i < panels.length; i++)
        {
			//console.log('ajaxInit')
			if($('panier') && ($$('#panier .fauxSelect').length == 0)){
			FauxFields.Factory
				({
					context: 'panier',
					field: 'select',
					maxHeight: 130
		
				});
			FauxFields.Factory
				({
					context: 'panier',
					field: 'checkbox'		
				});

			}
			
			if($('popinInscription') && ($$('#popinInscription .fauxSelect').length == 0)){
				addScrollToContainer($$('.scrollForm')[0],230);
				FauxFields.Factory
					({
						context: 'popinInscription',
						field: 'select',
						maxHeight: 130
			
					});
			}
			
			
			if ($('popinWishlist') && ($$('#popinWishlist .fauxSelect').length == 0)) {
				addScrollToContainer($$('.scrollForm')[0],230);
				FauxFields.Factory({
					context: 'popinWishlist',
					field: 'select',
					maxHeight: 130				
					});
				}	


			if($('compteClient') && ($$('.fauxSelect').length == 0) && ($$('.fauxCheckbox').length == 0)){
				initFauxFields(panels[i].id);
			}
			
			
			if ($('produitInner')) {
				var hauteur = document.documentElement.clientHeight;
				if (hauteur <= 630) {
					$('backImage').style.marginTop = '-45px';
					$('produitInner').style.top = '4%';
					
				}
				else 
					if (hauteur > 630 && hauteur <= 720) {
						$('backImage').style.marginTop = '0px';
						$('produitInner').style.top = '8%';
						$('produitInformation').style.top = '0px';
					}
					else {
						$('backImage').style.marginTop = '0px';
						$('produitInner').style.top = '25%';
					}
			}
			
			if($('popinWishlist')){
				var wishlistLink = $$('.produitLiens4')[1];
				if(wishlistLink){
					wishlistLink.onclick = function(){
						popinWishlist()
					}
				}
			}
						
			
			/*
			if (($$('.fauxSelect').length == 0) && ($$('.fauxCheckbox').length == 0)) {
				console.log('sans condition');
				initFauxFields(panels[i].id);
			}*/
        }
		//scrollingPage();
		if($('zoomPage')){
		initZoom();	
		}
    }
    else   
    {
        isPostBack = true;
    }
}
