
  /* Modified by Alex Spooner, 2011-03-29 14:25:23 EST */
	
	function dspInfo(a,i)
	{
		if (a==1)
		{
			document.getElementById('bubble'+i).style.display = 'block';
		}
		else
		{
			document.getElementById('bubble'+i).style.display = 'none';
		}
	}
	
	function add2KitLoad(id,e)
	{
		ajaxLoad('add2KitResA','GET','/ajax/custom-kit.php','do=getsize&id='+id);
		document.body.style.cursor = 'progress';
		WMousePos(e);
	}
	
	function add2KitResA(res)
	{
		//alert(res);
		if (res)
		{
			result = true;
			arr = res.split('|');
			id = arr[0];
			curs = new Number(arr[1]);
			f = 'document.CustomizeForm.';
			qty = new Number(eval(f+'qty'+id).value);
			nxts = new Number(eval(f+'nxts').value);
			ps = new Number(eval(f+'ps').value);
			
			if (isNaN(qty))
			{
				result = false; 
				WMouseTalk('Quantity is not a number!');
			}
			else
			{
				ajaxLoad('add2KitResB','GET','/ajax/custom-kit.php','do=add2kit&id='+id+'&qty='+qty+'&curs='+curs);
			}
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function add2KitResB(res)
	{
		//alert(res);
		if (res)
		{
			arr = res.split('|');
			id = arr[0];
			curs = new Number(arr[3]);
			f = 'document.CustomizeForm.';
			qty = new Number(eval(f+'qty'+id).value);
			nxts = new Number(eval(f+'nxts').value);
			nxt = arr[4].split(',');
			ps = new Number(eval(f+'ps').value);
			pop = false;
			talk = '';
			
			if (arr[2]==ps && nxts==0)
			{
				document.getElementById('button_2').innerHTML = '<p class="inactive_button"><span></span></p>';
				document.getElementById('button_3').innerHTML = '<p class="normal_button"><a href="/instant-makeup-cart.html" target="_top" title="Add to Cart | ColoronPro.com"><span>Add to Cart</span></a></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				pop = true;
			}
			else if (arr[2]==ps)
			{
				document.getElementById('button_2').innerHTML = '<p class="active_button"><a href="/instant-makeup-'+eval(f+'nxts_link').value+'.html" target="_top" title="Upgrade to '+eval(f+'nxts_name').value+' | ColoronPro.com"><span>Upgrade to '+eval(f+'nxts_name').value+'</span></a></p>';
				document.getElementById('button_3').innerHTML = '<p class="normal_button"><a href="/instant-makeup-cart.html" target="_top" title="Add to Cart | ColoronPro.com"><span>Add to Cart</span></a></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				pop = true;
			}
			else if (arr[2]>ps && nxts!=0 && nxt[0]!=0)
			{
				document.getElementById('button_2').innerHTML = '<p class="active_button"><a href="/instant-makeup-'+nxt[2]+'.html" target="_top" title="Upgrade to '+nxt[1]+' | ColoronPro.com"><span>Upgrade to '+nxt[1]+'</span></a></p>';
				document.getElementById('button_3').innerHTML = '<p class="inactive_button"><span>Add To Cart</span></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				pop = true;
			}
			
			if (arr[2]>ps && (nxts==0 || nxt[0]==0))
			{
				document.getElementById('kit_count').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				eval(f+'add'+id).className = 'customize_update';
				document.getElementById('prodln'+id).className = 'customize_list_active';
				talk = 'Quantity is more than the pack limit!';
			}
			else if (arr[1]==1)
			{
				document.getElementById('kit_count').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				eval(f+'add'+id).className = 'customize_update';
				document.getElementById('prodln'+id).className = 'customize_list_active';
				eval(f+'add'+id).value = 'Update';
				talk = 'Added to Kit!';
			}
			else if (arr[1]==2)
			{
				document.getElementById('kit_count').innerHTML = '<p>Your kit’s contents: <strong>'+arr[2]+' Pair</strong></p>';
				eval(f+'add'+id).className = 'customize_addtokit';
				document.getElementById('prodln'+id).className = 'customize_list_normal';
				eval(f+'add'+id).value = 'Add to Kit';
				talk = 'Removed from Kit!';
			}
			else
			{
				talk = arr[2];
			}
			if (pop) showDPOP();
			else if (talk>'') WMouseTalk(talk);
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function checkKitLoad()
	{
		ajaxLoad('checkKitRes','GET','/ajax/custom-kit.php','do=getsize&id=none');
		document.body.style.cursor = 'progress';
	}
	
	function checkKitRes(res)
	{
		//alert(res);
		if (res)
		{
			arr = res.split('|');
			id = arr[0];
			curs = new Number(arr[1]);
			f = 'document.CustomizeForm.';
			nxts = new Number(eval(f+'nxts').value);
			nxt = arr[3].split(',');
			ps = new Number(eval(f+'ps').value);
			
			
			if (curs>ps && (nxts==0 || nxt[0]==0))
			{
				document.getElementById('button_2').innerHTML = '<p class="inactive_button"><span>Too Large Pack</span></p>';
				document.getElementById('button_3').innerHTML = '<p class="inactive_button"><span>Add To Cart</span></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+curs+' Pair</strong></p>';
				showDPOP();
			}
			else if (curs-ps==0 && nxts==0)
			{
				document.getElementById('button_2').innerHTML = '<p class="inactive_button"><span></span></p>';
				document.getElementById('button_3').innerHTML = '<p class="normal_button"><a href="/instant-makeup-cart.html" target="_top" title="Add to Cart | ColoronPro.com"><span>Add to Cart</span></a></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+curs+' Pair</strong></p>';
				showDPOP();
			}
			else if (curs-ps==0)
			{
				document.getElementById('button_2').innerHTML = '<p class="active_button"><a href="/instant-makeup-'+eval(f+'nxts_link').value+'.html" target="_top" title="Upgrade to '+eval(f+'nxts_name').value+' | ColoronPro.com"><span>Upgrade to '+eval(f+'nxts_name').value+'</span></a></p>';
				document.getElementById('button_3').innerHTML = '<p class="normal_button"><a href="/instant-makeup-cart.html" target="_top" title="Add to Cart | ColoronPro.com"><span>Add to Cart</span></a></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+curs+' Pair</strong></p>';
				showDPOP();
			}
			else if (curs>ps && nxt[0]>0)
			{
				document.getElementById('button_2').innerHTML = '<p class="active_button"><a href="/instant-makeup-'+nxt[2]+'.html" target="_top" title="Upgrade to '+eval(f+'nxts_name').value+' | ColoronPro.com"><span>Upgrade to '+nxt[1]+'</span></a></p>';
				document.getElementById('button_3').innerHTML = '<p class="inactive_button"><span>Add To Cart</span></p>';
				document.getElementById('kit_pairs').innerHTML = '<p>Your kit’s contents: <strong>'+curs+' Pair</strong></p>';
				showDPOP();
			}
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function quickSelect()
	{
		f = document.QuickSelectForm;
		cat = f.category.value;
		kit = f.kit.value;
		if (cat=='all' && kit=='all')
		{
			document.location = '/instant-makeup-kits.html';
		}
		else if (kit=='all')
		{
			document.location = '/instant-makeup-' + cat + '.html';
		}
		else if (kit!='all')
		{
			document.location = '/instant-makeup-' + kit + '.html';
		}
	}
	function quickSelectLoad()
	{
		f = document.QuickSelectForm;
		ajaxLoad('quickSelectRes','GET','/ajax/quick-select.php','id='+f.category.value);
		f.kit.options.length = 1;
		f.kit.options[0].value = 'all';
		f.kit.options[0].text = 'Loading...';
		document.body.style.cursor = 'progress';
	}
	
	function quickSelectRes(res)
	{
		//alert(res);
		if (res)
		{
			arr = res.split('|');
			obj = document.QuickSelectForm.kit;
			obj.options.length = arr.length;
			for (i=0;i<arr.length;i++)
			{
				k = arr[i].split(';');
				obj.options[i].value = k[0];
				obj.options[i].text = k[1];
			}
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function changeCountry()
	{
		obj = document.evipform;
		if (obj.CustCountry.value!='US')
		{
			document.getElementById('State').style.display = 'none'; 
			document.getElementById('Province').style.display = 'block';
		}
		else
		{
			document.getElementById('Province').style.display = 'none'; 
			document.getElementById('State').style.display = 'block'; 
		}
	}
	
	function calcTotalLoad(e)
	{
		obj = document.CheckOutForm;
		ajaxLoad('calcTotalRes','POST','/ajax/calc-total.php','items='+document.getElementById('ItemPrice').innerHTML+'&tax='+obj.CustState.value+'&zip='+obj.CustZip.value+'&country='+obj.CustCountry.value+'&ship='+obj.ShipType.value+'&coupon='+obj.OrdCoupon.value);
		document.body.style.cursor = 'progress';
		WMousePos(e);
		WMouseTalk('<span>Calculating Total...</span>');
	}

	function calcTotalRes(res)
	{
		//alert(res);
		if (res)
		{
			obj = document.CheckOutForm;

			arr = res.split('|');
			document.getElementById('TaxPrice').innerHTML = arr[0];
			document.getElementById('ShippingPrice').innerHTML = arr[1];
			arr2 = arr[2].split(';');
			document.getElementById('CouponResult').innerHTML = arr2[0];
			document.getElementById('DiscountPrice').innerHTML = arr2[1];
			document.getElementById('TotalPrice').innerHTML = arr[3];

			obj.ShipType.options[0].text = 'Ground ($'+arr[4]+')';
			obj.ShipType.options[1].text = 'Priority ($'+arr[5]+')';
			obj.ShipType.options[2].text = 'International ($'+arr[6]+')';
			
			if (obj.CustCountry.value!='US')
			{
				document.getElementById('State').style.display = 'none'; 
				document.getElementById('Province').style.display = 'block';
				obj.ShipType.options[2].selected = true;
				obj.ShipType.disabled = true;
			}
			else
			{
				document.getElementById('Province').style.display = 'none'; 
				document.getElementById('State').style.display = 'block';
				if (arr[7]==1)
				{
					obj.ShipType.options[2].selected = true;
					obj.ShipType.disabled = true;
				}
				else
				{
    			if (obj.whlslr.value==1) {
  					obj.ShipType.options[0].selected = true;
  					obj.ShipType.disabled = true;
          } else {
  					if (obj.ShipType.selectedIndex>1) obj.ShipType.options[0].selected = true;
  					obj.ShipType.disabled = false;
          }
				}
			}

			WMouseTalk('<span>Total updated!</span>');
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function calcBuyLoad(e)
	{
		obj = document.CheckOutForm;
		ajaxLoad('calcBuyRes','POST','/ajax/calc-buy.php','items='+document.getElementById('ItemPrice').innerHTML+'&tax='+obj.CustState.value+'&zip='+obj.CustZip.value);
		document.body.style.cursor = 'progress';
		WMousePos(e);
		WMouseTalk('<span>Calculating Total...</span>');
	}

	function calcBuyRes(res)
	{
		//alert(res);
		if (res)
		{
			obj = document.CheckOutForm;

			arr = res.split('|');
			document.getElementById('TaxPrice').innerHTML = arr[0];
			document.getElementById('TotalPrice').innerHTML = arr[1];
			
			WMouseTalk('<span>Total updated!</span>');
		}
		else
		{
			alert('Internal Error!');
		}
		document.body.style.cursor = 'default';
	}
	
	function chkWait()
	{
		document.getElementById('chkimg').style.display = 'none'; 
		document.getElementById('working').style.display = 'block'; 
	}

	function changeFocus(id)
	{
		arr = document.getElementById('Ids').innerHTML.split('|');
		for (i=0;i<arr.length;i++)
		{
			document.getElementById(arr[i]).className = 'retail_data_passive';
		}
		document.getElementById(id).className = 'retail_data_active';
	}
