//Изврат с отзывами
function refreshResp()
{       var a=1;
		jQuery.post('/e_mag/rightResp', {'a':a}, function(data) {
			var b = data.split("|||");
			document.getElementById("rrText").innerHTML = b[0];
			document.getElementById("rrOwner").innerHTML = b[1];
  	});
}

function get_resp()
{       var a=1;
		jQuery.post('/e_mag/responsess', {'a':a}, function(data) {
			document.getElementById("resp").innerHTML = data;
		
  	});
}

function get_resp_id(id,k)
{       var a=1;
		if(k=="1")
		    id = id+'/'+k;
		jQuery.post('/e_mag/responsess/'+id, {'a':a}, function(data) {
			document.getElementById("resp").innerHTML = data;
		
  	});
}
//Изврат с галереей
function get_gal()
{       var a=1;
		jQuery.post('/e_mag/photogalleryz', {'a':a}, function(data) {
			document.getElementById("phototo").innerHTML = data;
		
  	});
}

function get_gal_id(id)
{       var a=1;
		jQuery.post('/e_mag/photogalleryz/'+id, {'a':a}, function(data) {
			document.getElementById("phototo").innerHTML = data;
		
  	});
}
function bonld()
{
	if (document.getElementById('YMapsID'))
		document.getElementById('YMapsID').style.display="block";
}
//Отправляет форму
function go_order2()
{
	if( obj('form_buy'))
	{
		var fmess = obj('elem').innerHTML+':\r\n '+obj('f_mess').value;
		var a = '1';
		jQuery.post('/order2', {'fio':obj('f_fio').value,'phone':obj('f_phone').value,'email':obj('f_email').value,'mess':fmess,'kapcha':obj('f_kapcha').value,'send_order':a}, function(data) {
			if(data==1)
			{
				$("#error").html('');
				$("#ok").html("Ваш заказ успешно отправлен. Наши менеджеры свяжутся с Вами в самое ближайшее время.");
				obj('form_buy').reset();
			}
			else
			{
				$("#ok").html("");
				$("#error").html(data);
			}
  	});
	}
}

function obj(id)
{
	if( document.getElementById(id) )
	   return document.getElementById(id);
	else
	   return false;
}

/*function get_cp()
{
	jQuery.post('/kcaptcha/', {}, function(data) {
				alert('123');
  	});
}*/
function goo(id)
{
	 if(document.getElementById('training'))
	 {
		 var gg = document.getElementById('training');
		 gg = gg.getElementsByTagName('div');
		 for (i = 0; i < gg.length; i++) 
		 {
			 if(gg[i].className=='sleep')
			 {
				 gg[i].style.display="none";
				 if(gg[i].id == id)
					gg[i].style.display="block";
			 }
		 }
		 if(document.getElementById('b_'+id))
	 	 {
			 var bb = document.getElementById('buttons');
			 bb = bb.getElementsByTagName('div');
			 for (i = 0; i < bb.length; i++) 
			 {
				 bb[i].className="";
				 if(bb[i].id == 'b_'+id)
					bb[i].className="act";
			 }
		 }
		 document.body.focus();
	 }
	 
	 
	 if (id=='sheme')
	 {
		 document.getElementById('YMapsID').style.display="block";
		 /*document.getElementById('YMapsID11').style.display="block";*/
	 }
	 else
	 {
	    if(document.getElementById('YMapsID')){ document.getElementById('YMapsID').style.display="none"; }
	    if(document.getElementById('YMapsID11')){ document.getElementById('YMapsID11').style.display="none"; }
	 }
}

function showBookDescription()
{
	document.getElementById("bookDescription").style.display = "block";
	document.getElementById("bookOrder").style.display = "none";
	
	document.getElementById("b_text").className = "act";
	document.getElementById("b_sheme").className = "";
}

function showBookOrder()
{
	document.getElementById("bookDescription").style.display = "none";
	document.getElementById("bookOrder").style.display = "block";
	
	document.getElementById("b_text").className = "";
	document.getElementById("b_sheme").className = "act";
}

