
function dynamic_tabel1_add(id_val)
{
	//alert(id_val);
	var count_val=document.getElementById("count_div1").value;
	//alert(count_val);
	var idss=id_val.split(",");
	ids=idss[1];
	//alert(ids);
	ids=parseInt(ids);
	if(ids==0)
	{
		//document.getElementById("cwb1").disabled=true;
		//alert(count_val);
		for(i=2;i<=count_val-1;i++)
		{
			document.getElementById("trip_advance"+i).style.display='none';
			//document.getElementById("cwb"+i).disabled=true;
		}
		document.getElementById("remov_sm1,1").style.display='none';
		
	}
	else
	{
		
		var next_id=ids+1;
		//alert(next_id);
		count_val=count_val-1;
		//alert(count_val);
		if(next_id!=count_val)
		{
		document.getElementById("plus_sm1,"+ids).style.display='none';
		document.getElementById("remov_sm1,"+ids).style.display='none';
		document.getElementById("trip_advance"+next_id).style.display='block';
		}
		else
		{
			document.getElementById("plus_sm1,"+ids).style.display='none';
			document.getElementById("remov_sm1,"+ids).style.display='none';
			document.getElementById("plus_sm1,"+next_id).style.display='none';
			document.getElementById("remov_sm1,"+next_id).style.display='block';
			document.getElementById("trip_advance"+next_id).style.display='block';
			
		}
		document.getElementById("cur_count1").value=next_id;	
	}	
}

/*function enab()
{
	//var cnt1=document.getElementById("cur_count1").value;
	var root_name = document.getElementById('root_name').value;
	
		if(root_name!='')
		{
			
			document.getElementById("fs_name").value =false;
			//document.getElementById("desc").value =false;
			document.getElementById("st_fee ").value =false;
		}
		else
		{
			///alert('ddd');
			document.getElementById("fs_name").value =true;
			//document.getElementById("desc").value =true;
			document.getElementById("st_fee ").value =true;
		}
}*/
///remove fieds
function dynamic_tabel1_remove(id_val,content)
{
	//alert(id_val);
	//alert(fs_name);
	var idss=id_val.split(",");
	ids=idss[1];
	//alert(ids);
	ids=parseInt(ids);
	
		
		var pre_id=ids-1;
		//alert(pre_id);
		
		//alert(count_val);
		if(pre_id==1)
		{
			if(content=="" && document.getElementById('sli_img'+ids).value=="" )
			{
				document.getElementById("plus_sm1,"+pre_id).style.display='block';
				document.getElementById("remov_sm1,"+pre_id).style.display='none';
				document.getElementById("trip_advance"+ids).style.display='none';
			}
			else
			{			
				var c_var=confirm("Are you Sure Want to Remove this Row ?");
				if(c_var==true)
				{
					document.getElementById('content'+ids).value="";
					document.getElementById('sli_img'+ids).value="";
					document.getElementById("plus_sm1,"+pre_id).style.display='block';
					document.getElementById("remov_sm1,"+pre_id).style.display='none';
					document.getElementById("trip_advance"+ids).style.display='none';
					//return true;
				}
				else
				{
					return false;
				}
			}
		}
		else
		{
			if(content=="" && document.getElementById('sli_img '+ids).value=="" )
			{
				document.getElementById("plus_sm1,"+pre_id).style.display='block';
				document.getElementById("remov_sm1,"+pre_id).style.display='block';
				document.getElementById("trip_advance"+ids).style.display='none';
			}
			else
			{
				var c_var=confirm("Are you Sure Want to Remove this Row ?");
				if(c_var==true)
				{
					document.getElementById('content'+ids).value="";
					document.getElementById('sli_img'+ids).value="";
					document.getElementById("plus_sm1,"+pre_id).style.display='block';
					document.getElementById("remov_sm1,"+pre_id).style.display='block';
					document.getElementById("trip_advance"+ids).style.display='none';
					
					//return true;
				}
				else
				{
					return false;
				}
			}
		}
		document.getElementById("cur_count1").value=pre_id;	
}

//onsubmit Validate
function form_val()
{
	//var cnt=document.getElementById("cur_count").value;
	var cnt1=document.getElementById("cur_count1").value;
	for(j=1;j<=cnt1;j++)
	{		
		var image_name=document.getElementById('sli_img'+j).value;
		var Extension = image_name.substring(image_name.lastIndexOf('.') + 1).toLowerCase();
		//var b=document.getElementById('sli_img'+j);
		//var filesize = b.files[0].size; // b.files[0].Size;
		//var size1=filesize / (1024 * 1024);
		if(image_name=="")
		{	
			alert("Please Select the Attachment "+j);
			document.getElementById('sli_img'+j).focus();
			return false;
		}
		else if(!(Extension == "gif" || Extension == "png" || Extension == "bmp"|| Extension == "jpeg" || Extension == "jpg"))
		{
			alert("Please Select the valid Images in Attachment"+j);
			document.getElementById('sli_img'+j).focus();
			return false;
		}
		/*else if(size1 > 2.0)
		{
			alert("Please Select under greater then 2 mb size in Attchment"+j);
			document.getElementById('sli_img'+j).focus();
			return false;
		}*/
		else
		{
			for(a=j+1;a<=cnt1;a++)
			{
				var image_name1=document.getElementById('sli_img'+a).value;
				var Extension = image_name.substring(image_name.lastIndexOf('.') + 1).toLowerCase();
				//var c=document.getElementById('sli_img'+j);
				//var filesize = c.files[0].size; // b.files[0].Size;
				//var size1=filesize / (1024 * 1024);
				if(image_name==image_name1)
				{
					alert("Attachment " +j+ " And Attachment " +a+ " are same.Please Insert The Different Image Name.");
					document.getElementById('sli_img'+a).focus();
					return false;
				}
				else if(!(Extension == "gif" || Extension == "png" || Extension == "bmp"|| Extension == "jpeg" || Extension == "jpg"))
				{
					alert("Please Select the valid Images in Attachment "+j);
					document.getElementById('sli_img'+j).focus();
					return false;
				}
				/*else if(size1 > 2.0)
				{
					alert("Please Select under greater then 2 mb size in Attchment"+j);
					document.getElementById('sli_img'+j).focus();
					return false;
				}*/
			}
		}
	}

	var con=confirm('Do you want to Submit?');
	if(con==true)
	{
		document.img.submit();
	}
	else
	{
		return false;
	}
}
//Old Stage Name
	
	