function changePhoto(src){
	document.getElementById('_main_photo').src = src;
}
function wopen(imgName, w , h, Title)
{
	var wo = window.open("", "abc", "width = " + w + " , height = " + h + ", scrollbars=0, status=0");
	wo.document.open();
	var win = "";
	win = "<html><head><title>";
	win += Title;
	win += "</title></head>"
	win += "<body bgcolor='#000' leftmargin='0' topmargin='0' rightmargin='0' bottommargin='0' marginwidth='0' marginheight='0'>";
	win += "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center'>";
	win += "<a href='#' onClick='self.window.close();'><img src='" + imgName + "' width='" + w + "' height='" + h + "' border='0' alt='" + Title + "'></a>";
	win += "</td></tr></table>";
	win += "</body></html>";
	w += 13;
	h += 32;
	wo.window.resizeTo(w, h);
	wo.document.write(win);
	wo.window.focus();
	wo.document.close();	
}

function wopen3 (obj){
 var wo = window.open("", "abc", "width=10, height=10, scrollbars=0, status=0");
 wo.document.open();
 var win = "";
 win = "<html><head>";
 win += "<title>Image</title>";
 win += "<script>function resizes (obj){";
 win += "var w=obj.width, h=obj.height;";
 win += "window.resizeTo (w+10, h+46);";
 win += "}</"+"script"+">";
 win += "<style type='text/css'> * {margin:0; padding:0; border:0; } </style> </head>"
 win += "<body>";
 win += "<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td align='center'>";
 win += "<img src='" + obj + "' alt='' onload='resizes(this)' />";
 win += "</td></tr></table>";
 win += "</body></html>";
 wo.document.write(win);
 wo.window.focus();
 wo.document.close();
}

function showMenu(id){
    document.getElementById(id).style.display = 'block';
}

function hideMenu(id){
    document.getElementById(id).style.display = 'none';
}
function showSections(id){
    id = '#' + id;
    $(id + ' .caption .title').toggleClass('active');
    $(id + ' .caption .text').toggle();
    $(id + ' .caption .collapse').toggle();
    $(id + ' .sections').toggle();
}
function showSection(id){
    id= '#' + id;
    $(id).toggleClass('active');
    $(id + ' .text').toggle();
}
function showAll(id){
    id= '#' + id;
    if ($(id + ' .caption .collapse a').attr('showall')=='no'){
        $(id + ' .sections .text').show();
        $(id + ' .sections .item').addClass('active');
        $(id + ' .caption .collapse a').text('Свернуть');
        $(id + ' .caption .collapse a').attr('showall', 'yes');

    }else{
        $(id + ' .sections .text').hide();
        $(id + ' .sections .item').removeClass('active');
        $(id + ' .caption .collapse a').text('Развернуть');
        $(id + ' .caption .collapse a').attr('showall', 'no');
    }

}

function showCar(src) {
	var oPhoto = document.getElementById('collage');
	oPhoto.src = src;

}

function outBlock(src) {
	var oPhoto = document.getElementById('collage');
	oPhoto.src = src;

}

//установка формы
function setSendForm() {
	var nowDate = new Date();	
	nowDate.setTime(nowDate.getTime() + 1 * 24 * 60 * 60 * 1000);
	setDaySendForm(nowDate);
	setTimeSendForm(nowDate);
}

//установка предполагаемой даты
function setDaySendForm(nowDate) {
	Day = nowDate.getDate();
	document.forms[0].PDay.options[Day-2].selected=true;
	Month = nowDate.getMonth() ;
	document.forms[0].PMonth.options[Month].selected=true;
	Year = nowDate.getFullYear();
	document.forms[0].PYear.options[Year-2010].selected=true;    
}

//установка предполагаемого времени
function setTimeSendForm(nowDate) {
	if (document.forms[0].PHour) {
		Hour = nowDate.getHours();
		//добавляем три часа - по условию задачи
		NewHour = Hour + 3;
		//если получилось слишком рано - ставим 9 утра
		if (NewHour < 9 ) NewHour = 9;
		//если получилось слишком поздно
		if (NewHour > 19) {
			//по умолчанию - утром
			NewHour = 9;
			//переносим "на завтра"
			nowDate.setTime(nowDate.getTime() + 1 * 24 * 60 * 60 * 1000);
			setDaySendForm(nowDate);
		}
		document.forms[0].PHour.options[NewHour-9].selected=true;
	}
}
