<div class="tx-cs2-gallery">
	
    

    <p>
	
    </p>
    <!--<a href="de/type/100/?tx_cs2gallery_cs2gallery%5Baction%5D=sendToFriend&amp;tx_cs2gallery_cs2gallery%5Bcontroller%5D=Photos&amp;cHash=b5cad4d88c519d6f29b330001ccba52c">test</a>-->

    <div id="cs2gallery_sendto_form_temp">
    <div class="cs2gallery_sendto_forms">
        <form action="" name="sendToFriend" id="sendToFriendForm_temp">
            <h1>Send to Friend</h1>
            <fieldset>
                <div class="cs2gallery_sendto_left">
                    <label>Your Name*</label>
                    <input name="fromName" value="" id="fromName" required="required" pattern="[a-zA-Z ]{5,}" maxlength="30" />
                    <label>Your Email*</label>
                    <input name="fromEmail" value="" id="fromEmail" type="email" required="required" />
                </div>
                <div class="cs2gallery_sendto_left">
                    <label>Friend Name*</label>
                    <input name="toName" value="" id="toName" required="required" pattern="[a-zA-Z ]{5,}" maxlength="30" />
                    <label>Friend Email*</label>
                    <input name="toEmail" value="" id="toEmail" type="email" required="required" />
                </div>
                <label>Custom Message</label>
                <textarea rows="3" cols="16" id="message" name="message"></textarea>
                <input type="submit" name="submit" value="Send" class="cs2gallery_sendto_forms_submit" id="cs2gallery_sendto_submit" />
                <input type="button" id="cs2gallery_sendto_close" value="close" class="cs2gallery_sendto_forms_submit" />
                <div class="cs2gallery_clr"></div>
                <p>* Required Fields</p>
            </fieldset>
        </form>
    </div>
