window.onload = setInnerPageCols;
//window.onresize = setInnerPageCols;

function setInnerPageCols(){
var leftCol = document.getElementById('left');
var textCol = document.getElementById('text');
if(leftCol && textCol){
if(leftCol.offsetHeight > textCol.offsetHeight){
textCol.style.height = leftCol.offsetHeight-40+'px';
}else if(leftCol.offsetHeight < textCol.offsetHeight){
leftCol.style.height = textCol.offsetHeight+'px';
}


var textCorners = document.getElementById('textCorners');
var bgTextCorners = document.getElementById('bgTextCorners');
textCorners.style.height = textCol.offsetHeight+'px';
bgTextCorners.style.height = textCol.offsetHeight-34+'px';
}


}



function showPhoto(img) {
document.getElementById('bigImg').src = img;
showPop();
}





function dPhotoMove(id) {
for (i=1; i<5; i++){
//window.alert(id);
wnd = document.getElementById('dPhotoWindow'+i);
cont = document.getElementById('dPhotoContainer'+i);
contWidth = (cont.getElementsByTagName('img').length)*177;
//window.alert(contWidth); cont.offsetWidth
if((cont.offsetLeft <= 0) && (cont.offsetLeft + contWidth >= wnd.offsetWidth)) {
	cont.style.left = cont.offsetLeft + 8 * pMoveDr + 'px';
	}

if(cont.offsetLeft > 0) {cont.style.left = 0;}
if(cont.offsetLeft + contWidth < wnd.offsetWidth) {cont.style.left = wnd.offsetWidth - contWidth + 'px';}
}
}
var pMoveDr = 0;
var hTimer;

function dPhotosMove(dr, id) {
pMoveDr = dr;
hTimer = setInterval("dPhotoMove("+id+")", 10);
}

function dPhotosNoMove() {
clearInterval(hTimer);
}

var img = new Object();


function showTab(tabId){
for (i=1; i<5; i++){
if(i == tabId){
document.getElementById('switchTab'+i).className = 'active';
document.getElementById('Tab'+i).style.display = 'block';
document.getElementById('dPhotoContainer'+i).style.left = 0;
}else{
document.getElementById('switchTab'+i).className = '';
document.getElementById('Tab'+i).style.display = 'none';
}
}

}




/*========================================
we make functions for any number of popups
underPop1
underPop2
...

popup1
popup2
...
========================================*/

//they are hidden
var popNum = 0;


function showPop() {
popNum++;
under = document.getElementById('underPop' + popNum);
pop = document.getElementById('popup' + popNum);

//show popup stuff
under.style.display = 'block';
pop.style.display = 'block';

//set underpop size
under.style.left = 0;
under.style.top = 0;
under.style.width = Math.max(document.body.offsetWidth, document.body.scrollWidth) + 'px';
under.style.height = Math.max(document.body.offsetHeight, document.body.scrollHeight) + 'px';

pop.style.left = 0;
pop.style.top = 0;

//set popup position
pop.style.left = document.documentElement.scrollLeft + ((document.body.offsetWidth - document.documentElement.scrollLeft - pop.offsetWidth) / 2) + 'px';
pop.style.top = document.documentElement.scrollTop + ((document.documentElement.clientHeight - pop.offsetHeight) / 2) + 'px';
}



function hidePop() {
if(popNum) {
	document.getElementById('underPop' + popNum).style.display = 'none';
	pop = document.getElementById('popup' + popNum);
	pop.style.display = 'none';
	if(pop.nodeName == 'form') {pop.reset();}
	popNum--;
	}
}


function showPopEnter() {
under = document.getElementById('underPopEnter');
pop = document.getElementById('popupEnter');

//show popup stuff
under.style.display = 'block';
pop.style.display = 'block';

//set underpop size
under.style.left = 0;
under.style.top = 0;
under.style.width = Math.max(document.body.offsetWidth, document.body.scrollWidth) + 'px';
under.style.height = Math.max(document.body.offsetHeight, document.body.scrollHeight) + 'px';

pop.style.left = 0;
pop.style.top = 0;

//set popup position
pop.style.left = document.documentElement.scrollLeft + ((document.body.offsetWidth - document.documentElement.scrollLeft - pop.offsetWidth) / 2) + 'px';
pop.style.top = document.documentElement.scrollTop + ((document.documentElement.clientHeight - pop.offsetHeight) / 2) + 'px';
}



function hidePopEnter() {
document.getElementById('underPopEnter').style.display = 'none';
pop = document.getElementById('popupEnter');
pop.style.display = 'none';
pop.reset();
}
