var onImgArray = new Array();
onImgArray["about"] = new Image(241,124);
onImgArray["about1"] = new Image(241,124);
onImgArray["faq"] = new Image(117,253);
onImgArray["faq1"] = new Image(117,253);
onImgArray["contact"] = new Image(241,124);
onImgArray["contact1"] = new Image(241,124);
onImgArray["course"] = new Image(241,124);
onImgArray["course1"] = new Image(241,124);
onImgArray["links"] = new Image(119,253);
onImgArray["links1"] = new Image(119,253);
onImgArray["update"] = new Image(241,124);
onImgArray["update1"] = new Image(241,124);
onImgArray["membership"] = new Image(241,124);
onImgArray["membership1"] = new Image(241,124);
onImgArray["JEDI"] = new Image(241,251);
onImgArray["JEDI1"] = new Image(241,251);
onImgArray["X"] = new Image(30,30);
onImgArray["X1"] = new Image(30,30);

/*course*/
onImgArray["adb"] = new Image(273,59);
onImgArray["adb1"] = new Image(273,59);
onImgArray["db"] = new Image(60,191);
onImgArray["db1"] = new Image(60,191);
onImgArray["ds"] = new Image(273,60);
onImgArray["ds1"] = new Image(273,60);
onImgArray["javame"] = new Image(168,60);
onImgArray["javame1"] = new Image(168,60);
onImgArray["javasecurities"] = new Image(60,191);
onImgArray["javasecurities1"] = new Image(60,191);
onImgArray["mad"] = new Image(369,60);
onImgArray["mad1"] = new Image(369,60);
onImgArray["ooad"] = new Image(394,60);
onImgArray["ooad1"] = new Image(394,60);
onImgArray["os"] = new Image(394,60);
onImgArray["os1"] = new Image(394,60);
onImgArray["prog1"] = new Image(220,60);
onImgArray["prog11"] = new Image(220,60);
onImgArray["prog2"] = new Image(208,60);
onImgArray["prog21"] = new Image(208,60);
onImgArray["se"] = new Image(60,255);
onImgArray["se1"] = new Image(60,255);
onImgArray["sposts"] = new Image(220,59);
onImgArray["sposts1"] = new Image(220,59);
onImgArray["wad"] = new Image(369,60);
onImgArray["wad1"] = new Image(369,60);
onImgArray["webservices"] = new Image(234,59);
onImgArray["webservices1"] = new Image(234,59);
onImgArray["scripting"] = new Image(168,60);
onImgArray["scripting1"] = new Image(168,60);
onImgArray["mysql"] = new Image(143,60);
onImgArray["mysql1"] = new Image(143,60);


onImgArray["adb"].src = "media/adb.png";
onImgArray["adb1"].src = "media/adb1.png";
onImgArray["db"].src = "media/db.png";
onImgArray["db1"].src = "media/db1.png";
onImgArray["ds"].src = "media/ds.png";
onImgArray["ds1"].src = "media/ds1.png";
onImgArray["javame"].src = "media/javame.png";
onImgArray["javame1"].src = "media/javame1.png";
onImgArray["javasecurities"].src = "media/javasecurities.png";
onImgArray["javasecurities1"].src = "media/javasecurities1.png";
onImgArray["mad"].src = "media/mad.png";
onImgArray["mad1"].src = "media/mad1.png";
onImgArray["ooad"].src = "media/ooad.png";
onImgArray["ooad1"].src = "media/ooad1.png";
onImgArray["os"].src = "media/os.png";
onImgArray["os1"].src = "media/os1.png";
onImgArray["prog1"].src = "media/prog1.png";
onImgArray["prog11"].src = "media/prog1_1.png";
onImgArray["prog2"].src = "media/prog2.png";
onImgArray["prog21"].src = "media/prog2_1.png";
onImgArray["se"].src = "media/se.png";
onImgArray["se1"].src = "media/se1.png";
onImgArray["sposts"].src = "media/sposts.png";
onImgArray["sposts1"].src = "media/sposts1.png";
onImgArray["wad"].src = "media/wad.png";
onImgArray["wad1"].src = "media/wad1.png";
onImgArray["webservices"].src = "media/webservices.png";
onImgArray["webservices1"].src = "media/webservices1.png";
onImgArray["scripting"].src = "media/scripting.png";
onImgArray["scripting1"].src = "media/scripting1.png";
onImgArray["mysql"].src = "media/mysql.png";
onImgArray["mysql1"].src = "media/mysql1.png";


