$(document).ready(function(){

	var closeWin=function(hash) {   
	$("#modalContainer").empty();  
	hash.w.fadeOut('2000',function(){ hash.o.remove(); }); }; 

	$('#modalContainer').jqm({onHide:closeWin});

	$(".jqModal").click(function(){
		divInfo=$(this).attr('id');
		divInfo=divInfo.split(",");
		divType=divInfo[0];

		if (divType=="video")
		{
			videoID=divInfo[1];
				$.ajax({
					url:"index.php",
					method:"GET",
					data:"ajax=1&action=videoInfo&videoID="+videoID,
					success: function (response){
						$("#modalContainer").html(response);
					}
				});
		}
		else {
			pageID=$(this).children('h2').attr('id');
			if (!pageID)
			{
				pageID=$(this).attr('id');
			}
			
				$.ajax({
					url:"index.php",
					method:"GET",
					data:"pageID="+pageID,
					success: function (response){
						$("#modalContainer").html(response);
					}
				});

		}
		});
});

function closeVideo(){
	$("#modalContainer").empty(); 
	$("#modalContainer").jqmHide();
}
