/**
 *
 */

function LoadStaticContent(iContentID, sContainer) {
    $('#' + sContainer).fadeOut(500, function() {
            $.get("./AjaxBackend/getStaticContent.php",{ContentID: iContentID},
                function success(sData){
                    $('#' + sContainer).html(sData);
            });
            $('#' + sContainer).fadeIn(500)
        });
}

function LoadDynamicNews(iContentID) {
	$('#news-content-text').animate({width: ['toggle', 'swing'],
            opacity: 'toggle'
            }, 500, function() {
                            $.get("./AjaxBackend/getNewsData.php",{ContentID: iContentID},
                                function success(sData){
                                    $('#news-content-text').html(sData);
                                    $('#news-content-image').fadeOut(2000, function() {
                                        $('#news-content-image').attr({ src: './PageData/NewsPictures/News_' + iContentID + '.jpg' });
                                    })
                                    $('#news-content-image').fadeIn(4000);
                            });
                            $('#news-content-text').animate({width: ['toggle', 'swing'],
                                                        opacity: 'toggle'
                                                        }, 500)
            });
}

function LoadAllNewsList(sLanguageID) {
    $('#TextZoomContainer').fadeIn(500);
    $.get("./AjaxBackend/getNewsList.php", {LanguageID: sLanguageID},
        function success(sData){
            $('#TextZoomLeft').html(sData);
    });
}

function LoadArchivedNews(iContentID) {
	$('#TextZoomRight').fadeOut(500, function() {
                            $.get("./AjaxBackend/getNewsData.php",{ContentID: iContentID},
                                function success(sData){
                                    $('#TextZoomRight').html('<img src="./PageData/NewsPictures/News_' + iContentID + '.jpg" />' + sData);
                            });
                            $('#TextZoomRight').fadeIn(500)
            });
}

function LoadProductsList(iContentID, sContainer) {
	$('#' + sContainer).animate({width: ['toggle', 'swing'],
            opacity: 'toggle'
            }, 500, function() {
                            $.get("./AjaxBackend/getProductsList.php",{ContentID: iContentID},
                                function success(sData){
                                    $('#' + sContainer).html(sData);
                            });
                            $('#' + sContainer).animate({width: ['toggle', 'swing'],
                                                        opacity: 'toggle'
                                                        }, 500)
            });
}

function LoadSimplifiedProductData(iContentID, sContainer, sImageContainer) {
	$('#' + sContainer).animate({width: ['toggle', 'swing'],
                                    opacity: 'toggle'
                                    }, 500, function() {
                                                    $.get("./AjaxBackend/getProductData.php",{ContentID: iContentID, ContentType: 'ProductDescription'},
                                                        function success(sData){
                                                            $('#' + sContainer).html(sData);
                                                        })

                                                    $('#' + sImageContainer).fadeOut(2500, function() {
                                                        $('#' + sImageContainer).attr({ src: './PageData/ProductsPictures/' + iContentID + '/MainPicture.jpg' });
                                                        $('#' + sImageContainer).fadeIn(4000)
                                                    });
                                    });
        $('#' + sContainer).fadeIn(500)
}

function LoadProductData(iContentID, sContainer, sImageContainer, sModelSelector, sModelCertificationsContainer, sModelLogoContainer) {
	$('#' + sContainer).animate({width: ['toggle', 'swing'],
                                    opacity: 'toggle'
                                    }, 500, function() {
                                                    $.get("./AjaxBackend/getProductData.php",{ContentID: iContentID, ContentType: 'ProductDescription'},
                                                        function success(sData){
                                                            $('#' + sContainer).html(sData);
                                                            $.get("./AjaxBackend/getProductData.php",{ContentID: iContentID, ContentType: 'ProductModelSelector'},
                                                                function success(sData){
                                                                    $('#' + sModelSelector).fadeOut(500, function() {
                                                                        $('#' + sModelSelector).html(sData);
                                                                    })
                                                                    $('#' + sModelSelector).fadeIn(500);
                                                                })

                                                        $.get("./AjaxBackend/getProductData.php",{ContentID: iContentID, ContentType: 'ProductCertifications'},
                                                                function success(sData){
                                                                    $('#' + sModelCertificationsContainer).fadeOut(500, function() {
                                                                        $('#' + sModelCertificationsContainer).html(sData);
                                                                    })
                                                                    $('#' + sModelCertificationsContainer).fadeIn(500);
                                                        })

                                                        $('#' + sModelLogoContainer).fadeOut(2500, function() {
                                                            $('#' + sModelLogoContainer).html('<img src="./PageData/ProductsPictures/' + iContentID + '/ProductLogo.jpg" />');
                                                            $('#' + sModelLogoContainer).fadeIn(4000)
                                                        });

                                                        $('#' + sImageContainer).fadeOut(2500, function() {
                                                            $('#' + sImageContainer).attr({ src: './PageData/ProductsPictures/' + iContentID + '/MainPicture.jpg' });
                                                            $('#' + sImageContainer).fadeIn(4000)
                                                        });
                                                    });
                                                    $('#' + sContainer).fadeIn(500)
                                    });
}

function ShowProductPicture(iProductID, iPictureID, sContainer, sImage, sTextContainer) {
    $('#' + sImage).attr({ src: './PageData/ProductsPictures/' + iProductID + '/Zoom/' + iPictureID + '.jpg'});
    $('#' + sTextContainer).html('<a href="javascript:HideMessageBox(\'' + sContainer + '\')">Cliquez pour fermer - Click to close</a>');
    $('#' + sContainer).fadeIn(500);
}

function HideMessageBox(sContainer) {
    $('#' + sContainer).fadeOut(500);
}

function ChangePanelImage() {
    var saImagesPath = new Array(   './MediaContent/LIGNECLUB/barettes.jpg',
                                    './MediaContent/D&C/D&C.jpg',
                                    './MediaContent/E6-E6 AMBIANCE/AMB-E6 -2.jpg');


    $('#news-content-image').fadeOut(2500, function() {
        do {
            iNewImageIndex = Math.floor(Math.random() * (saImagesPath.length + 1));
        } while(saImagesPath[iNewImageIndex] == $('#news-content-image').attr("src"));

        $('#news-content-image').attr({ src: saImagesPath[iNewImageIndex] });
    })
    $('#news-content-image').fadeIn(4000);
}

$(function() {
	$("#main").tabs({
		fx: {
                        opacity: 'toggle'
                    }
	});

	$("#tabs-products").tabs({
		fx: {
                        width: ['toggle', 'swing'],
                        opacity: 'toggle'
                    }
	}).addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#tabs-products li").removeClass('ui-corner-top').addClass('ui-corner-left');

	$("#tabs-entreprise").tabs({
		fx: {
                        width: ['toggle', 'swing'],
                        opacity: 'toggle'
                    }
	}).addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#tabs-entreprise li").removeClass('ui-corner-top').addClass('ui-corner-left');

	$("#tabs-contact").tabs({
		fx: {
                        width: ['toggle', 'swing'],
                        opacity: 'toggle'
                    }
	}).addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#tabs-contact li").removeClass('ui-corner-top').addClass('ui-corner-left');

});

/**
 * 
 */

// setInterval('ChangePanelImage();', 10000);