function ShowPhoto(p){
	fduke('Загрузка фотографии');
	foto=new Image();
	foto.src=p;
	if(foto.complete)ShowImageReact();
	else foto.onload=ShowImageReact;
}
function ShowImageReact(){
	if(foto.width==0){
		fotoId=setTimeout("ShowImageReact()",300);
		return true;
	}
	if(window.fotoId)clearTimeout(fotoId);
	fdukehide();
	
	if(by('photodiv')!=undefined){
		remove(by('photodiv'));
	}
	var n=document.createElement('div');
	n.id='photodiv';
	n.style.zindex=500;
	n.style.width=(foto.width+2)+'px';
	n.innerHTML="<img src="+foto.src+" ><div class=\"under_photo\">Закрыть</div>";
	document.body.appendChild(n);
	diver.center(n);
	n.onclick=function(){remove(this);}
}
function fduke(m,t){
	if(by('fdukediv')!=undefined){
		remove(by('fdukediv'));
	}
	var n=document.createElement('div');
	n.id='fdukediv';
	n.className='fdukePopup';
	n.innerHTML="<table width=100% height=100% onclick=fdukehide()><tr><td valign=center>"+m+"</td></tr></table>";
	document.body.appendChild(n);
	diver.center(n);
	diver.show(n);
	if(t)fdukeID=window.setTimeout('fdukehide()',t);
}
function fdukehide(){
	if(window.fdukeId)clearTimeout(fdukeId);
	if(window.diverID)clearTimeout(diverID);
	remove(by('fdukediv'));
}
function by(o){return document.getElementById(o)};
function remove(obj){
	if(document.removeNode)
		obj.removeNode(true);
	else
		obj.parentNode.removeChild(obj);
}
function Hover(b,c){
	if(!by('ccc'+b+"_1"))return;
	for(var i=1;i<6;i++){
		if(i<=c){
			by('ccc'+b+"_"+i).className='cc2'
		}else{
			by('ccc'+b+"_"+i).className='cc1'
		}
	}
}
function Select(b,c){
	by('data'+b).value=c;
	by('form'+b).submit();
}
function Look(id,stat,rating){
	if(stat==0){
		by('cc'+id).innerHTML="<div style=font-size:12px>Сегодня Вы уже поставили оценку этой девушке...</div>";
	}else{
		by('cc'+id).innerHTML="<div style=margin:0;padding:0>Ваша оценка учтена</div>";
		by('rating'+id).innerHTML=parseInt(by('rating'+id).innerHTML)+rating;
	}
}
function Register(){
	by('act').value='reg';
	by('authform').submit();
}

function Authorize(){
	by('act').value='auth';
	by('authform').submit();
}

function UnixToDate(ut){
	var t=new Date(parseInt(ut)*1000);
	return t.getDate()+' '+IntToMonth(t.getMonth()+1,true)+' '+t.getFullYear();
}

function byf(frame,object){
	return by(frame).contentDocument?
		by(frame).contentDocument.getElementById(object)
		:
		by(frame).contentWindow.document.all(object)

}

var diver={
	remove:function(so,sc,p){p=p?parseInt(p):95;var o=by(so);if(p>6){o.style.opacity='.'+p;o.style.filter="alpha(opacity:"+p+")";opacityID=window.setTimeout("diver.remove('"+so+"','"+sc+"',"+(p-6)+")",7);}else{remove(so,sc);}}
	,show:function(o){o.style.visibility='visible';diver.fadein(o,10)}
	,hide:function(o){o.style.opacity='.95';diver.fadeout(o,95)}
	,fadein:function(o,opac){
		opac=parseInt(opac);
		if(opac<96){
			o.style.opacity='.'+opac;
			o.style.filter="alpha(opacity:"+opac+")";
			window.diverID=window.setTimeout("diver.fadein(by('"+o.id+"'),"+(opac+4)+")",12);
		}
	}
	,fadeout:function(o,i){
		i=parseInt(i);
		if(i>6){
			o.style.opacity='.'+i;
			o.style.filter="alpha(opacity:"+i+")";
			opacityID=window.setTimeout("diver.fadeout(by('"+o.id+"'),"+(i-6)+")",7);
		}else{
			o.style.visibility='hidden';
		}
	}
	,center:function(o){
		var windowSize=diver.getWinSize(), scrollSize=diver.getScrSize();
		o.style.left=Math.round((windowSize.w-o.offsetWidth)/2+scrollSize.l)+"px";
		o.style.top=Math.round((windowSize.h-o.offsetHeight)/2+scrollSize.t)+"px";
	},
	sharename:null,
	destructor:null,
	setShare:function(content,name,destructor){
		if(diver.destructor)diver.destructor();
		if(destructor)diver.destructor=destructor;
		by('sharediv').innerHTML=content;diver.sharename=name;
	},
	getWinSize:function(){
		var winW,winH;
		if(window.innerWidth){
			winW=window.innerWidth;
			winH=window.innerHeight;
		}else if(document.documentElement && document.documentElement.clientWidth){
			winW=document.documentElement.clientWidth;
			winH=document.documentElement.clientHeight;
		}else if(document.body){
			winW=document.body.clientWidth;
			winH=document.body.clientHeight;
		}return {w:winW,h:winH }
	},
	getScrSize:function(){
		var scrT,scrL;
		if(window.scrollY){
			scrT=window.scrollY?window.scrollY:window.pageYOffset;
			scrL=window.scrollX?window.scrollX:window.pageXOffset;
		}else if(document.documentElement && document.documentElement.scrollTop){
			scrT=document.documentElement.scrollTop;
			scrL=document.documentElement.scrollLeft;
		}else if(document.body){
			scrT=document.body.scrollTop;
			scrL=document.body.scrollLeft;
		}return {t:scrT,l:scrL}
	},
	posite:function(o,l,t){
		var s=diver.getWinSize();
		o.style.left=(o.offsetWidth+l)>s.w?(s.w-o.offsetWidth-10)+'px':l+'px';
		o.style.top=(o.offsetHeight+t)>s.h?(s.h-o.offsetHeight-5)+'px':t+'px';
	}
}
