﻿window.map_points = 
{
 'Россия'         : {x: 435, y: 33},
 'Китай'          : {x: 462, y: 87},
 'США'            : {x: 86,  y: 79},
 'Франция'        : {x: 272, y: 62},
 'Германия'       : {x: 283, y: 58},
 'Польша'         : {x: 305, y: 54},
 'Чехия'          : {x: 293, y: 57},
 'Великобритания' : {x: 263, y: 51},
 'Израиль'        : {x: 330, y: 88},
 'Италия'         : {x: 289, y: 69},
 'Грузия'         : {x: 346, y: 70},
 'ЮАР'            : {x: 309, y: 184},
 'Украина'        : {x: 327, y: 59},
 'Австралия'      : {x: 508, y: 177},
 'Швейцария'      : {x: 284, y: 63},
 'Швеция'         : {x: 294, y: 41},
 'Япония'         : {x: 515, y: 79},
 'Канада'         : {x: 82,  y: 53},
 'Болгария'       : {x: 312, y: 69},
 'Бельгия'        : {x: 273, y: 58},
 'Индонезия'      : {x: 475, y: 140},
 'Иран'           : {x: 362, y: 86},
 'Турция'         : {x: 327, y: 75},
 'Венгрия'        : {x: 301, y: 62},
 'Латвия'         : {x: 309, y: 46},
 'Индия'          : {x: 407, y: 103},
 'Сербия'         : {x: 305, y: 65},
 'Эстония'        : {x: 314, y: 44},
 'ОАЭ'            : {x: 362, y: 101},
 'Азербайджан'    : {x: 352, y: 73},
 'Новая Зеландия' : {x: 575, y: 210},
 'Македония'      : {x: 305, y: 68},
 'Литва'          : {x: 307, y: 49},
 'Зимбабве'       : {x: 321, y: 169},
 'Венесуэла'      : {x: 145, y: 128},
 'Аргентина'      : {x: 147, y: 193},
 'Армения'        : {x: 346, y: 74},
 'Испания'        : {x: 262, y: 73},
 'Белоруссия'     : {x: 317, y: 52},
 'Греция'         : {x: 305, y: 75},
 'Нидерланды'     : {x: 278, y: 55},
 'Ирландия'       : {x: 253, y: 53},
 'Пакистан'       : {x: 387, y: 87},
 'Румыния'        : {x: 315, y: 64},
 'Словакия'       : {x: 303, y: 60},
 'Австрия'        : {x: 291, y: 59},
 'Албания'        : {x: 302, y: 71},
 'Алжир'          : {x: 273, y: 92},
 'Ангола'         : {x: 297, y: 154},
 'Андорра'        : {x: 290, y: 70},
 'Афганистан'     : {x: 384, y: 84},
 'Багамы'         : {x: 134, y: 98},
 'Бангладеш'      : {x: 430, y: 99},
 'Абхазия'        : {x: 346, y: 68},
 'Боливия'        : {x: 155, y: 169},
 'Гватемала'      : {x: 104, y: 113},
 'Гамбия'         : {x: 223, y: 117},
 'Гана'           : {x: 268, y: 124},
 'Бурунди'        : {x: 322, y: 143},
 'Бенин'          : {x: 280, y: 123},
 'Монако'         : {x: 282, y: 67},
 'Дания'          : {x: 285, y: 49},
 'Бахрейн'        : {x: 365, y: 98},
 'Белиз'          : {x: 110, y: 110},
 'Ботсвана'       : {x: 310, y: 172},
 'Босния и Герцеговина' : {x: 300, y: 66},
 'Бразилия'       : {x: 163, y: 154},
 'Бруней'         : {x: 475, y: 132},
 'Буркина-Фасо'   : {x: 254, y: 117},
 'Бутан'          : {x: 430, y: 90},
 'Вануату'        : {x: 537, y: 165},
 'Ватикан'        : {x: 269, y: 69},
 'Восточный Тимор' : {x: 451, y: 153},
 'Вьетнам'        : {x: 460, y: 119},
 'Габон'          : {x: 290, y: 137},
 'Гаити'          : {x: 138, y: 108},
 'Гайана'         : {x: 152, y: 131},
 'Антарктида'     : {x: 320, y: 225},
 'Финляндия'      : {x: 315, y: 37},
 'Гондурас'       : {x: 115, y: 114},
 'Гвинея'         : {x: 249, y: 118},
 'Гвинея-Бисау'   : {x: 247, y: 117},
 'Джибути'        : {x: 339, y: 120},
 'Сомалиленд'		: {x: 351, y: 123},
 'Доминика': {x: 154, y: 113},
 'Доминиканская Республика': {x: 156, y: 107},
 'Замбия': {x: 312, y: 164},
 'Египет': {x: 318, y: 93},
 'Гренада': {x: 155, y: 119},
 'Демократическая Республика Конго': {x: 298, y: 140},
 'Иордания' : {x: 337, y: 87},
 'Барбадос' : {x: 159, y: 115},
 'Узбекистан' : {x: 380, y: 69},
 'Антигуа и Барбуда' : {x: 120, y: 115},
 'Ирак' : {x: 345, y: 82},
 'Исландия' : {x: 241, y: 34},
 'Киргизия' : {x: 405, y: 73},
 'Куба' : {x: 130, y: 104},
 'Йемен' : {x: 343, y: 113},
 'Кабо-Верде' : {x: 226, y: 108},
 'Казахстан' : {x: 390, y: 58},
 'Камбоджа' : {x: 460, y: 120},
 'Кипр' : {x: 325, y: 81},
 'Камерун' : {x: 288, y: 128},
 'Катар' : {x: 358, y: 97},
 'Кения' : {x: 332, y: 136},
 'КНДР' : {x: 495, y: 76},
 'Туркмения' : {x: 362, y: 76},
 'Лихтенштейн' : {x: 287, y: 60},
 'Кирибати' : {x: 546, y: 160},
 'Колумбия' : {x: 135, y: 135},
 'Коморские острова' : {x: 334, y: 164},
 'Кот-д-Ивуар'   : {x: 244, y: 187},
 'Норвегия'         : {x: 284, y: 40},
 'Кувейт'        : {x: 365, y: 98},
 'Лаос'        : {x: 455, y: 114},
 'Лесото'            : {x: 309, y: 184},
 'Конго'          : {x: 293, y: 140},
 'Коста-Рика'       : {x: 115, y: 114},
 'Люксембург'        : {x: 273, y: 58},
 'Ливан'        : {x: 330, y: 85},
 'Либерия'         : {x: 249, y: 118},
 'Ливия': {x: 318, y: 93},
 'Маврикий' : {x: 334, y: 164},
 'Мадагаскар' : {x: 352, y: 169},
 'Мавритания'         : {x: 223, y: 117},
 'Малави': {x: 312, y: 164},
 'Мали'   : {x: 265, y: 110},
 'Мальдивы'          : {x: 407, y: 133},
 'Малайзия'      : {x: 453, y: 132},
 'Мальта'         : {x: 289, y: 69},
 'Марокко'          : {x: 258, y: 88},
 'Мексика'            : {x: 85,  y: 102},
 'Мозамбик'       : {x: 321, y: 169},
 'Молдавия'        : {x: 322, y: 60},
 'Уругвай'			: {x: 167, y: 193} 
 }


