 function validate_login() {
                  validity = true;
                  if (!check_empty(document.login.username.value))
                       {
                  validity = false;
                  alert('Insert your username !');
                  return validity;
                  }
                if (!check_empty(document.login.password.value)) {
                  validity = false;
                        alert('Insert your password !');
                  return validity;
                  }
              }
 function validate_login_links() {
                  validity = true;
                  if (!check_empty(document.loginl.email.value))
                       {
                  validity = false;
                  alert('Insert your email !');
                  return validity;
                  }
                if (!check_empty(document.loginl.password.value)) {
                  validity = false;
                        alert('Insert your password !');
                  return validity;
                  }
              }
 function validate_message() {
                  validity = true;
                if (!check_empty(document.messages.message.value)) {
                  validity = false;
                        alert('Insert a message !');
                  return validity;
                  }
              }

function validate_help() {
                                             validity = true;
                                             if (!check_empty(document.help.name.value))
                                           { validity = false;
                          alert('Insert your name or username !');
                          return validity;
                         }
                                           if (!check_email(document.help.email.value))
                                           { validity = false;
                          alert('Insert valid email !');
                          return validity;
                          }
                                           if (!check_empty(document.help.title.value))
                                               { validity = false;
                          alert('Insert title for your message !');
                          return validity;
                          }
         }

