function show_pr(prid) {
	document.all.show_pr_frm.id.value = prid;
	document.all.show_pr_frm.submit();
}
function showbig(im_name) {
	window.open('/bigwin.asp?im='+im_name, null,'height=300, width=300, status=1, toolbar=0, menubar=0, location=0, resizable=1, scrollbars=0',false);
}
var bigPic = null;

function ShowBigPicture(url,width,height) {
	if (null != bigPic) bigPic.close();
	bigPic = window.open(url,"bigPic",'width='+eval(width)+',height='+eval(height)+',status=no,toolbar=no,menubar=no,location=no,resizable=no',false);
	return false;
}


function changeLang2() {
	objSelect = document.getElementById("languageSelect");
	if(objSelect) {
		objSelect.selectedIndex = 0;
	}
}

function changeLang(objSelect){
	langId = objSelect.options[objSelect.selectedIndex].value;
	elementStr = "shopElement";
	
	childr = document.getElementById("shopContent").childNodes;
	childrlength = childr.length;
	
	for(i = 0; i < childr.length; i++){
		chld = childr.item(i);
		if(chld.className == "simpleDiv" && chld.id != "shopElement"){
			chld.className = "hiddenDiv";
		}
	}
	
	elem = document.getElementById(elementStr + langId);
	while(elem != null){
		//elem.style.display = "block";
		elem.className = "simpleDiv";
		elem.id = elementStr + "R";
		elem = document.getElementById(elementStr + langId);
	}

	elem = document.getElementById(elementStr + "R");
	while(elem != null){
		document.getElementById(elementStr + "R").id = elementStr + langId;
		elem = document.getElementById(elementStr + "R");
	}
}

function changeLang3() {
	changeLang2();
	changeLang(document.getElementById("languageSelect"));
}

function changeBackground(elem) {
	elem.style.backgroundColor = '#9DBAE8';
}
function restoreBackground(elem) {
	elem.style.backgroundColor = '#B7C9E6';
}

function buttonOver(objButton){
	objButton.style.backgroundColor = '#9DBAE8';
	//objButton.className = 'shopButttonActive';
}
function buttonOut(objButton){
	objButton.style.backgroundColor = '#B7C9E6';
	//objButton.className = 'shopButtton';
}





var SectionUnrollText = "Развернуть все";
var SectionRollupText = "Свернуть все";
var SubSectionUnrollText = "&#128;";
var SubSectionRollupText = "&#126;";

/*
var unrollarrow = new Image();
unrollarrow.src = "/images/unrollarrow.gif";

var rolluparrow = new Image();
unrollarrow.src = "/images/rolluparrow.gif";
*/
/*
var unrollarrow = document.createElement( "img" );
unrollarrow.setAttribute( "src", "/images/unrollarrow.gif" );

var rolluparrow = document.createElement( "img" );
rolluparrow.setAttribute( "src", "/images/rolluparrow.gif" );
/*rolluparrow.setAttribute( "class", "rollupdown" );*/

function isRollupSection(eventHolder) {
	var sectionElement, subSectionElement;
	
	sectionElement = eventHolder;
	while (sectionElement && sectionElement.tagName != "H1") {
		sectionElement = sectionElement.previousSibling;
	}
	
	subSectionElement = sectionElement.nextSibling;
	while (subSectionElement && subSectionElement.tagName != "H1") {
		if (subSectionElement.tagName == "H2" && subSectionElement.className != "hiddenproductlistheader") {
			return (false);
		}
		
		subSectionElement = subSectionElement.nextSibling;
	}
	
	return (true);
}

function changeSectionRollText(eventHolder, rollText) {
	var sectionElement, connectedRollText;
	
	sectionElement = eventHolder;
	while (sectionElement && sectionElement.tagName != "H1") {
		sectionElement = sectionElement.previousSibling;
	}
	
	connectedRollText = sectionElement.lastChild;
	connectedRollText.innerHTML = rollText;
}

function hideSection(eventHolder) {
	var sectionElement, connectedRollText;
	
	sectionElement = eventHolder;
	while (sectionElement && sectionElement.tagName != "H1") {
		sectionElement = sectionElement.previousSibling;
	}
	
	connectedRollText = sectionElement.lastChild;
	
	subSectionElement = sectionElement.nextSibling;
	while (subSectionElement && subSectionElement.tagName != "H1") {
		if (subSectionElement.tagName == "H2") {
			hideSubSection(subSectionElement);
		}
		
		subSectionElement = subSectionElement.nextSibling;
	}
	
	connectedRollText.innerHTML = SectionUnrollText;
}

function showSection(eventHolder) {
	var sectionElement, connectedRollText;
	
	sectionElement = eventHolder;
	while (sectionElement && sectionElement.tagName != "H1") {
		sectionElement = sectionElement.previousSibling;
	}
	
	connectedRollText = sectionElement.lastChild;
	
	subSectionElement = sectionElement.nextSibling;
	while (subSectionElement && subSectionElement.tagName != "H1") {
		if (subSectionElement.tagName == "H2") {
			showSubSection(subSectionElement);
		}
		
		subSectionElement = subSectionElement.nextSibling;
	}
	
	connectedRollText.innerHTML = SectionRollupText;
}

