function _ExpandMenus(img, row, path)
{
	if (row.style.display == '')
	{
		img.src = path + '/shop/leftnav/butArrowClosed4x7.gif';
		row.style.display = 'none';
	}
	else
	{
		img.src = path + '/shop/leftnav/butArrowOpen7x4.gif';
		row.style.display = '';
	}
}

function _ChangeCountryBasket(basketId, currentPage)
{
	var newCountry;
	newCountry = document.countrySelect.shipCountry.options[document.countrySelect.shipCountry.selectedIndex].value;
	if (basketId == '')
	{
		window.location.href = "/Basket/xt_corpEmptyBasketReset.asp?country=" + newCountry  + "&PageName=" + currentPage;
	}
	else
	{
		window.location.href = '/Basket/ConvertBasket.asp?Country=' + newCountry + '&pageBack=' + currentPage; 
	}
}


function _OpenPopup(fileName, width, height, langId, shipTo){
	window.open('/popups/' + fileName + '?LangID=' + langId + '&ShipTo=' + shipTo, 'PopUp', 'status=no,width=' + width + ',height=' + height + ',scrollbars=auto');
}


function _OpenSmallPartsPop(WarningType, langId, shipTo, inRichFx) {
	popup = window.open('/popups/safety_warning.asp?LangID=' + langId + '&ShipTo=' + shipTo + '&richfx=' + inRichFx + '&type=' + WarningType,'smallparts','status=no,width=500,height=470,scrollbars=no');
	
	if (!popup.opener)
		popup.opener = self;
}


function OpenAssetsPopup(Prod_Id, reqCatId, tabId, deptId, popType){
	var ss;
	ss='/popups/product_asset_popup.asp?p=' + Prod_Id + '&c=' + reqCatId + '&t=' + tabId + '&d=' + deptId + '&pType=' + popType;
	window.open(ss, null, "height=560,width=620,location=no,addressbar=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no"); 
}

function _Open360Popup(prodId, width, height, langId){	
	popup = window.open('/popups/360deg' + prodId + 'flash.asp?LangId=' + langId,'popup','status=no,width=' + width + ',height=' + height + ',scrollbars=no');
}


function OpenPopupNoDir(fileName, width, height){
	window.open(fileName,'PopUp','status=no,width=' + width + ',height=' + height + ',scrollbars=auto');
}

function OpenFrenchLEGOLANDPop() {
	window.open('/popups/fr_legoland_de.asp','legolandde','status=no,width=610,height=600,scrollbars=yes');
}	


function OpenCVVPop() {
	window.open('/popups/discover_cvv.asp','discover_cvv','status=no,width=420,height=520,scrollbars=auto');
}	

function OpenWhatIsLimitedQuantity(maxQty){
	window.open('/popups/limitedQuantity.asp?maxQty=' + maxQty,'limitedQuantity','status=no,width=345,height=395,scrollbars=no')
}

function OpenEmailFriendPop(prodId){	
	popup = window.open('/popups/emailAFriend.asp?p=' + prodId ,'popup','status=no,width=400,height=680,scrollbars=no');
}

function OpenEmailFriendPopWithAlert(prodId,errMsg){	
	if(document.frmDimension.ddlDimension.selectedIndex>0)
	{
		popup = window.open('/popups/emailAFriend.asp?p=' + prodId ,'popup','status=no,width=400,height=680,scrollbars=no');
	}
	else
	{
		alert(errMsg);
	}
}
function SetDimensionSku()
{
	var Sku;
	var url;
	sku = document.frmDimension.ddlDimension.options[document.frmDimension.ddlDimension.selectedIndex].value;
	if(document.frmProduct != null)
		document.frmProduct.sku.value=sku;
	if(document.frmWish != null)
		document.frmWish.sku.value=sku;
	document.frmDimension.skuid.value=sku;
	document.frmDimension.submit();
}

function AddToBasket(errMsg)
{
	if(document.frmDimension.ddlDimension.selectedIndex>0)
	{
		return true;
	}
	else
	{
		alert(errMsg);
		return false;
	}
}

function OpenCatalog(prodId){	
	popup = window.open('/ProductSmallMain.asp?p=' + prodId ,'popup','status=no,width=680,height=400,scrollbars=no');
}


function closePopupWindow(){
	var detect = navigator.userAgent.toLowerCase();
	var browser;
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		return place;
	}
	if (checkIt('win'))
	{		
		if (checkIt('msie'))
		{
			parent.parent.closePopUp();
		}else{
			top.window.close();
		}
	}else{
		if (checkIt('safari'))
		{
			top.window.close();		
		}else{
			parent.parent.closePopUp();
		}
	}

}
