function load_calculation(cal,mem_type,cat,crewSubcat,supportSubcat,crew_sub_id,support_sub_id,other_items,discount)
{	
	if(cal!="")
	  {
		  var prices = cal.split(",")	
		  for(j=0;j<prices.length ;j++)
			{			    
				if(j==0)
				{
				 document.getElementById("crew_subtotal").innerHTML	= prices[j]
				 document.registration_step2.h_crew_subtotal.value = prices[j]
				}
				else if(j==1)
				{
				 document.getElementById("support_subtotal").innerHTML	= prices[j]
				 document.registration_step2.h_support_subtotal.value = prices[j]
				}
				else if(j==2)
				{
				 document.getElementById("membership_subtotal").innerHTML	= prices[j]
				 document.registration_step2.h_membership_subtotal.value = prices[j]
				}
				else if(j==3)
				{
				 document.getElementById("total").innerHTML	= prices[j]
				 document.registration_step2.h_total.value = prices[j]
				}
				else if(j==4)
				{
				 document.getElementById("photo_subtotal").innerHTML = prices[j] 
				 document.registration_step2.h_photo_subtotal.value = prices[j]
				}
				else if(j==5)
				{
					
				 document.getElementById("video_subtotal").innerHTML = prices[j] 
				 document.registration_step2.h_video_subtotal.value = prices[j]
				}
				/*else if(j==6)
				{					
				 document.getElementById("alert_subtotal").innerHTML	= prices[j]
				 document.registration_step2.h_alert_subtotal.value = prices[j]
				}*/
				else if(j==7)
				{
				 document.getElementById("light_subtotal").innerHTML	= prices[j]
				 document.registration_step2.h_light_subtotal.value = prices[j]
				}
				else if(j==8)
				{
				 document.getElementById("overall_subtotal").innerHTML	= prices[j] 
				 document.registration_step2.h_overall_subtotal.value = prices[j]
				}
			}		
			display_fee();
			
			 //document.getElementById("light_subtotal").innerHTML ="$18";
			//document.getElementById("overall_subtotal").innerHTML="$18";
	  }
	 
	 if(mem_type!="")
	  {		
	        chk_val = mem_type
			if (chk_val == "Crew Basic" || chk_val == "Crew Premium" || chk_val == "Support Basic" || chk_val == "Support Premium")
			{ 		    
			document.getElementById("sub_cat_crew").style.display = ''
			document.getElementById("sub_cat_support").style.display = ''	
			}
			else if (chk_val == "Cast Basic" || chk_val == "Cast Premium" || chk_val == "Locations Basic" || chk_val == "Locations Premium" || chk_val == "Lodging Basic" || chk_val == "Lodging Premium" || chk_val == "Furnished Rentals Basic" || chk_val == "Furnished Rentals Premium" || chk_val == "Real Estate Basic" || chk_val == "Real Estate Premium" || chk_val == "Dining Basic" || chk_val == "Dining Premium" )
			{
			document.getElementById("sub_cat_crew").style.display = 'none'
			document.getElementById("sub_cat_support").style.display = 'none'	 
			}
			
	  }//if	  
	 
	  if(cat!="")
	  {
		  var prices = cat.split(",")	
		  for(j=0;j<prices.length ;j++)
			{			    
				if(j==0)
				{				 
				 document.registration_step2.member_type_cat.value = prices[j]
				}
				else if(j==1)
				{				 
				 document.registration_step2.member_type_crew.value = prices[j]
				}
				else if(j==2)
				{				 
				 document.registration_step2.member_type_support.value = prices[j]
				}
				else if(j==3)
				{				 
				 document.registration_step2.cnt_crew_subcat.value = prices[j]
				}
				else if(j==4)
				{				 
				 document.registration_step2.cnt_support_subcat.value = prices[j]
				}
			}//for
	  }//if
	  
	document.registration_step2.crewSubcat.value = crewSubcat 	
	document.registration_step2.supportSubcat.value = supportSubcat
	document.registration_step2.crew_sub_id.value = crew_sub_id
	document.registration_step2.support_sub_id.value = support_sub_id
	
	 if(other_items!="")
	  {
		  var prices = other_items.split(",")	
		  for(j=0;j<prices.length ;j++)
			{			    
				if(j==0)							 
				 document.registration_step2.no_photo.value = prices[j]								
				else if(j==1)							 
				 document.registration_step2.video_size1.value = prices[j]				
				else if(j==2)								 
				 document.registration_step2.video_size2.value = prices[j]				
				else if(j==3)						 
				 document.registration_step2.video_size3.value = prices[j]
				 else if(j==4)							 
				 document.registration_step2.video_size4.value = prices[j]				
				else if(j==5)								 
				 document.registration_step2.video_size5.value = prices[j]				
				else if(j==6)						 
				 document.registration_step2.video_size6.value = prices[j]
			}//for
			
	  }
			
	 if(discount!="")
	  {
		  var prices = discount.split(",")	
		  for(j=0;j<prices.length ;j++)
			{			    
				if(j==0)							 
				 document.registration_step2.total_final.value = prices[j]				
				else if(j==1)								 
				 document.registration_step2.tot_for_cal.value = prices[j]				
				else if(j==2)							 
				 document.registration_step2.promo_code_hidden.value = prices[j]				
				else if(j==3)								 
				 document.registration_step2.dis_amt.value = prices[j]									
			}
	  }
	  
	  if(document.registration_step2.total_final.value!="")
	  {
		 var overall_subtotal=document.registration_step2.total_final.value;
		 var overall_subtotal_hidden=document.registration_step2.promo_code_hidden.value;
		 document.getElementById("overall_subtotal").innerHTML = $+overall_subtotal;
		 document.registration_step2.promotional_code.value = $+overall_subtotal_hidden
	  }
}


