function openCloseHelp(noTopic)
{var topic_name='topic_'+noTopic;if(document.getElementById(topic_name).style.display=="none")
document.getElementById(topic_name).style.display="block";else{document.getElementById(topic_name).style.display="none";}}
function openCloseIntroduce(noTopic,countTopics)
{CloseAllTopics(1,countTopics,noTopic);var topic_name='topic_'+noTopic;if(document.getElementById(topic_name).style.display=="none")
document.getElementById(topic_name).style.display="block";else{document.getElementById(topic_name).style.display="none";}}
function CloseAllTopics(start,countTopics,current)
{for(i=0;i<countTopics;i++){no=start+i;if(no!=current){topic_name='topic_'+no;document.getElementById(topic_name).style.display="none";}}}
function CloseAllQuestions(noTopic,countQuestions)
{for(i=1;i<=countQuestions;i++){qwe_name='question_'+noTopic+'_'+i;document.getElementById(qwe_name).style.display="none";}}
function openCloseTopic(noTopic,countTopics,countQuestions)
{CloseAllTopics(9,countTopics,noTopic);CloseAllQuestions(noTopic,countQuestions);var topic_name='topic_'+noTopic;if(document.getElementById(topic_name).style.display=="none")
document.getElementById(topic_name).style.display="block";else{document.getElementById(topic_name).style.display="none";}}
function openCloseQuestion(noTopic,noQwe,countQuestions)
{var qwe_name='question_'+noTopic+'_'+noQwe;if(document.getElementById(qwe_name).style.display=="none"){CloseAllQuestions(noTopic,countQuestions);document.getElementById(qwe_name).style.display="block";}
else
document.getElementById(qwe_name).style.display="none";}
function responseGenerateContactTopics(t)
{var repObj=eval('('+t.responseText+')');var key;var val;var form_elt=document.forms['contactForm'].question;form_elt.disabled=false;form_elt.style.width="300px";form_elt.options.length=0;if(language=="eng")
form_elt.options[0]=new Option('Choose:','');else
form_elt.options[0]=new Option('Выберите тематику вопроса','');form_elt.options[0].style.color="#D43889";num=1;for(i in repObj){if(typeof(repObj[i])!='function'){key=repObj[i]['contact_topic_id'];if(language=='rus')
val=repObj[i]['contact_topic'];else
val=repObj[i]['contact_topic_eng'];form_elt.options[num++]=new Option(val,key);}}
contactForm.elements['msgText'].value="";}
function generateContactTopics(article)
{if(article==2){if(language=="eng")
uNameText="Your nickname (login):";else
uNameText="Ваш логин:";}else{if(language=="eng")
uNameText="Your name:"
else
uNameText="Ваше имя:";}
document.getElementById("uName").innerHTML="<table border=0 width=100% cellspacing=0 cellpadding=0><tr class=\"profile_field\"><td height=25 width=150 class=\"conditions_part\"><span class=\"conditions_list\">&nbsp;&nbsp;&nbsp;</span>"+uNameText+"</td><td align=left class=\"conditions_text\"><input type=\"text\" name=\"userName\" style=\"width:300px;\" maxlength=100></td></tr></table>";params="article="+article;params+='&task=loadContactTopics';new Ajax.Request('/lib/Ajax/ajax.contact.message.php',{method:'post',postBody:params,onSuccess:responseGenerateContactTopics});}
function checkContactInfo()
{var form_elt=document.forms['contactForm'].question;if(form_elt.disabled){document.forms['contactForm'].msgText.blur();if(language=="eng")
createMyPopup("You haven\'t mentioned who you are.",585,237);else
createMyPopup("Вы не указали, кем Вы являетесь.",585,237);}else{key=form_elt.options[form_elt.selectedIndex].value;if(key==""){document.forms['contactForm'].msgText.blur();if(language=="eng")
createMyPopup("You haven\'t mentioned what you want.",585,237);else
createMyPopup("Вы не выбрали тематику вопроса.",585,237);}}}
function checkContactInfo2()
{var form_elt=document.forms['contactForm'].question;var key=form_elt.options[form_elt.selectedIndex].value;if(key==""){document.forms['contactForm'].msgText.blur();createMyPopup("Вы не выбрали тематику вопроса.",585,237);}}
function checkTopic()
{if(document.forms['contactForm'].question.selectedIndex==0)
document.forms['contactForm'].msgText.value="";}
function responseSendContactMessage(t)
{document.location.href=serverName+'/contact.php';}
function sendContactMessage()
{var contactForm=document.forms['contactForm'];var text=contactForm.elements['msgText'].value;var userMail=contactForm.elements['userMail'].value;var userName="";if(contactForm.elements['userName']){userName=contactForm.elements['userName'].value;}
err="";if(!text||text==""){if(language=="eng")
err="You haven\'t entered a message.<br>";else
err="Вы не ввели текст сообщения.<br>";}
if(userMail==""){if(language=="eng")
err+="Enter your E-MAIL address, please.<br>";else
err+="Вы не указали свой почтовый ящик.<br>";}else{if(!pochta(userMail)){if(language=="eng")
err+="You have incorrectly input E-MAIL address.<br>";else
err+="Вы неправильно задали свой e-mail.<br>";}}
if(userName==""){if(language=="eng")
err+="Please specify your name.<br>";else
err+="Вы не указали свое имя.<br>";}
if(err!=""){if(language=="rus")
createMyPopup("<b>В форме содержатся ошибки.</b><br><br>"+err,585,237);else
createMyPopup("<b>Errors have been found in Contact form.</b><br><br>"+err,585,237);}else{if(contactForm.elements[0].checked)
userWho=contactForm.elements[0].value;else
userWho=contactForm.elements[1].value;elQuestion=contactForm.elements['question'];topic=elQuestion.options[elQuestion.selectedIndex].value;params="userName="+userName;params+="&userMail="+userMail;params+="&who="+userWho;params+="&topic="+topic;params+="&text="+text;params+="&task=sendContactMessage";new Ajax.Request('/lib/Ajax/ajax.contact.message.php',{method:'post',postBody:params,onSuccess:responseSendContactMessage});}}
function sendContactMessage2()
{var contactForm=document.forms['contactForm'];text=contactForm.elements['msgText'].value;err="";if(!text)
err="Вы не ввели текст сообщения<br>";if(err!=""){createMyPopup("<b>В форме содержатся ошибки.</b><br><br>"+err,585,237);}else{topic=contactForm.elements['topic'].value;elQuestion=contactForm.elements['question'];question=elQuestion.options[elQuestion.selectedIndex].value;params="who=user";params+="&topic="+topic;params+="&question="+question;params+="&text="+text;params+="&task=sendContactMessage";new Ajax.Request('/lib/Ajax/ajax.contact.message.php',{method:'post',postBody:params,onSuccess:responseSendContactMessage});}}