

	/***************************/

//@Author: Adrian "yEnS" Mato Gondelle

//@website: www.yensdesign.com

//@email: yensamg@gmail.com

//@license: Feel free to use it, but keep this credits please!					

/***************************/



//SETTING UP OUR POPUP

//0 means disabled; 1 means enabled;

var popupStatus = 0;

var currPopup = "";





//loading popup with jQuery magic!

function loadPopup(thisPop){

//	alert("loading...");
	currPopup = thisPop;

	//loads popup only if it is disabled

	if(popupStatus==0){

		$("#backgroundPopup").css({

			"opacity": "0.7"

		});

		$("#backgroundPopup").fadeIn("slow");

		$(thisPop).fadeIn("slow");

		popupStatus = 1;

	}

}



//disabling popup with jQuery magic!

function disablePopup(thisPop){

	//disables popup only if it is enabled

	if(popupStatus==1){

		$("#backgroundPopup").fadeOut("slow");

		$(thisPop).fadeOut("slow");

		popupStatus = 0;

		//clearRows();

	}

}



function clearRows()

{

	var table = document.getElementById("spaces");

	var rows = table.getElementsByTagName("tr");

	for(r = 0; r < rows.length; r++)

	{

		rows[r].style.backgroundColor="#FFFFFF";

	}



}



function rollMouse()

{

	if(popupStatus == 0)

	{

		return "#FFFFFF";

	}



	else

	{

		return "#0099CC";

	}



}



function rowClick(thisPop, row)
{

//	alert("Row click!");
	
	centerPopup(thisPop);
	

	//load popup

	loadPopup(thisPop);

	//row.bgcolor = "#00CC88";

	

}



//centering popup

function centerPopup(thisPop){

	//request data for centering

	var windowWidth = document.documentElement.clientWidth;

	var windowHeight = document.documentElement.clientHeight;

	

	var windowWidth = screen.width;

	var windowHeight = screen.height*.8;

	

	var popupHeight = $(thisPop).height();

	var popupWidth = $(thisPop).width();

	//centering

	$(thisPop).css({

		"position": "absolute",

		"top": windowHeight/2-popupHeight/2,

		"left": windowWidth/2-popupWidth/2

	});

	//only need force for IE6

	

	$("#backgroundPopup").css({

		"height": windowHeight

	});

	

}





//CONTROLLING EVENTS IN jQuery

