function bookmark() {
 url='http://www.sexpert.ro';
 title='Totul despre sex';

 if (document.all) window.external.AddFavorite(url,title);
  else alert ('Apasa CTRL+D pentru a adauga acest site la Bookmarks');
}

function selectall (form) {
 val=form.elements['selall'].checked;
 for (i=0; i<form.elements.length; i++)
  if ((form.elements[i].type=='checkbox')&&(form.elements[i].type!='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);
}

// 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;
}

// croc

function glow(a) {
 if ((document.getElementById('t'+a+'1').className=="bkhid")||(document.getElementById('t'+a+'1').className=="bkhid2"))
  for (i=1;i<=3;i++)
    if (a==6) document.getElementById('t'+a+i).className="bkovr2";
     else
   document.getElementById('t'+a+i).className="bkovr";
  else
   for (i=1;i<=3;i++)
    if (a==6) document.getElementById('t'+a+i).className="bkhid2";
     else
   document.getElementById('t'+a+i).className="bkhid";
}

function popit(e) {
 xpos=document.body.scrollLeft+e.clientX;
 ypos=document.body.scrollTop+e.clientY;
 obj=document.getElementById('sf');

 obj.style.display='block';
 obj.style.top=ypos;
 obj.style.left=xpos-42;
}

function popclose() {
 document.getElementById('sf').style.display='none';
}

// rating

rateditems=new Array();

function rateset(id,result,startype) {
 for (i=1; i<=5; i++) {
  obj=document.getElementById('rate'+id+'_'+i);
  obj.src='/_skins/croc/pics/v'+i+'.gif';
  if (i==result) obj.className='starvis';
   else obj.className='starnvis';
 }
}

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='<br style="font-size:3px">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='<br style="font-size:3px">Votul tau a fost inregistrat.';
}
