		
			var div_open;
			var IFRAME_WINDOW = null;
			var POPUP_WINDOW = null;
			var ZONE_HALFSIZE;
			var ZONE_FULLSIZE;
			var ACTIVE_TYPE = 0;
			var DEFAULT_TYPE = -1;
			
			
			function setDefaultType(type) {
				DEFAULT_TYPE = type;
			}
			function setActiveType(type) {
				ACTIVE_TYPE = type;
			}
			function getActiveType() {
				return ACTIVE_TYPE;
			}
			
			function asString(txt,dtxt) {
				if (txt==null)
					return dtxt;
				txt = txt.trim();
				if (txt.length == 0)
					return dtxt;
				return txt;
			}

		var div_popup_name = 'popup';
		function onIFramePageLoaded(div_up, div_down,popupWindow) {
			POPUP_WINDOW = popupWindow;
			if (div_up) {
				var txt = document.getElementById("incrustation_up_div_" + div_popup_name);
				txt.innerText= div_up.innerText;
			}
			if (div_down) {
				var south = document.getElementById("south_window_" + div_popup_name);
				south.innerHTML= div_down.innerHTML;
			}
		}

			
		function onPageLoaded(section_code, div_up, div_down,iframeWindow) {
			IFRAME_WINDOW = iframeWindow;
			var prefix = getMainZonename(ACTIVE_TYPE);
			if (div_up) {
				var north = document.getElementById("north_window_" + prefix);
				north.innerHTML= div_up.innerHTML;
			}
			if (div_down) {
				var south = document.getElementById("south_window_" + prefix);
				south.innerHTML= div_down.innerHTML;
			}
			updateSection(section_code);
			createVNAV();
			showMainframe(ACTIVE_TYPE);
		}

		function getSection(www) {
			if (www.indexOf("http")==0) {
					var j = www.substring(10).indexOf('/');
					www = www.substring(j+10);
			}
			var i = www.substring(1).indexOf('/');
			return www.substring(1, i+1);
		}
		
		function action_iframe(the_url) {
			var sep = the_url.split(",");
			var title = sep.length > 1 ? sep[1] : "";
			var link = sep.length > 2 ? sep[2] : "";
			var w_width = sep.length > 3 ? sep[3] : "500";
			var w_height = sep.length > 4 ? sep[4] : "300";
			
			popupIframe(w_width, w_height,title,link);
		}
		function action_logout() {
			window.location = "/site/index.html.logout.sys";
		}
		function action_back() {
			if (URLS.length > 1) {
				URLS.pop();
				var the_url = URLS.pop();
				goToUrl(-1, the_url);
			} else {
				window.location = "/";
			}
		}

		var TIME = 8000;
		function callPub() {
			if (getActiveType() == 1) {
				var iframe = document.getElementById("iframe_pub");
				iframe.src ="index-boxes.html";
			}
			TIME += 2000;
			setTimeout("callPub()", TIME); 
		}


		var URLS = new Array();		
	
		function goToUrl(type, the_url) {
			type= asInt(type, -1);
			if (type < 0)
				type = ACTIVE_TYPE;

			TIME = 8000;
			ACTIVE_TYPE = type;
			var prefix = getMainZonename(type);
			var iframe = document.getElementById("iframe_" + prefix);
			//			
			if (the_url.indexOf("/action:")==0) {
					var sep = the_url.split(",");
					var act = sep[0].substring("/action:".length);
					eval("action_" + act + "('"+the_url+"')");
					return ;
			}
			else if (the_url.indexOf('?') == 0) {
					if (IFRAME_WINDOW) {
							var iw_url = IFRAME_WINDOW.document.location.href;
							var j = iw_url.lastIndexOf('?');
							if (j != -1) {
								iw_url = iw_url.substring(0, j);
							}
							the_url = iw_url + the_url;
					}
			}
			else if (the_url.indexOf('/') != 0) {
					if (IFRAME_WINDOW) {
							var iw_url = IFRAME_WINDOW.document.location.href;
							var j = iw_url.lastIndexOf('/');
							the_url = iw_url.substring(0, j+1) + the_url;
					}
			}
			//
			if ( getSection(document.location.href) != getSection(the_url) ) {
				var full_url = "/" + getSection(the_url) + "/index.html?type="+type+"&url=" + the_url;
				window.location = full_url;
				//alert("full_url = " + full_url+",\n=" + getSection(document.location.href) + "\n="+getSection(the_url));
			}
			//
			URLS.push(the_url);
			iframe.src  = the_url;
		}
		
		function setBoxHTML(HTML) {
				var intern_div = document.getElementById('internal_zone_cell_zones');
				intern_div.innerHTML = HTML;
				//setTimeout("callPub()", 7000);
		}
		
		function getMainZonename(type) {
			if (type == 0) {
				if (ZONE_FULLSIZE)
					return ZONE_FULLSIZE;
				{
						ZONE_FULLSIZE = 'inside_fullsize';
						var intern_div = document.getElementById('internal_fullzone_div');
						var intern_cell = document.getElementById('internal_fullzone_cell');
						var w = 817;
						var h = intern_div.style.height+"";						
						h = h.substring(0, h.length -2) - 15;
						var html = '<iframe id="iframe_'+ZONE_FULLSIZE+'" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" width="100%" height="100%" src="/blank.htm" border="0" ></iframe>';	
						var innerHTML = buildPopup(w, h, null, html,30,30,ZONE_FULLSIZE,1,null,null,5);	
						intern_cell.innerHTML = innerHTML;
						return ZONE_FULLSIZE;
				}
			} else {
				if (ZONE_HALFSIZE)
					return ZONE_HALFSIZE;
				{
						ZONE_HALFSIZE = 'inside_halfsize';
						var intern_div = document.getElementById('internal_zone_div');
						var intern_cell = document.getElementById('internal_zone_cell');
						var h = intern_div.style.height+"";						
						h = h.substring(0, h.length -2) - 15;
						var w = 657;
						var html = '<iframe id="iframe_'+ZONE_HALFSIZE+'" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" width="100%" height="100%" src="/blank.htm" border="0" ></iframe>';	
						var innerHTML = buildPopup(w, h, null, html,30,30,ZONE_HALFSIZE,1,null,null,5);	
						intern_cell.innerHTML = innerHTML;
						return ZONE_HALFSIZE;
				}
			}
			
		}
		
		var zIndex = 300;
		function showMainframe(type) {
			ACTIVE_TYPE = type;
			var zonename0 = getMainZonename(0);
			var zonename1 = getMainZonename(1);
			var div0 = document.getElementById('internal_fullzone_div');
			var div1 = document.getElementById('internal_zone_div');
			var divon,divoff;
			if (type == 0) {
					divon = div0;
					divoff = div1;
			} else {
					divon = div1;
					divoff = div0;
			}
			if (divon) {
				divon.style.zIndex = zIndex;
				if (divon.style.display)
					divon.style.display = "block";
				divon.style.visibility = 'visible';
			}
			if (divoff) {
				divoff.style.zIndex = "1";
				divoff.style.display = "none";
				divoff.style.visibility = 'hidden';
			}
		}
		
		function closeMainDiv(divname) {
			var intern_div = document.getElementById(divname);
			intern_div.innerHTML = '';
		}


	function asInt(val,defaultval) {
			if ((val == null) || (val.length == 0) )
				return defaultval;

			if (val * 2 == (val*1 + val*1) )
				return val;
			
			return defaultval;
	}

	function closeDiv(divname) {
			var div = document.getElementById(divname);
			if (div) {
					div.innerHTML = '';
					div.style.visibility = 'hidden';
			}
	}

	function closeBuiltPopup(window_name) {
			closeDiv('div_intern_'+window_name+'_title_up');
			closeDiv('div_intern_'+window_name);
			closeDiv('div_intern_'+window_name+'_up');
			closeDiv('div_intern_'+window_name+'_up_wrapper');
			closeDiv('div_intern_'+window_name);
			closeDiv('body_window_'+window_name);
			closeDiv('div_intern_'+window_name+'_down_wrapper');
			closeDiv('div_intern_'+window_name+'_down');
			closeDiv('div_intern_'+window_name+'_title_down');
	}