$(document).ready(function(){

	

				

	//CLOSING POPUP

	//Click the x event!

		//LOADING POPUP

		//Click the button event!

		$("#button0").click(function(){

			//centering with css

			centerPopup("#popup0");

			//document.write("#popup0");

			//load popup

			loadPopup("#popup0");

		});

	

		$("#popupClose0").click(function(){

			disablePopup("#popup0");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button1").click(function(){

			//centering with css

			centerPopup("#popup1");

			//document.write("#popup1");

			//load popup

			loadPopup("#popup1");

		});

	

		$("#popupClose1").click(function(){

			disablePopup("#popup1");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button2").click(function(){

			//centering with css

			centerPopup("#popup2");

			//document.write("#popup2");

			//load popup

			loadPopup("#popup2");

		});

	

		$("#popupClose2").click(function(){

			disablePopup("#popup2");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button3").click(function(){

			//centering with css

			centerPopup("#popup3");

			//document.write("#popup3");

			//load popup

			loadPopup("#popup3");

		});

	

		$("#popupClose3").click(function(){

			disablePopup("#popup3");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button4").click(function(){

			//centering with css

			centerPopup("#popup4");

			//document.write("#popup4");

			//load popup

			loadPopup("#popup4");

		});

	

		$("#popupClose4").click(function(){

			disablePopup("#popup4");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button5").click(function(){

			//centering with css

			centerPopup("#popup5");

			//document.write("#popup5");

			//load popup

			loadPopup("#popup5");

		});

	

		$("#popupClose5").click(function(){

			disablePopup("#popup5");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button6").click(function(){

			//centering with css

			centerPopup("#popup6");

			//document.write("#popup6");

			//load popup

			loadPopup("#popup6");

		});

	

		$("#popupClose6").click(function(){

			disablePopup("#popup6");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button7").click(function(){

			//centering with css

			centerPopup("#popup7");

			//document.write("#popup7");

			//load popup

			loadPopup("#popup7");

		});

	

		$("#popupClose7").click(function(){

			disablePopup("#popup7");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button8").click(function(){

			//centering with css

			centerPopup("#popup8");

			//document.write("#popup8");

			//load popup

			loadPopup("#popup8");

		});

	

		$("#popupClose8").click(function(){

			disablePopup("#popup8");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button9").click(function(){

			//centering with css

			centerPopup("#popup9");

			//document.write("#popup9");

			//load popup

			loadPopup("#popup9");

		});

	

		$("#popupClose9").click(function(){

			disablePopup("#popup9");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button10").click(function(){

			//centering with css

			centerPopup("#popup10");

			//document.write("#popup10");

			//load popup

			loadPopup("#popup10");

		});

	

		$("#popupClose10").click(function(){

			disablePopup("#popup10");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button11").click(function(){

			//centering with css

			centerPopup("#popup11");

			//document.write("#popup11");

			//load popup

			loadPopup("#popup11");

		});

	

		$("#popupClose11").click(function(){

			disablePopup("#popup11");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button12").click(function(){

			//centering with css

			centerPopup("#popup12");

			//document.write("#popup12");

			//load popup

			loadPopup("#popup12");

		});

	

		$("#popupClose12").click(function(){

			disablePopup("#popup12");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button13").click(function(){

			//centering with css

			centerPopup("#popup13");

			//document.write("#popup13");

			//load popup

			loadPopup("#popup13");

		});

	

		$("#popupClose13").click(function(){

			disablePopup("#popup13");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button14").click(function(){

			//centering with css

			centerPopup("#popup14");

			//document.write("#popup14");

			//load popup

			loadPopup("#popup14");

		});

	

		$("#popupClose14").click(function(){

			disablePopup("#popup14");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button15").click(function(){

			//centering with css

			centerPopup("#popup15");

			//document.write("#popup15");

			//load popup

			loadPopup("#popup15");

		});

	

		$("#popupClose15").click(function(){

			disablePopup("#popup15");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button16").click(function(){

			//centering with css

			centerPopup("#popup16");

			//document.write("#popup16");

			//load popup

			loadPopup("#popup16");

		});

	

		$("#popupClose16").click(function(){

			disablePopup("#popup16");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button17").click(function(){

			//centering with css

			centerPopup("#popup17");

			//document.write("#popup17");

			//load popup

			loadPopup("#popup17");

		});

	

		$("#popupClose17").click(function(){

			disablePopup("#popup17");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button18").click(function(){

			//centering with css

			centerPopup("#popup18");

			//document.write("#popup18");

			//load popup

			loadPopup("#popup18");

		});

	

		$("#popupClose18").click(function(){

			disablePopup("#popup18");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button19").click(function(){

			//centering with css

			centerPopup("#popup19");

			//document.write("#popup19");

			//load popup

			loadPopup("#popup19");

		});

	

		$("#popupClose19").click(function(){

			disablePopup("#popup19");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button20").click(function(){

			//centering with css

			centerPopup("#popup20");

			//document.write("#popup20");

			//load popup

			loadPopup("#popup20");

		});

	

		$("#popupClose20").click(function(){

			disablePopup("#popup20");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button21").click(function(){

			//centering with css

			centerPopup("#popup21");

			//document.write("#popup21");

			//load popup

			loadPopup("#popup21");

		});

	

		$("#popupClose21").click(function(){

			disablePopup("#popup21");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button22").click(function(){

			//centering with css

			centerPopup("#popup22");

			//document.write("#popup22");

			//load popup

			loadPopup("#popup22");

		});

	

		$("#popupClose22").click(function(){

			disablePopup("#popup22");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button23").click(function(){

			//centering with css

			centerPopup("#popup23");

			//document.write("#popup23");

			//load popup

			loadPopup("#popup23");

		});

	

		$("#popupClose23").click(function(){

			disablePopup("#popup23");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button24").click(function(){

			//centering with css

			centerPopup("#popup24");

			//document.write("#popup24");

			//load popup

			loadPopup("#popup24");

		});

	

		$("#popupClose24").click(function(){

			disablePopup("#popup24");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button25").click(function(){

			//centering with css

			centerPopup("#popup25");

			//document.write("#popup25");

			//load popup

			loadPopup("#popup25");

		});

	

		$("#popupClose25").click(function(){

			disablePopup("#popup25");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button26").click(function(){

			//centering with css

			centerPopup("#popup26");

			//document.write("#popup26");

			//load popup

			loadPopup("#popup26");

		});

	

		$("#popupClose26").click(function(){

			disablePopup("#popup26");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button27").click(function(){

			//centering with css

			centerPopup("#popup27");

			//document.write("#popup27");

			//load popup

			loadPopup("#popup27");

		});

	

		$("#popupClose27").click(function(){

			disablePopup("#popup27");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button28").click(function(){

			//centering with css

			centerPopup("#popup28");

			//document.write("#popup28");

			//load popup

			loadPopup("#popup28");

		});

	

		$("#popupClose28").click(function(){

			disablePopup("#popup28");

		});

		//LOADING POPUP

		//Click the button event!

		$("#button29").click(function(){

			//centering with css

			centerPopup("#popup29");

			//document.write("#popup29");

			//load popup

			loadPopup("#popup29");

		});

	

		$("#popupClose29").click(function(){

			disablePopup("#popup29");

		});

	//Click out event!

	$("#backgroundPopup").click(function(){

		disablePopup(currPopup);

	});

	

	

	//Press Escape event!

	$(document).keypress(function(e){

		if(e.keyCode==27 && popupStatus==1){

			disablePopup(currPopup);

		}

	});

	

});

	

	
