var ns4 = (document.layers) ? 1 : 0;
var ie4 = (document.all) ? 1 : 0;
var ns6 = (document.getElementById && !document.all) ? 1 : 0;

function getWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}
function getHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}
function getTop(hei){
 return((getHeight() / 2) - hei);
}
function getLeft(wid){
 return((getWidth() / 2) - wid);
}

function createDiv(id, ids, hei, wid){
	document.getElementById(id).style.display = "block";
	document.getElementById(id).style.width = getWidth()+"px";
	document.getElementById(id).style.height = getHeight()+"px";
	//
	// Proverka za Skrolirane
	//
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
	//
	// Namestvane spored browserite
	//
	document.getElementById(id).style.top = scrOfY+"px";
	document.getElementById(id).style.left = scrOfX+"px";
	if (document.getElementById(ids).style){
		document.getElementById(ids).style.display = "block";
		document.getElementById(ids).style.top= getTop(hei)+scrOfY+"px";
		document.getElementById(ids).style.left= getLeft(wid)+scrOfX+"px";
	}
	else if(nn4){
		document.layers[id].top = getTop(hei)+scrOfY+"px";
		document.layers[id].left = getLeft(wid)+scrOfX+"px";
	}
	else{
		document.getElementById(ids).display = "block";
		document.getElementById(ids).offsetTop = getTop(hei)+scrOfY+"px";
		document.getElementById(ids).offsetLeft = getLeft(wid)+scrOfX+"px";
	}
}
function rezizeDiv(id, ids, hei, wid){
	document.getElementById(id).style.width = getWidth()+"px";
	document.getElementById(id).style.height = getHeight()+"px";
	// Proverka za Skrolirane
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
	
	document.getElementById(id).style.top = scrOfY+"px";
	document.getElementById(id).style.left = scrOfX+"px";
			if (document.getElementById(ids).style){
				document.getElementById(ids).style.top= getTop(hei)+scrOfY+"px";
				document.getElementById(ids).style.left= getLeft(wid)+scrOfX+"px";
			}
			else if(nn4){
				document.layers[id].top = getTop(hei)+scrOfY+"px";
				document.layers[id].left = getLeft(wid)+scrOfX+"px";
			}
			else{
				document.getElementById(ids).offsetTop = getTop(hei)+scrOfY+"px";
				document.getElementById(ids).offsetLeft = getLeft(wid)+scrOfX+"px";
			}
}
function closeReplyWin(id, ids){
	document.getElementById(id).style.display = "none";
	if (document.getElementById(ids).style){
		document.getElementById(ids).style.display = "none";
	}
	else{
		document.getElementById(ids).display = "none";
	}
}
// REQUEST i DRUGI
var xmlhttp = false;
if(window.XMLHttpRequest)
	xmlhttp = new XMLHttpRequest(); 
else if (window.ActiveXObject)
	xmlhttp  = new ActiveXObject("Microsoft.XMLHTTP"); 

function makeRequest(url, divId) {
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			var s = xmlhttp.responseText;
			document.getElementById(divId).innerHTML = s;
			/*setTimeout("reloadpage()", 1000);*/
		}
	}            
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}

function makeR(url, divId) {
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			var s = xmlhttp.responseText;
			document.eval(divId).value = s;
		}
	}            
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}

function reloadpage(url){
	window.location=url;
}

function showForms(bodyId, layerId, height, width){
	createDiv(bodyId, layerId, height, width);
}
//
// Uvelichavane na shrifta
//
var pixelArray =  new Array('11','12','14','16','18','20','22');
var emArray =  new Array('0.7','0.9','1.0','1.5','2.0','2.5','3');
var initSize = 0;

function fontSizer(inc,unit,id) {
	if (!document.getElementById) 
		return;
	var size = initSize;
		size += inc;
	if (size < 0 ) {
		size = 0;
		document.getElementById("minus").src= "images/fontSizeMinus_noActiv.gif";
		document.getElementById("plus").src= "images/fontSizePlus.gif";
	}
	if (size > 6 ) {
		size = 6;
		document.getElementById("plus").src= "images/fontSizePlus_noActiv.gif";
		document.getElementById("minus").src= "images/fontSizeMinus.gif";
	}
	if (size > 0 ) {
		document.getElementById("minus").src= "images/fontSizeMinus.gif";
	}
	if (size < 6 ) {
		document.getElementById("plus").src= "images/fontSizePlus.gif";
	}
	initSize = size;
				
	document.getElementById(id).style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;
}
//
//SNED mail
function sendM(){
	var a = "@";
	var w = 'mailto:';
	window.location = w+'info'+a+'machove.com';
}