/*******/

onImgArray["about"].src = "media/about.png";
onImgArray["about1"].src = "media/about1.png";
onImgArray["faq"].src = "media/faq.png";
onImgArray["faq1"].src = "media/faq1.png";
onImgArray["contact"].src = "media/contact.png";
onImgArray["contact1"].src = "media/contact1.png";
onImgArray["course"].src = "media/course.png";
onImgArray["course1"].src = "media/course1.png";
onImgArray["links"].src = "media/links.png";
onImgArray["links1"].src = "media/links1.png";
onImgArray["update"].src = "media/update.png";
onImgArray["update1"].src = "media/update1.png";
onImgArray["membership"].src = "media/membership.png";
onImgArray["membership1"].src = "media/membership1.png";
onImgArray["JEDI"].src = "media/JEDI.png";
onImgArray["JEDI1"].src = "media/JEDI1.png"
onImgArray["X"].src = "media/x.png";
onImgArray["X1"].src = "media/x1.png";



var popupStatus = 0;
function loadPopup(){
	if(popupStatus==0){
		$("#popup").fadeIn("slow");
		popupStatus = 1;
		$("#backgroundPopup").fadeIn("slow");
	}
}

function disablePopup(){
	if(popupStatus==1){
		$("#popup").fadeOut("slow");
		popupStatus = 0;
	}
}

function clickAbout(){
	$("#popupAbout").css({
	"display":"none",
	"z-index": 500 
	});
	$("#popupAbout").fadeIn("normal");
}

function clickFaq(){
	$("#popupFaq").fadeIn("normal");
}

function clickMem(){
	$("#popupMem").fadeIn("normal");
}

function clickCourse(){
	$("#popupCourse").fadeIn("normal");
}

function clickLinks(){
	$("#popupLinks").fadeIn("normal");
}

function clickContact(){
	$("#popupContact").fadeIn("normal");
}

function centerPopup(){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popup").height();
var popupWidth = $("#popup").width();

$("#popup").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#aboutPanel").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupAbout").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupFaq").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupMem").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupCourse").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupLinks").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

$("#popupContact").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});

}

function imageOn(var1) {
	//imgName = "update";
	var imgName = var1.id;
	var imgName0 = imgName + 1;
	//alert(imgName.startsWith('X'));
	if( imgName.startsWith('X')){
		imgName0 = "X1";
	}
	if (document.images) {
		document.images[imgName].style.cursor = "pointer";
		document.images[imgName].src = onImgArray[imgName0].src;
	}
	
	//$("#background2").fadeOut("slow");
}

function imageOff(var2) {
	var imgName = var2.id;
	var imgName1 = imgName;
	//alert(imgName.startsWith('X'));
	if( imgName.startsWith('X')){
		imgName1 = "X";
	}
	if (document.images) {
		document.images[imgName].style.cursor = "pointer";
		document.images[imgName].src = onImgArray[imgName1].src;
	}
	//$("#background2").fadeIn("slow");
}



function removing(){
	setTimeout('$("#background2").fadeOut(5000)',1000);
	setTimeout('$("#background2").fadeIn(5000)',2000);
	
}

function removing1(){
	$("#popupAbout").fadeOut("normal");
	$("#popupFaq").fadeOut("normal");
	setTimeout('$(".accordion p").hide()',500);
	setTimeout('$(".accordion h3").removeClass("active")',500);
	$("#popupMem").fadeOut("normal");
	$("#popupCourse").fadeOut("normal");
	$("#popupLinks").fadeOut("normal");
	$("#popupContact").fadeOut("normal");
}

