var d=document,pltext;
function getId(id){return d.getElementById(id);};
function CE(el){return d.createElement(el)}
function SA(el,atrib,val){return el.setAttribute(atrib,val)}
function kostra(id1){
getId(id1).style.display='none';
var cy=CE('div');
cy.id='cy';
var pl=CE('p');
var ul=CE('ul');
var opt=getId(id1).getElementsByTagName('option');
for(var i=0;i<opt.length;i++){
var li=CE('li');
ul.appendChild(li);
var ah=CE('a');
SA(ah,'href','#')
SA(ah,'rel',opt[i].value)
li.appendChild(ah);
ah.appendChild(d.createTextNode(opt[i].childNodes[0].nodeValue));
}
var inp=CE('input');
SA(inp,'type','hidden');
inp.value='';
inp.id='prime_quick_style';
getId(id1).parentNode.insertBefore(cy,getId(id1).nextSibling);
cy.appendChild(pl);
cy.appendChild(ul);
cy.parentNode.insertBefore(inp,cy);
var lbl=d.getElementsByTagName('label');
for(var i=0;i<lbl.length;i++){
if(lbl[i].htmlFor==id1){
lbl[i].style.display='none';
pl.appendChild(d.createTextNode(lbl[i].childNodes[0].nodeValue));
}}}
function gv(){
kostra('prime_quick_style');
var kde=getId('cy');
var fC=kde.firstChild;
if(kde.firstChild.nodeType==3){fC=kde.firstChild.nextSibling}//gecko
fC.onclick=function(){this.parentNode.className=this.parentNode.className=='hd'?'':'hd';}
fC.onmouseover=function(){this.className='hv';}
fC.onmouseout=function(){this.className='';}
kde.className='hd';
var co=kde.getElementsByTagName('a')
for(var i=0;i<co.length;i++){
co[i].onclick=function(){getId('prime_quick_style').value=this.getAttribute('rel');
this.parentNode.parentNode.parentNode.className='hd'
var ntext=d.createTextNode(this.childNodes[0].nodeValue);
fC.removeChild(fC.childNodes[0]);
fC.appendChild(ntext);
document.quickstyleform.submit();
return false;
}}}
if(document.childNodes){window.onload=gv}