function bookOrder()
{
	if( obj('form_buy'))
	{
		var fmess = obj('elem').innerHTML+':\r\n '+obj('f_mess').value;
		var a = '1';
		jQuery.post('/order3', {'fio':obj('f_fio').value,'phone':obj('f_phone').value,'email':obj('f_email').value,'mess':fmess,'kapcha':obj('f_kapcha').value,'send_order':a}, function(data) {
			if(data==1)
			{
				$("#error").html('');
				$("#ok").html("Ваш заказ успешно отправлен. Наши менеджеры свяжутся с Вами в самое ближайшее время.");
				obj('form_buy').reset();
			}
			else
			{
				$("#ok").html("");
				$("#error").html(data);
			}
  	});
	}
}


function gooo(id)
{
	
	 if(document.getElementById('list2'))
	 {
		 var gg = document.getElementById('list2');
		 gg = gg.getElementsByTagName('div');
		 
		 for (i = 0; i < gg.length; i++) 
		 {	
			 if(gg[i].className=="magDiv")
			 {
				 continue;
			 }
			 
			 if(gg[i].className=="ttext")
			 {
				 gg[i].style.display="none";
				 
				 if(gg[i].id == 'tt'+id)
				 {
				 	gg[i].style.display="block";				 	
				 }
			 }			 
			 else
			 {
				 gg[i].style.textDecoration="underline";
				 gg[i].style.fontWeight="normal";
				 
				 if(gg[i].id == 't'+id)
				 {
					gg[i].style.textDecoration="none";
					gg[i].style.fontWeight="bold";
				 }
			 }
			
		 }
		 /*if(document.getElementById('b_'+id))
	 	 {
			 var bb = document.getElementById('buttons');
			 bb = bb.getElementsByTagName('div');
			 for (i = 0; i < bb.length; i++) 
			 {
				 bb[i].className="";
				 if(bb[i].id == 'b_'+id)
					bb[i].className="act";
			 }
		 }*/
		 document.body.focus();
	 }	
}

function showResponse(id)
{
	var list = document.getElementById("list");
	
	if(list)
	{
		var divs = list.getElementsByTagName("div");
		
		for(var i = 0; i < divs.length; i++)
		{
			if(divs[i].className == "ttext")
			{
				
				 if(divs[i].id == 'tt' + id)
				 {
				 	divs[i].style.display = "block";
				 }
				 else
				 {
					 divs[i].style.display = "none";
				 }
			}
			else
			{
				divs[i].style.textDecoration = "underline";
				divs[i].style.fontWeight = "normal";
				
				if(divs[i].id == 't' + id)
				{
					divs[i].style.textDecoration = "none";
					divs[i].style.fontWeight = "bold";
				}
			}
		}
	}
}

function showResponses(id)
{
	var list = document.getElementById("twr");
	
	if(list)
	{
		var divs = list.getElementsByTagName("div");
		
		for(var i = 0; i < divs.length; i++)
		{
			if(divs[i].className == "responses")
			{
				
				 if(divs[i].id == 'responses' + id)
				 {
				 	divs[i].style.display = "block";
				 }
				 else
				 {
					 divs[i].style.display = "none";
				 }
			}
			else if(divs[i].className == "rtext")
			{
				divs[i].style.textDecoration = "underline";
				divs[i].style.fontWeight = "normal";
				
				if(divs[i].id == 'training' + id)
				{
					divs[i].style.textDecoration = "none";
					divs[i].style.fontWeight = "bold";
				}
			}
		}
	}
}

