function openVidWindow(height,width,scrolling)
{
	url='/vidlib/snapcap.phtml';
	window.open(url,"shiffler_popup","status,height="+height+",width="+width+",scrollbars="+scrolling+",resizable=no,toolbar=0");
}
function openProdWindow(type)
{
	//alert(type);	
	if (type == 'sendFriend')
	{
		//url='/checkout/confirmOrder.phtml?p=1';
		url='/popup/friendSend.phtml'
		options='toolbar=0,location=0,menubar=0,width=400,height=400'
		newWindow=window.open(url,'a',options);
		newWindow.focus();
		//newWindow.print();
	}
	else if (type == 'printProductDetail')
	{
		url=location.href+"?print=1";
		options='toolbar=0,location=0,scrollbars=1,menubar=0,width=800,height=600'
		newWindow=window.open(url,'a',options);
		newWindow.focus();
	
	}
	
}
function openColorChart(color_chart,pin,height,width,scrolling)
{
        url='/popup/color_chart.phtml?id='+color_chart+'&pin='+pin;
        window.open(url,"shiffler_popup","status,height="+height+",width="+width+",scrollbars="+scrolling+",resizable=no,toolbar=0");

}
function change_options(offset,current_value,current_choice)
{
	if (current_value != '')
	{
		f=document.forms['product_detail'];
		current_string='';
		var display_new = Array(possible_options.length);
		for (i=0;i<offset+1;i++)
		{
			current_string=current_string+f.elements['option'+i].value+",";
				
		}
		//alert(current_string);
		count=0;
		for(i=0;i<possible_options.length;i++)
		{
			temp_string='';
	
			temp=possible_options[i].split(",");
			
			for(zz=0;zz<offset+1;zz++)
			{
			
					
				temp_string=temp_string+temp[zz] + ",";	
				
			}
			
			
			//need to find out if this possible_options matches the current string
			if (temp[offset] == current_value)
			{
				//alert(temp_string + " => " . current_string);
				if (temp_string == current_string)
				{
					if (!contains(display_new,temp[offset+1]))
					{
						
						display_new[count]=temp[offset+1];
						count=count+1;
					}
				}				
			}
		}

		
		
		
		
		
		
		temp=offset+1;
		temp_count=0;
		
		if (f.elements['option'+temp])
		{
			for(i=0;i<display_new.length;i++)
			{
			
				if (display_new[i]  != undefined)
				{
					
					
					
					
					
					f.elements['option'+temp].options[0] = new Option('',0);
					f.elements['option'+temp].options[0].selected=true;
					f.elements['option'+temp].options[i+1] = new Option(display_new[i],display_new[i]);			
					temp_count++;
		
				
				}	
				
			}
			f.elements['option'+temp].options.length=temp_count+1;
			/* need to clear out the other option fields*/
			for (i=offset+2;i<12;i++)
			{
				
				if (f.elements['option'+i])
				{
					f.elements['option'+i].options.length=1;
					f.elements['option'+i].options[0] = new Option('',0);
					
					
				}
				
				
			}	
		}		
	}	
}
function contains(a, e) {
	for(j=0;j<a.length;j++)if(a[j]==e)return true;
	return false;
}
function verify_add_cart(f)
{
	
	if (f.action2.value == 'request_price')
	{
		
		if (f.cfp_name.value == '')
		{
			alert("Please enter your name.");
			f.cfp_name.focus();
			return false;	
			
			
		}
		if (!check_email_address(f.cfp_email_address.value,f,"cfp_email_address"))
		{
			return false;
		}
		if (!check_phone_number(f.cfp_daytime_phone.value,f,"cfp_daytime_phone"))
		{
			return false;
		}
		if (!check_zip_code(f.elements['cfp_zip_code'].value,5,f,"cfp_zip_code"))
			return false;
			
		if (f.elements['cfp_address'])
		{
			
			if (f.cfp_address.value == '')
			{
				alert("Please enter your address.");
				f.cfp_address.focus();
				return false;	
				
				
			}
			if (f.cfp_city.value == '')
			{
				alert("Please enter your city.");
				f.cfp_city.focus();
				return false;	
				
				
			}
			if (f.cfp_state.value == '')
			{
				alert("Please enter your state.");
				f.cfp_state.focus();
				return false;	
				
				
			}
				
			
		}
		
	}
	//alert(f.elements['quantity'].value);
	var quantity_reg_exp=/^\d{1,}$/
	if (quantity_reg_exp.exec(f.quantity.value) == null)
	{
		alert("Please enter a number for quantity.");
		
		f.quantity.focus();
		return false;
	}
	if (f.number_of_select_boxes.value > 0 && f.elements['pcode'].value == '')
	{

		dropdown_descriptions=f.detail_options.value.split(",");
		
		for (i=0;i<f.number_of_select_boxes.value;i++)
		{
			
			if (f.elements['option'+i].value == '' || f.elements['option'+i].value == 0)	
			{
				alert("Please choose a " + dropdown_descriptions[i] + ".");
				f.elements['option'+i].focus();
				return false;	
				
				
			}
		}
			
	}
	if (f.elements['pcode'].value != '')
	{
		dropdown_descriptions=f.detail_options.value.split(",");
		for (i=0;i<f.number_of_select_boxes.value;i++)
		{
			
			if (f.elements['option'+i].value == '' || f.elements['option'+i].value == 0)	
			{
				alert("Please choose a " + dropdown_descriptions[i] + ".");
				f.elements['option'+i].focus();
				return false;	
				
				
			}
		}
		
	}
	//if (f.elements['clicked_add_to_cart'].value == 'Y')
	//	f.submit();
	
}

