	function add_block()
	{
		var br = document.createElement('br');
		var brt = document.createElement('br');
		
		var input = document.createElement('input');
		input.type = 'file';
		input.name = 'img[]';
		input.size = '40';
		
		var textarea = document.createElement('textarea');
		textarea.name = 'text[]';
		textarea.rows = '4';
		textarea.cols = '50';
		
		blocks = document.getElementById('blocks');
		blocks.appendChild(br);
		blocks.appendChild(input);
		blocks.appendChild(brt);
		blocks.appendChild(textarea);
	}
	
	
	
	
	
function charge()

{

  actshop = new Image();

  actshop.src = "image/allshops-but.gif";

  onshop = new Image();

  onshop.src = "image/allshops-but-on.gif";

}

charge();





function show_hide(id)

{

		if (document.getElementById(id).style.display == 'none')

		{

			document.getElementById(id).style.display='';

		}

		else

		{

			document.getElementById(id).style.display='none';

		}

}



function confirm_to(href)

{

	if (confirm('Вы действительно хотите удалить?'))

	{

		window.location=href;

	}

}





function loadDateOfBirth(mode) {

    var day = document.getElementById("dayOfBirth");

    var month = document.getElementById("monthOfBirth");

    var year = document.getElementById("yearOfBirth");

    var dateOfBirth = document.getElementById("dateOfBirth");



    // Get Current Year

    var time = new Date();

    var currYear = time.getFullYear();

    var thisYear = time.getFullYear()+5;





    var daysInMonth=0;

    var totalMonths=12;

    var totalYears=10;



    // Prepare Year Dropdown

    year.options.length=totalYears+1;

    year.options[0].value=-1;

    year.options[0].text="Год";

    for (var i=1; i<=totalYears; i++,thisYear--) {

        year.options[i].value=thisYear;

        year.options[i].text=thisYear;

    }



    // Prepare Month Dropdown

    month.options.length=13;

    month.options[0].value=-1;

    month.options[0].text="Месяц";

    month.options[1].value=1;

    month.options[1].text="Январь";

    month.options[2].value=2;

    month.options[2].text="Февраль";

    month.options[3].value=3;

    month.options[3].text="Март";

    month.options[4].value=4;

    month.options[4].text="Апрель";

    month.options[5].value=5;

    month.options[5].text="Май";

    month.options[6].value=6;

    month.options[6].text="Июнь";

    month.options[7].value=7;

    month.options[7].text="Июль";

    month.options[8].value=8;

    month.options[8].text="Август";

    month.options[9].value=9;

    month.options[9].text="Сентябрь";

    month.options[10].value=10;

    month.options[10].text="Октябрь";

    month.options[11].value=11;

    month.options[11].text="Ноябрь";

    month.options[12].value=12;

    month.options[12].text="Декабрь";



    var od = 0;

    var om = 0;

    var oy = 0;

    if (mode == 1 && dateOfBirth) {

        // We need to parse dateOfBirth and reset value for

        // day, month, year select list

        var dob = dateOfBirth.value;

        var dobLen = dob.length;

        if (dobLen>0) {

            var dateOfBirthArr=dob.split("/");

            om=dateOfBirthArr[0];

            od=dateOfBirthArr[1];

            oy=dateOfBirthArr[2];

            oy = (currYear - oy) + 1;

            month.options.selectedIndex=om;

            year.options.selectedIndex=oy;

        }

    }



    var monthValue = month.value;

    if (year.value > 0 && monthValue > 0) {

        if (monthValue==2) {

            if (year.value % 4 != 0) {

                daysInMonth=28;

            } else if  (year.value % 400 == 0) {

                daysInMonth=29;

            } else if (year.value % 100 == 0) {

                daysInMonth=28;

            } else {

                daysInMonth=29;

            }

        } else if (monthValue==1 || monthValue==3 || monthValue==5 ||

                   monthValue==7 || monthValue==8 || monthValue==10 || monthValue==12) {

            daysInMonth=31;

        } else {

            daysInMonth=30;

        }

    }

    day.options.length=daysInMonth+1;

    day.options[0].value=-1;

    day.options[0].text="День";

    for (var i=1; i<=daysInMonth; i++) {

        day.options[i].value=i;

        day.options[i].text=i;

    }



    if (mode == 1 && od > 0) {

        day.options.selectedIndex=od;

    }



    // Prepare dateOfBirth

    if (year.value > 0 || month.value > 0 || day.value > 0) {

        dateOfBirth.value = month.value + "/" + day.value + "/" + year.value;

    } else {

        dateOfBirth.value="";

    }

}







function check_email(e) {

			ret = false;

			inp = document.getElementById(e);

			e = inp.value;

			if (e != '')

			{

				ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

				for(i=0; i < e.length; i++){

					if(ok.indexOf(e.charAt(i))<0){

						ret = true;

					}

				}

				if (ret == true)

				{

					alert('Вы ввели недопустимый email');

						inp.focus();

						inp.select();

				}

			}

}





function check_site(s) {

			ret = false;

			inp = document.getElementById(s);

			s = inp.value;

			if (s != '')

			{

				ok = "1234567890qwertyuiopasdfghjklzxcvbnm.-_QWERTYUIOPASDFGHJKLZXCVBNM";



				for(i=0; i < s.length; i++){

					if(ok.indexOf(s.charAt(i))<0){

						ret = true;

					}

				}

				if (ret == true)

				{

					alert('Вы ввели недопустимый сайт');

						inp.focus();

						inp.select();

				}

			}

}