function on_rez(rand)
{
	var way = document.getElementById('way');
	
	if(document.clientWidth<1100 || document.body.clientWidth<1100)
	{
		if(rand == 1)
		{
			document.getElementById('v1').style.background = 'url(/images/i/v2.gif) 117% top no-repeat';
			document.getElementById('v2').style.background = 'url(/images/i/v1.gif) -10% top no-repeat';
		}
		else if(rand == 2)
		{
			document.getElementById('v1').style.background = 'url(/images/i/vv2.gif) 117% top no-repeat';
			document.getElementById('v2').style.background = 'url(/images/i/v1.gif) -10% top no-repeat';
			document.getElementById('alltd').style.background = 'url(/images/i/vv3.jpg) center top no-repeat';
		}
		document.getElementById('logo').style.paddingLeft = '5%';
		document.getElementById('menu').style.paddingLeft = '5%';
		document.getElementById('v3').style.paddingLeft = '0px';
		document.getElementById('v3').style.paddingRight = '0px';
		if(way) //(document.getElementById('buttons'))
		{
			way.style.clear= 'both';
		}
	}
	else
	{
		if(rand == 1)
		{
			document.getElementById('v1').style.background = 'url(/images/i/v2.gif) right top no-repeat';
			document.getElementById('v2').style.background = 'url(/images/i/v1.gif) left top no-repeat';
		}
		else if(rand == 2)
		{
			document.getElementById('v1').style.background = 'url(/images/i/vv2.gif) right top no-repeat';
			document.getElementById('v2').style.background = 'url(/images/i/v1.gif) left top no-repeat';
			document.getElementById('alltd').style.background = 'url(/images/i/vv3.jpg) center top no-repeat';
		}
		document.getElementById('logo').style.paddingLeft = '7%';
		document.getElementById('menu').style.paddingLeft = '7%';
		document.getElementById('v3').style.paddingLeft = '5%';
		document.getElementById('v3').style.paddingRight = '5%';
		if(way) //(document.getElementById('buttons'))
		{
			way.style.clear= 'none';
		}
	}
	
	changeContentPadding();
	
}

function on_rez2()
{
	var content = document.getElementById("content");
	var right = document.getElementById("right");
	var header = document.getElementById("header");

	if(document.clientWidth<1100 || document.body.clientWidth<1100)
	{
		if (document.getElementById('buttons'))
		{
			document.getElementById('way').style.clear= 'both';
			document.getElementById('way').style.paddingTop= '10px';
		}
		
		header.style.paddingLeft = header.style.paddingRight = content.style.paddingLeft = right.style.paddingRight = "45px";	
	}
	else
	{
	
		if (document.getElementById('buttons'))
		{
			document.getElementById('way').style.clear= 'none';
			document.getElementById('way').style.paddingTop= '0px';
		}
		
		header.style.paddingLeft = header.style.paddingRight = content.style.paddingLeft = right.style.paddingRight = "90px";
	}
	
	changeContentPadding();
	
}

function changeContentPadding()
{
	var content = document.getElementById("content");
	
	if(!content){ return; }
	
	var cw = document.documentElement.clientWidth;
	var padding = 0;
	
	if((cw > 1024 )&& (cw <= 1139))
	{
		padding = 10;
	}
	else if((cw > 1139 ) && (cw <= 1254))
	{
		padding = 20;
	}
	else if((cw > 1254 )&& (cw <= 1369))
	{
		padding = 30;
	}
	else if((cw > 1369 ) && (cw <= 1484))
	{
		padding = 40;
	}
	else if((cw > 1484 ) && (cw <= 1600))
	{
		padding = 50;
	}
	else if(cw > 1600)
	{
		padding = 60;
	}
	else
	{
		padding = 0;
	}
	
	content.style.paddingRight = padding + "px";
}

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
} 

function setHome(ob) {
ob.style.behavior='url(#default#homepage)';
ob.setHomePage(document.location);
}


/*function preLoad()
{
pic = new Image();
pic.src="/images/i/m1a.gif";
pic.src="/images/i/m2a.gif";
pic.src="/images/i/m3a.gif";
pic.src="/images/i/m4a.gif";
pic.src="/images/i/m5a.gif";
pic.src="/images/i/mu1a.gif";
pic.src="/images/i/mu2a.gif";
pic.src="/images/i/mu3a.gif";
pic.src="/images/i/mu4a.gif";
pic.src="/images/i/mu5a.gif";
}*/

