
<!--

 //var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 
//-->


jQuery(document).ready(function() {
    var autoTime = 5000;
    var fancyopen = false; 
    
	jQuery("#divcarousel").jCarouselLite({
        vertical: true,
        hoverPause:true,
        visible: 1,
        speed:1000,
        btnNext: "#divcarousel .next",
        btnPrev: "#divcarousel .prev"
    });
    
    var x = setInterval("jQuery('#divcarousel .next').trigger('click');", autoTime);
    
    jQuery("#divcarousel").hover(function() {
        clearInterval(x);
        x = false; 
    }, function() {
        if(!fancyopen && !x) 
        { 
            x = setInterval("jQuery('#divcarousel .next').trigger('click');", autoTime); 
        } 
    });

    
   
    jQuery('#videocarousel').jcarousel({
        vertical: true,
        scroll: 4
    });
   
   jQuery(".fancyvideo").click(function() {
        jQuery.fancybox({
            'padding': 0,
            'autoScale': false,
            'transitionIn': 'none',
            'transitionOut': 'none',
            'overlayColor': '#000',
            'title': this.title,
            'width': 640,
            'height': 385,
            'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
            'type': 'swf',
            'onStart': function() { clearInterval(x); fancyopen = true; x = false; },
           	'onClosed': function() { x = setInterval("jQuery('#divcarousel .next').trigger('click');", autoTime); fancyopen = false; },
            'swf': {
                'wmode': 'transparent',
                'allowfullscreen': 'true'
            }
        });
 
        return false;
    }); 
  
});
