/* 
 * Template Name: Doma
 * Created date: 2010.11.5
 * Author: Olziibat
 * Mail: olziinaa@gmail.com
 */


$(document).ready(function() {
    // FANCYBOX DEFAULT

    // FANCYBOX DEFAULT
    $('.thumbArea a').fancybox({
        'titlePosition': 'inside',
        'overlayOpacity': 0.5,
        'overlayColor': '#000000'
    });
    // FANCYBOX DEFAULT
    $('.cmsGalleryList a').fancybox({
        'titlePosition': 'inside',
        'overlayOpacity': 0.5,
        'overlayColor': '#000000'
    });
    // JQUERY SPOTLIGHT FUNTION
    $('.spotlight').bind('mouseover', function () {
        $(this).spotlight({
            exitEvent: 'mouseover',
            speed: 100
        });
    });




    // IMAGE OVERLAY FUNCTION
    imgIconOverlay(jQuery);


    var overlayColor = '#000000';


});



// RECPLACING FONTS

Cufon.replace('h1, h2, h3, h4, h5, h6, p.cufon');
Cufon.replace('#logo-name, .dropcap, #logo-description,.jcycle-button, ul#menu-list li a, div.jcycle-slideshow-item p, #top-action-text h1, #top-action-text span, .day, .month, .slogan-text, #top-action-button a, .home-content table.pricing tr th, .err-number, .not-found-desc');


// IMAGE OVERLAY

function imgIconOverlay($) {


    // This will select the items which should include the image overlays
    $("a.imgMedium:not(.noIcon)").each(function(){
        var	ctnr = $(this);
        // insert the overlay image
        if (ctnr.children('img')) {
            if (ctnr.hasClass('iconPlay')) {
                ctnr.children('img').after($('<div class="imgOverlay symbolPlay"></div>'));
            } else if  (ctnr.hasClass('iconDoc')) {
                ctnr.children('img').after($('<div class="imgOverlay symbolDoc"></div>'));
            } else {
                ctnr.children('img').after($('<div class="imgOverlay symbolZoom"></div>'));
            }
        }

        var overImg = ctnr.children('.imgOverlay');

        if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 6) {
            // IE sucks at fading PNG's with gradients so just use show hide
            overImg.css('visibility','hidden'); // not visible to start

            ctnr.hoverIntent(
                function(){
                    overImg.css('visibility','visible');
                },		// mouseover
                function(){
                    overImg.css('visibility','hidden');
                }		// mouseout
                );
        } else {
            // make sure it's not visible to start
            overImg.css('opacity',0);

            ctnr.hoverIntent(
                function(){
                    overImg.animate({
                        'opacity':'1'
                    },100,'swing');
                },		// mouseover
                function(){
                    overImg.animate({
                        'opacity':'0'
                    },100,'swing');
                }		// mouseout
                );
        }
    });
}