function hideSubSection(eventHolder) {
	var connectedRollText, connectedList;
	connectedRollText = eventHolder.lastChild;
	
	connectedList = eventHolder.nextSibling;
	while (connectedList.nodeType == 3) {
		connectedList = connectedList.nextSibling;
	}
	
	if (connectedList.className != "hiddenproductlist") {
		connectedList.className = "hiddenproductlist";
		connectedRollText.innerHTML = SubSectionUnrollText;
		eventHolder.className = "hiddenproductlistheader";
	}
}

function showSubSection(eventHolder) {
	var connectedRollText, connectedList;
	connectedRollText = eventHolder.lastChild;
	
	connectedList = eventHolder.nextSibling;
	while (connectedList.nodeType == 3) {
		connectedList = connectedList.nextSibling;
	}
	
	if (connectedList.className == "hiddenproductlist") {
		connectedList.className = null;
		connectedRollText.innerHTML = SubSectionRollupText;
		eventHolder.className = null;
	}
}

function hideshowSection(eventHolder) {
	connectedRollText = eventHolder.lastChild;
	
	if (connectedRollText.innerHTML == SectionRollupText) {
		hideSection(eventHolder);
	}
	else {
		showSection(eventHolder);
	}
}

function hideshowSubSection(eventHolder) {
	var connectedRollText, connectedList;
	connectedRollText = eventHolder.lastChild;
	
	connectedList = eventHolder.nextSibling;
	while (connectedList.nodeType == 3) {
		connectedList = connectedList.nextSibling;
	}
	
	if (connectedList.className != "hiddenproductlist") {
		connectedList.className = "hiddenproductlist";
		connectedRollText.innerHTML = SubSectionUnrollText;
		eventHolder.className = null;
		eventHolder.className = "hiddenproductlistheader";
		
		if (isRollupSection(eventHolder)) {
			changeSectionRollText(eventHolder, SectionUnrollText);
		}
	}
	else {
		connectedList.className = null;
		connectedRollText.innerHTML = SubSectionRollupText;
		eventHolder.className = null;
		
		changeSectionRollText(eventHolder, SectionRollupText);
	}
}

function hideAllSection() {
	var allProductsContainer, sectionElement;
	
	allProductsContainer = document.getElementById("allproductslist");
	if (allProductsContainer) {
		sectionElement = allProductsContainer.firstChild;
		
		while (sectionElement) {
			if (sectionElement.tagName == "H1") {
				
				sectionElement.innerHTML += "<a href=\"#\" class=\"rollupdown\" onclick=\"return(false)\">" + SectionUnrollText + "</a>";
				
				subSectionElement = sectionElement.nextSibling;
				while (subSectionElement && subSectionElement.tagName != "H1") {
					if (subSectionElement.tagName == "H2") {
						subSectionElement.innerHTML += "<div class=\"rollupdown\">" + SubSectionUnrollText + "</div>";
					}
					
					subSectionElement = subSectionElement.nextSibling;
				}
				
				hideSection(sectionElement);
				
			}
			
			sectionElement = sectionElement.nextSibling;
		}
	}
}

function hideAllSubSection() {
	var allProductsContainer, subSectionElement;
	
	allProductsContainer = document.getElementById("allproductslist");
	if (allProductsContainer) {
		subSectionElement = allProductsContainer.firstChild;
		
		while (subSectionElement) {
			if (subSectionElement.tagName == "H2") {
				subSectionElement.innerHTML += "<div class=\"rollupdown\">" + SubSectionUnrollText + "</div>";
				hideSubSection(subSectionElement);
			}
			
			subSectionElement = subSectionElement.nextSibling;
		}
	}
}

function showSelectedSubsection() {
	var subsection = document.getElementById(location.hash.replace("#", ""));
	
	if (subsection) {
		showSubSection(subsection);
	}
}



function setCoverMargin() {
	productCover = document.getElementById("productcover");
	productText = document.getElementById("productdescription");
	productCoverContainer = document.getElementById("covercontainer");
	
	alert(productCover.clientWidth + "px");
	
	productText.style.paddingLeft = productCover.clientWidth + "px";
	productCover.style.marginLeft = "-" + productCover.clientWidth + "px";
	productCoverContainer.style.width = productCover.clientWidth + "px";
	
	//alert(productCover.clientWidth);
	
}

resString1 = "имя";
resString2 = "e-mail";
function anonsSubscr2(){
	userSubscrName = document.forms["anonsSubscr"].elements["userSubscrName"].value;
	userSubscrEmail = document.forms["anonsSubscr"].elements["userSubscrEmail"].value;
	userSubscrCityId = document.forms["anonsSubscr"].elements["userSubscrCityId"].value;
	if((userSubscrName != "" && userSubscrName != resString1) &&
		(userSubscrEmail != "" && userSubscrEmail != resString2) &&
		userSubscrCityId != 0){
		
		document.forms["anonsSubscr"].submit();
	}
	else{
		window.alert("Все поля обязательны для заполнения!");
	}
}

function anonsSubscrChangeSelect(obj){
	if(obj.options[0].value == "0"){
		obj.options[0] = null;
		obj.options[0].selected = true;
	}
}

function anonsSubscrInputFocus(obj){
	if((obj.value == resString1 && obj.name == "userSubscrName") || (obj.value == resString2 && obj.name == "userSubscrEmail")){
		obj.value = "";
	}
}

function anonsSubscrInputBlur(obj){
	if(obj.value == ""){
		if(obj.name == "userSubscrName"){
			obj.value = resString1;
		}
		if(obj.name == "userSubscrEmail"){
			obj.value = resString2;
		}
	}
}

/*window.onload = hideAllSection;*/


