﻿$J(document).ready(function () {    

    // HOMEPAGE CAROUSEL
    $J('.carousel').cycle({
        fx: 'turnLeft',
        speed: 'slow',
        timeout: 5000,
        prev: '.prev',
        next: '.next',
        pager: '.pager',
        cleartype: true,
        cleartypeNoBg: true
    });

    // WHAT'S NEW VIDEO POPUP

    if ($J('.pic').hasClass('video')) {
        //$J('.video').wrap('<a href="videopopup.html?placeValuesBeforeTB_=savedValues&amp;TB_iframe=true&amp;height=370&amp;width=400&amp;inlineId=videoContainer" class="thickbox" />');
        //$J('.video').wrap('<a href="#TB_inline?placeValuesBeforeTB_=savedValues&amp;height=370&amp;width=400&amp;inlineId=videoContainer" class="thickbox" />');
    }

    tb_init('a.thickbox, area.thickbox, input.thickbox');

    //PAGER REGION WIDTH
    var pagerNum = $J('.pager').children('a').size();
    var pagerWidth = 32 + (pagerNum * 25);
    // prev and next is 32 px, each of pager is 25px;
    $J('.pagerContainer').css("width", pagerWidth + "px");

    //png fix load

});

/*Png fix*/
function fixPng(png) {
    var src = png.src;
   
    //No manual height and width set
    if (!png.style.width && $J(png).css('width') == 'auto') png.style.width = $J(png)[0].offsetWidth+"px"; 
    if (!png.style.height && $J(png).css('height') == 'auto') png.style.height = $J(png)[0].offsetHeight+"px"; 
    
    // replace by blank image
    png.onload = function() { };
    png.src = blank.src;
    png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
