/*=============================================
 FontSize Change Preset
=============================================*/

/* Reload Cookie
------------------------------ */
function presetFontsize(){
	var $id = get_fontCookie();
	if($id){
		document.body.className = $id;
	}
}

/* Font Size Change
------------------------------ */
function sizeChange(fontSize){
	
	//Change ID Body_Tag 
	var $size = fontSize;
	document.body.className = $size;
	
	//Passed Cookie
	set_fontCookie(fontSize); 
}

/* Write And Setting Cookie
------------------------------ */
function set_fontCookie(vstrArg){

	//Cookie Info
	var strData   = 'BodyTagID=' + vstrArg + ';';
	var strDomain = 'domain=' + document.domain + ';';
	var strPath   = 'path=/;';
  
	//Limit Days
	var intDate = 365;

	var objDate = new Date();
	objDate.setTime(objDate.getTime() + (intDate*1000*60*60*24));

	var strTerm = 'expires=' + objDate.toGMTString() + ';';

	//Write Cookie
	document.cookie = strData + strDomain + strPath + strTerm;
}

/* Get Cookie
------------------------------ */
function get_fontCookie(){
	//Get Cookie Info
	var i = 0;
	var strKey      = 'BodyTagID=';
	var strCookie   = '';
	var astrCookies = document.cookie.split(';');
	var strValue    = '';

	for (i = 0; i < astrCookies.length; i ++) {
		if (astrCookies[i].indexOf(strKey) >= 0) {
			strCookie = astrCookies[i].replace(/ /i,'');
		}
	}
	if (strCookie.indexOf(strKey) >= 0) {
		strValue = strCookie.substr(strCookie.indexOf(strKey) + strKey.length, strCookie.length);	
	}
	return strValue;
}