function redirection_page(page_id)
{
	if(page_id=="back")
	{
		//alert('back')
		document.registration_step2.action="reg_step1.php";
		document.registration_step2.submit();
	}
}

function crew_window()
{   
    var value_crew=document.getElementById("h_crew_subtotal").value;
	if(value_crew=="")
	{
	  window.open('crew_category.php',null,'height=800,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,status=yes');
	}
  	else
	{
		var selected = document.registration_step2.crewSubcat.value
		window.open('crew_category.php?val='+selected,null,' height=800,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,status=yes');
	}
		
}

function support_window()
{   
    var value_support=document.getElementById("h_support_subtotal").value;
	if(value_support=="")
	{
	  window.open('support_category.php',null,'height=800,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,status=yes');
	}
	else
	{
		var selected = document.registration_step2.supportSubcat.value
		window.open('support_category.php?val='+selected,null,' height=800,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,status=yes');
	}
	
}

function checked_crew(price,pid)
    {		
	
		var prices_subcat=price.split(",")				
		//var checkmenu =document.crew_category.subcatcheck;
		var checkmenu = document.getElementById( 'subcatcheck_final' );
		//alert(checkmenu);
		//return false;
		var str="";
		var i=1;
		var j;
		var crew_subtotal1=0;
		var subcat_subtotal=0;
		crew_subtotal1 = checkmenu.length;
		for(i=0;i<checkmenu.length;i++)
		{
			/*if(checkmenu[i].checked==true)
			{*/
				str = str + checkmenu[i].value + ",";
				//support_subtotal1++;
			//}
		}
		
		if( checkmenu.length < 1 ){
			alert( 'Please select atleast 1' );
			return false;
		}	
		
		if(crew_subtotal1>6)
		{
		 self.parent.document.registration_step2.cnt_crew_subcat.value = ""
		}
		else
		{
		 self.parent.document.registration_step2.cnt_crew_subcat.value = crew_subtotal1	
		}
		var support_subcat_cnt = self.parent.document.registration_step2.cnt_support_subcat.value
		
		if(support_subcat_cnt=="")
		{
			support_subcat_cnt = 0
		}
		
		var light1 = 0;
		var member = self.parent.document.getElementById("membership_subtotal").innerHTML			
		var support = self.parent.document.getElementById("support_subtotal").innerHTML
		var photo = self.parent.document.getElementById("photo_subtotal").innerHTML	
		var video = self.parent.document.getElementById("video_subtotal").innerHTML
		light1 = self.parent.document.getElementById("light_subtotal").innerHTML
		//var crew_alert = self.parent.document.getElementById("alert_subtotal").innerHTML
		
		
		if(member!="")	
			member=parseFloat(member.substr(1));
		else
			member=0;					
			
		if(support!="")	
			support=parseFloat(support.substr(1));
		else
			support=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
	 	{	video=0;
		}
		
		if(isNaN(video))
			{
				video=0;  
			}
		
		if(light1!=0)
		{
			light1=parseFloat(light1.substr(1));						
		}
		else
			light1=0;	
			
		
		
		total_subcat1 = parseInt(crew_subtotal1) + parseInt(support_subcat_cnt)
		
		if(total_subcat1>6)
		{
			alert("You can select up to 6 sub-categories total.");	
			return false;	
						   
		}		
		
		else
		{		
			if(support_subcat_cnt==0)
			{
				limit = crew_subtotal1-1
			}
			else
			{
				limit = crew_subtotal1
			}
			//alert( "limit = "+limit );
			var limit1= self.parent.document.registration_step2.supportSubcat.value.split(",");
			var limit2=limit-limit1;
			if(self.parent.document.registration_step2.supportSubcat.value=="")
			{
				for(j=1;j<limit;j++)
				{			    
					//alert( "1st J = "+j );
					subcat_subtotal = parseFloat(prices_subcat[j]) + parseFloat(subcat_subtotal)		
				}
				self.parent.document.registration_step2.crewDiscounted.value = '1'; 
				self.parent.document.registration_step2.supportDiscounted.value = ''; 
			}
			else if(self.parent.document.registration_step2.supportSubcat.value!="")
			{
				var start = 1;
				if( self.parent.document.registration_step2.supportDiscounted.value == '1' ){
					start = 0;
				}
				for(j=start;j<limit;j++)
				{			    
					//alert( "2st J = "+j );
					subcat_subtotal = parseFloat(prices_subcat[j]) + parseFloat(subcat_subtotal)		
				}
			}
			//alert( "subcat_subtotal = "+subcat_subtotal );
			remstring = str.substring(0,str.length-1);											
			self.parent.document.registration_step2.crewSubcat.value = remstring			
			self.parent.document.registration_step2.crew_sub_id.value = pid 
			
			
			self.parent.document.getElementById("crew_subtotal").innerHTML="$"+subcat_subtotal;
			self.parent.document.registration_step2.h_crew_subtotal.value = "$"+subcat_subtotal
			var crew = self.parent.document.getElementById("crew_subtotal").innerHTML	
			if(crew!="")
			{
				crew=parseFloat(crew.substr(1));			
			}
			else
				crew=0;						
			
			var tot = member+crew+support
			
			rtotal = tot.toFixed(2)
			self.parent.document.getElementById("total").innerHTML="$"+(rtotal);	
			self.parent.document.registration_step2.h_total.value = "$"+(rtotal)
			
			//var overall = member+crew+support+photo+video+light1+crew_alert
			var overall = member+crew+support+photo+video+light1
			roverall = overall.toFixed(2)
			self.parent.document.getElementById("overall_subtotal").innerHTML="$"+(roverall);	
			self.parent.document.registration_step2.h_overall_subtotal.value = "$"+(roverall)			
			self.parent.document.registration_step2.total_final.value=(roverall);
			self.parent.document.registration_step2.tot_for_cal.value=(roverall);
			self.parent.tb_remove();
			//window.close();
			
		}
	}
	
	function checked_support(price,pid)
		{	
			var prices_subcat=price.split(",")			
			//var checkmenu =document.support_category.subcatcheck;
			var checkmenu = document.getElementById( 'subcatcheck_final' );
			var str="";
			var i=0;  
			var support_subtotal1=0;
			var subcat_subtotal=0;
			support_subtotal1 = checkmenu.length;
			for(i=0;i<checkmenu.length;i++)
			{
				/*if(checkmenu[i].checked==true)
				{*/
					str = str + checkmenu[i].value + ",";
					//support_subtotal1++;
				//}
			}
			
			if( checkmenu.length < 1 ){
				alert( 'Please select atleast 1' );
				return false;
			}
			//set count for support sub-categories
			if(support_subtotal1>6)
			{
				self.parent.document.registration_step2.cnt_support_subcat.value =""
			}
			else
			{
			 self.parent.document.registration_step2.cnt_support_subcat.value = support_subtotal1
			}
			
			//fetch count for crew sub-categories
			
			var crew_subcat_cnt = self.parent.document.registration_step2.cnt_crew_subcat.value	
			//alert( "crew_subcat_cnt = "+crew_subcat_cnt );
			if(crew_subcat_cnt=="")
			{
				crew_subcat_cnt = 0				
			}	
			//alert( "support_subtotal1 = "+support_subtotal1 );
			//alert( "crew_subcat_cnt = "+crew_subcat_cnt );
			total_subcat1 = parseInt(support_subtotal1) + parseInt(crew_subcat_cnt)
		 	//alert( "total_subcat1 = "+total_subcat1 );
			var light1 = 0;
			var member = self.parent.document.getElementById("membership_subtotal").innerHTML					
			var crew = self.parent.document.getElementById("crew_subtotal").innerHTML
			var photo = self.parent.document.getElementById("photo_subtotal").innerHTML	
			var video = self.parent.document.getElementById("video_subtotal").innerHTML
			light1 = self.parent.document.getElementById("light_subtotal").innerHTML
			//var crew_alert = self.parent.document.getElementById("alert_subtotal").innerHTML
			
				
			if(member!="")	
				member=parseFloat(member.substr(1));
			else
				member=0;
			
			if(crew!="")	
				crew=parseFloat(crew.substr(1));
			else
				crew=0;			
			
			if(photo!="")
			{
				photo=parseFloat(photo.substr(1));			
			}
			else
				photo=0;
			
			if(video!="")
			{
				video=parseFloat(video.substr(1));
			}
			else
			{
				video=0;		
			}
			
			if(isNaN(video))
			{
				video=0;  
			}
		
			if(light1!=0)
			{
				light1=parseFloat(light1.substr(1));						
			}
			else
				light1=0;	
			
			
			
			if(total_subcat1>6)
			{
			alert("You can select up to 6 sub-categories total.");				
			return false;	
			
			}	
			else
			{
			    //calculate value
				/*if(crew_subcat_cnt==0)
				{
					limit = support_subtotal1-1
				}
				else
				{*/
					limit = support_subtotal1
				/*}*/
				//alert( "limit = "+limit );
				if(self.parent.document.registration_step2.crewSubcat.value=='')
				{
					for(j=1;j<limit;j++)
					{
						//alert( "1st j = "+j );
						subcat_subtotal = parseFloat(prices_subcat[j]) + parseFloat(subcat_subtotal);
						
					}
					self.parent.document.registration_step2.supportDiscounted.value = '1'; 
					self.parent.document.registration_step2.crewDiscounted.value = ''; 
				}
				else if(self.parent.document.registration_step2.crewSubcat.value!='')
				{
					var start = 1;
					if( self.parent.document.registration_step2.crewDiscounted.value == '1' ){
						start = 0;
					}
					for(j=start;j<limit;j++)
					{
						//alert( "2nd j = "+j );
						subcat_subtotal = parseFloat(prices_subcat[j]) + parseFloat(subcat_subtotal)		
					}
					
				}
				//alert( "subcat_subtotal = "+subcat_subtotal );
				remstring = str.substring(0,str.length-1);	
				//alert(remstring);
				self.parent.document.registration_step2.supportSubcat.value = remstring; 
				self.parent.document.registration_step2.support_sub_id.value = pid 
				
				self.parent.document.getElementById("support_subtotal").innerHTML="$"+subcat_subtotal
				self.parent.document.registration_step2.h_support_subtotal.value ="$"+subcat_subtotal
				
				var support = self.parent.document.getElementById("support_subtotal").innerHTML
				if(support!="")
				{
					support=parseFloat(support.substr(1));			
				}
				else
					support=0;
				
				var tot = member+crew+support
				rtotal = tot.toFixed(2)			
				self.parent.document.getElementById("total").innerHTML="$"+(rtotal);
				self.parent.document.registration_step2.h_total.value = "$"+(rtotal);
				
				//var overall = member+crew+support+photo+video+light1+crew_alert
				var overall = member+crew+support+photo+video+light1
				roverall = overall.toFixed(2)
				self.parent.document.getElementById("overall_subtotal").innerHTML="$"+(roverall);
				self.parent.document.registration_step2.h_overall_subtotal.value="$"+(roverall);
				
				self.parent.document.registration_step2.total_final.value=(roverall);
				self.parent.document.registration_step2.tot_for_cal.value=(roverall);
				//window.close();
				self.parent.tb_remove();
			}		
			
}

