ie=document.all?1:0;

function bookmark() {
 url='http://www.potenta.ro';
 title='Marirea penisului';

 if (document.all) window.external.AddFavorite(url,title);
  else alert ('Apasa CTRL+D pentru a adauga acest site la Bookmarks');
}

function selectall (form,val) { 
 for (i=0; i<form.elements.length; i++)
  if ((form.elements[i].type=='checkbox')&&(form.elements[i].name!='selall')) form.elements[i].checked=val;
}

function winopen (nm, fx, fy, mdl) {
 sw=screen.width-8; sh=screen.height-55;
 s='no';
 if (fx>sw) { x=0; s='yes'; fx=sw; } else x=Math.round((sw-fx)/2);
 if (fy>sh) { y=0; s='yes'; fy=sh; } else y=Math.round((sh-fy)/2);
 abc=window.open('/_popup.php?mdl='+mdl+'&nm='+nm,'ViewPic','top='+y+',left='+x+',width='+fx+',height='+fy+',scrollbars='+s);
}

// rating

rateditems=new Array();

function rateset(id,result,startype) {
 for (i=1; i<=5; i++)
  document.getElementById('rate'+id+'_'+i).src='/_skins/pasa/pics/'+startype+'_'+((i<=result)?('f'):('e'))+'.gif';
}

function rateover(x,startype) {
 tmp=x.split('_');
 if (!rateditems[tmp[0]])
  rateset(tmp[0],parseInt(tmp[1]),startype);
}

function rateout(x,startype,value) {
 tmp=x.split('_');
 if (!rateditems[tmp[0]])
  rateset(tmp[0],value,startype);
}

function rateclick(x,startype,islogged,module) {
 tmp=x.split('_');
 if (!rateditems[tmp[0]]) {
  if (!islogged) document.getElementById('ratetext'+tmp[0]).innerHTML='Nu poti vota! Trebuie sa te logezi sau <a href="/cont/adduser">sa-ti faci cont</a>.';
   else
    window.bufferrate.location.href='/_rate.php?module='+module+'&id='+tmp[0]+'&vote='+tmp[1]+'&startype='+startype;
 }
}

function rateupdate(id,result,startype) {
 rateditems[id]=1;
 rateset(id,result,startype);
 document.getElementById('ratetext'+id).innerHTML='Votul tau a fost inregistrat.';
}

// devcode

function insertTag(field,to,tc,ic,l1) {
 if (ic) {
  x=prompt(l1,'');
  if (x)
   insertAtCursor(field,to+x+tc);
 } else insertAtCursor(field,to);
 field.focus();
}

function insertEmoticon(field,x) {
 insertAtCursor(field,x);
 field.focus();
}

function insertAtCursor(field,value) {
 if (document.selection) {
// IE & Opera
  field.focus();
  sel=document.selection.createRange();
  sel.text=value;
 } else
    if (field.selectionStart||field.selectionStart=='0') {
// Mozilla
     var startPos=field.selectionStart;
     var endPos=field.selectionEnd;
     field.value=field.value.substring(0, startPos)+value+field.value.substring(endPos, field.value.length);
    } else
       field.value+=value;
}

// Potenta.ro

function doround(o) { tmp=o.innerHTML; o.innerHTML=''; lastdiv=o; for (i=1; i<=4; i++) { newdiv=document.createElement('div'); newdiv.className='r'+i; if (i==4) newdiv.innerHTML=tmp; lastdiv.appendChild(newdiv); lastdiv=newdiv; } }
function rounded(classname) { classname='rounded'; node=document.getElementsByTagName("body")[0]; var a=[]; var re=new RegExp('\\b'+classname+'\\b'); var els=node.getElementsByTagName("*"); for (var i=0,j=els.length; i<j; i++) if  (re.test(els[i].className)) doround(els[i]); }

window.onload=function () { rounded('rounded'); }