function img_set(id,img,idcur)

{

	document.getElementById(id).src = img;



	document.getElementById('aimg1').bgColor = '#FFFAEE';

	document.getElementById('aimg2').bgColor = '#FFFAEE';

	document.getElementById('aimg3').bgColor = '#FFFAEE';

	document.getElementById('aimg4').bgColor = '#FFFAEE';

	document.getElementById('aimg5').bgColor = '#FFFAEE';

	document.getElementById('aimg6').bgColor = '#FFFAEE';

	document.getElementById('aimg7').bgColor = '#FFFAEE';

	document.getElementById('aimg8').bgColor = '#FFFAEE';



	document.getElementById(idcur).bgColor = '#FF7905';

}





function maxlength(max,text)

{

	count = text.value.length;

	if (count > max)

	{

		alert('Количество символов больше '+max);

	}

}





function set_inp(id,set)

{

	document.getElementById(id).value = set;
	
	alert('Установлено!');

}


function point_it(event,id){
	element = document.getElementById(id);
	
	
	var left = element.offsetLeft;
	var top = element.offsetTop;
	for (var parent = element.offsetParent; parent; parent = parent.offsetParent)
	{
		left += parent.offsetLeft - parent.scrollLeft;
		top += parent.offsetTop - parent.scrollTop;
	}
	//alert(left);
	

	//alert(event.clientX+' - '+event.screenX+' - '+event.X+' - '+event.pageX+' - '+event.layerX+' - '+event.offsetX+' - '+document.getElementById(id).offsetLeft);
	

	// pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById(id).offsetLeft;
	// pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById(id).offsetTop;
	
	pos_x = event.clientX-left;
	pos_y = event.clientY-top;
	
	document.getElementById('pos_x').value = pos_x;
	document.getElementById('pos_y').value = pos_y;
	
	document.getElementById(id+"_cross").style.left = (pos_x-2);
	document.getElementById(id+"_cross").style.top = (pos_y+4);
	document.getElementById(id+"_cross").style.display = '';
}







function show_hide_map(id,idl)

{


		document.getElementById('1stage').style.display = 'none'

		document.getElementById('2stage').style.display = 'none'

		document.getElementById('3stage').style.display = 'none'

          if(idl=='') {} else {
		document.getElementById('1stagel').style.display = 'none'

		document.getElementById('2stagel').style.display = 'none'

		document.getElementById('3stagel').style.display = 'none'
                               }


		if (document.getElementById(id).style.display == 'none')

		{

			document.getElementById(id).style.display='';
			 if(idl=='') {} else {
			document.getElementById(idl).style.display='';
                                  }
		}

		else

		{

			document.getElementById(id).style.display='none';
			 if(idl=='') {} else {
			document.getElementById(idl).style.display='none';
                                  }
		}

}



function point_hide(id)

{

	document.getElementById(id).style.display = 'none';

}



function point_show(id,x,y)

{

	ypos=y+document.body.scrollTop;

	xpos=x+document.body.scrollLeft;



	document.getElementById(id).style.display = '';

	document.getElementById(id).style.top = ypos-46;

	document.getElementById(id).style.left = xpos-200;



	//document.getElementById('pointer').innerHTML = '<PARAM NAME=movie VALUE="image/popup.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent><EMBED src="image/popup.swf?param='+name+'" quality=high quality=high wmode=transparent  WIDTH="170" HEIGHT="77" NAME="butiks" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';









	//'image/popup.swf?param='+name;

}





function zoomin(a,rout) {



 var fast = Math.random();

 fast = fast * 100;

 fast = Math.round(fast);

 var ffile = "test.php";

 //alert(ffile);

 myWin= open(ffile, "disp"+fast+"a",

   "height=200,width=200,status=no,toolbar=no,menubar=no,scrollbars=no");

 // открыть объект document для последующей печати

 myWin.document.open();

   // генерировать новый документ

 myWin.document.write("<html><head><title>ТК Гостиный Двор");

 myWin.document.write("</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\"></head><body onLoad=\" window.resizeTo(document.newwin.width+6, document.newwin.height+32); window.moveTo(10,10);\" leftmargin=0 topmargin=0 rightmargin=0 bgcolor=#333333>");

 myWin.document.write("<table cellspacing=0 cellpadding=0 border=0 width=100% height=100%><tr><td valign=top>");

 myWin.document.write("<img border=0 name=newwin src="+rout+">");

 myWin.document.write("</td></tr>");

 myWin.document.write("</table>");

 myWin.document.write("</body></html>");

 // закрыть документ - (но не окно!)

 myWin.document.close();  }

function shop_show1(id)

{

	/*y1=document.getElementById(id).offsetTop;
	x1=document.getElementById(id).offsetLeft;

	ypos=y+document.body.scrollTop;

	xpos=x+document.body.scrollLeft;

	y1=y1+1;
	x1=x1+1;
	alert(""+(document.getElementById(id).style.top)+"="+(document.getElementById(id).style.left)+"");*/

	document.getElementById(id).style.display = '';

	//document.getElementById(id).style.top = document.getElementById(id).offsetTop+document.body.scrollTop-46;

	//document.getElementById(id).style.left = (document.getElementById(id).offsetLeft+document.body.scrollLeft-200)*(-1);

}




function shop_over(id)
{
	//alert(id);
	//document.getElementById(id).style.display = 'none';
}

function shop_out(id)
{
	alert(id);
}