function draw_point(art_points) 
 {
  canvas = document.getElementById("rating_map");
  ctx = canvas.getContext("2d");

  var grad = Math.PI/180;

  var relations = ['#ff0000', '#b057b8', '#0018ff'];

  for(var i = 0; i <art_points.length; i++)
   {
    ctx.beginPath();
    
    ctx.arc(art_points[i].x, art_points[i].y, art_points[i].rating*1+1*1, 0, grad*360, true);
    ctx.fillStyle = '#ffffff';
    ctx.fill();
    
    ctx.beginPath();
    ctx.arc(art_points[i].x, art_points[i].y, art_points[i].rating, 0, grad*360, true);
    ctx.fillStyle = relations[art_points[i].relation*1+1];
    ctx.fill();
    
    var area = addArea({alt: '2', coords:{x:art_points[i].x, y:art_points[i].y, radius:art_points[i].rating}, onclick: function(){alert('hi all 2')}, links: art_points[i].articles, publisher: art_points[i].publisher});
	
	for(var j = 0; j < area.anounces.length; j++)
	 {
	  if(area.anounces[j].title == window.firstheader.innerHTML)
	   {
	    resetArtList(area);
	    document.getElementById('artlist').style.visibility='visible';
	   }
	 }
   }
 }


function getArticles()
 {
  var div_elements = document.getElementsByTagName('div');
  var publishers = [];
  
  var _s = new RegExp("[\t\n\v\f\r \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]" , "g");
  
  for(var i = 0; i < div_elements.length; i++)
   {
    if(div_elements[i].className == 'publisher') publishers.push(div_elements[i].innerHTML.split(',')[1].replace(_s, ''));
   }
   
  var a_elements = document.getElementsByTagName('a');
  var headers = [];
  for(var i = 0; i < a_elements.length; i++)
   {
    if(a_elements[i].className == 'title' && a_elements[i].parentNode.className == 'article_header')
     {
      headers.push(a_elements[i]);
     }
   }

  window.firstheader = headers[0];
   
  var rated_publishers = {};
  var articles_links = {};

  for(var i = 0; i < publishers.length; i++)
   {
    if(window.map_points[publishers[i]])
	 {
	  if(!rated_publishers[publishers[i]])
	   {

        rated_publishers[publishers[i]] = {rating: 1};
        articles_links[publishers[i]] = [{title:headers[i].innerHTML, 
                                          link:'#'+headers[i].getAttribute('name'), 
                                          publisher:(headers[i].previousSibling.nodeName != 'DIV')?
                                          headers[i].previousSibling.previousSibling.innerHTML.split(',')[0]:headers[i].previousSibling.innerHTML.split(',')[0]}];
	   }
	  else
	   {
	    rated_publishers[publishers[i]].rating++;
        articles_links[publishers[i]].push({title:headers[i].innerHTML, 
                                            link:'#'+headers[i].getAttribute('name'), 
                                            publisher:(headers[i].previousSibling.nodeName != 'DIV')?
                                            headers[i].previousSibling.previousSibling.innerHTML.split(',')[0]:headers[i].previousSibling.innerHTML.split(',')[0]});
	   }
	 }
   }
   
  var points = [];
  
  for (p in rated_publishers)
   {
    points.push({x: window.map_points[p].x,
                 y: window.map_points[p].y,
				 rating: rated_publishers[p].rating*1+2,
				 relation: 0,
                 articles: articles_links[p],
                 publisher: p})
   }

  return points;  
 }
 

