function drawOptions(arr,selected){
  selected = selected||"";
  //arr['0'] = '';
  for(var i in arr){
     select = (i==selected)?"selected":'';
     document.write('<option value="'+i+'" '+select+'>'+arr[i]+'</option>');
   }
}
function switchPos(obj,selected){
  selected = selected||'';
  var ind = obj.options[obj.selectedIndex].value; 
  var selbox2 = document.getElementById('position');
  delOptions(selbox2);
  for(var i in indexes){
     for(j=0;j<indexes[i].length;j++)
      {
        if(ind==indexes[i][j])
         {
            createOption(selbox2,i,positions[i],selected);
            break;
         } 
      }  
   } 
 if(ind !="")  
  createOption(selbox2,'0',other,selected);
}
function createOption(parent,val,text,selected){
  var opt = document.createElement("option");
  opt.value = val;
  opt.innerHTML = text;
  if(val==selected)
	 opt.selected = true;
  parent.appendChild(opt);
}
function delOptions(obj){
  var count = obj.options.length-1; 
  for(i=count; i>0; i--)
	obj.removeChild(obj.options[i]);
}
function updateOutput()
{   
	news_type     = document.getElementById('news_type').value;
	news_category = document.getElementById('news_category').value;
	news_quantity = document.getElementById('news_quantity').value;	
	news_view     = document.getElementById('news_view').value;	
	news_width    = document.getElementById('news_width').value;
	news_style    = document.getElementById('news_style').value;


out = '<!-- PUBLICITY.GE news code START -->\n';
if(news_style == 'custom')
{
	if(news_type == 'block')
	{
	out += '<style type=\'text/css\'>\n';
	out += 'a.PUB_title\n';
	out += '{\n';
	out += '    color: #DC3345;\n';
	out += '    text-decoration: none;\n';
	out += '    font-weight: bold;\n';
	out += '    font-family:Sylfaen;\n';
	out += '    font-size:11px;\n';
	out += '}\n';
	out += 'a.PUB_text\n';
	out += '{\n';
	out += '    color: #666666;\n';
	out += '    text-decoration: none;\n';
 	out += '    font-weight: normal;\n';
 	out += '    font-family:Sylfaen;\n';
 	out += '    font-size:11px;\n';    
 	out += '}\n';
 	out += 'td.PUB_bullet_td\n';
 	out += '{\n';
 	out += '	width:20px;\n';
 	out += '	background-image:URL(\'http://publicity.ge/images/red.gif\');\n';
 	out += '	background-position:center 7px;\n';
 	out += '	background-repeat:no-repeat;\n';
 	out += '}\n';
 	out += 'img.PUB_bullet_img\n';
 	out += '{\n';
 	out += '	width:  20px;\n';
 	out += '	height: 20px;\n';
 	out += '}\n';
 	out += '</style>';
	}
	else
	{
	out += '<style type=\'text/css\'>\n';
	out += 'a.PUB_title\n';
	out += '{\n';
	out += '    color: #DC3345;\n';
	out += '    text-decoration: none;\n';
	out += '    font-weight: bold;\n';
	out += '    font-family:Sylfaen;\n';
	out += '    font-size:11px;\n';
	out += '}\n';
	out += 'a.PUB_text\n';
	out += '{\n';
	out += '    color: #666666;\n';
	out += '    text-decoration: none;\n';
	out += '    font-weight: normal;\n';
	out += '    font-family:Sylfaen;\n';
	out += '    font-size:11px;\n';    
	out += '}\n';
	out += 'td.PUB_bullet_td\n';
	out += '{\n';
	out += '	width:20px;\n';
	out += '	background-image:URL(\'http://publicity.ge/images/red.gif\');\n';
	out += '	background-position:center 7px;\n';
	out += '	background-repeat:no-repeat;\n';
	out += '}\n';
	out += 'img.PUB_bullet_img\n';
	out += '{\n';
	out += '	width:  20px;\n';
	out += '	height: 20px;\n';
	out += '}\n';
	out += '</style>';		
	}
}

out += '<script type="text/javascript" src="http://publicity.ge/export.php?'+
	 'type=' + news_type
     //+ '&language=' + 
     + '&category=' + news_category
     + '&count='    + news_quantity
     + '&view='     + news_view
     + '&width='    + news_width
     + '&style='    + news_style
     + '"></script>\n';
//out += '<a href="http://publicity.ge/" target="_blank" title="News from PUBLICITY.GE">\n<font face="Arial" size="1">publicity.ge</font>\n</a>\n';
out += '<!-- PUBLICITY.GE news code END -->';

	
	document.getElementById('output').value = out;
}