function gofunc(id)
{
	if (id=='s1')
	{
		id2='s2';
	}
	else
	{
		id2='s1';
	}
document.getElementById('s'+id).style.display='';
document.getElementById('s'+id2).style.display='none';	
document.getElementById(id).style.background='#0b5e81';
document.getElementById(id).style.color='#fff';
document.getElementById(id).style.textDecoration='none';
document.getElementById(id2).style.background='none';
document.getElementById(id2).style.color='#3699b9';
document.getElementById(id2).style.textDecoration='underline';
}
function on(num)
{
 document.getElementById(num).style.display = 'block';
}

function off()
{
 document.getElementById('submenu1').style.display = 'none';
}
function on1(num)
{
 document.getElementById(num).style.display='block';
}

function on2(num)
{
	document.getElementById(num).style.display='';
	document.getElementById(num).style.width='1000px';
}


function off1(num)
{
 document.getElementById(num).style.display='none';
}


function views(url,name)
{
	foto=window.open('/images/view.php?foto='+url+'&name='+name,'foto','width=300,height=300');
	foto.focus();
}
function sub(){
  if (confirm("Вы уверены?")) { document.F.submit; return true; } else { return false;  }
}

function del(ref){
  if (confirm("Вы действительно хотите удалить?")) { document.F.submit; return true; } else { return false;  }
}

