 /*
  * Fallr v1.2 - jQuery Plugin
  * Simple & elegant modal box jQuery plugin
  *
  * Copyright 2011 amatyr4n
  * http://codecanyon.net/user/amatyr4n
  *
  * licensed under Envato licenses
  * http://wiki.envato.com/support/legal-terms/licensing-terms/
  *
  * Any suggestions, bug report, or whatever feedback are welcome :)
  */
 $(document).ready(function () {

     var methods = {
         alertlike: function () {
             $.fallr('show', {
                 content: '<p>Howdy.</p>'
             });
         },
         confirmlike: function () {
             var clicked = function () {
                     alert('congrats, you\'ve deleted internet');
                     $.fallr('hide');
                 };
             $.fallr('show', {
                 buttons: {
                     button1: {
                         text: 'Yes',
                         danger: true,
                         onclick: clicked
                     },
                     button2: {
                         text: 'Cancel'
                     }
                 },
                 content: '<p>Are you sure you want to delete internet?</p>',
                 icon: 'error'
             });
         },
         promptlike: function () {
             var clicked = function () {
                     var yourname = $(this).children('form').children('#yourname').val();
                     alert('Hello, ' + yourname);
                     $.fallr('hide');
                 };
             $.fallr('show', {
                 buttons: {
                     button1: {
                         text: 'Submit',
                         onclick: clicked
                     },
                     button2: {
                         text: 'Cancel'
                     }
                 },
                 content: '<p>Give me your name</p><form><input type="text" id="yourname" /' + '></form>',
                 icon: 'form'
             });
         },
         multiplechoices: function () {
             var clicked = function (n) {
                     alert(n);
                 };
             $.fallr('show', {
                 buttons: {
                     button1: {
                         text: 'Yes',
                         onclick: function () {
                             clicked(1)
                         }
                     },
                     button2: {
                         text: 'Yes to all',
                         onclick: function () {
                             clicked(2)
                         }
                     },
                     button3: {
                         text: 'No',
                         onclick: function () {
                             clicked(3)
                         }
                     },
                     button4: {
                         text: 'Whatever',
                         danger: true
                     }
                 },
                 content: '<p>Pick one</p>',
                 icon: 'help'
             });
         },
         below: function () {
             $.fallr('show', {
                 content: '<p>You\'ve got a message</p>',
                 position: 'bottom'
             });
         },

         ///////////////////////////////  LOGIN //////////////////////////////////////////////////////////////////////////
         Show_Login: function () {
             $.fallr('show', {
							   easingDuration: 555,
                 content: '<iframe scrolling = "yes" style="background-image:url(/luminances/ICO/LoadAndProgress/lightbox-loading.gif); background-repeat:no-repeat; background-position:center;overflow-x:hidden; background-color:transparent;" width="750" height="615" src="http://luminances.net/luminances/_V_0006/Site/Login.php?For_New_Login=true" frameborder="0" allowfullscreen></iframe>',
                 width: 777 + 100,
                 // 100 = for width padding
                 icon: 'form',
                 buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },
				          ///////////////////////////////  LOGIN //////////////////////////////////////////////////////////////////////////
         Show_Login_Silent_FOR_SCAN: function () {
             $.fallr('show', {
							   easingDuration: 555,
                 content: '<iframe scrolling = "yes" style="background-image:url(/luminances/ICO/LoadAndProgress/lightbox-loading.gif); background-repeat:no-repeat; background-position:center;overflow-x:hidden; background-color:transparent;" width="750" height="615" src="http://luminances.net/luminances/_V_0006/Site/Login.php?For_New_Login=true&Silent=true" frameborder="0" allowfullscreen></iframe>',
                 width: 777 + 100,
                 // 100 = for width padding
                 icon: 'form',
                 buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },
         ///////////////////////////////  Tirages_Choix_Transfert_Album.php //////////////////////////////////////////////////////////////////////////
         Tirages_Choix_Transfert_Album: function () {
             $.fallr('show', {
							   easingDuration: 555,
                 content: '<iframe style="background-image:url(/luminances/ICO/LoadAndProgress/lightbox-loading.gif); background-repeat:no-repeat; background-position:center"   scrolling="no" width="550" height="350" src="http://luminances.net/luminances/_V_0006/Site/Tirages_Choix_Transfert_Album.php" frameborder="0" allowfullscreen></iframe>',
                 width: 555 + 180,
                 // 100 = for width padding
                 icon: 'wizard',
                 buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },
         ///////////////////////////////  PORTFOLIO EDIT HTML //////////////////////////////////////////////////////////////////////////
         Show_PF_EditHTML: function () {
             $.fallr('show', {
							   easingDuration: 555,
                 content: '<iframe scrolling = "yes" style="background-image:url(/luminances/ICO/LoadAndProgress/lightbox-loading.gif); background-repeat:no-repeat; background-position:center;overflow-x:hidden; background-color:transparent;" width="750" height="615" src="http://luminances.net/luminances/LIVEEditor1/PF_EditHTML.php" frameborder="0" allowfullscreen></iframe>',
                 width: 777 + 100,
                 // 100 = for width padding
                 icon: 'form',
                 buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },
				 ///////////////////////////////  LOGIN //////////////////////////////////////////////////////////////////////////
         close: function () {
             $.fallr('show', {
                 closeKey: true,
                 closeOverlay: true,
                 content: '<p>Click on overlay or press ESC to close this message</p>',
                 icon: 'info'
             });
         },
				 
         papier: function () {
             $.fallr('show', {
                 closeKey: true,
                 closeOverlay: true,
                 content: '<p>papier</p>',
                 icon: 'info',
								                  buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },		
				 
         image: function () {
					 var Cont="e";
             $.fallr('show', {
                 closeKey: true,
                 closeOverlay: true,
content: 'image',
                 icon: 'info',
								                  buttons: {
                     button1: {
                         text: 'Fermer'
                     }
                 }
             });
         },						 
				 		 
         effect: function () {
             $.fallr('show', {
                 easingDuration: 3000,
                 easingIn: 'easeOutBounce',
                 easingOut: 'easeInElastic',
                 icon: 'card',
                 position: 'center',
                 content: '<h4>Animation please</h4><p>Everyone wants animation.</p>'
             });
         },



         forms: function () {
             var login = function () {
                     var user = $(this).children('form').children('input[type="text"]').val();
                     var pass = $(this).children('form').children('input[type="password"]').val();
                     if (user.length < 1 || pass.length < 1) {
                         alert('Invalid!\nPlease fill all required forms');
                     } else {
                         alert('username: ' + user + '\npassword: ' + pass);
                         $.fallr('hide');
                     }
                 }

             $.fallr('show', {
                 icon: 'secure',
                 width: '320px',
                 content: '<h4>Sign in</h4>' + '<form>' + '<input placeholder="username" type="text"/' + '>' + '<input placeholder="password" type="password"/' + '>' + '</form>',
                 buttons: {
                     button1: {
                         text: 'Envoyer',
                         onclick: login
                     },
                     button4: {
                         text: 'Annuler'
                     }
                 }
             });
         },
         callback: function () {
             var hide2 = function () {
                     $.fallr('hide', function () {
                         alert('callback after 2nd hide');
                     });
                 };

             var hide1 = function (n) {
                     $.fallr('hide', function () {
                         alert('Hi, this is a callback after hide');
                         $.fallr('show', {
                             content: '<p>You choose ' + n + '</p>',
                             position: 'bottom',
                             buttons: {
                                 button1: {
                                     text: 'OK',
                                     onclick: hide2
                                 }
                             }
                         }, function () {
                             alert('callback after 2nd show');
                         });
                     });
                 };

             $.fallr('show', {
                 icon: 'warning',
                 content: '<p>Yes or No?</p>',
                 buttons: {
                     button1: {
                         text: 'Yes',
                         onclick: function () {
                             hide1('Yes');
                         }
                     },
                     button2: {
                         text: 'No',
                         onclick: function () {
                             hide1('No');
                         }
                     }
                 },
             }, function () {
                 alert('Hi, this is a callback after show');
             });
         },
         size: function () {
             $.fallr('show', {
                 maxWidth: '600px',
                 height: '400px',
                 width: '600px',
                 content: '<h4>Lorem Ipsum</h4><p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>',
                 icon: 'config'
             });
         },
         autoresize: function () {
             var smaller = function () {
                     $.fallr('resize', {
                         width: '300px',
                         height: '300px'
                     });
                 };
             var bigger = function () {
                     $.fallr('resize', {
                         width: '500px',
                         height: '500px'
                     });
                 };
             $.fallr('show', {
                 content: '<h4>Click a button to resize</h4><p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>',
                 buttons: {
                     button1: {
                         text: 'Smaller',
                         onclick: smaller
                     },
                     button2: {
                         text: 'Bigger',
                         onclick: bigger
                     },
                     button3: {
                         text: 'Cancel'
                     }
                 },
                 width: '300px',
                 height: '300px',
                 position: 'center'
             }, function () {
                 // on show callback
                 $.fallr('resize', {
                     width: '400px',
                     height: '400px'
                 });
             });
         },
         fullsize: function () {
             var gap = $("#bottom_navigation").height();
             var boxH = $(window).height() - gap - 15; // bottom gap
             var boxW = $(window).width() - gap * 2; // left + right gap
             $.fallr('show', {
                 content: '<p>Fullscreen</p>',
                 width: boxW,
                 height: boxH
             });
         },
         autoclose: function () {
             $.fallr('show', {
                 content: '<p>This will be self closing</p>',
                 autoclose: 2000,
                 icon: 'warning'
             });
         },
         nooverlay: function () {
             $.fallr('show', {
                 content: '<p>Yay, no overlay!</p>',
                 icon: 'smile',
                 useOverlay: false
             });
         },
         effect: function () {
             var blinkIt = function () {
                     $.fallr('blink');
                 };
             var shakeIt = function () {
                     $.fallr('shake');
                 };
             $.fallr('show', {
                 content: '<h4>Special Effects</h4>',
                 position: 'center',
                 icon: 'wizard',
                 buttons: {
                     button1: {
                         text: 'Blink',
                         onclick: blinkIt
                     },
                     button2: {
                         text: 'Shake',
                         onclick: shakeIt
                     },
                     button3: {
                         text: 'Cancel'
                     }
                 }
             });
         },
         redirect: function () {
             var redirect = function () {
                     window.location.href = "http://www.google.com";
                 };

             $.fallr({
                 buttons: {
                     button1: {
                         text: 'confirm',
                         onclick: redirect
                     },
                     button2: {
                         text: 'cancel'
                     }
                 },
                 content: '<p>please confirm to get redirected</p>'
             });
         }
     };
     $('a[href^="#fallr-"]').click(function () {
         var id = $(this).attr('href').substring(7);
         methods[id].apply(this, [this]);
         return false;
     });
 });
 