function for_viet(){
	var str0 = '<br/><br/>You may also download the forms : JEDI Vietnam Application Form JEDI Vietnam Membership Mechanics Vietnam Address: <p class="add1">14floor, LADECO Building<br/>266 Doi Can Street<br/>Bah Dinh District , Hanoi <br/>Attn: Nguyen Thi Cam Nhung</p>';
	$(".mcontent").hide();
	$(".mcontent").html(str0);
	$(".mcontent").fadeIn("normal");


	$(".for_viet").css({
	"background-color":"#990000",
	"color":"#FFFFFF"
	});

	
	$(".for_ph").css({
	'color':'#530A09'
	});
	$(".for_ph").css('background', 'none');

	$(".for_oc").css({
	'color':'#530A09'
	});
	$(".for_oc").css('background', 'none');

}

function for_ph(){
	var str0 = '<br/>Interested parties must accomplish the application form. Completed application form must be endorsed and SIGNED by the College Dean and/or University President to vouch for the eligibility of the application. Signed applications must be submitted via courier or postal mail to:<br/><p class="add1">Java Education & Development Initiative<br/>Dept. of Computer Science<br/>University of the Philippines – Diliman<br/>Quezon City 1101 Philippines<br/></p>Or via email to info@jediproject.net. Application forms submitted through email must be sent by the College Dean and must bear his/ her official email address. Only duly accomplished application forms will be considered.You may also download the forms:<br/>JEDI Application Form<br/>JEDI Membership Mechanics<br/>';
	$(".mcontent").hide();
	$(".mcontent").html(str0);
	$(".mcontent").fadeIn("normal");

	$(".for_ph").css({
	"background-color":"#990000",
	"color":"#FFFFFF"
	});

	
	$(".for_viet").css({
	'color':'#530A09'
	});
	$(".for_viet").css('background', 'none');

	$(".for_oc").css({
	'color':'#530A09'
	});
	$(".for_oc").css('background', 'none');

}

function for_oc(){
	var str0 = '<br/><br/><br/><p class="add1">Visit Project Kenai</p><br/>';
	$(".mcontent").hide();
	$(".mcontent").html(str0);
	$(".mcontent").fadeIn("normal");

	$(".for_oc").css({
	"background-color":"#990000",
	"color":"#FFFFFF"
	});

	
	$(".for_viet").css({
	'color':'#530A09'
	});
	$(".for_viet").css('background', 'none');

	$(".for_ph").css({
	'color':'#530A09'
	});
	$(".for_ph").css('background', 'none');

}

$(document).ready(function(){
centerPopup();



$("#backgroundPopup").css({
"position":"url(bck1.png) repeat fixed -130% 0"
});


$("#about").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-55"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});

$("#faq").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-55"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});

$("#update").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-55"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});

$("#links").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-55"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});

$("#course").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "70"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "60"}, "fast");
	});

$("#membership").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "200"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "180"}, "fast");
	});

$("#contact").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "200"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "180"}, "fast");
	});


/*$(".accordion h3:first").addClass("active");*/
	$(".accordion p").hide();

	$(".accordion h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});




/*$("#backgroundPopup").click(function(){
$("#popup").fadeOut("fast");
$("#backgroundPopup").fadeOut("fast");
popupStatus = 0;
});*/

//$("#sidebar1").click(function(){
//$("#popup").fadeOut("fast");
//});
/*Click out event!
$("#backgroundPopup").click(function(){
disablePopup();
});*/
//Press Escape event!
$(document).keypress(function(e){
//alert("hello");
//if(e.keyCode==27 && popupStatus==1){
//disablePopup();
//}
});

});

String.prototype.startsWith = function(str) 
{return (this.match("^"+str)==str)};