function video_subtotal(price)
{	    
	var price_arr = price.split(",")
	
	var video_subtotal1=0;
	var video_subtotal2=0;
	var video_subtotal3=0;
	var video_subtotal4=0;
	var video_subtotal5=0;
	var video_subtotal6=0;

	for (var i=0; i<document.registration_step2.RG_video1.length; i++) 
	 {
         if (document.registration_step2.RG_video1[i].checked) 
		 {     
			if(i==0)
			{
				video_subtotal1 = parseFloat(price_arr[0])
				document.registration_step2.video_size1.value = "5-25MB"
				
			}
			else if(i==1)
			{
				video_subtotal1 = parseFloat(price_arr[2])
				document.registration_step2.video_size1.value = "25-50MB"
			}
			
			else if(i==2)
			{
				video_subtotal1 = parseFloat(price_arr[1])
				document.registration_step2.video_size1.value = "50-100MB"
			}
			
         }
      }
	  
	  for (var i=0; i<document.registration_step2.RG_video2.length; i++) 
	 {
         if (document.registration_step2.RG_video2[i].checked) 
		 {		 
		  	if(i==0)
			{				
				video_subtotal2 = parseFloat(price_arr[0])				
				document.registration_step2.video_size2.value = "5-25MB"
			}
			else if(i==1)
			{				
				video_subtotal2 = parseFloat(price_arr[2])
				document.registration_step2.video_size2.value = "25-50MB"
			}
			
			else if(i==2)
			{				
				video_subtotal2 = parseFloat(price_arr[1])
				document.registration_step2.video_size2.value = "50-100MB"
			}
			
         }
      }
	  
	 for (var i=0; i<document.registration_step2.RG_video3.length; i++) 
	 {
         if (document.registration_step2.RG_video3[i].checked) 		 
		 { 			
		  	if(i==0)
			{
				video_subtotal3 = parseFloat(price_arr[0])	
				document.registration_step2.video_size3.value = "5-25MB"
			}
			else if(i==1)
			{
				video_subtotal3 = parseFloat(price_arr[2])
				document.registration_step2.video_size3.value = "25-50MB"
			}
			
			else if(i==2)
			{
				video_subtotal3 = parseFloat(price_arr[1])
				document.registration_step2.video_size3.value = "50-100MB"
			}
         }	
      }
	  
	  
	 for (var i=0; i<document.registration_step2.RG_video4.length; i++) 
	 {
         if (document.registration_step2.RG_video4[i].checked) 
		 {
			
		  	if(i==0)
			{
				video_subtotal4 = parseFloat(price_arr[0])
				document.registration_step2.video_size4.value = "5-25MB"
			}
			else if(i==1)
			{
				video_subtotal4 = parseFloat(price_arr[2])
				document.registration_step2.video_size4.value = "25-50MB"
			}
			
			else if(i==2)
			{
				video_subtotal4 = parseFloat(price_arr[1])
				document.registration_step2.video_size4.value = "50-100MB"
			}			
         }
      }
	  
	 for (var i=0; i<document.registration_step2.RG_video5.length; i++) 
	 {
         if (document.registration_step2.RG_video5[i].checked) 
		 {      
			
		  	if(i==0)
			{
				video_subtotal5 = parseFloat(price_arr[0])
				document.registration_step2.video_size5.value = "5-25MB"
			}
			else if(i==1)
			{
				video_subtotal5 = parseFloat(price_arr[2])
				document.registration_step2.video_size5.value = "25-50MB"
			}
			
			else if(i==2)
			{
				video_subtotal5 = parseFloat(price_arr[1])
				document.registration_step2.video_size5.value = "50-100MB"
			}			
         }
      }
	  
	for (var i=0; i<document.registration_step2.RG_video6.length; i++) 
	 {
         if (document.registration_step2.RG_video6[i].checked) 
		 { 		  
  		  	if(i==0)
			{
				video_subtotal6 = parseFloat(price_arr[0])
				document.registration_step2.video_size6.value = "5-25MB"
			}
			else if(i==1)
			{
				video_subtotal6 = parseFloat(price_arr[2])
				document.registration_step2.video_size6.value = "25-50MB"
			}
			
			else if(i==2)
			{
				video_subtotal6 = parseFloat(price_arr[1])
				document.registration_step2.video_size6.value = "50-100MB"
			}			
         }
      }
	  
	 document.getElementById("video_subtotal").innerHTML="$"+(video_subtotal1+video_subtotal2+video_subtotal3+video_subtotal4+video_subtotal5+video_subtotal6)
	 document.registration_step2.h_video_subtotal.value = "$"+(video_subtotal1+video_subtotal2+video_subtotal3+video_subtotal4+video_subtotal5+video_subtotal6)
	 
	// alert( document.getElementById("video_subtotal").innerHTML)
	 	 var light1=0;
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		 light1 = document.getElementById("light_subtotal").innerHTML
		// var crew_alert = document.getElementById("alert_subtotal").innerHTML
		 
		if(mem_cat_subtotal!="")	
			mem_cat_subtotal=parseFloat(mem_cat_subtotal.substr(1));
		else
			mem_cat_subtotal=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
	 		video=0;		
		
		if(light1!=0)
		{
			light1=parseFloat(light1.substr(1));						
		}
		else
			light1=0;
		
		var tot = mem_cat_subtotal+photo+video+light1
		rtotal = tot.toFixed(2)
		//alert(rtotal)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal);
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal);
		
		document.registration_step2.total_final.value=rtotal;
		document.registration_step2.tot_for_cal.value=rtotal;
		
}

