/* 
 * Bionest 
 */
$(document).ready(function() {
        
        $('#btnBrochure').click(function(){
            if( $('.docsBrochure').css('display') == 'block'){
                $('.docsBrochure').slideUp(300);   
            }else{
                $('.docsBrochure').slideDown(300);
            }
           
        });
        
        $(".isFancy").fancybox({
            'transitionIn'        : 'fade',
            'transitionOut'       : 'elastic',
            'margin' : '0px', 
            'padding': '0px'
        });
        $(".iframe").fancybox({
            'width' : 720,
            'height': 480,
            'transitionIn'        : 'fade',
            'transitionOut'       : 'elastic',
            'margin' : '0px', 
            'padding': '0px'
        });
        $(".fancyVideo").click(function() {
                 $.fancybox({
                  'padding'             : 0,
                  'autoScale'   : false,
                  'transitionIn'        : 'elastic',
                  'transitionOut'       : 'fade',
                  'title'               : this.title,
                  'width'               : 640,
                  'height'              : 386,
                  'href'                : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                  'type'                : 'swf',    // <--add a comma here
                  'swf'                 : {'allowfullscreen':'true'} // <-- flashvars here
                  });
                 return false;

            });
 	$('#searchFld').focus(function(){
 		/*
 		* if search field contains the hint... empty it
 		*/
 		if($(this).val() == $("#searchHint").val()){
 			$(this).val('');
 		}
 	});
 	$('#searchFld').blur(function(){
 		/*
 		* if search field is empty... show hint
 		*/
 		if($(this).val() == ''){
 			$(this).val($("#searchHint").val());
 		}
 	});
 	
 	
 	$('#searchBtn').click(function(){
 		if($('#searchFld').val() != $("#searchHint").val()){
 			$('#searchForm').submit();
 		}
 		
 	});
 	
 	var cache = [];
	$.preLoadImages = function() {
	  var args_len = arguments.length;
	  for (var i = args_len; i--;) {
	    var cacheImage = document.createElement('img');
	    cacheImage.src = arguments[i];
	    cache.push(cacheImage);
	  }
	}
});
