var LiferayJedi = function () {
var $ = jQuery;
return {
init: function() {
var instance = this;
instance.handleSearchForm();
instance.dropDownMenu();
instance.handleLastChild();
},
handleSearchForm: function() {
var searchForm = $('#banner .search');
var searchInput = searchForm.find('input[@type=image]');
var searchLink = $('<a class="search-input-link" href="javascript:;"></a>');
searchLink.click(
function() {
$(this).parents('form')[0].submit();
}
);
searchInput.hide();
searchInput.before(searchLink);
},
handleLastChild: function () {
var instance = this;
$('#footer ul li:last').addClass('last-child');
},
dropDownMenu: function() {
$(".parent-nav-item").hoverIntent(
{
interval: 25,
timeout: 0,
over: function () {
var instance = $(this);
var child = $('.child-menu', this);
instance.addClass("init");
child.slideDown(100);
},
out: function () {
var instance = $(this);
var child = $('.child-menu', this);
child.slideUp(50);
instance.removeClass("init");
}
}
);
}
};
}();
jQuery(document).ready(
function() {
LiferayJedi.init();
}
);
/*********start accessibilty***************/
function toggle (id) {
var post = document.getElementById(id);
if (post.className=="portletshown") { 
post.className="portlethidden"; 
} else { 
post.className="portletshown"; 
}
}
function changeLocation (targetURL) {
window.location = targetURL;
}
var size;
var defaultFontSize = 11;
var currentFontSize = size;	
var Color;
var defaultColor = 'black';
var currentColor = Color;	
var prefsLoaded = false;
/*********besarkan saiz tulisan**************/	
function setFontPlus(id){
size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 13;
} else {
size = size.substr(0,2);
}
if(size < 15) {
if(size == 14) {
size = eval(size) + 2;
} else {
size = eval(size) + 1;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
changecss('#nav li a','font-size',fontSize);
changecss('.portlet-title','font-size',fontSize);
changecss('.journal-content-article','font-size',fontSize);
changecss('.content_font','font-size',fontSize);
changecss('.title2_font','font-size',fontSize);
changecss('#portlet-wrapper-56_INSTANCE_xaD8 .portlet-title,#portlet-wrapper-56_INSTANCE_ZDcF .portlet-title,#portlet-wrapper-56_INSTANCE_6cyX .portlet-title','font-size',fontSize);
changecss('b','font-size',fontSize);
changecss('span','font-size',fontSize);
changecss('table#tbl_pryr_times td','font-size',fontSize);
changecss('#hijri_date_info','font-size',fontSize);
changecss('#date_info','font-size',fontSize);
changecss('#location','font-size',fontSize);
changecss('div.topmenu a','font-size',fontSize);
changecss('#copyright','font-size',fontSize);
changecss('#disclaimer','font-size',fontSize);
changecss('#disclaimer a','font-size',fontSize);
changecss('#nav li a span','font-size',fontSize);
}
}// end setFontPlus
/*********kecilkan saiz tulisan*************/
function setFontMinus(id){
size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 11; 
} else {
size = size.substr(0,2);
} 
if(size > 11) {
if(size == 17) {
size = eval(size) - 2;
} else {
size = eval(size) - 1;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
changecss('.content_font','font-size',fontSize);
changecss('.title2_font','font-size',fontSize);	
changecss('#nav li a','font-size',fontSize);
changecss('.portlet-title','font-size',fontSize);
changecss('.journal-content-article','font-size',fontSize);
changecss('#portlet-wrapper-56_INSTANCE_xaD8 .portlet-title,#portlet-wrapper-56_INSTANCE_ZDcF .portlet-title,#portlet-wrapper-56_INSTANCE_6cyX .portlet-title','font-size',fontSize);
changecss('b','font-size',fontSize);
changecss('span','font-size',fontSize);
changecss('table#tbl_pryr_times td','font-size',fontSize);
changecss('#hijri_date_info','font-size',fontSize);
changecss('#date_info','font-size',fontSize);
changecss('#location','font-size',fontSize);
changecss('div.topmenu a','font-size',fontSize);
changecss('#copyright','font-size',fontSize);
changecss('#disclaimer','font-size',fontSize);
changecss('#disclaimer a','font-size',fontSize);
changecss('#nav li a span','font-size',fontSize);
}
}
/********kembalikan saiz huruf kepada asal************/
function revertFontStyles(id){
size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 11; 
} else {
size = size.substr(0,2);
} 
if(size > 10) {
if(size == 16) {
size = 11;
} else {
size = 11;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
changecss('.portlet-title','font-size','10px');
changecss('#portlet-wrapper-56_INSTANCE_xaD8 .portlet-title,#portlet-wrapper-56_INSTANCE_ZDcF .portlet-title,#portlet-wrapper-56_INSTANCE_6cyX .portlet-title','font-size','12px');
changecss('#nav li a','font-size','12px');
changecss('.journal-content-article','font-size','11px;');
changecss('.content_font','font-size','11px;');
changecss('.title2_font','font-size','11px;');
changecss('b','font-size','11px;');
changecss('span','font-size','11px;');
changecss('table#tbl_pryr_times td','font-size','11px;');
changecss('#hijri_date_info','font-size','11px;');
changecss('#date_info','font-size','11px;');
changecss('#location','font-size','11px;');
changecss('div.topmenu a','font-size','11px;');
changecss('#copyright','font-size','11px;');
changecss('#disclaimer','font-size','11px;');
changecss('#disclaimer a','font-size','11px;');
changecss('#nav li a span','font-size','12px;');
}
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
};
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
};
window.onload = setUserOptions;
function setUserOptions(){
if(!prefsLoaded){
cookie = readCookie("fontSize");
size = cookie ? cookie : 11;
cookieColor = readCookie("color");
Color = cookieColor ? cookieColor : 'black';
if(Color=='red'){
fontRed()
}
else if(Color=='blue')
{
fontBlue()
}
else if(Color=='green'){
fontGreen()}
else if(Color=='orange') {
fontOrange()
}
else{
revertStyles()
}
setFontSize(size);
prefsLoaded = true;
}
}
window.onunload = saveSettings;
function saveSettings()
{
createCookie("color", Color, 365);
  createCookie("fontSize", size, 365);
 
}
function setFontSize(fontSize){
document.getElementById('wrapper').style.fontSize = fontSize + 'px';
//alert (document.body.style.fontSize);
};
i
/**********kembalikan warna asal*************/
function revertStyles(){
Color='';
changecss('.portlet-title','color','black');
changecss('#nav a','color','#ffffff');
changecss('body','color','black');
changecss('a','color','#5078AA');
changecss('a:hover','color','#7EACD6');
changecss('.title2_font','color','#0000FF');
changecss('.content_font','color','#000000');
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color','black');
changecss('b','color',Color);
changecss('span','color',Color);
changecss('table#tbl_pryr_times td','color',Color);
changecss('#hijri_date_info','color',Color);
changecss('#date_info','color',Color);
changecss('#location','color',Color);
changecss('div.topmenu a','color',Color);
changecss('#copyright','color',Color);
changecss('#disclaimer','color',Color);
changecss('#disclaimer a','color',Color);
}
function changecss(theClass,element,value) {
//Last Updated on May 21, 2008
//documentation for this script at
//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
 var cssRules;
 if (document.all) {
 cssRules = 'rules';
 }
 else if (document.getElementById) {
 cssRules = 'cssRules';
 }
 var added = false;
 for (var S = 0; S < document.styleSheets.length; S++){
 for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
 if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
 if(document.styleSheets[S][cssRules][R].style[element]){
 document.styleSheets[S][cssRules][R].style[element] = value;
 added=true;
 break;
 }
 }
 }
 if(!added){
 if(document.styleSheets[S].insertRule){
 document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
 }
 else if (document.styleSheets[S].addRule) {
 document.styleSheets[S].addRule(theClass,element+': '+value+';');
 }
 }
 }
}
// end function changecss
/*************tukar warna tulisan kepada warna merah**********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontRed(){
Color='red';
changecss('body','color',Color);
changecss('a','color',Color);
changecss('#nav a','color',Color);
changecss('a:hover','color',Color);
changecss('.title2_font','color',Color);
changecss('.content_font','color',Color);
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color',Color);
changecss('b','color',Color);
changecss('span','color',Color);
changecss('table#tbl_pryr_times td','color',Color);
changecss('#hijri_date_info','color',Color);
changecss('#date_info','color',Color);
changecss('#location','color',Color);
changecss('div.topmenu a','color',Color);
changecss('#copyright','color',Color);
changecss('#disclaimer','color',Color);
changecss('#disclaimer a','color',Color);
}
/*************tukar warna tulisan kepada warna biru**********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontBlue(){
Color='blue';
changecss('body','color',Color);
changecss('a','color',Color);
changecss('#nav a','color',Color);
changecss('a:hover','color',Color);
changecss('.title2_font','color',Color);
changecss('.content_font','color',Color);
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color',Color);
changecss('b','color',Color);
changecss('span','color',Color);
changecss('table#tbl_pryr_times td','color',Color);
changecss('#hijri_date_info','color',Color);
changecss('#date_info','color',Color);
changecss('#location','color',Color);
changecss('div.topmenu a','color',Color);
changecss('#copyright','color',Color);
changecss('#disclaimer','color',Color);
changecss('#disclaimer a','color',Color);
}
/*************tukar warna tulisan kepada warna green **********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontGreen(){
Color='green';
changecss('body','color',Color);
changecss('a','color',Color);
changecss('#nav a','color',Color);
changecss('a:hover','color',Color);
changecss('.title2_font','color',Color);
changecss('.content_font','color',Color);
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color',Color);
changecss('b','color',Color);
changecss('span','color',Color);
changecss('table#tbl_pryr_times td','color',Color);
changecss('#hijri_date_info','color',Color);
changecss('#date_info','color',Color);
changecss('#location','color',Color);
changecss('div.topmenu a','color',Color);
changecss('#copyright','color',Color);
changecss('#disclaimer','color',Color);
changecss('#disclaimer a','color',Color);
}
/*************tukar warna tulisan kepada warna orange**********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontOrange(){
Color='orange';
changecss('body','color',Color);
changecss('a','color',Color);
changecss('#nav a','color',Color);
changecss('a:hover','color',Color);
changecss('.title2_font','color',Color);
changecss('.content_font','color',Color);
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color',Color);
}
/*******end accessibility************/