function display_fee()
{
	
  	var obj_list_box = document.registration_step2.AvailabilityLight;
	var val = new String(obj_list_box.options[obj_list_box.selectedIndex].value);			
	
	if(val=="N")
	{
	   	 document.registration_step2.year.disabled = true
		 var oRadio = document.getElementsByName("RG_Light");			
	     oRadio[0].checked = false; 
		 document.getElementById("light_subtotal").innerHTML =""
		 document.registration_step2.h_light_subtotal.value=""		 
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		 //var crew_alert = document.getElementById("alert_subtotal").innerHTML
		 
		if(mem_cat_subtotal!="")	
			mem_cat_subtotal=parseFloat(mem_cat_subtotal.substr(1));
		else
			mem_cat_subtotal=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
		{
	 		video=0;
		}
		
		if(isNaN(video))
			{
				video=0;  
			}
			
		
		var tot =mem_cat_subtotal+photo+video
		rtotal = tot.toFixed(2)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal)
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal)		
		document.registration_step2.total_final.value=rtotal
		document.registration_step2.tot_for_cal.value=rtotal
		 
	}
	if(val=="Y")
	{		
	   	 document.getElementById("year").disabled = false		
		 var oRadio = document.getElementsByName("RG_Light");			
	     oRadio[0].checked = true; 
		 cal_light_subtotal(document.getElementById("RG_Light_hidden").value);		 
		   
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		  var tot=0; 
		 tot=mem_cat_subtotal+photo+video;
		 if(tot==''){tot=0;}
		// var tot =mem_cat_subtotal+photo+video
		rtotal = tot.toFixed(2)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal)
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal)		
		document.registration_step2.total_final.value=rtotal
		document.registration_step2.tot_for_cal.value=rtotal
	}
}

