2 var thickDims, tbWidth, tbHeight;
3 jQuery(document).ready(function($) {
5 thickDims = function() {
6 var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
8 w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
9 h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
11 if ( tbWindow.size() ) {
12 tbWindow.width(w).height(h);
13 $('#TB_iframeContent').width(w).height(h - 27);
14 tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
15 if ( typeof document.body.style.maxWidth != 'undefined' )
16 tbWindow.css({'top':'30px','margin-top':'0'});
21 $(window).resize( function() { thickDims() } );
23 $('a.thickbox-preview').click( function() {
26 var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text;
28 if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
29 tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
31 tbWidth = $(window).width() - 90;
33 if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
34 tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
36 tbHeight = $(window).height() - 60;
39 url = alink.attr('href') || '';
40 text = alink.attr('title') || '';
41 link = ' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
43 text = $(this).attr('title') || '';
44 link = ' <span class="tb-theme-preview-link">' + text + '</span>';
47 $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
48 $('#TB_closeAjaxWindow').css({'float':'left'});
49 $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
51 $('#TB_iframeContent').width('100%');
58 $('.theme-detail').click(function () {
59 $(this).siblings('.themedetaildiv').toggle();