function showLogin(e){var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}
else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}
document.getElementById('login').style.top=(posy+10)+"px";document.getElementById('login').style.left=(posx-150)+"px";document.getElementById('login').style.visibility='visible';return false;}
function hideLogin(){document.getElementById('login').style.visibility='hidden';return false;}
var ca;var timer=-1;function cicle(a){ca=a;id=a.id.substring(1);if(a.pippo==undefined){pic1=new Image();pic1.onload=cicleT;pic1.src=loadB+"video-img/"+id+"-b.jpg";a.pippo=1;}else{if(a.pippo>7)a.pippo=0;if(a.pippo>0){var b=-(a.pippo-1)*120;a.style.background="transparent url('"+loadB+"video-img/"+id+"-b.jpg') no-repeat "+b+"px 0px";}else{a.style.background="transparent url('"+loadB+"video-img/"+id+"-a.jpg') no-repeat 0px 0px";}
a.pippo++;window.clearTimeout(timer);timer=window.setTimeout('cicleT()',800);}}
function cicleT(){a=ca;id=a.id;id=a.id.substring(1);if(a.pippo==undefined)a.pippo=1;if(a.pippo>7)a.pippo=0;if(a.pippo>0){var b=-(a.pippo-1)*120;a.style.background="transparent url('"+loadB+"video-img/"+id+"-b.jpg') no-repeat "+b+"px 0px";}else{a.style.background="transparent url('"+loadB+"video-img/"+id+"-a.jpg') no-repeat 0px 0px";}
a.pippo++;window.clearTimeout(timer);timer=window.setTimeout('cicleT()',800);}
var BLOCKSEARCHFLAG=false;function handleKeyPress(e,elem){var key=e.keyCode||e.which;if(key==13){location.href='search.php?what='+elem.value}else{if(elem.value.toString().length<1){document.getElementById('shelp').style.visibility='hidden';return;}
if(BLOCKSEARCHFLAG==true)return;BLOCKSEARCHFLAG=true;window.setTimeout('ds()',300);}}
function handleKeyPress2(e,elem,udtype){var key=e.keyCode||e.which;if(key==13){var none=document.getElementById('gnone').checked;var male=document.getElementById('gmale').checked;var female=document.getElementById('gfemale').checked;var ages=document.getElementById('ageS').value;var agee=document.getElementById('ageE').value;var country=document.getElementById('countryQ').value;location.href='userdet.php?what='+elem.value+"&ud="+udtype+"&male="+male+"&female="+female+"&ages="+ages+"&agee="+agee+"&country="+country;}}
function userSearchHide()
{document.getElementById('gnone').checked=true;document.getElementById('ageS').selectedIndex=0;document.getElementById('ageE').selectedIndex=0;document.getElementById('countryQ').selectedIndex=0;document.getElementById("c").style.display="none";document.getElementById("a").style.display="block";document.getElementById("advsrch").style.display="none";}
function userSearchShow()
{document.getElementById("c").style.display="block";document.getElementById("a").style.display="none";document.getElementById("advsrch").style.display="block";}
function userSearch()
{var none=document.getElementById('gnone').checked;var male=document.getElementById('gmale').checked;var female=document.getElementById('gfemale').checked;var ages=document.getElementById('ageS').value;var agee=document.getElementById('ageE').value;var country=document.getElementById('countryQ').value;location.href='userdet.php?what='+document.getElementById('aux').value+"&male="+male+"&female="+female+"&ages="+ages+"&agee="+agee+"&country="+country;}
function ds(){elem=document.getElementById('s'); if (elem.value.length<3) {BLOCKSEARCHFLAG=false;return;} getURL('searchAjax.php?what='+elem.value,searchCB);}
function getXY(obj)
{var curleft=0;var curtop=0;var border;var padding;if(obj.offsetParent)
{do
{if(getStyle(obj,'position')!='absolute')
{if(border=getStyle(obj,'border-top-width'))curtop+=parseInt(border);if(border=getStyle(obj,'border-left-width'))curleft+=parseInt(border);if(padding=getStyle(obj,'padding-top'))curtop+=parseInt(padding);if(padding=getStyle(obj,'padding-left'))curleft+=parseInt(padding);}
curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}
while(obj=obj.offsetParent)}
else if(obj.x)
{curleft+=obj.x;curtop+=obj.y;}
return{'x':curleft,'y':curtop};}
function getStyle(obj,styleProp)
{if(obj.currentStyle)
return obj.currentStyle[styleProp];else if(window.getComputedStyle)
return window.getComputedStyle(obj,null).getPropertyValue(styleProp);}
function searchCB(x){var t=getXY(document.getElementById('search'));var tmp=document.getElementById('shelp');tmp.style.top=((t.y)+24)+"px";tmp.style.left=((t.x))+"px";BLOCKSEARCHFLAG=false;if(x.content.toString().length<10){document.getElementById('shelp').style.visibility='hidden';return;}
document.getElementById('shelp').innerHTML=x.content;document.getElementById('shelp').style.visibility='visible';}
function setOpacity(obj,opacity){op=opacity;opacity=(opacity==100)?99.999:opacity;obj.style.filter="alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity=opacity/100;obj.style.MozOpacity=opacity/100;obj.style.opacity=opacity/100;obj.ct=op;}
var rsta;function alertMSG(me){var a=0;var b=0;var r=/BackCompat/i;if(r.test(document.compatMode)){a=document.body.clientWidth;b=document.body.clientWidth;}
else{a=document.documentElement.clientWidth;b=document.documentElement.clientHeight;}
var el=document.getElementById('tooltip');document.getElementById('tooltiptxt').innerHTML="You have received a new message!<br><br>"+"Click <a href='userdet.php?show="+me+"&amp;msg=1'>Here</a> to check it, or <a href='#'"+"onClick='hideTip(); return false;'>Here</a> to close this alert";t1=getStyle2(document.getElementById('tooltip'),"height");t2=getStyle2(document.getElementById('tooltip'),"width");el.style.top=(a/2-parseInt(t1)/2)+"px";el.style.left=(b/2-parseInt(t2)/2)+"px";el.style.visibility='visible';clearTimeout(rsta);el.co=0;changeOpac(0,'tooltip');fadeIn('tooltip',20);}
function hideTip(){var el=document.getElementById('tooltip');clearTimeout(rsta);el.co=100;changeOpac(100,'tooltip');fadeOut('tooltip',20);}
function showTip(e,txt){var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
var el=document.getElementById('tooltip');document.getElementById('tooltiptxt').innerHTML=txt;t1=getStyle2(document.getElementById('tooltip'),"height");t2=getStyle2(document.getElementById('tooltip'),"width");el.style.top=(posy-parseInt(t1)-3)+"px";el.style.left=(posx-parseInt(t2)/2)+"px";el.style.visibility='visible';clearTimeout(rsta);el.co=0;changeOpac(0,'tooltip');fadeIn('tooltip',20);}
var last=null;function sendMSG(){hideTip();var t=document.getElementById('msgTXT').value;getURL('priv.php?who='+last+"&descr="+t,sendMSGCB);}
var TMPX;var TMPY;document.onmousemove=getMouseCoordinates;function getMouseCoordinates(event)
{TMPX=0;TMPY=0;try{e=event||window.event;if(e.pageX||e.pageY){TMPX=e.pageX;TMPY=e.pageY;}else if(e.clientX||e.clientY){TMPX=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;TMPY=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}}catch(e){}}
function vote(what,rank,id,hideList){var el=document.getElementById('tooltip');el.style.visibility='hidden';getURL('vote.php?what='+what+"&rank="+rank+"&id="+id+"&hide="+hideList,voteCB);return false;}
function getStyle2(obj,name){if(window.getComputedStyle)return window.getComputedStyle(obj,null).getPropertyValue(name);else return IE_computedStyle.get(obj,name);}
var rstb=-1;function voteCB(x){var array=x.content.split("#");var id=array[0].split(",");var score=array[1]*17;var finish=array[2];var msg=array[3];var t1=0;var t2=0;if(finish==1){for(i=0;i<id.length;i++){try{var el=document.getElementById("voteBox"+id[i]);el.innerHTML="<li class='my-rating' style='width:"+score+"px;'></li>";}catch(e){}}}
var el=document.getElementById('tooltip');document.getElementById('tooltiptxt').innerHTML=msg;t1=getStyle2(el,"height");t2=getStyle2(el,"width");el.style.top=(TMPY-parseInt(t1)-3)+"px";el.style.left=(TMPX-parseInt(t2)/2)+"px";el.style.visibility='visible';clearTimeout(rsta);clearTimeout(rstb);el.co=0;changeOpac(0,'tooltip');fadeIn('tooltip',20);rstb=window.setTimeout('hideTip()',5000);}
var IE_computedStyle=function(){var isIE=0;var borderRegex=/thin|medium|thick/i;var styleEl;var getPos=function(which){var curStyle=styleEl.currentStyle[which];return(/auto/i.test(curStyle))?"auto":grabLength(curStyle)+"px";};var getMargin=function(which){var curStyle=styleEl.currentStyle["margin"+which];return(/auto/i.test(curStyle))?"0px":grabLength(curStyle)+"px";};var getBorderWidth=function(which){var borderWidth=styleEl.currentStyle["border"+which+"Width"];if(styleEl.currentStyle["border"+which+"Style"]!=="none"&&((/Top|Bottom/i.test(which)&&styleEl.offsetHeight>styleEl.clientHeight)||(/Right|Left/i.test(which)&&styleEl.offsetWidth>styleEl.clientWidth))){if(!borderRegex.test(borderWidth)){return grabLength(borderWidth)+"px";}else if(borderRegex.test(borderWidth)){var temp=document.createElement("DIV");temp.style.width="10px";temp.style.border=borderWidth+" "+styleEl.currentStyle["border"+which+"Style"]+" #000000";styleEl.parentNode.appendChild(temp);borderWidth=Math.round((temp.offsetWidth-10)/2);styleEl.parentNode.removeChild(temp);return borderWidth+"px";}}else{return"0px";}};var getPadding=function(which){return grabLength(styleEl.currentStyle["padding"+which])+"px";};var getWidth=function(){var width=styleEl.offsetWidth;width-=parseInt(getPadding("Right"));width-=parseInt(getPadding("Left"));width-=parseInt(getBorderWidth("Right"));width-=parseInt(getBorderWidth("Left"));return width+"px";};var getHeight=function(){var height=styleEl.offsetHeight;height-=parseInt(getPadding("Top"));height-=parseInt(getPadding("Bottom"));height-=parseInt(getBorderWidth("Top"));height-=parseInt(getBorderWidth("Bottom"));return height+"px";};var grabLength=function(length){var temp=document.createElement("DIV");temp.style.width=length;styleEl.parentNode.appendChild(temp);length=Math.round(temp.offsetWidth);styleEl.parentNode.removeChild(temp);return length;};return{get:function(el,styleProp){var rValue;styleEl=(typeof(el)==="string")?document.getElementById(el):el;var styleProp=(typeof(styleProp)==="string")?styleProp.toLowerCase():"";styleProp=styleProp.replace(/\-/g,"");if(!isIE||!/block/i.test(styleEl.currentStyle["display"]))
return;switch(styleProp){case"top":rValue=getPos("top");break;case"right":rValue=getPos("right");break;case"bottom":rValue=getPos("bottom");break;case"left":rValue=getPos("left");break;case"margintop":rValue=getMargin("Top");break;case"marginright":rValue=getMargin("Right");break;case"marginbottom":rValue=getMargin("Bottom");break;case"marginleft":rValue=getMargin("Left");break;case"bordertopwidth":rValue=getBorderWidth("Top");break;case"borderrightwidth":rValue=getBorderWidth("Right");break;case"borderbottomwidth":rValue=getBorderWidth("Bottom");break;case"borderleftwidth":rValue=getBorderWidth("Left");break;case"paddingtop":rValue=getPadding("Top");break;case"paddingright":rValue=getPadding("Right");break;case"paddingbottom":rValue=getPadding("Bottom");break;case"paddingleft":rValue=getPadding("Left");break;case"width":rValue=getWidth();break;case"height":rValue=getHeight();break;}
return rValue;}};}();function sendMSG2(){hideTip();var t=document.getElementById('msgTXT2').value;getURL('priv.php?who='+last+"&friend=1&descr="+t,sendMSGCB);}
function sendMSGCB(x){alert(x.content);}
function getFocusRemoveKey(el,key){if(el.value==key)el.value='';}
var chatPOP=null;function openCHAT()
{if(chatPOP==null||chatPOP.closed){chatPOP=window.open('chat.php',"PornHub4UCHAT","width=755,height=495,scrollbars=no,menubar=no");chatPOP.focus();}
else{chatPOP.focus();}}
function showMSG(e,txt){var posx=0;var posy=0;last=txt;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
var el=document.getElementById('tooltip');document.getElementById('tooltiptxt').innerHTML="<center>Send Private Msg To <b>"+txt+"</b><br/>"+"<textarea class='popuptxt'  id='msgTXT' onfocus='getFocusRemoveKey(this,\"Write Message Here\")'>Write Message Here</textarea><br>"+"<input class='button'  type='submit' value='Ok' onClick='sendMSG();'></center>";t1=getStyle2(document.getElementById('tooltip'),"height");t2=getStyle2(document.getElementById('tooltip'),"width");el.style.top=(posy-parseInt(t1)-3)+"px";el.style.left=(posx-parseInt(t2)/2)+"px";el.style.visibility='visible';clearTimeout(rsta);el.co=0;changeOpac(0,'tooltip');fadeIn('tooltip',20);}
function showMSG2(e,txt){var posx=0;var posy=0;last=txt;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
var el=document.getElementById('tooltip');document.getElementById('tooltiptxt').innerHTML="<center>Add <b>"+txt+"</b> to your friends!<br/>"+"<textarea class='popuptxt' id='msgTXT2' onfocus='getFocusRemoveKey(this,\"Write Message Here\")'>Write Message Here</textarea><br>"+"<input class='button'  type='submit' value='Ok' onClick='sendMSG2();'></center>";t1=getStyle2(document.getElementById('tooltip'),"height");t2=getStyle2(document.getElementById('tooltip'),"width");el.style.top=(posy-parseInt(t1)-3)+"px";el.style.left=(posx-parseInt(t2)/2)+"px";el.style.visibility='visible';clearTimeout(rsta);el.co=0;changeOpac(0,'tooltip');fadeIn('tooltip',20);}
function fadeOut(id,spd){var el=document.getElementById(id);el.co=Math.max(0,el.co-5);changeOpac(el.co,id);if(el.co<=0){el.style.visibility="hidden";return;}
el.style.top=(parseInt(el.style.top)-1)+"px";rsta=setTimeout("fadeOut('"+id+"',"+spd+")",spd);}
function fadeIn(id,spd){var el=document.getElementById(id);el.style.visibility="visible";el.co=Math.min(100,el.co+5);changeOpac(el.co,id);if(el.co>=100)return;if(el.co%5==0)
el.style.top=(parseInt(el.style.top)-1)+"px";rsta=setTimeout("fadeIn('"+id+"',"+spd+")",spd);}
function changeOpac(opacity,id){var object=document.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";}
function styleME(el,styleName){el.className=styleName;}
function shareVID(id){a=window.open('shareVID.php?id='+id,'embedVID','width=400, height=230, scrollbars=yes, resizable=yes');a.focus();return false;}
function embedVID(id){a=window.open('embedVID.php?id='+id,'embedVID','width=400, height=220, scrollbars=yes, resizable=yes')
a.focus();return false;}
function blogEdit(id){a=window.open('postblog.php?edit='+id,'postblog','width=765px, height=680px, scrollbars=yes, resizable=yes')
a.focus();return false;}
function photoPost(id){a=window.open('postpic.php?album='+id,'postpics','width=330px, height=200px, scrollbars=yes, resizable=yes')
a.focus();return false;}
if(typeof getURL=='undefined'){getURL=function(url,callback){if(!url)
throw'No URL for getURL';try{if(typeof callback.operationComplete=='function')
callback=callback.operationComplete;}catch(e){}
if(typeof callback!='function')
throw'No callback function for getURL';var http_request=null;if(typeof XMLHttpRequest!='undefined'){http_request=new XMLHttpRequest();}
else if(typeof ActiveXObject!='undefined'){try{http_request=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{http_request=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}}}
if(!http_request)
throw'Both getURL and XMLHttpRequest are undefined';http_request.onreadystatechange=function(){if(http_request.readyState==4){callback({success:true,content:http_request.responseText,contentType:http_request.getResponseHeader("Content-Type")});}}
http_request.open('GET',url,true);http_request.send(null);}}
function tst(t,b){document.getElementById(b).src=t;}
function turnOn(qty){if(qty>0){document.getElementById('comment').innerHTML='Awful';}
if(qty>1){document.getElementById('comment').innerHTML='Bad';}
if(qty>2){document.getElementById('comment').innerHTML='Average';}
if(qty>3){document.getElementById('comment').innerHTML='Good';}
if(qty>4){document.getElementById('comment').innerHTML='Excellent';}}





function setFavs(what,rem){var el=document.getElementById('tooltip');el.style.visibility='hidden';getURL('setFavs.php?what='+what+'&rem='+rem,favsCB);return false;}


function favsCB(x) {
	var array = x.content.split("#");
        
        if (array[0] == 1)
        {
            var ml = document.getElementById('favs');
            ml.innerHTML = "<td>Rem Favs:</td><td colspan=2><a href='#' onClick=\"return setFavs("+array[2]+",1);\" ><img src='"+loadB+"img/heart2.png'></a>";
        }
        if (array[0] == 2)
        {
            var ml = document.getElementById('favs');
            ml.innerHTML = "<td>Add Favs:</td><td colspan=2><a href='#' onClick=\"return setFavs("+array[2]+",0);\" ><img src='"+loadB+"img/heart.png'></a>";
        }
        var el = document.getElementById('tooltip');
        document.getElementById('tooltiptxt').innerHTML = array[1];
        	t1  = getStyle2(el,"height");
	t2  = getStyle2(el,"width");
        	el.style.top = (TMPY-parseInt(t1)-3)+"px";
	el.style.left = (TMPX-parseInt(t2)/2)+"px";
        
	el.style.visibility = 'visible';
	
	clearTimeout(rsta);
	clearTimeout(rstb);
	
	el.co = 0;
	changeOpac(0,'tooltip');
	fadeIn('tooltip',20);
	rstb = window.setTimeout('hideTip()', 3000);
}