function display_fee_alert()
{
	
  	var obj_list_box = document.registration_step2.CrewAlert;
	var val = new String(obj_list_box.options[obj_list_box.selectedIndex].value);

	if(val=="N")
	{
	   	 document.registration_step2.alert_month.disabled = true
		 document.registration_step2.alert_year.disabled = true 
		 
		 document.getElementById("alert_subtotal").innerHTML = ""
		 document.registration_step2.h_alert_subtotal.value=""
		 
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		 light1 = document.getElementById("light_subtotal").innerHTML
		 
		if(mem_cat_subtotal!="")	
			mem_cat_subtotal=parseFloat(mem_cat_subtotal.substr(1));
		else
			mem_cat_subtotal=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
		{
	 		video=0;
		}
		
		if(isNaN(video))
			{
				video=0;  
			}
			
		if(light1!=0)
		{
			light1=parseFloat(light1.substr(1));						
		}
		else
			light1=0;	
		
		var tot = mem_cat_subtotal+photo+video+light1
		rtotal = tot.toFixed(2)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal);
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal)
		
		document.registration_step2.total_final.value= rtotal;
		document.registration_step2.tot_for_cal.value= rtotal;
		 
	}
	if(val=="Y")
	{
		document.registration_step2.alert_month.disabled = false
		document.registration_step2.alert_year.disabled = false
		 
		var oRadio = document.getElementsByName("RG_crewalert");				
	    oRadio[0].checked = true; 		
		cal_alert_subtotal(oRadio[0].value);
		
		
	}
}