</div>

    


    

    
        <script type="text/javascript">
        /**
         * CS2 Gallery
         * main JS/jquery for cs2gallery functionality *
         */
       jQuery(document).ready(function() {
           /**
            * Fancybox frontend modifications
            */
           function formatTitle() {
               var headPrint = '<div id="cs2gallery_buttons"><span> <input type="button" onclick="jQuery.fancybox.close();" class="cs2gallery_btn" value="close" /></span></div>' +
                       '<div id="cs2gallery_sendto_form" class="cs2gallery_hide"></div>' +
                       '<div id="cs2gallery_sendto_success">Your recommendation was sent. Thank you!</div>' +
                       '<div id="cs2gallery_sendto_error">We are sorry, some error occurred. Please try again later.</div>' +
                       '<div id="cs2gallery_rating_box" class="cs2gallery_hide"><input name="star1" type="radio" class="star required" value="1" title="Worst" /><input name="star1" type="radio" class="star" value="2" title="Bad"/><input name="star1" type="radio" class="star" value="3" title="OK"/><input name="star1" type="radio" class="star" value="4" title="Good"/><input name="star1" type="radio" class="star" value="5" title="Best"/></div>';
               return headPrint;
           }

           /**
            * Fancybox
            */
           jQuery('.fancybox').fancybox({
               openEffect	: 'elastic',
               closeEffect	: 'elastic',
               closeBtn  : false,
               padding: 0,
               title: formatTitle(), // custom toolbar
               helpers : {
                   title: { type: 'inside'}
               },
               beforeShow: function(){
                   // Set alt of the image as lightbox image desc
                   this.title = this.title + '<span class="cs2gallery_title">' + jQuery(this.element).find('img').attr('alt') + '</span>';

                   // Hide/Show toolbar on mouseenter/leave
                   jQuery('.fancybox-wrap').mouseenter(function(){
                       jQuery('.fancybox-title-inside-wrap').animate({opacity: 1.0}, 250);
                       jQuery('#cs2gallery_rating_box').animate({opacity: 1.0}, 250);
                   }).mouseleave(function(){
                               jQuery('.fancybox-title-inside-wrap').animate({opacity: 0.0}, 500);
                               jQuery('#cs2gallery_rating_box').animate({opacity: 0.0}, 500);
                           });

                   // update url address bar when image change
                   location.hash = jQuery(this.element).find('img').attr('id');



               },
               afterShow: function() {
                   /**
                    * Photo Rating
                    */
                   var imgUid = jQuery(this.element).find('img').attr('id').split('_');
                   jQuery('.fancybox-wrap').prepend(jQuery('#cs2gallery_rating_box'));
                   jQuery.getJSON("de/type/100/?tx_cs2gallery_cs2gallery%5Baction%5D=getRating&tx_cs2gallery_cs2gallery%5Bcontroller%5D=Photos&cHash=f18fa37466f5bef48fd88735e6d9a47a&uid="+imgUid[1], function(data){
                       var rating = data['rating'];
                       // set actual rating
                       jQuery('#cs2gallery_rating_box input[value='+rating+']').attr('checked', true);

                       jQuery('input.star').rating({
                           // send user rating via ajax request
                           callback: function(value, link){
                               var cs2g_image_uid = location.hash.split('_');
                               jQuery.ajax({
                                   type: "POST",
                                   url: "de/type/100/?tx_cs2gallery_cs2gallery%5Baction%5D=setRating&tx_cs2gallery_cs2gallery%5Bcontroller%5D=Photos&cHash=abff57fcb9c0bb4c58137df78e4fb6e0",
                                   data: "rating="+value+'&img='+cs2g_image_uid[1],
                                   success: function(data){
                                       //alert(data); // not needed...
                                   },
                                   error: function(data){
                                       //alert(data); // not needed...
                                   }
                               });
                           }
                       });
                       jQuery('#cs2gallery_rating_box').animate({opacity: 1}, 250);
                   });


                   /**
                    * Send to friend dialog
                    */
                   jQuery('#cs2gallery_sendto_form').append(jQuery('.cs2gallery_sendto_forms').clone());
                   jQuery("#cs2gallery_sendto_btn").click(function(){
                       jQuery('.fancybox-title-inside-wrap').animate({
                           height: 160
                       }, function() {
                           jQuery('.cs2gallery_sendto_forms:eq(1) > form').attr("id","sendToFriendForm");
                           jQuery('#sendToFriendForm').show();
                           jQuery('#sendToFriendForm').animate({opacity: 1.0}, 250);
                       });

                       // submit form with user suggestion and send email via controller
                       jQuery('#cs2gallery_sendto_form').delegate('form', 'submit', function(){
                           jQuery('#cs2gallery_sendto_form > #sendToFriendForm').validator();
                           var fromName     = jQuery('#sendToFriendForm input[name=fromName]').val();
                           var toName       = jQuery('#sendToFriendForm input[name=toName]').val();
                           var fromEmail    = jQuery('#sendToFriendForm input[name=fromEmail]').val();
                           var toEmail      = jQuery('#sendToFriendForm input[name=toEmail]').val();
                           var msg          = jQuery('#sendToFriendForm textarea[name=message]').val();
                           var img_url      = window.location;

                           var data = 'fromName='+fromName+'&toName='+toName+'&fromEmail='+fromEmail+'&toEmail='+toEmail+'&msg='+msg+'&img_url='+img_url;

                           jQuery.ajax({
                               type: "POST",
                               url: "de/type/100/?tx_cs2gallery_cs2gallery%5Baction%5D=sendToFriend&tx_cs2gallery_cs2gallery%5Bcontroller%5D=Photos&cHash=b5cad4d88c519d6f29b330001ccba52c",
                               data: data,
                               success: function(data){
                                   jQuery('#sendToFriendForm').animate({opacity: 0}, 250, function(){
                                       jQuery('#cs2gallery_sendto_success').show();
                                       jQuery('#cs2gallery_sendto_success').animate({opacity: 1}, 250);
                                           setTimeout(function(){
                                               jQuery('#cs2gallery_sendto_success').animate({opacity: 0.0}, 250, function(){
                                                   jQuery('.fancybox-title-inside-wrap').animate({height: 35});
                                                   jQuery('#sendToFriendForm').hide();
                                               });
                                           }, 2000);
                                   });

                               },
                               error: function(data){
                                   //alert(data);
                                   jQuery('#cs2gallery_sendto_form').animate({opacity: 0}, 250, function(){
                                       jQuery('#cs2gallery_sendto_error').show();
                                       jQuery('#cs2gallery_sendto_error').animate({opacity: 1}, 250);
                                   });
                               }
                           });
                           return false;
                       });

                       jQuery('#cs2gallery_sendto_close').live('click', function(){
                           jQuery('#sendToFriendForm').animate({opacity: 0.0}, 250, function(){
                               jQuery('.fancybox-title-inside-wrap').animate({height: 35});
                               jQuery('#sendToFriendForm').hide();
                           });
                       });
                   });
               },
               afterClose: function() {
                       location.hash = null; // reset hash of actual image in url when close
               }
           });

           if (location.hash.substring(0, 6) == "#cs2g_") {
               var cs2g_image_uid = location.hash.split('_');
               jQuery('#cs2gallery_a_'+cs2g_image_uid[1]).trigger('click');
           }
       });
   </script>

</div>