function SwitchCurrency(newcurrency){
	var msgWindow = window.open ("/switch_currency.asp?currency="+newcurrency, "SwitchCurrency", "height=100,width=100,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,replace=true");
}

function PopupPicture(id, w, h){
	var x,y;
	x=Math.floor((screen.width-w)/2);
	y=Math.floor((screen.height-h)/2);
	var msgWindow = window.open ("/picture.asp?id="+id, "ProductPicture", "height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,left="+x+",top="+y,"replace=true");
	if (msgWindow != null && msgWindow.opener == null) msgWindow.opener=window;
		if (navigator.appVersion.charAt(0) == 4) {
			msgWindow.focus();
		}
}
function AddToShoppingBag(control, SeriesID, ProductID){
	var x,y;
	x=Math.floor((screen.width - 200)/2);
	y=Math.floor((screen.height - 150)/2);
	if (control.checked == true){
		var msgWindow = window.open ("", "Bag", "height=150,width=200,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,left="+x+",top="+y,"replace=true");
		default_action = document.forms["Series_"+SeriesID].action;
		document.forms["Series_"+SeriesID].elements['id'].value=control.value;
		document.forms["Series_"+SeriesID].submit();
		bagcount++;
	}
	else{
		var msgWindow = window.open ("/bag/bag_remove.asp?id="+ProductID, "Bag", "height=150,width=200,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,left="+x+",top="+y,"replace=true");
		bagcount--;
	}
	if (document.all)
		document.all.bagcounter.innerHTML="<a href=/bag.asp class=basketmenu><strong>"+bagcount+"</strong>&nbsp;"+CorrectTermination(bagcount) + "</a>";
	else
		document.location.reload();
	if (msgWindow != null && msgWindow.opener == null) msgWindow.opener=window;
	if (navigator.appVersion.charAt(0) == 4) {
			msgWindow.focus();
	}
}
function CorrectTermination(c){
	var str = ""+c;
	last_digit = str.substring(str.length-1,str.length)
	root = "наименован"
	if (c>=5 && c<21){
		return root+"ий";
	}
	else{
		if (last_digit=="1")
			return root+"ие";
		if (last_digit=="2" || last_digit=="3" || last_digit=="4")
			return root+"ия";
		return root+"ий";
	}
}

function ChangeYear(control, scriptname, group, vendor){
	selected_item = control.selectedIndex;
	val = control.options[selected_item].value;
	document.location = scriptname+"?g="+group+"&v="+vendor+"&year="+val;
}

