

	function fnNavigate(url)
	{
		for(i=0;i<document.all.length;i++)
		{
		    if(document.all(i).tagName=="IFRAME")
		    {
				document.all(i).contentWindow.location = url
		    }
		}
	}

	function fnSearch()
	{
		var objSearch = document.getElementById('searchMain')
		//alert(objSearch.value)
		fnNavigate('webshaper/pcm/user/searchProduct.asp?searchText=' + objSearch.value)
	}




	imagename='';
	productItemName='';
	function enlarge(imgnme, productItemNameInput) {
		lrgewin=window.open("about:blank","","height=200,width=200,scrollbars=yes")
		imagename=imgnme;
		productItemName = productItemNameInput;
		setTimeout('update()',500)
	}


	function update() {
		doc=lrgewin.document;
		doc.open('text/html');

		var str = '<HTML><HEAD><TITLE>' + productItemName + '</TITLE></HEAD>' + 
				'<BODY bgcolor="white" onLoad="if (self.resizeTo)self.resizeTo((document.images[0].width+50),(document.images[0].height+150))" topmargin="10px" leftmargin="10px" rightmargin="10px" bottommargin="10px">' + 
				'<table width="' + document.images[0].width + '" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" >' + 
				'<IMG SRC="' + imagename + '" style="border:1px solid #aaa;" ></td></tr>' + 
				'<tr>' + 
				'<td>' + 
				'	<img src="/theme/images/AA-logo-75.gif" />' + 
				'</td>' +
				'<td><form name="viewn"><input type="image" src="../0img/close.gif" align="right" value="Close Window" onClick="self.close()"></td></tr></table>' + 
				'</form></BODY></HTML>';

		doc.write(str);	


		doc.close();
	}


	//author-yip
	//date: 13 june 05
	//InsertCart - sends item to shoppping cart
	//				1) For each product, check if compulsory product option selected
	//				2) submit to viewCart.asp
	function InsertCartViewProd()
	{
		var f = document.FormViewProd
		
		bQtyEntered = false;

		for(i=0; i<f.TotalProduct.value; i++)
		{
			//1. Check if qty is valid
			var bQtyValid;
			
			if (parseInt(f.TotalProduct.value) > 1)
			{

				var objQtyProduct = eval('f.qtyProduct' + i)
			
				
				if(objQtyProduct.length)	//drop down list
				{
					if(objQtyProduct.options.selectedIndex > 0)
					{
						bQtyValid = true;
					}

				}
				else
				{
					if(isIntPositive(objQtyProduct.value)) bQtyValid = true;
					
				}
			}
			else if(parseInt(f.TotalProduct.value) == 1)
			{
				bQtyValid = true;
			}
			
			if(bQtyValid)
			{
				bQtyEntered = true;

				var objPKProduct = eval('f.iPKProduct' + i)
				
				totalProductOpt = eval('f.TotalProdOpt_' + objPKProduct.value)
				
				if(totalProductOpt)
				{
					//alert('totalProductOpt=' + totalProductOpt.value)
				
					for(j=0; j< totalProductOpt.value; j++)
					{
						//get pkOptGrps
						objProdOpt = eval('f.idProdOpt_' + objPKProduct.value + '_' + j)
						//alert('objProdOpt.value=' + objProdOpt.value)
						
						objProdOptChk = eval('f.idProdOptChk_' + objPKProduct.value + '_' + objProdOpt.value)
						//alert('objProdOptChk=' + objProdOptChk.value)
						
						objProdOptName = eval('f.idProdOptName_' + objPKProduct.value + '_' + objProdOpt.value)
						
						//if objProdOptChk.value = 1 then, must check whether product option is selected
						if(objProdOptChk.value == '1')
						{
							objProdOptAttrs = eval('f.idProdOptAttr_' + objPKProduct.value + '_' + objProdOpt.value)
							if(objProdOptAttrs.options.selectedIndex == 0 )
							{
								alert('Please select the product option \'' + objProdOptName.value + '\'')
								return;
							}
						}
					}
				}
			}

			
		}
		
		if(!bQtyEntered)
		{
			alert('Please enter quantity to add to cart.');
		}
		else
		{
			f.action = 'cartAddItem.asp'
			f.submit();	
		}

	}

	function GoTranslate()
	{
		var f = document.FormViewProd;
		
		var url = 'http://translate.google.com/translate?';
		
		var subUrl = 'u=' + encodeURIComponent(location.href) + '&' + 
					'langpair=' + encodeURIComponent(f.langpair.options[f.langpair.selectedIndex].value) + '&' + 
					'hl=' + encodeURIComponent(f.hl.value) + '&' + 
					'ie=' + encodeURIComponent(f.ie.value) + '&' +
					'oe=' + encodeURIComponent(f.oe.value) + '&' +
					'prev=' + encodeURIComponent(f.prev.value);
		
		
		var fullURL = url + subUrl;
		
		
		
		windowName = 'winTranslate';
		
		window.open(fullURL, windowName, 'top=100,left=100,height=400,width=750,location=no,resizable=yes,scrollbars=yes,status=yes');
		
		return false;
	
	}

	function SelectOption(imgInput, imgSrc, optionAlpha)
	{
		var objImg = document.getElementById(imgInput);

		objImg.src = imgSrc;


		if(optionAlpha == '1')
		{
			objImg.className = 'imgOptionFocus';
		}
		else if(optionAlpha == '0')
		{
			objImg.className = 'imgOptionBlur';
		}
	}