function showShadow() {
//	var h = $(document).height();
//	$('#shadow').css('height', h);
	$('#shadow').show();
}
function hideShadow() {
	$('.popunder').hide();
	$('#shadow').hide();
}

function authForm(afs) {
	centerDiv('auth_popup');
	if(afs==1) { afsd='block';showShadow(); } else { afsd='none';hideShadow(); }
	document.getElementById('auth_popup').style.display=afsd;
	return false;
}

function centerDiv(id) {
	var h = $(window).height();
	var w = $(window).width();
	h = (h/2) - ($('#'+id).height()/2);
	w = (w/2) - ($('#'+id).width()/2);
	$('#'+id).css('top', h);
	$('#'+id).css('left', w);
}

function showCgv(){
	centerDiv('cgv');
	showShadow();
	$('#cgv').toggle();
}

function showMyPop(id) {
	hideShadow();
	centerDiv(id);
	showShadow();
	$('#'+id).toggle();
}




function openPhoto(op_src) {
	document.getElementById('wtm_img').getElementsByTagName('img')[0].src=op_src;
}
function openPhoto2(op_src) {
	document.getElementById('p_big_photo').getElementsByTagName('img')[0].src=op_src;
}


function showPresent() {
	prsnt=document.getElementById('presents').getElementsByTagName('div');
	for(i=0;i<prsnt.length;i++) {
		if(prsnt[i].className=='prsnt') {
			prsnt[i].onmouseover=function() {
				this.className='prsnt_over';
			}
			prsnt[i].onmouseout=function() {
				this.className='prsnt';
			}
		}
	}
}

/***** ADDED *****/
function initMenu() {
	var mli=document.getElementById('top_menu').getElementsByTagName('li');
	for(i=0;i<mli.length;i++) {
		mli[i].onmouseover=function() { this.className='m_act'; };
		mli[i].onmouseout=function() { this.className=''; };
	}
}


var stars;
function vsInit() {
	stars=document.getElementById('vote_stars').getElementsByTagName('img');
	stars[0].onmouseover=function() { setStar(0,'vs_over') };
	stars[0].onmouseout=function() { setStar(4,'') };
	stars[1].onmouseover=function() { setStar(1,'vs_over') };
	stars[1].onmouseout=function() { setStar(4,'') };
	stars[2].onmouseover=function() { setStar(2,'vs_over') };
	stars[2].onmouseout=function() { setStar(4,'') };
	stars[3].onmouseover=function() { setStar(3,'vs_over') };
	stars[3].onmouseout=function() { setStar(4,'') };
	stars[4].onmouseover=function() { setStar(4,'vs_over') };
	stars[4].onmouseout=function() { setStar(4,'') };
}
function setStar(strs,sClass) {
	for(i=0;i<=strs;i++) stars[i].className=sClass;
}


function openPhotoPopup(pSrc) {
	var sh=document.getElementById('white_shadow');
	var pp=document.getElementById('photo_popup');
	var imgb=pp.getElementsByTagName('div')[0]
	var img=document.createElement('img');
	pp.getElementsByTagName('div')[1].onclick=function() { img.parentNode.removeChild(img);pp.style.display='none';sh.style.display='none'; };
	img.onload=function() { openPP(img,pp,sh); };
	img.src=pSrc;
	imgb.appendChild(img);

	return false;
}
function openPP(img,pp,sh) {
	sh.style.height=document.documentElement.offsetHeight+'px';
	sh.style.display='block';
	pp.style.top='120px';
	pp.style.display='block';
	var imgWidth=img.offsetWidth;
	if(imgWidth<300) imgWidth=300;
	pp.style.marginLeft=(-imgWidth/2)+'px';
}




