/* 

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */





// WHEN THE DOCUMENT IS READY

        jQuery(document).ready(function() {
            $("#inscription").validationEngine();
            $("#newsForm").validationEngine('attach', {
                  onValidationComplete: function(form, status){
                  if(status){
			  				$('span#newsletter_content').slideToggle('slow', function() {
                			$('span#newsletter_footer').toggleClass('open close');
																						});
			
							$.post("http://www.kareenabollywood.fr/wp-content/themes/KareenaBollywood/fake.php", $("#newsForm").serialize());
							
							          var height = $(document).height();

            var width = $(document).width();

            var html = '<div id="myoverlay" style="background-color:#000000; top:0; left:0; position:absolute; z-index:90; width: ' + width + 'px; height: ' + height + 'px; opacity: 0.5; display: none;"></div><div id="alerteManager" style="  position:absolute; top:120px; text-align: center; z-index:100; display:block; width:100%; "><div id="topAlert"  style="background-color:#fafad2; position:relative; width:400px; height:210px; margin:0 auto;"><div  style="padding:25px;"><p style="margin-top:20px; display:block; font-weight: bold;">Inscription à la Newsletter</p><p class="closeAlerte" style="position:absolute; top:10px; right:10px; cursor:pointer;">[x]</p><p style="margin-top:5px; ">Vous etes maintenant abonné à la newsletter <br /> de Kareena Bollywood</p></div></div>';

            $("body").append(html);

            $('div#myoverlay').show();
			$("div#topAlert").center();
							
							
							
							}
					 return false; 	
				  }
			
                });
            
            $("#mycheckout_form").validationEngine();
            $("#fcontact").validationEngine();


        });

(function($) {







           jQuery.fn.center = function () {

            this.css("position","absolute");

            this.css("top", (($(window).height() - this.outerHeight()) / 3) + $(window).scrollTop() + "px");

            this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");

            return this;

        }



    $(document).ready(function() {









        $("#jcarou").jCarouselLite({

            btnNext: "#actualites a.nextActu ",

            btnPrev: "#actualites a.previousActu",

            scroll:2



        });





        //$('.content').hide();

        $('span#newsletter_footer, span#newsletter_header, span.titleNewsletter, .activeNewsletterForm').click(function() {

            $('span#newsletter_content').slideToggle('slow', function() {

                $('span#newsletter_footer').toggleClass('open close');

            });



        });



        $('span#panier_footer, span#panier_header').live('click', function() {

            $('span#panier_content').slideToggle('slow', function() {

                $('span#panier_footer').toggleClass('open close');

            });

        });



        $('form#newsForm').submit(function() {

            //alert('merci de renseigner une email valide')

            //return false;

        });



        /*   $('.boutonSupprimer').live('click',function() {

         $(this).parent().parent().fadeOut('slow', function(){

         $(this).parent().remove();

         });

         });*/



        $('div#video a').click(function() {

            $(this).parent().fadeOut(1500, function() {

                $('div#video a').remove();

                $(this).removeClass('kbvideo');

                $('div#video iframe').removeClass('noPrint');

                $('div#video').fadeIn('slow');





            });

        });



        var timeout = 500;

        var closetimer = 0;

        var ddmenuitem = 0;



        function jsddm_open() {

            jsddm_canceltimer();

            jsddm_close();

            ddmenuitem = $(this).find('ul').css('visibility', 'visible');

        }



        function jsddm_close() {

            if (ddmenuitem) ddmenuitem.css('visibility', 'hidden');

        }



        function jsddm_timer() {

            closetimer = window.setTimeout(jsddm_close, timeout);

        }



        function jsddm_canceltimer() {

            if (closetimer) {

                window.clearTimeout(closetimer);

                closetimer = null;

            }

        }





        $('#nav > li').bind('mouseover', jsddm_open);

        $('#nav > li').bind('mouseout', jsddm_timer);



        document.onclick = jsddm_close;





        $(".lesphotos").hide();



        $("a#photos").live('click', function() {

            $(".leplan").hide();

            $(".lesphotos").show();

            $(".lesphotos").focus();





        });



        $("a#plan").live('click', function() {

            $(".lesphotos").hide();

            $(".leplan").show();



        });



        // DEBUT Overlay Alerte SMS Email

        $("li.alerteSMS a, li.alerteMail a").live('click', function() {

            var height = $(document).height();

            var width = $(document).width();

            var html = '<div id="myoverlay" style="background-color:#000000; top:0; left:0; position:absolute; z-index:90; width: ' + width + 'px; height: ' + height + 'px; opacity: 0.5; display: none;"></div>';


            $("body").append(html);

            $('div#myoverlay').show();

            var callAction = $(this).parent('li').attr('class');

            var myProduct = $(this).parent('li').parent('ul').parent('form').attr('id');



            $.post('http://www.kareenabollywood.fr/wp-content/themes/KareenaBollywood/jqueryi.php', 'call=' + callAction + '&product=' + myProduct, function(data) {



                $("body").append(data);

                $("div#topAlert").center();



            });



            return false;

        });

        // FIN  Overlay Alerte SMS Email

        $("#myoverlay, p.closeAlerte").live('click', function() {



            $('div#myoverlay').remove();

            $('div#alerteManager').remove();



        });



        $('div#suiteFormBill').hide();

        $('p.revenirCommande').hide();



        $('p.suiteCommande').live('click', function() {

            var formValid = $("#mycheckout_form").validationEngine('validateField', "#Cemail");

            if (formValid == false) {



                var zemail = $('#Cemail').attr('value');

                $.post('http://www.kareenabollywood.fr/wp-content/themes/KareenaBollywood/jqueryi.php', 'call=panier&info=' + zemail, function() {



              //  $("body").append(data);

            });



                $(this).html('Poursuivre ma Commande');



                $('table.checkout_cart, div.wpsc_email_address, .formCoupon, div#checkout_page_container h3').toggle();

                $('div#suiteFormBill').toggle();

                $(this).toggle();

                $('.revenirCommande').toggle();

            }

        })

           $('p.revenirCommande').live('click', function() {

            var formValid = $("#mycheckout_form").validationEngine('validateField', "#Cemail");

            if (formValid == false) {

                $(this).html('Revenir à mon detail');

                $('table.checkout_cart, div.wpsc_email_address, .formCoupon, div#checkout_page_container h3').toggle();

                $('div#suiteFormBill').toggle();

                $(this).toggle();

                $('.suiteCommande').toggle();

            }

        })



     

     





    });

})(jQuery);