function validate_register() {
                                             validity = true;
                        if (!check_empty(document.register.first_name.value))
                                           { validity = false;
                                          alert('Insert your first name !');
                                          return validity;
                                      }
                         if (!check_empty(document.register.last_name.value))
                                           { validity = false;
                                          alert('Insert your last name !');
                                          return validity;
                                      }
                                         if (!check_empty(document.register.username.value))
                                           { validity = false;
                                          alert('Choose your username !');
                                          return validity;
                                      }
                        if (!check_space(document.register.username.value))
                                           { validity = false;
                                          alert('Username cannot have space !');
                                          return validity;
                                      }
                        if (!check_lenght(document.register.username.value))
                                           { validity = false;
                                          alert('Username can have maximum 14 letters !');
                                          return validity;
                                      }
                        if (!check_empty(document.register.password.value))
                                               { validity = false;
                                          alert('Choose your password !');
                                          return validity;
                                            }
                       if (document.register.password.value!=document.register.repass.value)
                                    { validity = false;
                                                alert('Repeat correct your password !'); return validity;}
                        if (!check_email(document.register.email.value))
                                               { validity = false;
                                                alert('Insert valid email !'); return validity;}
                       if (document.register.terms.checked==false)
                                               { validity = false;
                                                alert('You must agree our term of services !'); return validity;}

}
function validate_myprofile() {
                                             validity = true;
                        if (!check_value(document.myprofile.age.value))
                                           { validity = false;
                                          alert('Your age must be minimum 18 !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.sign.value))
                                           { validity = false;
                                          alert('Select your sign !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.city.value))
                                           { validity = false;
                                          alert('Insert your city !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.country.value))
                                           { validity = false;
                                          alert('Select your country !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.marital_status.value))
                                           { validity = false;
                                          alert('Select your marital status !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.height.value))
                                           { validity = false;
                                          alert('Select your height !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.weight.value))
                                           { validity = false;
                                          alert('Select your weight !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.hair_color.value))
                                           { validity = false;
                                          alert('Select your hair color !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.hair_length.value))
                                           { validity = false;
                                          alert('Select your hair length !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.eye_color.value))
                                           { validity = false;
                                          alert('Select your eye color !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.build.value))
                                           { validity = false;
                                          alert('Select your build !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.build.value))
                                           { validity = false;
                                          alert('Select your build !');
                                          return validity;
                                      }
                        if (!check_empty(document.myprofile.ethnicity.value))
                                           { validity = false;
                                          alert('Select your ethnicity !');
                                          return validity;
                                      }
                        if (!check_min_lenght(document.myprofile.description.value))
                                           { validity = false;
                                          alert('Your description must have minimum 30 letters !');
                                          return validity;
                                      }
                        if (!check_words(document.myprofile.description.value))
                                           { validity = false;
                                          alert('Use real words in your description !');
                                          return validity;
                                      }
                        if (!check_html(document.myprofile.description.value))
                                           { validity = false;
                                          alert('Don\'t use any web site address !');
                                          return validity;
                                      }
                        if (!check_rude(document.myprofile.description.value))
                                           { validity = false;
                                          alert('Don\'t use rude words in your description !');
                                          return validity;
                                      }
}
function validate_submit_link() {
                  validity = true;
        if (!check_email(document.submitl.email.value))
                                               { validity = false;
                                                alert('Insert valid email !'); return validity;}
        if (!check_empty(document.submitl.password.value))
                                               { validity = false;
                                          alert('Choose your password !');
                                          return validity;
                                            }
        if (document.submitl.password.value!=document.submitl.repass.value)
                                    { validity = false;
                                                alert('Repeat correct your password !'); return validity;}
        if (!check_empty(document.submitl.title.value))
                                           { validity = false;
                                          alert('Insert title of your site !'); return validity;}
        if (!check_empty(document.submitl.type.value))
                                           { validity = false;
                                          alert('Choose category for your site !'); return validity;}
        if (!check_empty(document.submitl.link.value))
                                           { validity = false;
                                          alert('Insert URL of your site !'); return validity;}
        if (!check_empty(document.submitl.my_link.value))
                                           { validity = false;
                                          alert('Insert URL with our link !'); return validity;}
}
function validate_invite() {
                                             validity = true;
                        if (!check_empty(document.invite.name.value))
                                           { validity = false;
                          alert('Insert your knowed name !');
                          return validity;
                          }
                                           if (!check_email(document.invite.email.value))
                                           { validity = false;
                          alert('Insert valid email !');
                          return validity;
                          }
                        if (document.invite.terms.checked==false)
                                               { validity = false;
                                                  alert('You must agree our conditions !');
                          return validity;
                          }
}
function check_user(url) {
     if (!check_empty(document.register.username.value))   {
                          alert('Choose your username !');
     }
     else {
          if (!check_space(document.register.username.value)) {
                          alert('Username cannot have space !');
          }
          else {
            if (!check_lenght(document.register.username.value)) {
                          alert('Username can have maximum 14 letters !');
            }
            else {
            Hide('show_text');
            show_user.location=url;
            }
          }
     }
}
function check_email(address) {
        if ((address == "") || (address.indexOf ('@') == -1) || (address.indexOf ('.') == -1)) {
        return false; }
        else {
        return true;
        }
}

function check_words(text) {
        if ((text.substring(0,12).indexOf(' ') == -1) || (text.split(' ').length < 5) || (text.split(' ')[0]==text.split(' ')[1]) || (text.split(' ')[1]==text.split(' ')[2]) || text.split(' ')[text.split(' ').length-1].length > 20) {
        return false; }
        else {
        return true;
        }
}

function check_html(text) {
        if ((text.indexOf('www') >= 0) || (text.indexOf('http//') >= 0)) {
        return false; }
        else {
        return true;
        }
}

function check_rude(text) {
        if ((text.indexOf(' fut ') >= 0) || (text.indexOf('futui') >= 0) || (text.indexOf('futut') >= 0) || (text.indexOf('fute') >= 0) || (text.indexOf('pula') >= 0) || (text.indexOf('pizda') >= 0) || (text.indexOf(' dick ') >= 0) || (text.indexOf(' cock ') >= 0) || (text.indexOf(' fuck ') >= 0)) {
        return false; }
        else {
        return true;
        }
}

function check_lenght(text) {
         return (text.length <= 14);
}

function check_space(text) {
       if (text.indexOf(' ') >= 0) {
       return false;
       }
       else {
       return true;
       }
}

function check_min_lenght(text) {
         return (text.length >= 30);
}

function check_empty(text) {
          return (text.length > 0);
}

function check_value(text) {
          return (text >= 18);
}


function open_terms(url)
{
window.open(url,"profile","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=450,left=150,top=60");
}

function Show(obj)
{
                document.all(obj).style.display =''
}

function Hide(obj)
{
                document.all(obj).style.display="none"
}

function open_videochat(url, alt)
{
 posLeft=(screen.availWidth-720)/2;
 posTop=(screen.availHeight-280)/2;
 window.open("security_saschart_"+url,"videochat","resizable=no,scrollbars=no,width=720,height=280,left="+posLeft+",top="+posTop);
}

function open_chat(url, alt, page)
{
 posLeft=(screen.availWidth-396)/2;
 posTop=(screen.availHeight-280)/2;
 window.open("security_saschart_"+url,page,"resizable=no,scrollbars=no,width=396,height=280,left="+posLeft+",top="+posTop);
}

function open_image(imageName, alt)
{
 posLeft=(screen.availWidth-200)/2;
 posTop=(screen.availHeight-100)/2;
 msg= '<script>';
 msg+='leftPressed=0;';
 msg+='function ClickCheck(){if(event.button!=1)self.close();';
 msg+='if(event.button==1){leftPressed=1;oldMouseX=event.clientX;oldMouseY=event.clientY;}}';
 msg+='document.onmousedown=ClickCheck;';
 msg+='function Release(){leftPressed=0;}';
 msg+='document.onmouseup=Release;';
 msg+='function mouseMoved(){if(leftPressed){mouseX=event.clientX;mouseY=event.clientY;';
 msg+='window.scrollBy(oldMouseX-mouseX,oldMouseY-mouseY);oldMouseX=mouseX;oldMouseY=mouseY;}}';
 msg+='</script>';
 msg+='<html><head><title>'+alt+'</title><META HTTP-EQUIV="imagetoolbar" CONTENT="no">';
 msg+='<script>';
 msg+='function CenterImage(){';
 msg+='w=document.images[0].width+10;h=document.images[0].height+29;';
 msg+='scrWidth=screen.availWidth;scrHeight=screen.availHeight;';
 msg+='posLeft=(scrWidth-w)/2;posTop=(scrHeight-h)/2;';
 msg+='if(posLeft<0){posLeft=0;w=scrWidth;}';
 msg+='if(posTop<0){posTop=0;h=scrHeight;}';
 msg+='window.moveTo(posLeft,posTop);window.resizeTo(w,h);';
 msg+='loading.style.visibility="hidden"}';
 msg+='</script>';
 msg+='</head><body onload="CenterImage()">';
 msg+='<div style="position:absolute; left:0px; top:0px"><img src="'+imageName+'" alt="Feel for us" ondrag="mouseMoved()" style="cursor:pointer; cursor:hand"></div>';
 msg+='<div id="loading" style="position:absolute; left:0px; top:0px"><table bgcolor="black" width=200 height=100><td align=center style="font:11px verdana;color:white">Loading...</td></table></div>';
 msg+='</body></html>';
 BigImage=window.open("","image","resizable=no,scrollbars=no,width=200,height=100,left="+posLeft+",top="+posTop);
 BigImage.document.write(msg);
 BigImage.document.close();
}

function preload_image() {
    var d=document; if(d.images){ if(!d.pre) d.pre=new Array();
    var i,j=d.pre.length,a=preload_image.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.pre[j]=new Image; d.pre[j++].src=a[i];}}
}

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function show_mini(which, e, Xposition, Yposition, imgwidth, imgheight, scroll) {
if (ie||ns6){
crossobj=document.getElementById("showmini")

if (Xposition=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX-Xposition
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY-Yposition
}


crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar" onMousedown="initializedrag(event)" onMouseup="stopdrag()"><span id="closetext" onMouseOver="this.style.color=\'#B5005B\'" onMouseOut="this.style.color=\'#000000\'" onClick="closepreview()">Close</span> </div><iframe name="mini_frame" src="'+which+'" width="'+imgwidth+'" height="'+imgheight+'" frameborder="0" scrolling="'+scroll+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}


function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
function stopdrag() {
dragapproved=false
}

//function nr(e){return(e.which==3)?false:true}function cu(){return false}function cv(){vp=event.button;if(vp==2||vp==3)alert(unescape("This function is not available."))}io=document.all;ae=document.getElementById;if(io){if(ae){document.oncontextmenu=cu}else{document.onmousedown=cv}}if(ae&&!io){document.onmouseup=nr;document.oncontextmenu=cu}if(document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=nr}