function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}


function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function styleContains(definition, style){
	var defs = style.split(";");
	var c = defs.length;
	
	for(i = 0; i < c; i++ ){
		var blah = defs[i].replace(/^\s+|\s+$/g, '');
		if(definition.toLowerCase().indexOf(blah) != -1){
			continue;
		}else{
			return false;
		}
			
	}
	return true;
		
}




function resize(resize, adding){
	var isIE = false;
    if(navigator.appName == "Microsoft Internet Explorer"){
    	isIE = true;
    }

	var cssRules;
	if(isIE){
		cssRules = "rules";
	}else{
		cssRules = "cssRules";
	}

	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
         var font = document.styleSheets[S][cssRules][R].style.fontSize; 	   
	     var size = font.split("px");
	     
	     if(!isIE){

	        if(document.styleSheets[S][cssRules][R].cssText.indexOf("navigation") != -1 || 
	           document.styleSheets[S][cssRules][R].cssText.indexOf("font_buttons") != -1 || 
	           document.styleSheets[S][cssRules][R].cssText.indexOf("phone") != -1 ||
	           document.styleSheets[S][cssRules][R].cssText.indexOf("adjust") != -1 ){
	     	   continue;
	        }
	       
	     }else{

			if(styleContains(document.styleSheets[S]["rules"][R].style.cssText, "float: right; padding-right: 5px; text-align: right;font-size: 14px;")){
	     	   continue;
			}
		    //alert(R + " " + document.styleSheets[S]["rules"][R].style.cssText);
			if(R == 75 || R == 76 || R == 77 || R == 78 || R == 34 || R == 35 || R == 36 || R == 37 || R == 38 || R == 39 || R == 22){
				continue;
			}
	     }

	     
	     if(size.length == 2){
	        
	     	if(adding){
	     			setCookie("font_size", Number(resize), 1);
	     			setCookie("operation", "+", 1);
	     			document.styleSheets[S][cssRules][R].style.fontSize = (Number(size[0]) + Number(resize)) + "px";
	     	}else{
	     			setCookie("font_size", Number(resize), 1);
	     			setCookie("operation", "-", 1)
	     			document.styleSheets[S][cssRules][R].style.fontSize = (Number(size[0]) - Number(resize)) + "px";
	     	}
	        
	     }
	  }
	 }
}


function redimension(){
    if(getCookie("font_size") != 0){
		if(getCookie("operation") == "+"){
			resize(Number(getCookie("font_size")), false);
			setCookie("font_size", Number(0), 1);
			setCookie("operation", "+", 1);
		}else{
			resize(Number(getCookie("font_size")), true);
			setCookie("font_size", Number(0), 1);
			setCookie("operation", "-", 1);
		}
    }
}

function resizeFromCookies(){
	if(getCookie("font_size") != 0){
		if(getCookie("operation") == "+"){
			resize(Number(getCookie("font_size")), true);
		}else{
			resize(Number(getCookie("font_size")), false);
		}
	}
}
