
$(function(){
   $(".ProductType").change(function()
		{
							 
		   var st_v=$(this).attr("value");//5066=wire and cable
			 if (st_v==-1 || st_v!=5066 ) 
			 {
				
				 $(".ProductFamily").attr("disabled","");
				  
			 }
			 else{
				
				  $(".ProductFamily").attr("disabled","disabled");//need to be close and open the product
				  $(".Product").attr("disabled","");//openning the program
				  $(".Product").load("/GetProduct.asp",{"id":st_v})
			 }
			 
			 $(".ProductFamily").load("/GetProductFamily.asp",{"id":st_v},function(data)
				{
					if(!data.match("<option"))
						{
							
							$(".ProductFamily").attr("disabled","disabled");
						  	$(".ProductFamily").html("<option>&nbsp;&nbsp;&nbsp;>></option>");
							$(".Product").load("/GetProduct.asp",{"id":data},function()
								{
									$(this).change(function()
										{
											$("#GoBtn").attr("href",$(this).attr("value")).attr("target","_blank");
										 })
								})										 
																													 
																													 
					}else{
																													 
						//Disabled 34d select when change product
						//$(".Product").attr("disabled","disabled");
						$(".Product").html("<option>Select...</option>");
						///////
						$("#GoBtn").attr("href","#").attr("target","");													 
						///////
																			 
						$(".ProductFamily").change(function()
							{	
															
							 ///////
							$("#GoBtn").attr("href","#").attr("target","");													 
							///////							
																					
							 var st_v=$(this).attr("value");
							 if (st_v>-1) {
							 	$(".Product").attr("disabled","");
							 }else{
													 
								// even if no results: enable the select 
							  
								$(".Product").attr("disabled","disabled");
								$("#GoBtn").attr("href",$(this).attr("value")).attr("target","_blank");
							 }
							 
							 $(".Product").load("/GetProduct.asp",{"id":st_v},function()
								 {
								   $(this).change(function()
										{
										 $("#GoBtn").attr("href",$(this).attr("value")).attr("target","_blank");
										})
								 })
																									
							 });
						}														 
					});
				});	
		   });