 /*
    * Code generated by PHP - Generator
    * Author: Yohanan Borda
    * Modification Date: 25/10/2011
    * Boro Software Inc.
    * Copyrights © 2006 - 2010
    */

var image1 = new Image(15, 15), 
	image2 = new Image(13, 13);
	  
image1.src = "./images/static/newsPlaneOver.gif";
image2.src = "./images/static/newsPlane.gif";

function changeImg(Elem, Img, Value) {
	var img, 
	     k;
	  
	for (k = 1; k <= Value; k++) {
		img = document.getElementById(Elem + k);
	  
	  	if (document.images) {
			img.src = Img.src;
	  	}
	}
}

function popupSub(pagina, nombre, settings) {
      var posx = ((window.screen.width - 580) / 2), 
          posy = ((window.screen.height - 500) / 2);
		 
      settings += ',top=' + posy + ',left=' + posx; 
      host = location.hostname;
      popupWin = window.open(pagina, nombre, settings);
      popupWin.opener.top.name = "opener";
      popupWin.focus();  
}

function findPos(obj) {
	var curleft = curtop = 0;

	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	
	return curtop;
}

function showNews(layerName, item, leftPos) {
	
	var layer = document.getElementById(layerName);
	
	if (layer.style.visibility == "visible") {
		layer.style.visibility = "hidden";
		//document.getElementById("tabTransparent").style.visibility = "hidden";
	} else {
		//document.getElementById("tabTransparent").style.visibility = "visible";
		layer.style.top        = findPos(item) + "px";
		layer.style.left       = leftPos + "px";
		layer.style.visibility = "visible";
	}
}

/*
function showNews(layerName, item, str, leftPos) {
	
	var layer = document.getElementById(layerName);
	
	if (layer.style.visibility == "visible") {
		layer.style.visibility = "hidden";
		//document.getElementById("tabTransparent").style.visibility = "hidden";
	} else {
		//document.getElementById("tabTransparent").style.visibility = "visible";
		layer.style.top        = findPos(item) + "px";
		layer.style.left       = leftPos + "px";
		layer.innerHTML        = str;
		layer.style.visibility = "visible";
	}
}
*/

function hideNews(layerName) {
	document.getElementById(layerName).style.visibility = "hidden";
}

function windowBlock() {
	
	var viewportwidth, 
	    viewportheight;
	 
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight; 
	} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight; 
	} else { 
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}

	var width  = viewportwidth;
	var height = viewportheight;
	var posx   = ((window.screen.width - 410) / 2); 
    var posy   = ((window.screen.height - 400) / 2);

	document.getElementById("windowBlock").style.width          = width + "px";
	document.getElementById("windowBlock").style.height         = height + getScrollXY() + "px";
	document.getElementById("windowBlock").style.visibility     = "visible";
	document.getElementById("windowBlockForm").style.left       = posx;
	document.getElementById("windowBlockForm").style.top        = posy;
	document.getElementById("windowBlockForm").style.visibility = "visible";
}

function getScrollXY() {
	
	  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;
	  }
	  
	  //return [ scrOfX, scrOfY ];
	  return scrOfY;
}

function trim(str) {
    return str.replace(/^\s+|\s+$/g, '');
}

function timeRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);", timeoutPeriod);
}