function buildPopup(width, height, onclose, internal_html, part_intern_up_height, part_intern_down_height, 
					window_name, scrolldiv, title, title_down,part_intern_sep,
					typecolor, rounded_left, rounded_right, close_popup) {

		var size = 6;
		var corner= 15;
		var href;
		var div_wrapped;
		var corner_color;
		var corner_color_left;
		var corner_color_right;
		var corner_background_left;
		var corner_background_right;
		var width_intern = width - 2 * size;
		var height_intern = height - 2 * size;
		
		var height_text = height ? height : "100%";
		var height_intern_text = height ? height_intern : "100%";

	  typecolor = asInt(typecolor, 1);
	  
		var border_color = typecolor==1 ? "white" : "green";
		var border_background = typecolor==1 ? null : '/images/news/green_corner.gif';
		var imgNE, imgNW, imgSE, imgSW;
		
		rounded_left = asInt(rounded_left,1);
		rounded_right = asInt(rounded_right,1);
		
		var prefix = typecolor==1 ? "white_corner" : "green_corner";
		if (rounded_left == 1) {
			imgNW = '<td><img src="/images/news/' + prefix + '_NW.gif" width="' + corner + '" height="' + corner + '"></td>';
			imgSW = '<td><img src="/images/news/' + prefix + '_SW.gif" width="' + corner + '" height="' + corner + '"></td>';
		} else {
			imgNW = '<td><img src="/images/news/' + prefix + '_square_NW.gif" width="' + corner + '" height="' + corner + '"></td>';
			imgSW = '<td><img src="/images/news/' + prefix + '_square_SW.gif" width="' + corner + '" height="' + corner + '"></td>';
		}
		if (rounded_right == 1) {
			imgNE = '<td><img src="/images/news/' + prefix + '_NE.gif" width="' + corner + '" height="' + corner + '"></td>';
			imgSE = '<td><img src="/images/news/' + prefix + '_SE.gif" width="' + corner + '" height="' + corner + '"></td>';
		} else {
			imgNE = '<td><img src="/images/news/' + prefix + '_square_NE.gif" width="' + corner + '" height="' + corner + '"></td>';
			imgSE = '<td><img src="/images/news/' + prefix + '_square_SE.gif" width="' + corner + '" height="' + corner + '"></td>';
		}
		
		//
		//			INCRUSTATION
		//
		var incrustation_up_divname = "incrustation_up_div_" + window_name;
		var incrustation_down_divname;
		var text_incrustation_up = title;
		var html_incrustation_up = onclose ? ('<a href="#" onclick="div_open.parentNode.removeChild(div_open);div_open=undefined"><img src="/images/window_close.gif" border="0" width="11" height="11"></a>') : '';
		var text_incrustation_down = title_down;
		var html_incrustation_down;
		var incrustation_height_up = 20;
		var incrustation_height_down = 20;
		var incrustation_color_up = "#6C8C36";
		var incrustation_color_down = "#6C8C36";
		var incrustation_colortxt_up= "white";
		var incrustation_colortxt_down = "white";
		//
		//			params
		//
		var imgsrc;
		
		var PART_UP= '';
		var PART_DIV_NORTH= '';
		var PART_INTERN= '';
		var PART_DIV_SOUTH= '';
		var PART_DOWN= '';

		if ((text_incrustation_up) || (html_incrustation_up)) {
			PART_UP = '<div id="div_intern_'+window_name+'_title_up" style="visibility:visible;position:absolute;z-index:200;margin-left:0px;margin-top:' + size + 'px">\
				<table border="0" width="' + width + '" height="' + incrustation_height_up + '" type="1">\
					<tr height="'+size+'">\
						<td style="padding-left:' + size + 'px"></td>\
						<td height="' + incrustation_height_up + '" width="' + width_intern + '" align="center" style="color:' + incrustation_colortxt_up + ';background-color: ' + incrustation_color_up + ';opacity: .8;filter:alpha(opacity=80);" type="2">\
<b id="' + incrustation_up_divname + '">\
								' + (text_incrustation_up?text_incrustation_up:'') + '\
							</b></td>';
							var style_part_up = 'color:' + incrustation_colortxt_up + ';background-color: ' + incrustation_color_up + ';opacity: .8;filter:alpha(opacity=80);';
						PART_UP+='<td style="'+style_part_up+'">\
							' + (html_incrustation_up?html_incrustation_up:'') + '</td>';
						if (close_popup) {
							PART_UP +='\
						<td onclick="'+close_popup+'" style="cursor:pointer;'+style_part_up+'"><img src="/images/window_close.gif" ></td>\
						<td style="padding-left:10px;'+style_part_up+'"></td>\
						';
					}
					PART_UP +='\
						<td style="padding-left:' + size + 'px"></td>\
					</tr>\
				</table>\
			</div>\
			';
		}
		PART_DIV_NORTH = '\
			<div id="div_intern_'+window_name+'_up" style="visibility:visible;position:absolute;z-index:200">\
				<table width="' + width + '" height="' + corner + '" type="1">\
					<tr height="1">' + imgNW +'\
						<td style="padding-left:' + (width - 2 * corner ) + 'px"></td>' + imgNE +'\
					</tr>\
				</table>\
		</div>\
		';
		
		PART_INTERN='\
		<table width="' + width + '" height="' + height_text + '" type="1">\
			<tr height="'+size+'">\
				<td style="padding-left:'+size+'px" '+ ( corner_color_left ? ('bgcolor="' + corner_color_left+'"') : (corner_background_left ? ('background="' +corner_background_left + '"') : '') )+' ></td>\
				<td style="padding-left:'+width_intern+'px" ' + (border_background ? ('background="' + border_background + '"') : ('bgcolor="' + border_color +'"') ) + '></td>\
				<td style="padding-left:'+size+'px" '+ ( corner_color_right ? ('bgcolor="' + corner_color_right+'"') : (corner_background_right ? ('background="' +corner_background_right + '"') : '') )+' ></td>\
			</tr>\
			<tr height="' + height_intern_text + '">\
				<td style="padding-left:1px" ' + (border_background ? ('background="' + border_background + '"') : ('bgcolor="' + border_color +'"') ) + '></td>\
				<td valign="top"><table width="100%" height="100%">';
		if (part_intern_up_height > 0) {
					PART_INTERN +='<tr height="'+part_intern_up_height+'">\
				<td colspan="3" id="north_window_'+window_name+'" width="100%" background="/images/intern/background/bg_footer.gif"></td>\
			</tr>';
				// <td background="/images/intern/background/bg_footer.gif" style="padding-left:1px"></td>
				// <td background="/images/intern/background/bg_footer.gif"  style="padding-left:1px"></td>
			if (part_intern_sep > 0) {
				PART_INTERN +='<tr height="5">\
					<td colspan="3" height="5" bgcolor="white"></td>\
				</tr>';
			}
		}
		if (scrolldiv == 1) {
			PART_INTERN +='\
				<tr>\
					<td style="padding:0px" colspan="3" align="left" valign="top" bgcolor="white" width="100%" height="100%"><div id="body_window_'+window_name+'" style="overflow:auto;width:'+(width_intern)+'px;height:'+(height_intern - 50)+'px">'+internal_html+'</div></td>\
				</tr>';
		} else {
			PART_INTERN +='\
				<tr>\
					<td style="padding:0px" colspan="3" align="left" valign="top" bgcolor="white">'+internal_html+'</td>\
				</tr>';
		}
			
			
		if (part_intern_down_height > 0) {
			if (part_intern_sep > 0) {
				PART_INTERN +='<tr height="5">\
					<td colspan="3" bgcolor="white"  style="padding-left:1px"></td>\
				</tr>';
			}
					PART_INTERN +='\
			<tr height="'+part_intern_down_height+'">\
				<td colspan="3" id="south_window_'+window_name+'" width="100%" background="/images/intern/background/bg_footer.gif"></td>\
			</tr>';
				// <td background="/images/intern/background/bg_footer.gif"  style="padding-left:1px"></td>
				// <td background="/images/intern/background/bg_footer.gif"  style="padding-left:1px"></td>
		}
		PART_INTERN +='\
		</table></td>\
				<td ' + (border_background ? ('background="' + border_background + '"') : ('bgcolor="' + border_color +'"') ) + '></td>\
			</tr>\
			<tr height="'+size+'">\
				<td style="padding-left:'+size+'px" '+ ( corner_color_left ? ('bgcolor="' + corner_color_left+'"') : (corner_background_left ? ('background="' +corner_background_left + '"') : '') )+'></td>\
				<td style="padding-left:'+width_intern+'px" ' + (border_background ? ('background="' + border_background + '"') : ('bgcolor="' + border_color +'"') ) + '></td>\
				<td style="padding-left:'+size+'px" '+ ( corner_color_right ? ('bgcolor="' + corner_color_right+'"') : (corner_background_right ? ('background="' +corner_background_right + '"') : '') ) +'>\
			</tr>\
		</table>\
		';
		
		PART_DIV_SOUTH = '\
		<div id="div_intern_'+window_name+'_down_wrapper" style="visibility:visible;position:'+(close_popup==null ? "absolute" : "relative")+'">\
			<div id="div_intern_'+window_name+'_down" style="visibility:visible;position:relative;top:-' + corner + 'px;z-index:200">\
				<table width="' + width + '" height="' + corner + '" type="1">\
					<tr>' + imgSW +'\
						<td style="padding-left:'+( width - 2 * corner )+'px" ></td>' + imgSE +'\
					</tr>\
				</table>\
			</div>\
			';

		if ((text_incrustation_down) || (html_incrustation_down)) {
			PART_DOWN += '\
			<div id="div_intern_'+window_name+'_title_down" style="visibility:visible;position:absolute;bottom:' + (2 + incrustation_height_down) +'px;z-index:200">\
				<table width="' + width + '" height="' + incrustation_height_down + '" type="1">\
					<tr height="'+size+'">\
						<td style="padding-left:'+size+'px"></td>\
						<td height="' + incrustation_height_down + '" width="' + width_intern + '" align="center" style="color:' + incrustation_colortxt_down + ';background-color: ' + incrustation_color_down + ';opacity: .8;filter:alpha(opacity=80);" type="2">\
							<b id="' + incrustation_down_divname + '">\
								' + (text_incrustation_down?text_incrustation_down:'') + '\
							</b>\
						</td>\
						<td valign="bottom" style="color:' + incrustation_colortxt_down + ';background-color: ' + incrustation_color_down + ';opacity: .8;filter:alpha(opacity=80);">\
							' + (html_incrustation_down?html_incrustation_down:'') + '</td>\
						<td style="padding-left:'+size+'px"></td>\
					</tr>\
				</table>\
			</div>\
			';
			PART_DOWN += '</div>';
		} else 
			PART_DIV_SOUTH += '</div>';
		
		
		return PART_UP + PART_DIV_NORTH + PART_INTERN +PART_DIV_SOUTH + PART_DOWN;
		

}