<link rel="stylesheet" href="css/jquery.css">
<link rel="stylesheet" href="css/simpleform.css">

<script src="js/jquery-ui.js"></script>
  <script src="js/jquery-u2.js"></script>
  <script src="js/validate.js"></script>  
  <script src="js/simpleform.js"></script>  
    <script src="js/moder.js"></script>  
  
	<!-- Add fancyBox main JS and CSS files -->
	<script type="text/javascript" src="js/source/jquery.fancybox.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="js/source/jquery.fancybox.css?v=2.1.5" media="screen" />

	<!-- Add Button helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="js/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
	<script type="text/javascript" src="js/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>

	<!-- Add Thumbnail helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="js/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
	<script type="text/javascript" src="js/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

	<!-- Add Media helper (this is optional) -->
	<script type="text/javascript" src="js/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>

 <!--  <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
   <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script> 
-->

  <script>
  $(function() {
	if($('#sticky').length>0){
       $(window).scroll(sticky_relocate);
	   sticky_relocate();
    }
    $( ".date" ).datepicker({dateFormat: 'dd/mm/yy'}); 
   
   $( ".datefrom" ).datepicker({
       dateFormat: 'dd/mm/yy',
          	firstDay: 0, 
                 
      onSelect: function( selectedDate ) {
           console.log(new Date(Date.parse($(".datefrom").attr("mindate"))));
        $( ".dateto" ).datepicker( "option", "minDate", selectedDate );  
         if (typeof restaFecha == 'function')
            {
              restaFecha();
            }else  if (typeof restaFechas == 'function')
                restaFechas();
      }
    }); 
           var noAttr = $( ".datefrom" ).attr('mindate'); // undefined
               if(typeof noAttr != 'undefined') { // strict equality comparison doesn't work
                    dae=noAttr.split("/");
                    newfor=dae[1]+"/"+dae[0]+"/"+dae[2];
                    
                    $( ".datefrom" ).datepicker( "option", "minDate",  new Date(Date.parse(newfor)));
                    }
                    
    $( ".dateto" ).datepicker({ 
        dateFormat: 'dd/mm/yy', mindate: 0,     
       onSelect: function( selectedDate ) {
        $( ".datefrom" ).datepicker( "option", "maxDate", selectedDate );
         
        if (typeof restaFecha == 'function')
            {
              restaFecha();
            }else  if(typeof restaFechas == 'function')
                restaFechas();
           
         }
    });
    
    
    
    });
	
	function sticky_relocate() {
		var window_top = $(window).scrollTop();
		var div_top = $('#sticky-anchor').offset().top;
		if (window_top > div_top) {
			$('#sticky').addClass('stick');
			$('#sticky-anchor').height($('#sticky').outerHeight());
		} else {
			$('#sticky').removeClass('stick');
			$('#sticky-anchor').height(0);
		}
	}
  </script>