function cal_light_subtotal(val)
{
   document.getElementById("light_subtotal").innerHTML = "$"+parseFloat(val)
   document.registration_step2.h_light_subtotal.value = "$"+parseFloat(val)
   
  	 	 var light1=0;
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		// var crew_alert =document.getElementById("alert_subtotal").innerHTML
		 
		if(mem_cat_subtotal!="")	
			mem_cat_subtotal=parseFloat(mem_cat_subtotal.substr(1));
		else
			mem_cat_subtotal=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
	 	{
			video=0;
		}
		
		if(isNaN(video))
			{
				video=0;  
			}
			
		
		var tot = mem_cat_subtotal+photo+video+parseFloat(val)
		rtotal = tot.toFixed(2)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal); 		
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal)
		
		document.registration_step2.total_final.value=rtotal;
		document.registration_step2.tot_for_cal.value=rtotal;
}

function cal_alert_subtotal(val)
{
   document.getElementById("alert_subtotal").innerHTML = "$"+parseFloat(val)
   document.getElementById("h_alert_subtotal").innerHTML = "$"+parseFloat(val)
   //document.registration_step2.h_alert_subtotal.value = "$"+parseFloat(val)
   
  	 	 var light1=0;
		 var mem_cat_subtotal = document.getElementById("total").innerHTML
		 var photo = document.getElementById("photo_subtotal").innerHTML	
		 var video = document.getElementById("video_subtotal").innerHTML
		  light1 = document.getElementById("light_subtotal").innerHTML

		if(mem_cat_subtotal!="")	
			mem_cat_subtotal=parseFloat(mem_cat_subtotal.substr(1));
		else
			mem_cat_subtotal=0;			
		
		if(photo!="")
		{
			photo=parseFloat(photo.substr(1));			
		}
		else
			photo=0;
			
		if(video!="")
		{
			video=parseFloat(video.substr(1));
		}
		else
		{
	 		video=0;
		}
		
		if(isNaN(video))
			{
				video=0;  
			}
			
		if(light1!=0)
		{
			light1=parseFloat(light1.substr(1));						
		}
		else
			light1=0;
		
		 var tot = mem_cat_subtotal+photo+video+parseFloat(val)+light1
		rtotal = tot.toFixed(2)
		//alert(mem_cat_subtotal+photo+video+parseFloat(val)+light1)
		document.getElementById("overall_subtotal").innerHTML="$"+(rtotal);	
		document.registration_step2.h_overall_subtotal.value="$"+(rtotal)
		document.registration_step2.total_final.value = rtotal;
		document.registration_step2.tot_for_cal.value = rtotal;
}

function enable_button()
	 {	
		 if(document.registration_step2.terms.checked)
		 {
			 document.registration_step2.submit_step3.disabled = false;			 
		 }
		 else
		 {
			 document.registration_step2.submit_step3.disabled = true;
		 }		
	 }
	 
function enable_terms()
{	
    self.parent.document.registration_step2.submit();  
    tb_remove();	 
	
}

function display_crewalert()
{	
	var obj_list_box = document.registration_step2.CrewAlert;
	var val = new String(obj_list_box.options[obj_list_box.selectedIndex].value);
	
	if(val=="N")
	{
	   	 document.registration_step2.alert_month.disabled = true
		 document.registration_step2.alert_year.disabled = true 
	}
	else if(val=="Y")
	{
	   	 document.registration_step2.alert_year.disabled = false
		 document.registration_step2.alert_month.disabled = false 
	}
}

