var vDuration = 8000;
var vLoop = 0;
var vInterval = 0;

$(document).ready(function() {
	vInterval = setInterval(function() { fnLoop(); }, vDuration);
	
	if (screen.width==320) { $("#fbContent").css("right","-200px"); } 
	else if (screen.width==800) { $("#fbContent").css("right","-400px"); } 
	else if (screen.width==1024) { $("#fbContent").css("right","-200px"); }
	else if (screen.width==1152) { $("#fbContent").css("right","-100px"); }
	else if (screen.width==1280) { $("#fbContent").css("right","-50px"); }
	else { $("#fbContent").css("right","50px"); }
		
	$("#btnFacebookUp").click(function(){ $("#fbContentInner").slideUp(); $("#btnFacebookDown").show(); $("#btnFacebookUp").hide(); });
	$("#btnFacebookUp").mouseover(function() { $("#btnFacebookUp").css("cursor","pointer"); }); 
	$("#btnFacebookUp").mouseout(function() { $("#btnFacebookUp").css("cursor","default"); });
	$("#btnFacebookDown").click(function(){ $("#fbContentInner").slideDown(); $("#btnFacebookDown").hide(); $("#btnFacebookUp").show(); });
	$("#btnFacebookDown").mouseover(function() { $("#btnFacebookDown").css("cursor","pointer"); });
	$("#btnFacebookDown").mouseout(function() { $("#btnFacebookDown").css("cursor","default"); });
	
	$("#btnSearch").mouseover(function() { $("#btnSearch").attr("src","images/imgSearchRov.png"); $("#btnSearch").css("cursor","pointer"); });
	$("#btnSearch").mouseout(function() { $("#btnSearch").attr("src","images/imgSearchNor.png"); $("#btnSearch").css("cursor","default"); });
	$("#btnSearch").attr('title',''); $("#btnSearch").click(function() { location.href='#'; });
	$("#btnRegister").mouseover(function() { $("#btnRegister").css("cursor","pointer"); });
	$("#btnRegister").mouseout(function() { $("#btnRegister").css("cursor","default"); });
	$("#btnRegister").attr('title','Click to download the application form'); $("#btnRegister").click(function() { location.href='images/SOP-Form-StudAppForm.pdf'; });
	$("#btnMQA").mouseover(function() { $("#btnMQA").css("cursor","pointer"); });
	$("#btnMQA").mouseout(function() { $("#btnMQA").css("cursor","default"); });
	$("#btnMQA").attr('title','Malaysian Qualifications Agency'); $("#btnMQA").click(function() { location.href='http://www.mqa.gov.my/'; });
	$("#btnMOHE").mouseover(function() { $("#btnMOHE").css("cursor","pointer"); });
	$("#btnMOHE").mouseout(function() { $("#btnMOHE").css("cursor","default"); });
	$("#btnMOHE").attr('title','Ministry of Higher Education'); $("#btnMOHE").click(function() { location.href='http://www.mohe.gov.my/'; });
	$("#btnPTPTN").mouseover(function() { $("#btnPTPTN").css("cursor","pointer"); });
	$("#btnPTPTN").mouseout(function() { $("#btnPTPTN").css("cursor","default"); });
	$("#btnPTPTN").attr('title','Perbadanan Tabung Pendidikan Tinggi Nasional'); $("#btnPTPTN").click(function() { location.href='http://www.ptptn.gov.my/'; });
	$("#btnKTSI").mouseover(function() { $("#btnKTSI").css("cursor","pointer"); });
	$("#btnKTSI").mouseout(function() { $("#btnKTSI").css("cursor","default"); });
	$("#btnKTSI").attr('title','Kompleks Taman Seni Islam'); $("#btnKTSI").click(function() { location.href='http://www.mbsa.gov.my/pelancongan_komplekstamanseniislam/'; });
	$("#btnYayasan").mouseover(function() { $("#btnYayasan").css("cursor","pointer"); });
	$("#btnYayasan").mouseout(function() { $("#btnYayasan").css("cursor","default"); });
	$("#btnYayasan").attr('title','Yayasan Restu'); $("#btnYayasan").click(function() { location.href='http://www.restu-art.com/'; });
	$("#btnALM").mouseover(function() { $("#btnALM").css("cursor","pointer"); });
	$("#btnALM").mouseout(function() { $("#btnALM").css("cursor","default"); });
	$("#btnALM").attr('title','ALM Group of Companies'); $("#btnALM").click(function() { location.href='http://almgroup.my/'; });
	$("#btnHome").mouseover(function() { $("#btnHome").attr("src","images/imgHomeRov.png"); $("#btnHome").css("cursor","pointer"); });
	$("#btnHome").mouseout(function() { $("#btnHome").attr("src","images/imgHomeNor.png"); $("#btnHome").css("cursor","default"); });
	$("#btnHome").attr('title',''); $("#btnHome").click(function() { location.href='index.php?page=0'; });
	$("#btnAbout").mouseover(function() { $("#btnAbout").attr("src","images/imgAboutRov.png"); $("#btnAbout").css("cursor","pointer"); });
	$("#btnAbout").mouseout(function() { $("#btnAbout").attr("src","images/imgAboutNor.png"); $("#btnAbout").css("cursor","default"); });
	$("#btnAbout").attr('title',''); $("#btnAbout").click(function() { location.href='index.php?page=1'; });
	$("#btnProgrammes").mouseover(function() { $("#btnProgrammes").attr("src","images/imgProgrammesRov.png"); $("#btnProgrammes").css("cursor","pointer"); });
	$("#btnProgrammes").mouseout(function() { $("#btnProgrammes").attr("src","images/imgProgrammesNor.png"); $("#btnProgrammes").css("cursor","default"); });
	$("#btnProgrammes").attr('title',''); $("#btnProgrammes").click(function() { location.href='index.php?page=2'; });
	$("#btnApplication").mouseover(function() { $("#btnApplication").attr("src","images/imgApplicationRov.png"); $("#btnApplication").css("cursor","pointer"); });
	$("#btnApplication").mouseout(function() { $("#btnApplication").attr("src","images/imgApplicationNor.png"); $("#btnApplication").css("cursor","default"); });
	$("#btnApplication").attr('title',''); $("#btnApplication").click(function() { location.href='index.php?page=3'; });
	$("#btnGallery").mouseover(function() { $("#btnGallery").attr("src","images/imgGalleryRov.png"); $("#btnGallery").css("cursor","pointer"); });
	$("#btnGallery").mouseout(function() { $("#btnGallery").attr("src","images/imgGalleryNor.png"); $("#btnGallery").css("cursor","default"); });
	$("#btnGallery").attr('title',''); $("#btnGallery").click(function() { location.href='index.php?page=4'; });
	$("#btnContact").mouseover(function() { $("#btnContact").attr("src","images/imgContactRov.png"); $("#btnContact").css("cursor","pointer"); });
	$("#btnContact").mouseout(function() { $("#btnContact").attr("src","images/imgContactNor.png"); $("#btnContact").css("cursor","default"); });
	$("#btnContact").attr('title',''); $("#btnContact").click(function() { location.href='index.php?page=5'; });
	$("#btnMushaf").mouseover(function() { $("#btnMushaf").attr("src","images/imgMushafRov.png"); $("#btnMushaf").css("cursor","pointer"); });
	$("#btnMushaf").mouseout(function() { $("#btnMushaf").attr("src","images/imgMushafNor.png"); $("#btnMushaf").css("cursor","default"); });
	$("#btnMushaf").attr('title',''); $("#btnMushaf").click(function() { location.href='index.php?page=21'; });
	$("#btnChildhood").mouseover(function() { $("#btnChildhood").attr("src","images/imgChildhoodRov.png"); $("#btnChildhood").css("cursor","pointer"); });
	$("#btnChildhood").mouseout(function() { $("#btnChildhood").attr("src","images/imgChildhoodNor.png"); $("#btnChildhood").css("cursor","default"); });
	$("#btnChildhood").attr('title',''); $("#btnChildhood").click(function() { location.href='index.php?page=22'; });
	$("#btnBanking").mouseover(function() { $("#btnBanking").attr("src","images/imgBankingRov.png"); $("#btnBanking").css("cursor","pointer"); });
	$("#btnBanking").mouseout(function() { $("#btnBanking").attr("src","images/imgBankingNor.png"); $("#btnBanking").css("cursor","default"); });
	$("#btnBanking").attr('title',''); $("#btnBanking").click(function() { location.href='index.php?page=23'; });
	$("#btnBusiness").mouseover(function() { $("#btnBusiness").attr("src","images/imgBusinessRov.png"); $("#btnBusiness").css("cursor","pointer"); });
	$("#btnBusiness").mouseout(function() { $("#btnBusiness").attr("src","images/imgBusinessNor.png"); $("#btnBusiness").css("cursor","default"); });
	$("#btnBusiness").attr('title',''); $("#btnBusiness").click(function() { location.href='index.php?page=24'; });
	$("#btnCalligraphy").mouseover(function() { $("#btnCalligraphy").attr("src","images/imgCalligraphyRov.png"); $("#btnCalligraphy").css("cursor","pointer"); });
	$("#btnCalligraphy").mouseout(function() { $("#btnCalligraphy").attr("src","images/imgCalligraphyNor.png"); $("#btnCalligraphy").css("cursor","default"); });
	$("#btnCalligraphy").attr('title',''); $("#btnCalligraphy").click(function() { location.href='index.php?page=25'; });
	$("#btnEnglish").mouseover(function() { $("#btnEnglish").attr("src","images/imgEnglishRov.png"); $("#btnEnglish").css("cursor","pointer"); });
	$("#btnEnglish").mouseout(function() { $("#btnEnglish").attr("src","images/imgEnglishNor.png"); $("#btnEnglish").css("cursor","default"); });
	$("#btnEnglish").attr('title',''); $("#btnEnglish").click(function() { location.href='index.php?page=26'; });
	$("#btnArabic").mouseover(function() { $("#btnArabic").attr("src","images/imgArabicRov.png"); $("#btnArabic").css("cursor","pointer"); });
	$("#btnArabic").mouseout(function() { $("#btnArabic").attr("src","images/imgArabicNor.png"); $("#btnArabic").css("cursor","default"); });
	$("#btnArabic").attr('title',''); $("#btnArabic").click(function() { location.href='index.php?page=27'; });
	$("#btnStudent").mouseover(function() { $("#btnStudent").css("cursor","pointer"); });
	$("#btnStudent").mouseout(function() { $("#btnStudent").css("cursor","default"); });
	$("#btnStudent").attr('title','Student Artwork'); $("#btnStudent").click(function() { location.href='#'; });
	$("#btnFacility").mouseover(function() { $("#btnFacility").css("cursor","pointer"); });
	$("#btnFacility").mouseout(function() { $("#btnFacility").css("cursor","default"); });
	$("#btnFacility").attr('title','Facility'); $("#btnFacility").click(function() { location.href='#'; });
	
});

function fnLoop() {
	vLoop = vLoop + 1;
	$("#imgbanner").fadeIn(vDuration);
	if (vLoop == 1) { $("#imgbanner").attr("src","images/imgScroll_01.jpg"); }
	if (vLoop == 2) { $("#imgbanner").attr("src","images/imgScroll_02.jpg"); }
	if (vLoop == 3) { $("#imgbanner").attr("src","images/imgScroll_03.jpg"); vLoop = 0; }
	$("#imgbanner").fadeOut(vDuration);
}
