function showAnswer(id,answers,ques){
for (i=1; i<=answers; i++){
if (i==id){
if (eval("answer"+i).className=="isnone"){
eval("answer"+i).className="allnone";
eval("aques"+i).className="allnone";
eval("ques"+i).className="isnone";
}
else{
eval("answer"+i).className="isnone";
eval("aques"+i).className="isnone";
eval("ques"+i).className="allnone";
}
}
else{
eval("answer"+i).className="isnone";
eval("aques"+i).className="isnone";
eval("ques"+i).className="allnone";
}
}
}


function showDescription(id,als){
for (i=0; i<=als; i++){
if (i==id){
if (eval("podrob"+i).className=="isnone"){
eval("podrob"+i).className="allnone";
eval("slink"+i).className="isnone";
}
else{
eval("podrob"+i).className="isnone";
eval("slink"+i).className="allnone";
}
}
}
}

function sortNews(link){
document.location=link+document.getElementById("sort").value+"/";
}

function sortNewsIn(link){
document.location="/"+document.getElementById("sort").value+link;
}


function ShowFoto(id,widt,heit,bro){
if (window.big_item){big_item.close();}
if (bro==1){hei=((screen.height-heit)/2-30);wid=((screen.width-widt)/2);big_item=window.open("/showfoto/"+id+"/","mapp","width="+(widt-4)+",height="+(heit-4)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
if (bro==0){widt=widt+8;heit=heit+8;hei=((screen.height-heit)/4);wid=((screen.width-widt)/2);big_item=window.open("/showfoto/"+id+"/","mapp","width="+(widt-8)+",height="+(heit-8)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
}

function ShowOur(id,widt,heit,bro){
if (window.big_item){big_item.close();}
if (bro==1){hei=((screen.height-heit)/2-30);wid=((screen.width-widt)/2);big_item=window.open("/showour/"+id+"/","mapp","width="+(widt-4)+",height="+(heit-4)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
if (bro==0){widt=widt+8;heit=heit+8;hei=((screen.height-heit)/4);wid=((screen.width-widt)/2);big_item=window.open("/showour/"+id+"/","mapp","width="+(widt-8)+",height="+(heit-8)+",screenX=0,screenY=0,left="+wid+",top="+hei+",scrollbars=no");big_item.focus();}
}


function HideReveal(otdel){
var xx=1;
while (xx<11){
if (xx==otdel){eval("doctora"+xx).className="reveal";} else{eval("doctora"+xx).className="hide";}
xx++;
}
}

function filiShow(){
document.getElementById("fili2").style.display = "block";
}

function filiHide(){
document.getElementById("fili2").style.display = "none";
}

function upPages(id){
document.getElementById("cpage"+(id-1)).className = "isnone";
document.getElementById("cpage"+id).className = "allnone";
}

function downPages(id){
document.getElementById("cpage"+(id+1)).className = "isnone";
document.getElementById("cpage"+id).className = "allnone";
}

function setRram(id){
document.getElementById("rram"+id).className = "ram";
}

function unsetRram(id){
document.getElementById("rram"+id).className = "noram";
}

function checkAgree(){
if (document.getElementById("iagree").checked){document.getElementById("sendreg").disabled=false;}
else{document.getElementById("sendreg").disabled=true;}
}

function next5(current){
if (current==5){
for (ii=1;ii<11;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}
for (ii=6;ii<11;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5(1); style="cursor:hand;cursor:pointer;"><u>предыдущие 5</u></a>'; 
}

if (current==10){
for (ii=1;ii<13;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}
for (ii=11;ii<13;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5(5); style="cursor:hand;cursor:pointer;"><u>предыдущие 5</u></a>'; 
}


if (current==1){
for (ii=1;ii<11;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}

for (ii=1;ii<6;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<22;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5(5); style="cursor:hand;cursor:pointer;"><u>следующие 5</u></a>'; 
}




}




function next5sp(current){
if (current==5){
for (ii=1;ii<12;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}
for (ii=6;ii<10;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5sp(1); style="cursor:hand;cursor:pointer;"><u>предыдущие 5</u></a> | <a onclick=next5sp(10); style="cursor:hand;cursor:pointer;"><u>следующие 2</u></a>'; 
}

if (current==10){
for (ii=1;ii<12;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}
for (ii=10;ii<12;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5sp(5); style="cursor:hand;cursor:pointer;"><u>предыдущие 4</u></a>'; 
}


if (current==1){
for (ii=1;ii<12;ii++){
document.getElementById("therow"+ii).className="isnone"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isnone"; 
}
}

for (ii=1;ii<6;ii++){
document.getElementById("therow"+ii).className="isall"; 
for (jj=0;jj<15;jj++){
document.getElementById("therow"+ii+"a"+jj).className="isall"; 
}
}

document.getElementById("pages").innerHTML='<a onclick=next5sp(5); style="cursor:hand;cursor:pointer;"><u>следующие 4</u></a>'; 
}




}



function changeBlocks(){
document.getElementById("donthave").className="hide";
document.getElementById("ihave").className="reveal";
document.getElementById("blocktext").innerHTML='<table cellspacing=0 cellpadding=0 border=0><tr><td valign=top><a id=blocklink class=myxlink onmouseover=overLink(); onmouseout=outLink(); onclick=changeBlocksBack();>У меня еще нет личной страницы</a></td></tr><tr><td valign=top style="padding-top:5;"><a href=/ourpages/mypage/mypassword/>Забыли пароль?</a></td></tr></table>';
}

function changeBlocksBack(){
document.getElementById("donthave").className="reveal";
document.getElementById("ihave").className="hide";
document.getElementById("blocktext").innerHTML='<a id=blocklink class=myxlink onmouseover=overLink(); onmouseout=outLink(); onclick=changeBlocks();>У меня уже есть личная страница</a>';
}

function overLink(){
document.getElementById("blocklink").className="myxnlink";
}

function outLink(){
document.getElementById("blocklink").className="myxlink";
}

function checkAddNew(){
if (document.getElementById("thetext").value!="" || document.getElementById("thehead").value!="" || document.getElementById("pic1").value!="" || document.getElementById("pic2").value!="" || document.getElementById("pic3").value!="" || document.getElementById("pic4").value!=""){
document.getElementById("sendnew").disabled=false;
}
else{document.getElementById("sendnew").disabled=true;}
}

function hideText(){
document.getElementById("newyear").className="hide";
this.setCookie("ishide","1");
}

function showTextBox(){
document.getElementById("newyear").className="show";
}

function setCookie (name, value, expire, path)
{
	document.cookie = name + '=' + escape (value)
		+ ((expire == null)? '' : ('; expires=' + expire.toGMTString()))
		+ ((path == null)? '' : ('; path=' + path));
}

function switchSecond(){
document.getElementById("click47").disabled=true;
document.getElementById("click34").disabled=false;
document.getElementById("click35").disabled=false;
document.getElementById("click34").checked=true;
document.getElementById("clicktext47").className="sttx";
document.getElementById("clicktext34").className="mtx";
document.getElementById("clicktext35").className="mtx";
}

function switchFirst(){
document.getElementById("click47").disabled=false;
document.getElementById("click34").disabled=true;
document.getElementById("click35").disabled=true;
document.getElementById("click47").checked=true;
document.getElementById("clicktext47").className="mtx";
document.getElementById("clicktext34").className="sttx";
document.getElementById("clicktext35").className="sttx";
}

function changeSchedule(id,id2){
if (id2==1){document.getElementById("showSchedule").style.width="550px";}
if (document.getElementById("showSchedule").scrollLeft<id){
document.getElementById("showSchedule").scrollLeft+=20;
if (document.getElementById("showSchedule").scrollLeft<(document.getElementById("realSchedule").offsetWidth-500)){
setTimeout("changeSchedule("+id+",0)",1);
}
else{document.getElementById("showSchedule").scrollLeft=(document.getElementById("realSchedule").offsetWidth-500);}
}
}

function changeScheduleBack(id,id2){
if (id2==1){document.getElementById("showSchedule").style.width="500px";}
if (document.getElementById("showSchedule").scrollLeft>id){
document.getElementById("showSchedule").scrollLeft-=20;
if (document.getElementById("showSchedule").scrollLeft>0){
setTimeout("changeScheduleBack("+id+",0)",1);
}
else{document.getElementById("showSchedule").scrollLeft=0;}
}
}


function changeScheduleZZ(id,id2){
if (id2==1){
document.getElementById("mainTdSchedule").style.width=document.getElementById("mainTdSchedule").offsetWidth+50+'px';
document.getElementById("showSchedule").style.width="400px";
}
if (document.getElementById("showSchedule").scrollLeft<id){
document.getElementById("showSchedule").scrollLeft+=10;
if (document.getElementById("showSchedule").scrollLeft<(document.getElementById("realSchedule").offsetWidth-350)){
setTimeout("changeScheduleZZ("+id+",0)",1);
}
else{document.getElementById("showSchedule").scrollLeft=(document.getElementById("realSchedule").offsetWidth-350);}
}
}

function changeScheduleBackZZ(id,id2){
if (id2==1){
document.getElementById("mainTdSchedule").style.width=document.getElementById("mainTdSchedule").offsetWidth-50+'px';
document.getElementById("showSchedule").style.width="350px";
}
if (document.getElementById("showSchedule").scrollLeft>id){
document.getElementById("showSchedule").scrollLeft-=10;
if (document.getElementById("showSchedule").scrollLeft>0){
setTimeout("changeScheduleBackZZ("+id+",0)",1);
}
else{document.getElementById("showSchedule").scrollLeft=0;}
}
}


function showAllSchedule(){
var xt=parseInt(document.getElementById("showSchedule").style.width);
if (xt<document.getElementById("realSchedule").offsetWidth){
xt=xt+20;
if (xt<document.getElementById("realSchedule").offsetWidth){
document.getElementById("showSchedule").style.width=xt;
setTimeout("showAllSchedule()",1);
}
else{document.getElementById("showSchedule").style.width=document.getElementById("realSchedule").offsetWidth+70;}
}
}

function checkScheduleTable(){
var h=Math.abs(parseInt(document.getElementById("realSchedule").style.marginLeft));
if (h>0){
document.getElementById("realSchedule").style.marginLeft="0px";
document.getElementById("showSchedule").scrollLeft=h;
}
}

function showPodr(i){
var w=parseInt((document.body.clientWidth-918)/2);
document.getElementById("podr"+i).className="allnone";
var h=parseInt(document.body.scrollTop+(document.body.clientHeight-document.getElementById("podr"+i).offsetHeight)/2);
document.getElementById("podr"+i).style.top=h+"px";
document.getElementById("podr"+i).style.left=w+"px";
}


function showPodr_(i){
var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY) { 
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
} 

// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else { 
pageHeight = yScroll;
}

// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){ 
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}

document.getElementById("AviaFormWait").style.height = pageHeight + "px";
document.getElementById("AviaFormWait").style.width = pageWidth + "px";
document.getElementById("AviaFormWait").style.display = "block";
var w=parseInt((document.body.clientWidth-918)/2);
document.getElementById("podr"+i).className="allnone";
var h=parseInt(document.body.scrollTop+(document.body.clientHeight-document.getElementById("podr"+i).offsetHeight)/2);
document.getElementById("podr"+i).style.top=h+"px";
document.getElementById("podr"+i).style.left=w+"px";
}

function closeFunction(i){
document.getElementById("podr"+i).className="isnone";
document.getElementById("AviaFormWait").style.display = "none";
}

function revealDiv(id){
if (document.getElementById(id).className=="isnone"){
document.getElementById("div"+id).style.textDecoration="none";
document.getElementById("div"+id).style.fontSize="18px";
document.getElementById(id).className="allnone";
}
else{
document.getElementById("div"+id).style.textDecoration="underline";
document.getElementById("div"+id).style.fontSize="13px";
document.getElementById(id).className="isnone";
}
}


