/*accessibility using Jquery    *************************/
// Programmer : Abdul Wahid bin Ani
// wahid@skali.biz
// Edited for arkib.gov.my lfr 6 by Lala

var min_fsize="10px";
var max_fsize="14px";

var themename= "arkib-homepage-theme";

//var ele_=new Array("#main-content span","#main-content a", "#main-content table", "#main-content div", "#main-content p");
var ele_=new Array("span","a", "table", "div", "p");

var eleFSize=new Array();

function getFontSize(fSize){
	for(i=0;i<ele_.length;i++) {
		if (fSize==""){
			jQuery(ele_[i]).css("font-size", '');
			jQuery.cookie("fSize", null, { expires: 1 }); 
		}
		else{
			if (jQuery(ele_[i]).css("font-size")){
				jQuery(ele_[i]).css("font-size", fSize);
				jQuery.cookie("fSize", fSize, { expires: 1 }); 
			}
		}
	}
}

function fontColor(id) {

  //set color yang sesuai dengan portal anda
   if (id=='fontColor1'){color='#0000FF';} //blue
   else if (id=='fontColor2'){color='#FF0000';} //red
   else if (id=='fontColor3'){color='#00FF00';} //green
   else color="";

   jQuery("body *").css("color",color);
   jQuery.cookie("color_", id, { expires: 1 }); 
}

function resetW3C() {
	fontColor('');
	getFontSize('');
	bodybg('bodybg4');
	colorContrast('rescont','ms_MY');
}

function bodybg(id) {
  //set latar belakang

   if (id=='bodybg1'){bg='url(/'+themename+'/images/arkib/background_image/bg1.jpg) no-repeat fixed';}
   else if (id=='bodybg2'){bg='url(/'+themename+'/images/arkib/background_image/bg2.jpg) no-repeat fixed';} 
   else if (id=='bodybg3'){bg='url(/'+themename+'/images/arkib/background_image/bg3.jpg) no-repeat fixed';}
   else if (id=='bodybg4'){bg='url(/'+themename+'/images/arkib/background_image/bg4.jpg) no-repeat fixed';}
  
   jQuery("body").css('background', bg);
   jQuery.cookie("bg_", id, { expires: 1 }); 
}

function FontSize(opt){
	for(i=0;i<ele_.length;i++) {
		if (opt=="increase"){
			cur_fsize=max_fsize;
		}
		else {
			cur_fsize=min_fsize;
		}

		jQuery(ele_[i]).css("font-size", cur_fsize);
	}

	jQuery.cookie("fSize", cur_fsize, { expires: 1 });
}

function colorContrast(id){
	//set Contrast

	if (id=='lowcont'){
		wrapper_bgimage="url('url(/"+themename+"/images/arkib/background_image/wrapper_bg3.png') no-repeat";
		wrapper_bg='#ECF6CE';
		f_fontColor='#FFF';
	}
	else if (id=='hicont'){
		wrapper_bgimage="url('url(/"+themename+"/images/arkib/background_image/wrapper_bg3.png') no-repeat";
		wrapper_bg='#000';
		f_fontColor="yellow";
		
	} 
	else if (id=='nocont'){
		wrapper_bgimage="url('url(/"+themename+"/images/arkib/background_image/wrapper_bg3.png') no-repeat";
		wrapper_bg='#FFF';
		f_fontColor='#000';
	}
	else {
		wrapper_bgimage="url('url(/"+themename+"/images/arkib/background_image/wrapper_bg3.png') no-repeat";
		wrapper_bg='#FFF';
		f_fontColor='#000';
		
	} 


	jQuery("#wrapper").css('background-image', wrapper_bgimage);
	jQuery("#wrapper").css('background-color', wrapper_bg);
	jQuery("#wrapper").css('color', f_fontColor);

	jQuery.cookie("colorContrast_id", id, { expires: 1 });
}

function increaseFontSize() {FontSize("increase");}
function decreaseFontSize() {FontSize("decrease");}

