
var min = 10;
var max = 20;
var htmlelements = new Array();
var SizeStatus = 2;

htmlelements[0] = 'div';
htmlelements[1] = 'table';
htmlelements[2] = 'a';
htmlelements[3] = 'span';
htmlelements[4] = 'form';
htmlelements[5] = 'body';
htmlelements[6] = 'p';
htmlelements[7] = 'li';
htmlelements[8] = 'h1';
htmlelements[9] = 'h2';
htmlelements[10] = 'h3';
htmlelements[11] = 'h4';
htmlelements[12] = 'h5';
htmlelements[13] = 'td';
htmlelements[14] = 'label';
// htmlelements[15] = 'option';
//htmlelements[16] = 'select';
jQuery(document).ready(function() {

    jQuery("div,table,a,span,form,body,p,li,h1,h2,h3,h4,h5,td,label").each(function() {
        //alert(1);
        var currentSize = parseFloat(jQuery(this).css("font-size"));
        jQuery(this).css("font-size", currentSize)
        jQuery("a.resize").click(function() {
            //var appliedStatus = jQuery(this).data("resize");
            var appliedStatus = jQuery(this).attr("id").split('-')[1];
            //console.log(appliedStatus);
            if (appliedStatus == SizeStatus)
                return;
            var count1 = ChangeStatus(appliedStatus);


            jQuery("div,table,a,span,form,body,p,li,h1,h2,h3,h4,h5,td,label").each(function() {
                var currentSize = parseFloat(jQuery(this).css("font-size"));
                //this.style.fontSize = (currentSize + count1) + "px !important";
                //console.log(""font-size", (currentSize + count1) + "px !important"
                jQuery(this).css("font-size", (currentSize + count1));
                try {
                    this.style.setProperty("font-size", (currentSize + count1) + "px", "important");
                }
                catch (e) { }
            });
            SizeStatus = appliedStatus;
        });

    });
    function ResizeFont(AppliedStatus) {

        if (AppliedStatus == SizeStatus)
            return;

        var count1 = ChangeStatus(AppliedStatus);
        console.log(count1);

        jQuery("div,table,a,span,form,body,p,li,h1,h2,h3,h4,h5,td,label").each(function() {
            var currentSize = parseFloat(jQuery(this).css("font-size"));
            jQuery(this).css("font-size", currentSize + count1)

        });
        SizeStatus = AppliedStatus;
        return;
    }
});





function ChangeStatus(AppliedStatus) {
    var s = 0;
    if (SizeStatus == 1) {
        if (AppliedStatus == 2) {
            s = 1;
        }
        else if (AppliedStatus == 3) {
            s = 2;
        }
    }
    else if (SizeStatus == 2) {
        if (AppliedStatus == 1) {
            s = -1;
        }
        else if (AppliedStatus == 3) {
            s = 1;
        }
    }
    else if (SizeStatus == 3) {
        if (AppliedStatus == 1) {
            s = -2;
        }
        else if (AppliedStatus == 2) {
            s = -1;
        }
    }
    return s;
}


//function decreaseFontSize() {
//for(element=0;element<htmlelements.length;element++) {
//   var p = document.getElementsByTagName(htmlelements[element]);
//   for(i=0;i<p.length;i++) {
//      if(p[i].style.fontSize ) {
//       
//         var s = parseInt(p[i].style.fontSize.replace("px",""));
//      } else {
//         var s = 10;
//      }
//      if(s!=min) {
//         s -= 1;
//      }
//      p[i].style.fontSize = s+"px"
//   }      
//   }
//}
