$(document).ready(function(){
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//$('#maskimg').css({ 'width': maskWidth, 'height': maskHeight });
$('#maskimg2').css({ 'width': maskWidth, 'height': maskHeight });

var winH = $(window).height();
var winW = $(window).width();

$('.popup1').click(function(){
$(".firstdiv").css('top:0');
$(".firstdiv").css('left', winW / 2 - $(".firstdiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".firstdiv").fadeIn(1000);
});
$('.popup2').click(function(){
$(".seconddiv").css('top:0');
$(".seconddiv").css('left', winW / 2 - $(".seconddiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".seconddiv").fadeIn(1000);
});

$('.popup3').click(function(){
$(".thirddiv").css('top:0');
$(".thirddiv").css('left', winW / 2 - $(".thirddiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".thirddiv").fadeIn(1000);
});

$('.popup4').click(function(){
$(".fourthdiv").css('top:0');
$(".fourthdiv").css('left', winW / 2 - $(".thirddiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".fourthdiv").fadeIn(1000);
});


$(".fifthdiv").css('top', winH / 2 - $(".fifthdiv").height() / 2);
$(".fifthdiv").css('left', winW / 2 - $(".fifthdiv").width() / 2);
$('#maskimg2').fadeIn(500);
$('#maskimg2').fadeTo("slow", 0.8);
$(".fifthdiv").fadeIn(1000);


$('.popup6').click(function(){
$(".sixthdiv").css('top', winH / 2 - $(".sixthdiv").height() / 2);
$(".sixthdiv").css('left', winW / 2 - $(".sixthdiv").width() / 2);
$('#maskimg2').fadeIn(500);
$('#maskimg2').fadeTo("slow", 0.8);
$(".sixthdiv").fadeIn(1000);
});


$(".seventhdiv").css('top', winH / 2 - $(".seventhdiv").height() / 2);
$(".seventhdiv").css('left', winW / 2 - $(".seventhdiv").width() / 2);
$('#maskimg2').fadeIn(500);
$('#maskimg2').fadeTo("slow", 0.8);
$(".seventhdiv").fadeIn(1000);



$(".eighthdiv").css('top', winH / 2 - $(".eighthdiv").height() / 2);
$(".eighthdiv").css('left', winW / 2 - $(".eighthdiv").width() / 2);
$('#maskimg2').fadeIn(500);
$('#maskimg2').fadeTo("slow", 0.8);
$(".eighthdiv").fadeIn(1000);

});


function modelpopup() {
$(".firstdiv").fadeOut(500);
$(".seconddiv").fadeOut(1000);
$(".thirddiv").fadeOut(500);
$(".fourthdiv").fadeOut(500);
$(".fifthdiv").fadeOut(500);
$(".sixthdiv").fadeOut(500);
$(".seventhdiv").fadeOut(500);
$(".eighthdiv").fadeOut(500);
$('#maskimg').fadeOut(500);
}

function modelpopupshow() {
var winH = $(window).height();
var winW = $(window).width();
$(".firstdiv").css('top:0');
$(".firstdiv").css('left', winW / 2 - $(".firstdiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".firstdiv").fadeIn(1000);
}
function modelpopupshow2() {
var winH = $(window).height();
var winW = $(window).width();
$(".seconddiv").css('top:0');
$(".seconddiv").css('left', winW / 2 - $(".seconddiv").width() / 2);
$('#maskimg').fadeIn(500);
$('#maskimg').fadeTo("slow", 0.8);
$(".seconddiv").fadeIn(1000);
}
