var min=10; //min font
var max=20; //max font
var def=12; // default font

function showDiv(div) {
  with (document.getElementById(div).style) {
       display = display == "none"  ? "block" : "none";
   }
  //alert(div);
}

//open all dives
function showAllDivs() {
  var divsAmount = 50; //number div's
  for (var i = 1; i<=divsAmount; i++) {
    document.getElementById("div" + i).style.display = "block";
  }
} 
function changeBgImage(el,img,repeat) {
	//el = document.getElementById("imgHeader");
	el.style.background = "url("+img+")";
	el.style.backgroundRepeat = repeat;
	}
function increaseFontSize(el) {
   var p = document.getElementById(el);
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } 
	  else {
	  p.style.fontSize = "";
         var s = def;
		}
      if(s!=max) {
         s += 1;
      }
      p.style.fontSize = s+"px";
}

function decreaseFontSize(el) {
   var p = document.getElementById(el);
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } 
	  else {
         var s = def;
      }
      if(s!=min) {
         s -= 1;
      }
      p.style.fontSize = s+"px";
}

function defaultFontSize(el) {
 var p = document.getElementById(el);
      p.style.fontSize = def+"px";
}

function searchTextOnPage(textToFind) {
	ar = document.getElementsByTagName('span');
	if (ar) {
	for (i=0;i<ar.length;i++) {
			ar[i].style.backgroundColor='transparent';
		}
	}
	var array = textToFind.split(" ");
	for (i=0;i<array.length;i++) {
		if (array[i].length>3) {
			//alert(array[i]);
			document.body.innerHTML = document.body.innerHTML.replace(eval("/"+array[i]+"/gi"),"<span style='background-color:yellow;'>"+array[i]+"</span>");	
		}
	}
}
function disableMessage(el) {
	//alert(el.readOnly);
	if (el.readOnly===true) {
		ShowModalbox();
	}
}
//modalbox.style.left=(parseInt(document.body.clientWidth)-parseInt(modalbox.clientWidth))/2 + "px";
//modalbox.style.top=(parseInt(document.body.clientHeight)-parseInt(modalbox.clientHeight))/2 + "px";
	function ShowModalbox() {
	//	if (modal==undefined) {
		//var modalbox;
		//}
	document.getElementById("main").style.filter = "alpha(opacity=80)";
	document.getElementById("main").style.opacity = 0.8;
	document.getElementById("main").style.display = "block";

	modalbox.style.display = "block";
	shade.style.display = "block";

	posleft = Math.round(scrollWidth / 2) - 200;
	postop = document.body.scrollHeight - 500;

	shade.style.left = posleft + 7;
	shade.style.top = document.body.scrollTop + 207;

	modalbox.style.left = posleft;
	modalbox.style.top = document.body.scrollTop + 200;

	}

	function HideModalbox() {

	document.getElementById("main").style.display = "none";
	modalbox.style.display = "none";
	shade.style.display = "none";

	}

