$(document).ready(function () {
    $('form').show();
    $("[id$='ckbCheque']").click(function () {
        if ($(this).is(':checked')) {
            $("#creditCardTable").slideUp()
        } else {
            $("#creditCardTable").slideDown()
        };
    });
  $('.prominentSpeakers').cycle('fade');
  $('#followUs a').hover(function(){$(this).stop().animate({opacity:0.5},300)},function(){$(this).stop().animate({opacity:1},200)});
  $('.cta a.ctaButton').hover(function () { $(this).stop().animate({ backgroundColor: '#454545',backgroundPosition: '100% 0px' }, 300) }, function () { $(this).stop().animate({ backgroundColor: '#00467F',backgroundPosition: '100% -70px' }, 200) });
  $('nav ul li a:not(.selected)').hover(function(){$(this).stop().animate({backgroundPosition:'50% 32px'},300)},function(){$(this).stop().animate({backgroundPosition:'50% 45px'}, 200) });
  $('#standardSite #sideNav ul.sideNav li:not(.selected) > a').hover(function(){$(this).stop().animate({borderLeftColor:'#00467F'},500)},function(){$(this).stop().animate({borderLeftColor:'#CFCFCF'}, 200) });
  $('#greenSite #sideNav ul.sideNav li:not(.selected) > a').hover(function(){$(this).stop().animate({borderLeftColor:'#19733c'},500)},function(){$(this).stop().animate({borderLeftColor:'#c4dbcd'}, 200) });
  $('#homePage').fixHeight();  
  $('.footerSiteMap .level1').fixHeight();  
  //$("#main").fixHeight();
  //$(".contentTextContainer").resize(function(){    
    //$("#main").fixHeight();
  //});
    $('.button').button();
  //Gallery Javascript to make popups
  $("a[rel=gallery]").fancybox({
        'transitionIn'  : 'elastic',
        'transitionOut'  : 'elastic',
        'titlePosition'  : 'inside',
        'titleFormat'    : function(title, currentArray, currentIndex, currentOpts) {
          return '<div id="fancybox-title-inside">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '<p>' + title + '</p>' + '</div>';
        }
      });
    // $('input:submit').button();
   //     $('input:button').button();
    $('.whoIsComing').button({ icons: { primary: "ui-icon-help", secondary: "ui-icon-newwin"} });
    $('.linkButtonSubmit').button({ icons: { secondary: "ui-icon-circle-triangle-e"} });
    //$('.question').button({ icons: { primary: "ui-icon-help" }, text: false });
  $('.question').hide();
    $('.save').button();
    var questionTitle = $('.instructionPane h3');
    var questionDlg = $('.instructionPane').dialog({ autoOpen: false, width: 700, show: "blind", title: questionTitle.text() });
    questionTitle.hide();
    $('.question').click(function (event) {
        event.preventDefault();
        questionDlg.dialog("open");
    });

    var dlgFrgtPass = $('.forgotPassword').dialog({ autoOpen: false, width: 500, height: 200, show: "blind", title: $('#forgotPasswordTitle').html() });
    dlgFrgtPass.parent().appendTo($("form:first"));
    $('#forgotPasswordTitle').hide();
    $("#PasswordRecoveryLink").click(function (event) {
        event.preventDefault();
        dlgFrgtPass.dialog("open");
        if($('[id$="UserName"]').val()){
         $('[id$="tbxEmailForgetPass"]').val($('[id$="UserName"]').val());
        }
    });

    $(".linkButton").button();
    //$('.linkButton').button({ icons: { secondary: "ui-icon-circle-triangle-e"} });
    $('.eventDetailsItem').hide();
  //hack because of hardcoded class name is in code behind
    $('.CurrentRegPanel .eventDetailsItem').show();
    $('.detailButton').button({ icons: { primary: "ui-icon-circle-plus"} }).click(function (event) {
        event.preventDefault();
        $(this).next().slideToggle();
        $(this).toggleClass("clicked");
        if ($(this).hasClass("clicked"))
            $(this).button("option", "icons", { primary: "ui-icon-circle-minus" });
        else
            $(this).button("option", "icons", { primary: "ui-icon-circle-plus" });

    }).css("font-size", 11);
    $("#tabs").tabs();

    $(".modalOpen").click(function (event) {
        event.preventDefault();
        var url = $(this).attr("href");
        var title = $(this).attr('title')
        var newDiv = $('<iframe frameBorder="0"></iframe>').attr('src', url).dialog({
            title: title,
            width: 560,
            height: 370,
            modal: true
        }).css({ width: "530px", height: "350px" });

    });
    //    $("#linksResources ul").hide();
    //    $("#linksResources h4").click(function (e) {
    //        e.preventDefault();
    //        $(this).next().slideToggle();
    //        $(this).toggleClass("clicked");
    //    });
    $(".accordion").accordion({
        autoHeight: false,
        collapsible: true,
        active: false
    });

  //autocomplete
    if ($("#strCompanies").length > 0 ) {
    
        var options = {
            'maxCharacterSize': 200,
            'textFontSize': '12px',
            'textColor': '#5C2306',
            'textFamily': 'Tahoma,sans-serif',
            'textAlign': 'right',
            'warningColor': '#CC3300',
            'warningNumber': 40,
            'isCharacterCount': true,
            'isWordCount': false
        };
        if ($("[id$='_taDescription']").Length > 0) {
            $("[id$='_taDescription']").textareaCount(options);
        }
        var data = $("#strCompanies").val().split(',');
        $("#tbxCompany").autocomplete({
            source: function(req, response) {
                var re = $.ui.autocomplete.escapeRegex(req.term);
                var matcher = new RegExp("^" + re, "i");
                response($.grep(data, function(n) {
                    return matcher.test(n);
                }));
            },
            minLength: 2
        });
    }
  
    //Job Postings
    $('.postingSection').hide();
    $('.postingSection:first').show();
     $('input#btnNext').click(function () {
        if (Page_ClientValidate('posting'))
            $(this).parents('.postingSection').first().slideToggle("slow").next().slideToggle("slow");
    });
    $('input#btnPrevious').click(function () {
        $(this).parents('.postingSection').first().slideToggle("slow").prev().slideToggle("slow");
    });
    $('.highlight').focus(function () {
        $(this).parent().parent().parent().stop().animate({
            backgroundColor: "#ececec"
        }, 500);
    });
    $('.highlight').blur(function () {
        $(this).parent().parent().parent().stop().animate({
            backgroundColor: "transparent"
        }, 300);
    });
    //$('input:submit').button().css("font-size", 12);
    $('#btnNext').button({ icons: { secondary: "ui-icon-circle-triangle-e"} }).css("font-size", 12);
    $('#btnPrevious').button({ icons: { primary: "ui-icon-circle-triangle-w"} }).css("font-size", 12);
    $('.postingTable tr:odd').css("background-color", "#EBEAE8");
    //End JobPostings
    $('.datepicker').datepicker();
    /*Style Tables with jQuery UI*/
    $(".postingTable th").each(function () { $(this).addClass("ui-state-default"); });
    //$("#postingTable td").each(function() { $(this).addClass("ui-widget-content"); });
    $(".postingTable tr").hover(function () { $(this).children("td").addClass("ui-state-hover"); }, function () { $(this).children("td").removeClass("ui-state-hover"); });
    $(".postingTable tr").click(function () { $(this).children("td").toggleClass("ui-state-highlight"); });

    $("[id$='chkbxCheque']").click(function () {
        $("[id$='pnlCreditCard']").slideToggle();
        $("[id$='pnlCardExists']").slideToggle();
    });
    //Contact Us Google Map
  if (typeof ItemEditing == 'undefined') {
 $('div[class=map]').each(function() {     
    $(this).addClass('mapdimensions');
    var mapId = $(this).attr('id');    
    var value = $(this).html();
    value = $.trim(value);    
    var point = value.split(',');
    var lat = parseFloat(point[0]);
    var lon = parseFloat(point[1]);
    var zoom = parseFloat(point[2]);
    
    var latlng = new google.maps.LatLng(lat, lon);
    var myOptions = {
      zoom: zoom,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById(mapId),myOptions);
     var marker = new google.maps.Marker({
      position: latlng,
       map: map
    });   
    
  });}

});


function checkPurchases() {
}
    