function convert2(){
var a2=new Array(); var stxt = document.pages.name.value; 
ns2 = 0; sp2 = 0; dlina2=10; 
while (sp2 != dlina2) {
simvoly2 = stxt.substr(sp2,1); 
sp2 = sp2 + 1; b12=simvoly2; 
switch (b12) {
case " ": massiv=a2.push("_");break;
case "!": massiv=a2.push("");break;
case "#": massiv=a2.push("");break;
case "$": massiv=a2.push("");break;
case "%": massiv=a2.push("");break;
case "&": massiv=a2.push("");break;
case "'": massiv=a2.push("");break;
case "(": massiv=a2.push("");break;
case ")": massiv=a2.push("");break;
case "*": massiv=a2.push("");break;
case "+": massiv=a2.push("");break;
case ",": massiv=a2.push("");break;
case "-": massiv=a2.push("-");break;
case ".": massiv=a2.push("");break;
case "/": massiv=a2.push("");break;
case "0": massiv=a2.push("0");break;
case "1": massiv=a2.push("1");break;
case "2": massiv=a2.push("2");break;
case "3": massiv=a2.push("3");break;
case "4": massiv=a2.push("4");break;
case "5": massiv=a2.push("5");break;
case "6": massiv=a2.push("6");break;
case "7": massiv=a2.push("7");break;
case "8": massiv=a2.push("8");break;
case "9": massiv=a2.push("9");break;
case ":": massiv=a2.push("");break;
case ";": massiv=a2.push("");break;
case "<": massiv=a2.push("");break;
case "=": massiv=a2.push("");break;
case ">": massiv=a2.push("");break;
case "?": massiv=a2.push("");break;
case "@": massiv=a2.push("");break;
case "A": massiv=a2.push("a");break;
case "B": massiv=a2.push("b");break;
case "C": massiv=a2.push("c");break;
case "D": massiv=a2.push("d");break;
case "E": massiv=a2.push("e");break;
case "F": massiv=a2.push("f");break;
case "G": massiv=a2.push("g");break;
case "H": massiv=a2.push("h");break;
case "I": massiv=a2.push("i");break;
case "J": massiv=a2.push("j");break;
case "K": massiv=a2.push("k");break;
case "L": massiv=a2.push("l");break;
case "M": massiv=a2.push("m");break;
case "N": massiv=a2.push("n");break;
case "O": massiv=a2.push("o");break;
case "P": massiv=a2.push("p");break;
case "Q": massiv=a2.push("q");break;
case "R": massiv=a2.push("r");break;
case "S": massiv=a2.push("s");break;
case "T": massiv=a2.push("t");break;
case "U": massiv=a2.push("u");break;
case "V": massiv=a2.push("v");break;
case "W": massiv=a2.push("w");break;
case "X": massiv=a2.push("x");break;
case "Y": massiv=a2.push("y");break;
case "Z": massiv=a2.push("z");break;
case "[": massiv=a2.push("");break;
case "\\": massiv=a2.push("");break;
case "]": massiv=a2.push("");break;
case "^": massiv=a2.push("");break;
case "_": massiv=a2.push("_");break;
case "`": massiv=a2.push("");break;
case "a": massiv=a2.push("a");break;
case "b": massiv=a2.push("b");break;
case "c": massiv=a2.push("c");break;
case "d": massiv=a2.push("d");break;
case "e": massiv=a2.push("e");break;
case "f": massiv=a2.push("f");break;
case "g": massiv=a2.push("g");break;
case "h": massiv=a2.push("h");break;
case "i": massiv=a2.push("i");break;
case "j": massiv=a2.push("j");break;
case "k": massiv=a2.push("k");break;
case "l": massiv=a2.push("l");break;
case "m": massiv=a2.push("m");break;
case "n": massiv=a2.push("n");break;
case "o": massiv=a2.push("o");break;
case "p": massiv=a2.push("p");break;
case "q": massiv=a2.push("q");break;
case "r": massiv=a2.push("r");break;
case "s": massiv=a2.push("s");break;
case "t": massiv=a2.push("t");break;
case "u": massiv=a2.push("u");break;
case "v": massiv=a2.push("v");break;
case "w": massiv=a2.push("w");break;
case "x": massiv=a2.push("x");break;
case "y": massiv=a2.push("y");break;
case "z": massiv=a2.push("z");break;
case "{": massiv=a2.push("");break;
case "|": massiv=a2.push("");break;
case "}": massiv=a2.push("");break;
case "~": massiv=a2.push("");break;
case "А": massiv=a2.push("a");break;
case "Б": massiv=a2.push("b");break;
case "В": massiv=a2.push("v");break;
case "Г": massiv=a2.push("g");break;
case "Д": massiv=a2.push("d");break;
case "Е": massiv=a2.push("e");break;
case "Ё": massiv=a2.push("yo");break;
case "Ж": massiv=a2.push("zh");break;
case "З": massiv=a2.push("z");break;
case "И": massiv=a2.push("i");break;
case "Й": massiv=a2.push("j");break;
case "К": massiv=a2.push("k");break;
case "Л": massiv=a2.push("l");break;
case "М": massiv=a2.push("m");break;
case "Н": massiv=a2.push("n");break;
case "О": massiv=a2.push("o");break;
case "П": massiv=a2.push("p");break;
case "Р": massiv=a2.push("r");break;
case "С": massiv=a2.push("s");break;
case "Т": massiv=a2.push("t");break;
case "У": massiv=a2.push("u");break;
case "Ф": massiv=a2.push("f");break;
case "Х": massiv=a2.push("h");break;
case "Ц": massiv=a2.push("ts");break;
case "Ч": massiv=a2.push("ch");break;
case "Ш": massiv=a2.push("sh");break;
case "Щ": massiv=a2.push("sch");break;
case "Ъ": massiv=a2.push("");break;
case "Ы": massiv=a2.push("y");break;
case "Ь": massiv=a2.push("");break;
case "Э": massiv=a2.push("e");break;
case "Ю": massiv=a2.push("yu");break;
case "Я": massiv=a2.push("ya");break;
case "а": massiv=a2.push("a");break;
case "б": massiv=a2.push("b");break;
case "в": massiv=a2.push("v");break;
case "г": massiv=a2.push("g");break;
case "д": massiv=a2.push("d");break;
case "е": massiv=a2.push("e");break;
case "ё": massiv=a2.push("yo");break;
case "ж": massiv=a2.push("zh");break;
case "з": massiv=a2.push("z");break;
case "и": massiv=a2.push("i");break;
case "й": massiv=a2.push("j");break;
case "к": massiv=a2.push("k");break;
case "л": massiv=a2.push("l");break;
case "м": massiv=a2.push("m");break;
case "н": massiv=a2.push("n");break;
case "о": massiv=a2.push("o");break;
case "п": massiv=a2.push("p");break;
case "р": massiv=a2.push("r");break;
case "с": massiv=a2.push("s");break;
case "т": massiv=a2.push("t");break;
case "у": massiv=a2.push("u");break;
case "ф": massiv=a2.push("f");break;
case "х": massiv=a2.push("h");break;
case "ц": massiv=a2.push("ts");break;
case "ч": massiv=a2.push("ch");break;
case "ш": massiv=a2.push("sh");break;
case "щ": massiv=a2.push("sch");break;
case "ь": massiv=a2.push("");break;
case "ъ": massiv=a2.push("");break;
case "ы": massiv=a2.push("y");break;
case "э": massiv=a2.push("e");break;
case "ю": massiv=a2.push("yu");break;
case "я": massiv=a2.push("ya");break;
} simvoly2 = "";  }  x2 = "" + a2.join(""); 
}

