$(document).ready(function() { //select all the a tag with name equal to modal $('a[name=modal]').click(function(e) { //Cancel the link behavior e.preventDefault(); $.ajax({ url: "/admin/", cache: false, success: function(data){ document.getElementById('modaldata').innerHTML = data; } }); //Get the A tag var id = $(this).attr('href'); //Get the screen height and width var maskHeight = $(document).height(); var maskWidth = $(window).width(); //Set height and width to mask to fill up the whole screen $('#mask').css({'width':maskWidth,'height':maskHeight}); //transition effect $('#mask').fadeIn(1000); $('#mask').fadeTo("slow",0.8); //Get the window height and width var winH = $(window).height(); var winW = $(window).width(); //Set the popup window to center $(id).css('top', winH/2-$(id).height()/2); $(id).css('left', winW/2-$(id).width()/2); //transition effect $(id).fadeIn(2000); }); //if close button is clicked $('.window .close').click(function (e) { //Cancel the link behavior e.preventDefault(); $('#mask').hide(); $('.window').hide(); }); //if mask is clicked $('#mask').click(function () { $(this).hide(); $('.window').hide(); }); }); function default_pick(arg, def) { return (typeof arg == 'undefined' ? def : arg); } function showdialog(valueref, x_height, x_width) { x_height=default_pick(x_height,$('#dialog').height()); x_width=default_pick(x_width,$('#dialog').width()); document.getElementById('modaldata').innerHTML = 'Loading...'; $.ajax({ url: valueref, cache: false, success: function(data){ document.getElementById('modaldata').innerHTML = data; } }); var id = document.getElementById('#dialog'); //Get the screen height and width var maskHeight = $(document).height(); var maskWidth = $(window).width(); //Set height and width to mask to fill up the whole screen $('#mask').css({'width':maskWidth,'height':maskHeight}); //transition effect $('#mask').fadeIn(1000); $('#mask').fadeTo("slow",0.8); //Get the window height and width var winH = $(window).height(); var winW = $(window).width(); //alert( 'Window Height:' + winH ); //Set the popup window to center $('#dialog').css('top', winH/2-x_height/2); $('#dialog').css('left', winW/2-x_width/2); $('#dialog').css('height', x_height); $('#dialog').css('width', x_width); //transition effect $('#dialog').fadeIn(2000); } function showextra(id) { //alert('showextra'); document.getElementById('showmore[' + id + ']').style.display = 'none'; document.getElementById('hidemore[' + id + ']').style.display = 'block'; } function hideextra(id) { //alert('hideextra'); document.getElementById('hidemore[' + id + ']').style.display = 'none'; document.getElementById('showmore[' + id + ']').style.display = 'block'; }