﻿$(document).ready(function() {
    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7) {
        // do nothing
    }
    else {
        $('.cWrap').show();
        $('.cWrap').hover(
            function() {
                $('.cDrop').stop(true, true).slideDown();
            },
            function() {
                $('.cDrop').stop(true, true).slideUp();
            }
        )
        $('.country').click(function() {
            x = $(this).attr('class');
            var xArray = x.split(" ");
            changeCultureCookie(xArray[0]);
        })
    }

    // set tracking on pdf's
    $('a').bind('click', function() {
        var url = $(this).attr('href');
        if (url.substr(-4) === ".pdf") {
            _gaq.push(['_trackEvent', 'PDFs', 'Download', url]);
        }
    });

    // set event tracking on login
    $('a.clientLogin').click(function() {
        _gaq.push(['_trackEvent', 'Login', 'Click']);
    });

    // set event tracking on contact us
    $('a.contactUs').click(function() {
        _gaq.push(['_trackEvent', 'Contact Us', 'Click']);
    });
})

function changeCultureCookie(c) {
    __doPostBack('__Page', "dc|" + c);
}



$(function () {
    $('.nyroModal').nyroModal();
});

/* for nyromodal */
//$(function() {
//    $.nyroModalSettings({
//        processHandler: function(settings) {
//            var from = settings.from;
//            if (from && from.href && from.href.indexOf('http://www.youtube.com/watch?v=') == 0) {
//                $.nyroModalSettings({
//                    type: 'swf',
//                    height: 561,
//                    width: 860,
//                    url: from.href.replace(new RegExp("watch\\?v=", "i"), 'v/')
//                });
//            }
//        }
//    });
//});


/* Set Cookies */
function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
}
