
function nextNode(e){return((e&&e.nodeType!=1)?nextNode(e=e.nextSibling):e);}
function NextObj(nObj){tObj=nextNode(nObj.nextSibling);with(tObj.style)
display=(display!='block')?'block':'none';}
var JSonData=ConstJS.constants;function checkname()
{var str=document.getElementById('first_name').value;var filter=/^[А-ЯA-Z]{2,}( +)?([А-ЯA-Z]{2,})?( +)?$/i;if(filter.test(str)){document.getElementById('name_div').style.visibility="hidden";document.getElementById('name_pic').style.visibility="visible";}else{document.getElementById('name_pic').style.visibility="hidden";document.getElementById('name_div').style.visibility="visible";}}
function checksurname()
{var str=document.getElementById('last_name').value;var filter=/^[А-ЯA-Z]{2,}( +)?([А-ЯA-Z]{2,})?( +)?$/i;if(filter.test(str)){document.getElementById('surname_div').style.visibility="hidden";document.getElementById('surname_pic').style.visibility="visible";}else{document.getElementById('surname_pic').style.visibility="hidden";document.getElementById('surname_div').style.visibility="visible";}}
function checkmail()
{var str=document.getElementById('email').value;var filter=/^[.\w-]+@([\w-]+\.)+[a-zA-Z]{2,6}$/;if(filter.test(str)){document.getElementById('mail_div').style.visibility="hidden";document.getElementById('mail_pic').style.visibility="visible";}else{document.getElementById('mail_pic').style.visibility="hidden";document.getElementById('mail_div').style.visibility="visible";}}
function checkphone()
{var str=document.getElementById('phone').value;var filter=/^(?:8|\+7)? ?\(\d{1,5}\)? ?\d{1,5}\-\d{2}\-\d{2}$/;if(str!=""){document.getElementById('phone_div').style.visibility="hidden";document.getElementById('phone_pic').style.visibility="visible";}else{document.getElementById('phone_pic').style.visibility="hidden";document.getElementById('phone_div').style.visibility="visible";}}
function open_window(link,w,h)
{var win="width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";newWin=window.open(link,'newWin',win);newWin.focus();}
function validate_custinfo()
{var strFName=document.getElementById('first_name').value;var filterFName=/^[А-ЯA-Z]{2,}( +)?([А-ЯA-Z]{2,})?( +)?$/i;if(!filterFName.test(strFName))
{alert(JSonData.ERROR_INPUT_NAME);return false;}
var strSName=document.getElementById('last_name').value;var filterSName=/^[А-ЯA-Z]{2,}( +)?([А-ЯA-Z]{2,})?( +)?$/i;if(!filterSName.test(strSName))
{alert(JSonData.ERROR_INPUT_NAME);return false;}
var strEmail=document.getElementById('email').value;var filterEmail=/^[.\w-]+@([\w-]+\.)+[a-zA-Z]{2,6}$/;if(!filterEmail.test(strEmail))
{alert(JSonData.ERROR_INPUT_EMAIL);return false;}
var strPhone=document.getElementById('phone').value;var filterPhone=/^(?:8|\+7)? ?\(\d{1,5}\)? ?\d{1,5}\-\d{2}\-\d{2}$/;if(str="")
{alert(JSonData.ERROR_INPUT_PHONE);return false;}
return true;}
function moduleSearch()
{location="./index.php?searchstring="+$('#mod_search_searchword').attr('value');}
function currencyFormat(num,dec){num=Math.round(num/dec)*dec;num=new Number(num).toFixed(2);var s=0;var str='';for(var i=num.toString().length-1;i>=0;i--){s++;str=num.toString().charAt(i)+str;if(num.toString().charAt(i)=='.')s=0;if(s>0&&!(s%3))str=" "+str;}
return str;}
$(document).ready(function(){$('#mod_search_searchword').keydown(function(e){if(e.keyCode==13){moduleSearch();}});});$(document).ready(function(){$("a.inframe").fancybox({"padding":20,"imageScale":false,"zoomOpacity":false,"zoomSpeedIn":1000,"zoomSpeedOut":1000,"zoomSpeedChange":1000,"frameWidth":600,"frameHeight":600,"overlayShow":true,"overlayOpacity":0.8,"hideOnContentClick":false,"centerOnScroll":false});$("a.thickbox").fancybox({'width':'800','height':'600','type':'swf','titlePosition':'inside'});$("a[rel=example_group]").fancybox({'transitionIn':'none','transitionOut':'none','titlePosition':'over','titleFormat':function(title,currentArray,currentIndex,currentOpts){return'<span id="fancybox-title-over">Фотография '+(currentIndex+1)+' из '+currentArray.length+(title.length?' &nbsp;-&nbsp; '+title:'')+'</span>';}});});$(document).ready(function(){$("#poll").submit(formProcess);if($("#poll-results").length>0){animateResults();}
if(document.getElementById('idvote'))
{idvote=document.getElementById('idvote').value;if($.cookie('vote_id_'+idvote)){$("#poll-container").empty();votedID=$.cookie('vote_id_'+idvote);$.getJSON("poll.php?vote=none",loadResults);}}});function formProcess(event){event.preventDefault();var id=$("input[@name='poll']:checked").attr("value");id=id.replace("opt",'');idvote=document.getElementById('idvote').value;$("#poll-container").fadeOut("slow",function(){$(this).empty();votedID=id;$.getJSON("poll.php?vote="+id+'&idvote='+idvote,loadResults);$.cookie('vote_id_'+idvote,id,{expires:365,path:'/'});});}
function animateResults(){$("#poll-results div").each(function(){var percentage=$(this).next().text();$(this).css({width:"0%"}).animate({width:percentage},'slow');});}
function loadResults(data){var total_votes=0;var percent;for(id in data){total_votes=total_votes+parseInt(data[id][OPT_VOTES]);}
var results_html="<div id='poll-results'>\n<dl class='graph'>\n";for(id in data){percent=0;if(data[id][OPT_VOTES]>0)
percent=Math.round((parseInt(data[id][OPT_VOTES])/parseInt(total_votes))*100);if(data[id][OPT_ID]!==votedID){results_html=results_html+"<dd  style='float:left;' class='bar-container'><div id='bar"+data[id][OPT_ID]+"'style='width:0%; float:left; '><nobr><b>"+data[id][OPT_TITLE]+"</b></nobr></div><strong>"+percent+"%</strong></dd>\n";}else{results_html=results_html+"<dd class='bar-container' style='float:left;'><div id='bar"+data[id][OPT_ID]+"'style='width:0%;background-color:#FD5300; float:left;'><nobr><b>"+data[id][OPT_TITLE]+"</b></nobr></div><strong>"+percent+"%</strong></dd>\n";}}
results_html=results_html+"</dl><p style='clear: both;'>Total Votes: "+total_votes+"</p></div>\n";$("#poll-container").append(results_html).fadeIn("slow",function(){animateResults();});}