function validate_checkitems()
{

	
	var cont_crew=document.registration_step2.cnt_crew_subcat.value;
	var cont_support=document.registration_step2.cnt_support_subcat.value;
	var value_crew=document.getElementById("h_crew_subtotal").value;
	var value_support=document.getElementById("h_support_subtotal").value;
	
	
	var count_total=parseInt(cont_crew) + parseInt(cont_support)
	
	var flag = 0,flag_video=0,flag_subcat=0,cat_flag=0,cnt_flag=0;
	
	if(cont_crew>6 || cont_support>6 || count_total>6)
	cnt_flag=1;
	if(document.registration_step2.cnt_crew_subcat.value=="")
 	 cnt_crew=0;
	else
	  cnt_crew=document.registration_step2.cnt_crew_subcat.value
	  	   
	if(document.registration_step2.cnt_support_subcat.value=="")
 	  cnt_support=0;
	else
	   cnt_support=document.registration_step2.cnt_support_subcat.value  	 
	   
	var oRadio = document.registration_step2.RG_Cat
	for(i=0;i<oRadio.length;i++)
	{
		if(oRadio[i].checked == true)
		{
			
		  if(oRadio[i].value == "Crew Basic" || oRadio[i].value == "Crew Premium" || oRadio[i].value == "Support Basic" || oRadio[i].value == "Support Premium")
		  {
			  cat_flag=1
		  }
		}
	}
	if(cat_flag==1)
	{
		if(document.getElementById("crewSubcat").value=='' && document.getElementById("supportSubcat").value=='')
		{
		  flag_subcat=2;
		}
	}
	
	for (var i=0; i<document.registration_step2.RG_Cat.length; i++) 
	 {
         if (document.registration_step2.RG_Cat[i].checked) 
		 {    		   
			var select_membership = document.registration_step2.RG_Cat[i].value
			var member_basic = select_membership.indexOf("Basic")
			var member_premium = select_membership.indexOf("Premium")

			if(member_basic!=-1)			
			{
				//alert(member_basic)
				for (var i=0; i<document.registration_step2.RG_video1.length-1; i++) 
				{
					if (document.registration_step2.RG_video1[i].checked) 
					{
						flag_video = 1
					}
				}
				
				for (var i=0; i<document.registration_step2.RG_video2.length-1; i++) 
				{
					if (document.registration_step2.RG_video2[i].checked) 
					{				
						flag_video = 1;
					}
				}
				
				for (var i=0; i<document.registration_step2.RG_video3.length-1; i++) 
				{
					if (document.registration_step2.RG_video3[i].checked) 
					{				
						flag_video = 1;
					}
				}
				
				for (var i=0; i<document.registration_step2.RG_video4.length-1; i++) 
				{
					if (document.registration_step2.RG_video4[i].checked) 
					{				
						flag_video = 1;
					}
				}
				
				for (var i=0; i<document.registration_step2.RG_video5.length-1; i++) 
				{
					if (document.registration_step2.RG_video5[i].checked) 
					{				
						flag_video = 1;
					}
				}
				
				for (var i=0; i<document.registration_step2.RG_video6.length-1; i++) 
				{
					if (document.registration_step2.RG_video6[i].checked) 
					{				
						flag_video = 1;
					}
				}
				//alert(flag_video)
			}			
			flag=1;
			break;
         }
      }		
	  
	  if(document.registration_step2.h_total.value=="")
	  {		
		alert("Please select category."); 
		return false;
	  }
	 else if(flag_subcat==2)
	  {	  
	  	alert("In order to continue with your registration, please select your free sub-category now.")
		return false;
	  }
	 else if(flag_video==1)
	  {		
		alert("Sorry, but only Premium Members can upload video. Join as Premium today!");
		return false;
	  }  
	else
	{
	
	//window.open('terms.html',null,'height=800,width=800,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,status=yes');
	tb_open_new('terms.html?TB_iframe=true&height=550&width=500&resizeable=yes&scrollbar=yes');
	
	}
	  
	 	 
}

function checkifempty()
{
if (document.registration_step2.promotional_code.value=="")
	document.registration_step2.chk_promo.disabled=true
else
	document.registration_step2.chk_promo.disabled=false
}


