$(document).ready(function() {	

$("p#p1intro").fadeTo(4000, 1);

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth 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();
		document.getElementById('ifr').src='movie.htm';
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
		document.getElementById('ifr').src='movie.htm';
	});
	
});



function qq(var1) {
	document.getElementById('qq').innerHTML= var1;
}

function piclink(var1, var2, var3){
	document.write ('<a href="http://www.youtube.com/embed/' + var2 + '?rel=0" target="mbox" onMouseover="qq(\'' + var1 + '\')" onMouseout="qq(\'&nbsp;\')"><img src="media/thumbs/' + var3 + '.jpg" width="76" height="64" border="0" alt="' + var1 + '"></a>');
}

function piclinkv(var1, var2, var3){
	document.write ('<a href="http://player.vimeo.com/video/' + var2 + '" target="mbox" onMouseover="qq(\'' + var1 + '\')" onMouseout="qq(\'&nbsp;\')"><img src="media/thumbs/' + var3 + '.jpg" width="76" height="64" border="0" alt="' + var1 + '"></a>');
}


function breaker(){
	document.write ('</div><div class="choices">');
}

function frontpage1(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://www.youtube.com/embed/' + var3 + '?rel=0\'"><img src="media/p1thumbs/hot1.jpg" border="0"></a></div>');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('</div>');
	document.write('</td>');

}

function frontpage2(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://www.youtube.com/embed/' + var3 + '?rel=0\'"><img src="media/p1thumbs/hot2.jpg" border="0"></a></div>');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('</div>');
	document.write('</td>');
}

function frontpage3(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://www.youtube.com/embed/' + var3 + '?rel=0\'"><img src="media/p1thumbs/hot3.jpg" border="0"></a></div>');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('</div>');
	document.write('</td>');
}

function frontpagev1(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://player.vimeo.com/video/' + var3 + '\'"><img src="media/p1thumbs/hot1.jpg" border="0"></a></div>');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('</div>');
	document.write('</td>');

}

function frontpagev2(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://player.vimeo.com/video/' + var3 + '\'"><img src="media/p1thumbs/hot2.jpg" border="0"></a></div>');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('</div>');
	document.write('</td>');
}

function frontpagev3(var1, var2, var3){
	document.write('<td>');
	document.write('<div class="hot">');
	document.write('<div class="title">' + var1 + '</div>');
	document.write('<div class="video"><a href="#dialog1" name="modal" onClick="document.getElementById(\'ifr\').src=\'http://player.vimeo.com/video/' + var3 + '\'"><img src="media/p1thumbs/hot3.jpg" border="0"></a></div>');
	document.write('<div class="description">' + var2 + '</div>');
	document.write('</div>');
	document.write('</td>');
}



