// SAMPLE AGE GATE HOOKS FROM DISNEY'S MAIN.JS
// assign IOS social button handlers
var $soc_container = $('.site-container .social a');
$soc_container.filter('[target="fb-like"]').click(function(e ){
gateway('javascript:openFBLike();');
e.stopPropagation();return false;
});
$soc_container.filter('[target="fb-share"]').click(function(e) {
gateway($(e.target).attr('href'));
e.stopPropagation();return false;
});
$soc_container.filter('[target="tw-tweet"]').click(function(e) {
gateway($(e.target).attr('href'));
e.stopPropagation();return false;
});
$soc_container.filter('[target="tw-follow"]').click(function(e) {
gateway($(e.target).attr('href'));
e.stopPropagation();return false;
});
// preserve default values in age gateway - pre filled with zeroes
$('#dialog-age-gate input').each(function() {
$(this).data('default', $(this).val());
});
$('#dialog-age-gate input').focus(function(e) {
if ($(e.target).val() == $(e.target).data('default')) {
$(e.target).val('');
}
});
$('#dialog-age-gate input').blur(function(e) {
if ('' == $(e.target).val()) {
$(e.target).val($(e.target).data('default'));
}
});
$('#dialog-age-gate input').keyup(function(e) {
filterNumbers($(e.target));
});
$('#dialog-age-gate input').blur(function(e) {
filterNumbers($(e.target));
});
// Open FB Like
function openFBLike () {
var x = (document.width - 360)/2;
if (navigator.appName.indexOf("Microsoft")!=-1) {
x = (document.body.offsetWidth - 360)/2;
}
document.getElementById("RES_ID_fb_pop_dialog_table").style.left = x + "px";
document.getElementById("RES_ID_fb_pop_dialog_table").style.top = "250px";
document.getElementById("fb-like").style.display = "block";
}
//Close FB Like
function closeFBLike() {
document.getElementById("fb-like").style.display = "none";
}
//DEPRECATED VIEWPORT AND ORIENTATION HEADER LINKS
//DEPRECATED ORIENTATION CHECK METHOD
var checkOrientation = function() {
$('body').bind('orientationchange',function(oce) {
curOr = oce.orientation;
});
};
//PAGE SWIPE FUNCTION - CURRENTLY UNUSED:
var bindSwipe = function() {
var curID = $curPage[0].id;
var curRayPos = pageRay.indexOf(curID);
var targetIndex;
$('.pagecontainer').bind('swipeleft',function(sle) {
//move forward
targetIndex = curRayPos+1;
//wrap
if (targetIndex == pageRay.length) {
targetIndex = 0;
}
$.mobile.changePage(pageRay[targetIndex]);
});
$('.pagecontainer').bind('swiperight',function(sre) {
//move backward
targetIndex = curRayPos-1;
//wrap
if (targetIndex < 0) {
targetIndex = pageRay.length-1;
}
$.mobile.changePage(pageRay[targetIndex], { reverse:true });
});
};