function addArea(a)
 {
  if(!a) a = {alt: '123', coords: {x:150, y:100, radius:50}, onclick: function(){alert('hi all')}, links: []}
  var linksmap = document.getElementById('links_areas');
  var area = document.createElement('area');
  area.setAttribute("nohref", true);
  area.setAttribute("shape","circle");
  area.setAttribute("coords",(a.coords.x*1+1*1)+','+(a.coords.y-2)+','+(a.coords.radius*1+1*1));
  
  area.links = 
   {top: a.coords.y, left: a.coords.x, width: 320, height: 100, countrycode: window.ISO3166_1[a.publisher][2].toLowerCase(), country: window.ISO3166_1[a.publisher][3], anounces: a.links, radius: a.coords.radius};
  
  area.onmouseover = function ()
   {
    resetArtList(this.links);
    document.getElementById('artlist').style.visibility='visible';
   }

  linksmap.appendChild(area);
  
  return area.links;
 }


window.artlist_struc = 
 {
  "artlist":
   {
    "background":
     {
      "top_left_corner":1,
      "top_margin":1,
      "top_right_corner":1,
      "right_margin":1,
      "bottom_right_corner":1,
      "bottom_margin":1,
      "bottom_left_corner":1,
      "left_margin":1,
      "body":1
     },
    "content":
     {
      "header":
       {
        "flag_shadow":1,
        "flag":1,
        "country_title":1
       },
      "list":1
     }
   }
 }  


