/***tabbing****/
jQuery(document).ready(function() {
//When page loads...
jQuery(".tabsed_content").hide(); //Hide all content
jQuery("ul.tabsed li:first").addClass("active").show(); //Activate first tab
jQuery(".tabsed_content:first").show(); //Show first tab content
//On Click Event
jQuery("ul.tabsed li").click(function() {
jQuery("ul.tabsed li").removeClass("active"); //Remove any "active" class
jQuery(this).addClass("active"); //Add "active" class to selected tab
jQuery(".tabsed_content").hide(); //Hide all tab content
var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
jQuery(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
jQuery(document).ready(
    /*
    This function gets loaded when all the HTML, not including the portlets,
is
    loaded.
    */
    function() {
    }
);
Liferay.Portlet.ready(
    /*
    This function gets loaded after each and every portlet on the page.
    portletId: the current portlet's id
    jQueryObj: the jQuery wrapped object of the current portlet
    */
    function(portletId, jQueryObj) {
    }
);
jQuery(document).last(
    /*
    This function gets loaded when everything, including the portlets, is on
    the page.
    */
    function() {
    }
);
function resetFontSize() {
   
   for(i=0;i<font.length;i++) {		  
      font[i].style.fontSize = "";
      font[i].style.color = defaultFont[i];
   }
   
   for(i=0;i<span.length;i++) {	
      span[i].style.fontSize = "";
      span[i].style.color = defaultSpan[i];
   }	   
   	
   for(i=0;i<link.length;i++) {	
      link[i].style.fontSize = "";
   }	
   for(i=0;i<table.length;i++) {
      table[i].style.fontSize = "";
      table[i].style.color = defaultTable[i];
   }
}
function increaseFontSize() {
   
   for(i=0;i<font.length;i++) {		  
      if(font[i].style.fontSize) {
 var s = parseInt(font[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=max) {
 s += 1;
      }
      font[i].style.fontSize = s+"px"
   }
   
   for(i=0;i<span.length;i++) {		  
      if(span[i].style.fontSize) {
 var s = parseInt(span[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=max) {
 s += 1;
      }
      span[i].style.fontSize = s+"px"
   }	   
   	
   for(i=0;i<link.length;i++) {		  
      if(link[i].style.fontSize) {
 var s = parseInt(link[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=max) {
 s += 1;
      }
      link[i].style.fontSize = s+"px"
   }	
   for(i=0;i<table.length;i++) {		  
      if(table[i].style.fontSize) {
 var s = parseInt(table[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=max) {
 s += 1;
      }
      table[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize() {
   
   for(i=0;i<font.length;i++) {
      if(font[i].style.fontSize) {
 var s = parseInt(font[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=min) {
 s -= 1;
      }
      font[i].style.fontSize = s+"px"
   }  
   
   for(i=0;i<span.length;i++) {
      if(span[i].style.fontSize) {
 var s = parseInt(span[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=min) {
 s -= 1;
      }
      span[i].style.fontSize = s+"px"
   }   	   
   
   for(i=0;i<link.length;i++) {
      if(link[i].style.fontSize) {
 var s = parseInt(link[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=min) {
 s -= 1;
      }
      link[i].style.fontSize = s+"px"
   }	   
   
   for(i=0;i<table.length;i++) {
      if(table[i].style.fontSize) {
 var s = parseInt(table[i].style.fontSize.replace("px",""));
      } else {
 var s = 12;
      }
      if(s!=min) {
 s -= 1;
      }
      table[i].style.fontSize = s+"px"
   }  	   	  
}
/*********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('.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);
}
}// 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);
}
}
/********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;');
}
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);
};
/**********kembalikan warna asal*************/
function revertStyles(){
Color='';
 
changecss('.language_live','color','white');
changecss('.hubungi a','color','white');
changecss('.soalan a','color','white');
changecss('.pautan a','color','white');
changecss('.bantuan a','color','white');
changecss('.petaLaman a','color','white');		
changecss('.galeri a','color','white');
changecss('.style1','color','#FFFFFF');
changecss('.style10','color','#000099');
changecss('.style13','color','#FFFFFF');
changecss('.style4','color','#000000');
changecss('.style9','color','red');
changecss('.portlet-title','color','white');
changecss('body','color','#000000');
changecss('a','color','#336699');
changecss('#nav li a','color','white');
changecss('#nav li.selected a ','color','white');
changecss('#nav li ul li a ','color','white');
changecss('a:hover','color','#0066CC');
changecss('.title2_font','color','#553F23');
changecss('.content_font','color','#553F23');
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');
}
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('silverheader','color','red');
changecss('.language_live','color','red');
changecss('.hubungi a','color','red');
changecss('.soalan a','color','red');
changecss('.pautan a','color','red');
changecss('.bantuan a','color','red');
changecss('.petaLaman a','color','red');		
changecss('.galeri a','color','red');
changecss('.style1','color','red');
changecss('.style10','color','red');
changecss('.style13','color','red');
changecss('.style4','color','red');
changecss('.style9','color','red');
changecss('.portlet-title','color','red');
changecss('body','color','red');
changecss('a','color','red');
changecss('#nav li a','color','red');
changecss('#nav li.selected a ','color','red');
changecss('#nav li ul li a ','color','red');
changecss('a:hover','color','red');
changecss('.title2_font','color','red');
changecss('.content_font','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);
}
/*************tukar warna tulisan kepada warna biru**********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontBlue(){
Color='blue';
changecss('.silverheader','color','blue');
changecss('.language_live','color','blue');
changecss('.hubungi a','color','blue');
changecss('.soalan a','color','blue');
changecss('.pautan a','color','blue');
changecss('.bantuan a','color','blue ');
changecss('.petaLaman a','color','blue');		
changecss('.galeri a','color','blue');
changecss('.style1','color','blue');
changecss('.style10','color','blue');
changecss('.style13','color','blue');
changecss('.style4','color','blue');
changecss('.style9','color','blue');
changecss('.portlet-title','color','blue');
changecss('body','color','blue');
changecss('a','color','blue');
changecss('#nav li a','color','blue');
changecss('#nav li.selected a ','color','blue');
changecss('#nav li ul li a ','color','blue');
changecss('a:hover','color','blue');
changecss('.title2_font','color','blue');
changecss('.content_font','color','blue');
changecss('body','color','blue');
changecss('a','color','blue');
changecss('#nav a','color','blue');
changecss('a:hover','color','blue');
changecss('.title2_font','color','blue');
changecss('.content_font','color','blue');
changecss('input[type="text"], input[type="password"], input[type="file"],input[type="submit"], input[type="button"], input[type="reset"], select, textarea, .textarea','color',Color);
}
/*************tukar warna tulisan kepada warna green **********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontGreen(){
Color='green';
changecss('.silverheader','color','green');
changecss('.language_live','color','green');
changecss('.hubungi a','color','green');
changecss('.soalan a','color','green');
changecss('.pautan a','color','green');
changecss('.bantuan a','color','green');
changecss('.petaLaman a','color','green');		
changecss('.galeri a','color','green');
changecss('.style1','color','green');
changecss('.style10','color','green');
changecss('.style13','color','green');
changecss('.style4','color','green');
changecss('.style9','color','green');
changecss('.portlet-title','color','green');
changecss('body','color','green');
changecss('a','color','green');
changecss('#nav li a','color','green');
changecss('#nav li.selected a ','color','green');
changecss('#nav li ul li a ','color','green');
changecss('a:hover','color','green');
changecss('.title2_font','color','green');
changecss('.content_font','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);
}
/*************tukar warna tulisan kepada warna orange**********/
/****changecss('<nama class@ id>','<element>','<value>');*************/
function fontOrange(){
Color='orange';
changecss('.silverheader','color','orange');
changecss('.language_live','color','orange');
changecss('.hubungi a','color','orange');
changecss('.soalan a','color','orange');
changecss('.pautan a','color','orange');
changecss('.bantuan a','color','orange');
changecss('.petaLaman a','color','orange');		
changecss('.galeri a','color','orange');
changecss('.style1','color','orange');
changecss('.style10','color','orange');
changecss('.style13','color','orange');
changecss('.style4','color','orange');
changecss('.style9','color','orange');
changecss('.portlet-title','color','orange');
changecss('body','color','orange');
changecss('a','color','orange');
changecss('#nav li a','color','orange');
changecss('#nav li.selected a ','color','orange');
changecss('#nav li ul li a ','color','orange');
changecss('a:hover','color','orange');
changecss('.title2_font','color','orange');
changecss('.content_font','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************/
/*******for gallery************/
 jQuery(document).ready(function(){
jQuery(".lightbox").lightbox();
});