function chk_reg_step_one_values()
{
	var flag_phone = 0;
	var obj_list_box = document.registration_step2.h_primaryphone;
	var phone = new String(obj_list_box.options[obj_list_box.selectedIndex].value);	
	  
	
	if(isEmpty(document.registration_step2.h_firstname.value))
	  {
		   alert ("Please Enter First Name.");
		   document.registration_step2.h_firstname.value="";
		   document.registration_step2.h_firstname.focus();
		   return false;
	  }	 
	  
     if(isEmpty(document.registration_step2.h_lastname.value))
	  {
		   alert ("Please Enter Last Name.");
		   document.registration_step2.h_lastname.value="";
		   document.registration_step2.h_lastname.focus();
		   return false;
	  }	 

	  if(isEmpty(document.registration_step2.h_address1.value))
	  {
		   alert ("Please Enter Your Address.");
		   document.registration_step2.h_address1.value="";
		   document.registration_step2.h_address1.focus();
		   return false;
	  }	

	 if(isEmpty(document.registration_step2.h_city.value))
	  {
		   alert ("Please Enter  Your City.");
		   document.registration_step2.h_city.value="";
		   document.registration_step2.h_city.focus();
		   return false;
	  }	
	  
	   
	   if(isAllCharacters(document.registration_step2.h_city.value)==false)
	  {
		   alert ("Please Use Letters Only.");
		   document.registration_step2.h_city.value="";
		   document.registration_step2.h_city.focus();
		   return false;
	  }
	  
	   if(isEmpty(document.registration_step2.h_zip.value))
	  {
		   alert ("Please Enter Zip Code.");
		   document.registration_step2.h_zip.value="";
		   document.registration_step2.h_zip.focus();
		   return false;
	  }	
	 
		  if(isAllNumerics(document.registration_step2.h_zip.value)==false)
		  {
			   alert ("Please Enter Only Numbers for Zip Code.");
			   document.registration_step2.h_zip.value="";
			   document.registration_step2.h_zip.focus();
			   return false;
		  }
	 
	   if(isEmpty(document.registration_step2.h_emailaddress.value))
	  {
		   alert ("Please Enter a  Valid Email Address.");
		   document.registration_step2.h_emailaddress.value="";
		   document.registration_step2.h_emailaddress.focus();
		    return false;
	  }
	  
	  if(isEmpty(document.registration_step2.h_emailaddress.value)==false)
	  {		
	   if(isValidEmail(document.registration_step2.h_emailaddress.value)==false)
	     {
		   alert ("Please Enter a  Valid Email Address.");
		   document.registration_step2.h_emailaddress.value="";
		   document.registration_step2.h_emailaddress.focus();
		   return false;
	     }
	  }
	  if(isEmpty(document.registration_step2.h_backup_emailaddress.value)==false)
	  {
		  if(isValidEmail(document.registration_step2.h_backup_emailaddress.value)==false)
		  {
			   alert ("Please Enter a  Valid Email Address.");
			   document.registration_step2.h_backup_emailaddress.value="";
			   document.registration_step2.h_backup_emailaddress.focus();
			   return false;
		  }
	  }       
	   
	   //To write validations for primary phone 
	   if(phone=="Home")
	   {
		   	if(isEmpty(document.registration_step2.h_homephone1.value))
			{
				 alert("Please Enter Your Home Phone Number.");
				 document.registration_step2.h_homephone1.focus();			  
			  	 return false;
			}
			
			if(isEmpty(document.registration_step2.h_homephone2.value))
			{
				 alert("Please Enter Your Home Phone Number.");
				 document.registration_step2.h_homephone2.focus();			  
			  	 return false;
			}
			
			if(isEmpty(document.registration_step2.h_homephone3.value))
			{
				 alert("Please Enter Your Home Phone Number.");
				 document.registration_step2.h_homephone3.focus();			  
			  	 return false;
			}
			
	   }
	   else if(phone=="Work")
	   {
		  if(isEmpty(document.registration_step2.h_workphone1.value))
	      {		  	  
	  	      alert ("Please Enter Your Work Phone Number.");			  
			  document.registration_step2.h_workphone1.focus();			  
			  return false;
		  }
		  
		  if(isEmpty(document.registration_step2.h_workphone2.value))
	      {		  	  
	  	      alert ("Please Enter Your Work Phone Number.");			  
			  document.registration_step2.h_workphone2.focus();			  
			  return false;
		  }
		  
		  if(isEmpty(document.registration_step2.h_workphone3.value))
	      {		  	  
	  	      alert ("Please Enter Your Work Phone Number.");			  
			  document.registration_step2.h_workphone3.focus();			  
			  return false;
		  }
		  
		  
	   }
	   else if(phone=="Cell")
	   {
		   if(isEmpty(document.registration_step2.h_cellphone1.value))
	      {		  	  
	  	      alert ("Please Enter Your Cell Phone Number.");			  
			  document.registration_step2.h_cellphone1.focus();			  
			  return false;
		  }
		  
		   if(isEmpty(document.registration_step2.h_cellphone2.value))
	      {		  	  
	  	      alert ("Please Enter Your Cell Phone Number.");			  
			  document.registration_step2.h_cellphone2.focus();			  
			  return false;
		  }
		  
		   if(isEmpty(document.registration_step2.h_cellphone3.value))
	      {		  	  
	  	      alert ("Please Enter Your Cell Phone Number.");			  
			  document.registration_step2.h_cellphone3.focus();			  
			  return false;
		  }
	   }
	   
	   //home phone
	   	    if(isEmpty(document.registration_step2.h_homephone1.value) && !isEmpty(document.registration_step2.h_homephone2.value) &&isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone1.focus();			  
			  return false;
		  }
		  
	   	    if(isEmpty(document.registration_step2.h_homephone1.value) && !isEmpty(document.registration_step2.h_homephone2.value) && !isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone1.focus();			  
			  return false;
		  }
		  if(!isEmpty(document.registration_step2.h_homephone1.value) && isEmpty(document.registration_step2.h_homephone2.value) && !isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone2.focus();			  
			  return false;
		  }
	    if(!isEmpty(document.registration_step2.h_homephone1.value) && isEmpty(document.registration_step2.h_homephone2.value) &&isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone2.focus();			  
			  return false;
		  }
		   if((isEmpty(document.registration_step2.h_homephone1.value) && isEmpty(document.registration_step2.h_homephone2.value)) && !isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone3.focus();
			  return false;
		  }
		  if((!isEmpty(document.registration_step2.h_homephone1.value) && !isEmpty(document.registration_step2.h_homephone2.value)) &&isEmpty(document.registration_step2.h_homephone3.value))
	      {		  	  
	  	      alert ("Please Enter Valid Home Phone Number.");			  
			  document.registration_step2.h_homephone3.focus();
			  return false;
		  }
		  
		  //
		  if(!isEmpty(document.registration_step2.h_homephone1.value) || !isEmpty(document.registration_step2.h_homephone2.value) || !isEmpty(document.registration_step2.h_homephone3.value))
		  {
			 if(!isAllNumerics(document.registration_step2.h_homephone1.value))
			  {
				   alert ("Please Enter Only Numbers for Home Phone.");
			       //document.registration_step1.homephone1.value="";
				   document.registration_step2.h_homephone1.focus();
				   return false;
			  }
			  	if(!isAllNumerics(document.registration_step2.h_homephone2.value))
			  {
				   alert ("Please Enter Only Numbers for Home Phone.");
			       //document.registration_step1.homephone1.value="";
				   document.registration_step2.h_homephone2.focus();
				   return false;
			  }
			  	 if(!isAllNumerics(document.registration_step2.h_homephone3.value))
			  {
				   alert ("Please Enter Only Numbers for Home Phone.");
			       //document.registration_step1.homephone1.value="";
				   document.registration_step2.h_homephone3.focus();
				   return false;
			  }
			  
		  }

}

function checkSelectedSubCount( obj_id , minimum ){
	var checkmenu = document.getElementById(obj_id);
	if( checkmenu.length < minimum ){
		return false;
	}else {
		return true;
	}
}