function toclip() {
if (window.clipboardData) {
window.clipboardData.setData('Text', x2);
} 
return false;
}

function calcnetsum() { 
convert2(); 
document.pages.name_url.value = x2; 
}


function show() { 
document.getElementById('hide').style.display=''; 
document.getElementById('hider').style.display=''; 
document.getElementById('shower').style.display='none';
}

function hide() { 
document.getElementById('hide').style.display='none';
document.getElementById('shower').style.display='';
document.getElementById('hider').style.display='none';
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function showArchive(archiveTab, archiveID)
{
	curArchiveTab.className = "";
	curArchiveTab.style.fontWeight = "normal";
	curArchiveTab = archiveTab;
	curArchiveTab.style.fontWeight = "bold";
	curArchiveTab.className = "cur";
	
	curArchiveYear.style.display = "none";
	curArchiveYear = document.getElementById(archiveID);
	curArchiveYear.style.display = "block";
	
	return false;
}



function flashVersion() {
      // Отдельно определяем Internet Explorer
      var ua = navigator.userAgent.toLowerCase();
      var isIE = (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1);
      // Стартовые переменные
      var version = 0;
      var lastVersion = 10; // На момент 2007 года с запасом
      var i;
      if (isIE) { // browser == IE
            try {
                  for (i = 3; i <= lastVersion; i++) {
                        if (eval('new ActiveXObject("ShockwaveFlash.ShockwaveFlash.'+i+'")')) {
                              version = i;
                        }
                  }
            } catch(e) {}
      } else { // browser != IE
            for (i = 0; i < navigator.plugins.length; i++) {
                  if (navigator.plugins[i].name.indexOf('Flash') > -1) {
                        version = (parseInt(navigator.plugins[i].description.charAt(16)) > version) ? parseInt(navigator.plugins[i].description.charAt(16)) : version;
                  }
            }
      }
      return version;
}

var currentSession = null;

function showSession(SessionId)
{   
    if(currentSession)
    {
        if(currentSession == document.getElementById("session" + SessionId))
        {
            currentSession.style.display = currentSession.style.display == "none" ? "block" : "none";
            return false;
        }

        currentSession.style.display = "none";
    }

    currentSession = document.getElementById("session" + SessionId);
    currentSession.style.display = "block";

    return false;
}

/*var oldE = null;

function showSession(e, id)
{
	if(oldE)
	{
		oldE.style.color = "#CB2323";
		oldE.style.textDecoration = "underline";
	}
	
	e.style.color = "#000";
	e.style.textDecoration = "none";
	oldE = e;
	
	for(var i = 1; i <= 2; i++)
	{
		document.getElementById("session" + i).style.display = "none";
	}
	
	document.getElementById(id).style.display = "block";
}*/

var currentRecom = null;
var e = null;

function showRecommendation(e, Id)
{
    if(currentRecom)
    {
        if(currentRecom == document.getElementById("recom" + Id))
        {
            currentRecom.style.display = currentRecom.style.display == "none" ? "block" : "none";
		    e.style.fontWeight = e.style.fontWeight == "normal" ? "bold" : "normal";
		    e.style.textDecoration = e.style.textDecoration == "underline" ? "none" : "underline";
            return false;
        }

        currentRecom.style.display = "none";
	    e.style.fontWeight = "normal";
	    e.style.textDecoration = "underline";
    }

    currentRecom = document.getElementById("recom" + Id);
    currentRecom.style.display = "block";
    e.style.fontWeight = "bold";
    e.style.textDecoration = "none";

    return false;
}

var currentResponses = null;

function showResponsesByTrainingId(trainingId)
{   
    if(currentResponses)
    {
        if(currentResponses == document.getElementById("responses" + trainingId))
        {
            currentResponses.style.display = currentResponses.style.display == "none" ? "block" : "none";
            return false;
        }

        currentResponses.style.display = "none";
    }

    currentResponses = document.getElementById("responses" + trainingId);
    currentResponses.style.display = "block";

    return false;
}

/*function showResponsesByTrainingId(trainingId)
{
    if(currentResponses)
    {
        currentResponses.style.display = "none";        
    }

    currentResponses = document.getElementById("responses" + trainingId);
    currentResponses.style.display = "";

    return false;
}*/

var currentYear = null;
var currentLink = null;

function showResponsesByYear(year)
{
    if(!currentYear)
    {
        divs = document.getElementById("resp").getElementsByTagName("div");

        for(var i = 0; i < divs.length; i++)
        {
            if(divs[i].className == "currentYearId")
            {
                divs[i].className = "";
                currentYear = divs[i];
                break;
            }
        }

        as = document.getElementById("resp").getElementsByTagName("a");

        for(var i = 0; i < as.length; i++)
        {
            if(as[i].className == "currentLinkId")
            {
                as[i].className = "";
                currentLink = as[i];
                break;
            }
        }
    }
    
    currentLink.style.fontWeight = "normal";
    currentLink.style.textDecoration = "";
    currentLink.style.cursor = "pointer";
    currentLink = document.getElementById("yearLink" + year);
    currentLink.style.fontWeight = "bold";
    currentLink.style.textDecoration = "none";
    currentLink.style.cursor = "default";

    currentYear.style.display = "none";
    currentYear = document.getElementById("year" + year);
    currentYear.style.display = "";

    return false;
}

function go_order3()
{
	var errors = "",
		countMC = 0;
	
	// Сначала проверим выбрал ли хоть один мастеркласс 
	for(var i = 1; i < 31; i++)
	{
		if( $('#mc' + i).attr('checked') )
		{
			countMC++;
		}
	}
	
	if( countMC == 0 )
	{
		errors += "Выберите  Мастер-классы\r\n";
	}
	
	
	
	// Проверим заполнено ли ФИО
	if( $('#f_fio').val() == '' )
	{
		errors += "Укажите ФИО\r\n";
	}
	
	
	// Проверим заполнено ли Телефон
	if( $('#f_phone').val() == '' )
	{
		errors += "Укажите Телефон\r\n";
	}
	
	if(!isValidEmail($('#f_email').val()))
	{
		errors += "Укажите корректный E-mail\r\n";
	}
	
	// Проверим заполнено ли Поле с капчой
	if( $('#f_kapcha').val() == '' )
	{
		errors += "Укажите Код подтверждения\r\n";
	}
	
	// Если ошибки, то выводим их
	if( errors != "" )
	{
		alert( errors );
	}
	// Иначе отправляем данные
	else
	{
		// Отправим форму
		$.post("/order2", $("#orderform").serialize(),
		   function(data) {
			   if(data == 1)
			   {
				   alert('Ваша заявка успешно отправлена.\r\nВ ближайшее время с Вами свяжется наш специалист.');
				   document.window.reload;
			   }
			   else 
			   {
				   alert(data);
			   }
		   }
		);
	}
	
}

function isValidEmail(email)
{
	return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/).test(email);
}

/**
 *	Scroll to object of content 
 */
function scrollToObject( objectText )
{
	// Get a top object position
	destination = $("h2:contains(" + objectText + ")").offset().top;
	// Animate scroll to object
	$('html, body').animate({scrollTop:destination}, 1000, 'swing');
}