function buildStructure(structure, obj)
 {
  var nodeset = [];
  for(p in structure)
   {
    var node = document.createElement('div');
    node.className = p;
    nodeset.push(node);
    if(typeof structure[p] == 'object')
     {
      var childnodes = buildStructure(structure[p], '');
      for(var i = 0; i < childnodes.length; i++) node.appendChild(childnodes[i]);
     }
   }
  if(nodeset[0].className == obj) return nodeset[0];
  else return nodeset;
 }


function setNodeStyle(node, style)
 {
  for(p in style) node.style[p] = style[p];
 }


function getStructureMap(obj)
 {
  var mapobject = {node:obj};
  for(var i = 0; i < obj.childNodes.length; i++)
   {
    mapobject[obj.childNodes[i].className] = {node:obj.childNodes[i]};
    if(obj.childNodes[i].childNodes.length)
     {
      var childnodes = getStructureMap(obj.childNodes[i]);
      for(p in childnodes) if(p != 'node') mapobject[obj.childNodes[i].className][p] = childnodes[p];
     }
   }
  return mapobject;
 }


function setArtList(arg)
 {
  if(!arg)
   {
    arg = 
     {
      top: 120,
      left: 320,
      width: 330,
      height: 100,
      country: 'Андорра',
      countrycode: 'ad',
      anounces: 
       [
        {title:'', link:'', publisher:''},
        {title:'', link:'', publisher:''},
        {title:'', link:'', publisher:''}
       ]

     }
   }
 
  if(!arg.top)         arg.top = 120;
  if(!arg.left)        arg.left = 320;
  if(!arg.width)       arg.width = 330;
  if(!arg.height)      arg.height = 100;
  if(!arg.country)     arg.country = 'Андорра';
  if(!arg.countrycode) arg.countrycode = 'ad';
  if(!arg.anounces)    arg.anounces = 
   [
    {title:'', link:'', publisher:''},
    {title:'', link:'', publisher:''},
    {title:'', link:'', publisher:''}
   ];
  
  var map_element = document.getElementById('map_bg');
  map_element.onmouseout = function (e)
   {
    if(e) var event = e;
	else event = window.event;
	
	var offsetX = document.getElementById('map_bg').offsetLeft +
                  document.getElementById('map_bg').parentNode.offsetLeft +
                  document.getElementById('map_bg').parentNode.parentNode.offsetLeft +
                  document.getElementById('map_bg').parentNode.parentNode.parentNode.offsetLeft +
                  document.getElementById('map_bg').parentNode.parentNode.parentNode.parentNode.offsetLeft;
    var offsetY = document.getElementById('map_bg').offsetTop +
                  document.getElementById('map_bg').parentNode.offsetTop +
                  document.getElementById('map_bg').parentNode.parentNode.offsetTop +
                  document.getElementById('map_bg').parentNode.parentNode.parentNode.offsetTop +
                  document.getElementById('map_bg').parentNode.parentNode.parentNode.parentNode.offsetTop;
	var width   = document.getElementById('map_bg').offsetWidth;
	var height  = document.getElementById('map_bg').offsetHeight;
	
	var mouseIsFitMapWidth  = (event.clientX > offsetX) && (event.clientX < offsetX*1+width*1);
	var mouseIsFitMapHeight = (event.clientY > offsetY) && (event.clientY < offsetY*1+height*1);
	
	if(!mouseIsFitMapWidth || !mouseIsFitMapHeight) document.getElementById('artlist').style.visibility='hidden';
   }
  
  var _artlist = document.body.appendChild(buildStructure(window.artlist_struc, 'artlist'));
  var artlist = getStructureMap(_artlist);
  artlist.node.id="artlist";
  artlist.node.style.visibility = 'hidden';
  
  for(var i = 0; i < arg.anounces.length; i++)
   {

    var anounce = document.createElement('div');
    setNodeStyle(anounce,
    {position:'relative', overflow:'visible', top:'0px', left:'10px', width:(arg.width-40)+'px', marginTop: '7px', marginBottom: '1px'});
  
    var anounce_article_title = document.createElement('a');
    anounce_article_title.className = 'article_title';
    anounce_article_title.setAttribute('href', arg.anounces[i].link);
    anounce_article_title.appendChild(document.createTextNode(arg.anounces[i].title));
    setNodeStyle(anounce_article_title,
    {color:'#1c3f93', 
     fontFamily:'Tahoma',
     fontSize:'12px',
     fontWeight:'bold', 
     lineHeight:'15px'});  
  
    var anounce_article_publisher = document.createElement('span');
    anounce_article_publisher.className = 'article_publisher';
    anounce_article_publisher.appendChild(document.createTextNode(''+arg.anounces[i].publisher+''));
    setNodeStyle(anounce_article_publisher,
    {marginTop:'1px',
     marginLeft:'5px',
     color:'#5e5e5e', 
     fontFamily:'Tahoma',
     fontSize:'12px',
     fontWeight:'normal', 
     lineHeight:'15px'});
  
    anounce.appendChild(anounce_article_title);
    anounce.appendChild(anounce_article_publisher);
  
    artlist.content.list.node.appendChild(anounce);
   }
  
  arg.height = artlist.content.list.node.offsetHeight*1+35;
  if((arg.height-70) < 0) arg.height = 70;
  
  setNodeStyle(artlist.node, {position:'absolute', overflow:'hidden', top:arg.top+'px', left:arg.left+'px', width:arg.width+'px', height:arg.height+'px'});
  artlist.node.inFocus = 0;
  artlist.node.onmouseout = function () {setTimeout('if(!document.getElementById("artlist").inFocus) document.getElementById("artlist").style.visibility = "hidden"', 10)};
  setNodeStyle(artlist.background.node, {position:'absolute', overflow:'hidden', top:'-3px', left:'-3px', width:arg.width+'px', height:arg.height+'px'});

  var _v = browserVersion();

  setNodeStyle(artlist.background.top_left_corner.node,     
  {position:'absolute', overflow:'hidden', top:'0px', left:'0px', width:'35px', height:'35px',
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_top_left_corner.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_top_left_corner.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.top_margin.node,          
  {position:'absolute', overflow:'hidden', top:'0px', left:'35px', width:(arg.width-70)+'px', height:'35px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_top_margin.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_top_margin.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.top_right_corner.node,    
  {position:'absolute', overflow:'hidden', top:'0px', left:(arg.width-35)+'px', width:'35px', height:'35px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_top_right_corner.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_top_right_corner.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.right_margin.node,        
  {position:'absolute', overflow:'hidden', top:'35px', left:(arg.width-35)+'px', width:'35px', height:(arg.height-70)+'px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_right_margin.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_right_margin.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.bottom_right_corner.node, 
  {position:'absolute', overflow:'hidden', top:(arg.height-35)+'px', left:(arg.width-35)+'px', width:'35px', height:'35px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_bottom_right_corner.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_bottom_right_corner.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.bottom_margin.node,       
  {position:'absolute', overflow:'hidden', top:(arg.height-35)+'px', left:'35px', width:(arg.width-70)+'px', height:'35px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_bottom_margin.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_bottom_margin.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.bottom_left_corner.node,  
  {position:'absolute', overflow:'hidden', top:(arg.height-35)+'px', left:'0px', width:'35px', height:'35px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_bottom_left_corner.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_bottom_left_corner.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.left_margin.node,         
  {position:'absolute', overflow:'hidden', top:'35px', left:'0px', width:'35px', height:(arg.height-70)+'px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_left_margin.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_left_margin.png', sizingMethod='scale')"});
  setNodeStyle(artlist.background.body.node,                
  {position:'absolute', overflow:'hidden', top:'35px', left:'35px', width:(arg.width-70)+'px', height:(arg.height-70)+'px', 
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_body.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_body.png', sizingMethod='scale')"});
   
  setNodeStyle(artlist.content.node,                
  {position:'absolute', overflow:'hidden', top:'-3px', left:'-3px', width:arg.width+'px', height:arg.height+'px'});
  setNodeStyle(artlist.content.header.node,                
  {position:'absolute', overflow:'hidden', top:'10px', left:'10px', width:(arg.width-20)+'px', height:'25px',
   backgroundColor:''});
  setNodeStyle(artlist.content.header.flag_shadow.node,                
  {position:'absolute', overflow:'hidden', top:'4px', left:'5px', width:'22px', height:'17px',
   backgroundColor:'',
   backgroundImage:(_v == 'IE6')? '':'url(/images/img_/artlist_flag_shadow.png)',
   filter:(_v != 'IE6')? '':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/img_/artlist_flag_shadow.png', sizingMethod='scale')"});
  setNodeStyle(artlist.content.header.flag.node,                
  {position:'absolute', overflow:'hidden', top:'7px', left:'8px', width:'16px', height:'11px',
   backgroundColor:'',
   backgroundImage:'url(gif/'+arg.countrycode+'.gif)'});
  setNodeStyle(artlist.content.header.country_title.node,                
  {position:'absolute', overflow:'hidden', top:'5px', left:'31px', width:(arg.width-58)+'px', height:'15px',
   backgroundColor:''});

  artlist.content.header.country_title.node.appendChild(document.createTextNode(arg.country));
  artlist.content.header.node.onmouseover = function () {document.getElementById("artlist").inFocus = 1}
  artlist.content.header.node.onmouseout = function () {document.getElementById("artlist").inFocus = 0}
  
  setNodeStyle(artlist.content.header.country_title.node,                
  {color:'#ffffff', 
   fontFamily:'Tahoma',
   fontSize:'12px',
   fontWeight:'bold', 
   lineHeight:'14px'});
  
  setNodeStyle(artlist.content.list.node,                
  {position:'absolute', overflow:'hidden', top:'35px', left:'10px', width:(arg.width-20)+'px', paddingBottom:'15px'});
  
  artlist.content.list.node.onmouseover = function () {document.getElementById("artlist").inFocus = 1}
  artlist.content.list.node.onmouseout = function () {document.getElementById("artlist").inFocus = 0}
 }


function resetArtList(arg)
 {
  var _artlist = document.getElementById('artlist');
  var artlist = getStructureMap(_artlist);

  artlist.content.list.node.innerHTML = '';
  
  for(var i = 0; i < arg.anounces.length; i++)
   {

    var anounce = document.createElement('div');
    setNodeStyle(anounce,
    {position:'relative', overflow:'visible', top:'0px', left:'10px', width:(arg.width-40)+'px', marginTop: '7px', marginBottom: '1px'});
  
    var anounce_article_title = document.createElement('a');
    anounce_article_title.className = 'article_title';
    anounce_article_title.setAttribute('href', arg.anounces[i].link);
    anounce_article_title.appendChild(document.createTextNode(arg.anounces[i].title));
    setNodeStyle(anounce_article_title,
    {color:'#1c3f93', 
     fontFamily:'Tahoma',
     fontSize:'12px',
     fontWeight:'bold', 
     lineHeight:'15px'});  
  
    var anounce_article_publisher = document.createElement('span');
    anounce_article_publisher.className = 'article_publisher';
    anounce_article_publisher.appendChild(document.createTextNode(''+arg.anounces[i].publisher+''));
    setNodeStyle(anounce_article_publisher,
    {marginTop:'1px',
     marginLeft:'5px',
     color:'#5e5e5e', 
     fontFamily:'Tahoma',
     fontSize:'12px',
     fontWeight:'normal', 
     lineHeight:'15px'});
  
    anounce.appendChild(anounce_article_title);
    anounce.appendChild(anounce_article_publisher);
  
    artlist.content.list.node.appendChild(anounce);
   }
  
  arg.height = artlist.content.list.node.offsetHeight*1+45;
  
  var offsetX = document.getElementById('map_bg').offsetLeft +
                document.getElementById('map_bg').parentNode.offsetLeft +
				document.getElementById('map_bg').parentNode.parentNode.offsetLeft +
				document.getElementById('map_bg').parentNode.parentNode.parentNode.offsetLeft +
				document.getElementById('map_bg').parentNode.parentNode.parentNode.parentNode.offsetLeft + arg.radius;
  var offsetY = document.getElementById('map_bg').offsetTop +
                document.getElementById('map_bg').parentNode.offsetTop +
				document.getElementById('map_bg').parentNode.parentNode.offsetTop +
				document.getElementById('map_bg').parentNode.parentNode.parentNode.offsetTop +
				document.getElementById('map_bg').parentNode.parentNode.parentNode.parentNode.offsetTop + arg.radius;
  
  setNodeStyle(artlist.node, {top:(arg.top*1+offsetY*1)+'px', left:(arg.left*1+offsetX*1)+'px', width:(arg.width-6)+'px', height:(arg.height-6)+'px'});
  artlist.node.inFocus = 0;
  artlist.node.onmouseout = function () {setTimeout('if(!document.getElementById("artlist").inFocus) document.getElementById("artlist").style.visibility = "hidden"', 10)};
  setNodeStyle(artlist.background.node, {width:arg.width+'px', height:arg.height+'px'});
  
  var _v = browserVersion();
  
  setNodeStyle(artlist.background.top_margin.node,          
  {width:(arg.width-70)+'px'});
  setNodeStyle(artlist.background.top_right_corner.node,    
  {left:(arg.width-35)+'px'});
  setNodeStyle(artlist.background.right_margin.node,        
  {left:(arg.width-35)+'px', height:(arg.height-70)+'px'});
  setNodeStyle(artlist.background.bottom_right_corner.node, 
  {top:(arg.height-35)+'px', left:(arg.width-35)+'px'});
  setNodeStyle(artlist.background.bottom_margin.node,       
  {top:(arg.height-35)+'px', width:(arg.width-70)+'px'});
  setNodeStyle(artlist.background.bottom_left_corner.node,  
  {top:(arg.height-35)+'px'});
  setNodeStyle(artlist.background.left_margin.node,         
  {height:(arg.height-70)+'px'});
  setNodeStyle(artlist.background.body.node,                
  {width:(arg.width-70)+'px', height:(arg.height-70)+'px'});
   
  setNodeStyle(artlist.content.node,                
  {width:arg.width+'px', height:arg.height+'px'});
  setNodeStyle(artlist.content.header.node,                
  {width:(arg.width-20)+'px'});
  setNodeStyle(artlist.content.header.flag.node,                
  {backgroundImage:'url(/images/gif/'+arg.countrycode+'.gif)'});
  setNodeStyle(artlist.content.header.country_title.node,                
  {width:(arg.width-58)+'px'});

  artlist.content.header.country_title.node.innerHTML = '';
  artlist.content.header.country_title.node.appendChild(document.createTextNode(arg.country));
  
  
  setNodeStyle(artlist.content.list.node,                
  {width:(arg.width-20)+'px'});
 }

 
function browserVersion()
 {
  var ver = navigator.appName;
  if(navigator.appName == 'Microsoft Internet Explorer')
   {
    var _ap = navigator.userAgent;
    var IEoffset = _ap.indexOf("MSIE ");
    var MSIEVersionNumber = parseFloat(_ap.substring(IEoffset+5, _ap.indexOf(";", IEoffset)));
    ver = 'IE'+MSIEVersionNumber;
   }
  return ver;
 }