function resizePopup() { $('#popup_modal').css('height', parseInt(($(window).height()*0.8))+'px'); } $(document).ready(function() { $('a[rel=testimonials]').each(function() { $(this).click(function() { popURL = '#?w=745&h='+parseInt($(window).height()*0.8)+'px'; $('#popup_modal').html($('#testimonials').html()); $('#popup_testimonials').css('height', parseInt($(window).height()*0.8)+'px'); hbc_popup('popup_modal', popURL); return false; }); }); $('a[rel=galwssslery]').each(function() { var popURL = '#?w=790&h=455'; $(this).click(function() { var spl = $(this).attr('href').toString().split('#')[1]; var _percent = 1; var _w = parseInt(spl.split('&')[0].toString().split('=')[1]); var _h = parseInt(spl.split('&')[1].toString().split('=')[1]); popURL = '#?w='+_w+'&h='+_h; var _width = parseInt(_w*_percent); var _height = parseInt(_h*_percent); var _sW = $(window).width() * _percent; if(_w > _sW) { var _p = ((_w - _sW)*100)/_w; _width = _w - parseInt(_w * (_p/100)); _height = _h - parseInt(_h*(_p/100)); popURL = '#?w=' + _width + '&h=' +_height; _width = parseInt(_width * _percent); _height = parseInt(_height * _percent); } var _content = ''; $('#popup_modal').html(_content); hbc_popup('popup_modal', popURL, true, _percent); return false; }); }); //Close Popups and Fade Layer $('a.close, #fade').live('click', function() { //When clicking on the close or fade layer... $('#fade , .popup_block').fadeOut(function() { $('#fade, a.close').remove(); //fade them both out }); return false; }); }); function hbc_privacy() { $('#popup_modal').html($('#terms-conditions-html').html()); var popID = 'popup_modal'; //Get Popup Name var popURL = '#?w=500'; //Get Popup href to define size hbc_popup(popID, popURL); } function hbc_popup(popID, popURL, unfloat, _percent, video, right) { //Pull Query & Variables from href URL var query= popURL.split('?'); var dim= query[1].split('&'); var popWidth = dim[0].split('=')[1]; //Gets the first query string value if(unfloat && video == null) { popWidth = popWidth*_percent; var popHeight = dim[1].split('=')[1]; $('#' + popID).css({ 'height' : Number(parseInt(popHeight)*_percent-1) }); } if(right == null) right = 0; //Fade in the Popup and add close button $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend(''); if(video) $('#' + popID).css({ 'height' : Number(dim[1].split('=')[1]) }); //Define margin for center alignment (vertical horizontal) - we add 80px to the height/width to accomodate for the padding and border width defined in the css var popMargTop = ($('#' + popID).height() + 80) / 2; var popMargLeft = ($('#' + popID).width() + 80) / 2; //Apply Margin to Popup $('#' + popID).css({ 'margin-top' : -popMargTop, 'margin-left' : -popMargLeft, 'position' : 'fixed', 'top' : '50%', 'padding' : '20px', 'display' : 'block' }); if(unfloat && video == null) { $('#' + popID).css({ 'margin-top' : 0, 'margin-left' : -popMargLeft, 'position' : 'absolute', 'top' : ($(window).scrollTop() + 100) + 'px', 'padding' : '0px' }); } //Fade in Background $('body').append('
'); //Add the fade layer to bottom of the body tag. $('#fade').css({ 'filter' : 'alpha(opacity=69)' }).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies }