    var agt=navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var metadatalist = "IDBATESNO,SIDBATESNO,EIDBATESNO,DEPEXNOS,TRIALEXNOS,REVIEWEDBY,REVIEWERNOTES,PRODHIST,CASEMDATA,CSTATUS,OWNER,OWNERMDATA,CATEGORY,DOCAUTHOR,DOCAUTHORMDATA,APPLICATION,PRIVILEGE,PROPERTIES,PARENTID,CHILDIDS,NUMCHILD,MEDIA,ARCHIVEID,WKEYWORDS,BKEYWORDS,MENTIONS,KEYDATES,KEYCONCEPTS,ISSUES,PROCESSED,INDEXED,ORGANIZATIONS,SPAM,MESSAGEID,HEADERS,DATESENT,TIMERECVD,FROM,TO,CC,BCC,STATUS,SUBJECT,TITLE,BODY,SUMMARY,NOTES,ATT_NOTES,SOURCE,CD_DVD,DISK,BOX,FILEDATE,FMDATA,PRINTABLE_LINK,TIF_LINK,PDF_LINK,MSOURCE,PIDBATESNO,PRODUCTIONID,PRODUCTIONLABEL,PRODUCTIONDATE";
	var codetemplist = "";
	var arrmetadatalist = metadatalist.split(",");
	var arrcodetemplist = codetemplist.split(",");
	var morebtnHTML = '<a href="#" onclick="addInput(document.custannotform)"><img src="images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="removeInput(document.custannotform)"><img src="./images/Remove_01.gif" border="0" alt="Remove above rows" title=" Remove above rows "></a> &nbsp;&nbsp;&nbsp;'; 
	var morebtnHTML_overriders = '<a href="#" onclick="addInput_overriders(document.custannotform)"><img src="images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="removeInput_overriders(document.custannotform)"><img src="./images/Remove_01.gif" border="0" alt="Remove above rows" title=" Remove above rows "></a> &nbsp;&nbsp;&nbsp;'; 
	var morebtnHTML_diag = '<a href="#" onclick="addInput_diag(document.custannotform)"><img src="images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="removeInput_diag(document.custannotform)"><img src="./images/Remove_01.gif" border="0" alt="Remove above rows" title=" Remove above rows "></a> &nbsp;&nbsp;&nbsp;'; 
	var morebtnHTML_cases = '<a href="#" onclick="addInput_cases(document.custannotform,document.custannotform.no_of_fields.value)"><img src="images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="removeInput_cases(document.custannotform)"><img src="./images/Remove_01.gif" border="0" alt="Remove above rows" title=" Remove above rows "></a> &nbsp;&nbsp;&nbsp;'; 
	//var morebtnHTML_basicdesign = '<input type="button" onclick="addInput_basicdesign(document.frmbasicdesign,document.frmbasicdesign.no_of_fields.value)" value="More" class="Formbutton">&nbsp;&nbsp;&nbsp;<input type="button" onclick="removeInput_basicdesign(document.frmbasicdesign)" value="Remove" title="Remove" class="Formbutton"> &nbsp;&nbsp;&nbsp;'; 
	var morebtnHTML_basicdesign = '<a href="#section" onclick="addInput_basicdesign(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"   title="More" border="0"></span></a>&nbsp;&nbsp;&nbsp;<a href="#section" onclick="removeInput_basicdesign()"><span class="blue"><img src="images/remove_b.gif" title="Remove" border="0"></span></a> &nbsp;&nbsp;&nbsp;'; 
	var removebtnHTML_basicdesign = '<a href="#section" onclick="removeInput_basicdesign()"><span class="blue"><img src="images/remove_b.gif" title="Remove" border="0"></span></a> &nbsp;&nbsp;&nbsp;'; 
	var morebtnHTML_basicdesign_edit = '<a href="#section" onclick="addInput_basicdesign_edit(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"   title="More" border="0"></span></a>&nbsp;&nbsp;&nbsp;<a href="#section" onclick="removeInput_basicdesign_edit()"><span class="blue"><img src="images/remove_b.gif"  title="Remove" border="0"></span></a> &nbsp;&nbsp;&nbsp;'; 
	var removebtnHTML_basicdesign_edit = '<a href="#section" onclick="removeInput_basicdesign_edit()"><span class="blue"><img src="images/remove_b.gif" title="Remove" border="0"></span></a> &nbsp;&nbsp;&nbsp;'; 

	function  validate() {

		var res = true;
		var dupfnames = new Array();

		for (i=0; i < id ; i++) {
			fn = document.getElementById('userInput1_' + i).value;
			dupfnames[i] = fn;
			if ( fn == "" ) {
				alert('Product code should not be empty');
				document.getElementById('userInput3_' + i).value = "";
				document.getElementById('userInput5_' + i).value = "";
				document.getElementById('userInput1_' + i).focus();
				return false;
			}
			if (isNaN(fn)){
				alert("Enter only digits for Product code");
				document.getElementById('userInput1_' + i).focus();
				return false;				
			}
			
/*
			for( var j=0; j < arrmetadatalist.length; j++) {
				if ( arrmetadatalist[j] == fn.toUpperCase() ) {
					alert('Metadata field name "' + document.getElementById('userInput1_' + i).value + '" cannot be redefined ');
					document.getElementById('userInput1_' + i).value = "";
					document.getElementById('userInput3_' + i).value = "";
					document.getElementById('userInput1_' + i).focus();
					return false;	
				}
			}

			for( var j=0; j < arrcodetemplist.length; j++) {

				if ( arrcodetemplist[j] == fn.toUpperCase()  ) {

					alert('Field Name "' + document.getElementById('userInput1_' + i).value + '" already defined in coding template ');
					document.getElementById('userInput1_' + i).value = "";
					document.getElementById('userInput3_' + i).value = "";
					document.getElementById('userInput1_' + i).focus();
					return false;					
				}
			}
*/
			fvalue = document.getElementById('userInput3_' + i).value;
			if ( fvalue == "" ) {
				alert('Product name should not be empty');
				document.getElementById('userInput3_' + i).value = "";
				document.getElementById('userInput3_' + i).focus();
				return false;					
			}

			fdesc = document.getElementById('userInput5_' + i).value;
			if ( fdesc == "" ) {
				alert('Comments / Products of Interest should not be empty');
				document.getElementById('userInput5_' + i).value = "";
				document.getElementById('userInput5_' + i).focus();
				return false;					
			}

			/*
			typefield = document.getElementById('userInput2_' + i);

			ftype = typefield.options[typefield.selectedIndex].value;

			//alert(ftype);

			if ( ftype == 1 ) {

				res = isDate(fvalue);
			}
			else if ( ftype == 2 ) {

				res = chk4int(fvalue);
			}

			if(!res) {
				document.getElementById('userInput3_' + i).focus();
				return false;
			}
			*/
		}

		if ( containsDoubles(dupfnames) ) {

			alert('Product code should be unique');
			return false;
		}
	
		return true;
	}


function  validatecases() {
		var res = true;
		var dupfnames = new Array();

		for (i=0; i < id ; i++) {
			fn = document.getElementById('userInput2_' + i).value;
			dupfnames[i] = fn;
			if ( fn == "" ) {
				alert('Product Code should not be empty');
				document.getElementById('userInput2_' + i).value = "";
				document.getElementById('userInput2_' + i).focus();
				return false;
		}
		
			fvalue = document.getElementById('userInput3_' + i).value;
			if ( fvalue == "" ) {
				alert('Quantity should not be empty');
				document.getElementById('userInput3_' + i).value = "";
				document.getElementById('userInput3_' + i).focus();
				return false;					
			}				
			fvalue = document.getElementById('userInput4_' + i).value;
			if ( fvalue == "" ) {
				alert('Price should not be empty');
				document.getElementById('userInput4_' + i).value = "";
				document.getElementById('userInput4_' + i).focus();
				return false;					
			}		
		}
		if ( containsDoubles(dupfnames) ) {

			alert('Product Code should be unique');
			return false;
		}
	
		return true;
	}


function  validatediagnosis() {
		var res = true;
		var dupfnames = new Array();

		for (i=0; i < id ; i++) {
			fn = document.getElementById('txtdiag1_' + i).value;
			dupfnames[i] = fn;
			if ( fn == "" ) {
				alert('Diagnosis Name should not be empty');
				document.getElementById('txtdiag1_' + i).value = "";
				document.getElementById('txtdiag1_' + i).focus();
				return false;
		}
		
			fvalue = document.getElementById('txtdiag2_' + i).value;
			if ( fvalue == "" ) {
				alert('Description should not be empty');
				document.getElementById('txtdiag2_' + i).value = "";
				document.getElementById('txtdiag2_' + i).focus();
				return false;					
			}		
		}
		if ( containsDoubles(dupfnames) ) {

			alert('Diagnosis Name should be unique');
			return false;
		}
	
		return true;
	}

	
	function  validatecoverage() {
		var res = true;
		var dupfnames = new Array();

		for (i=0; i < id ; i++) {
			fn = document.getElementById('txtdiag1_' + i).value;
			dupfnames[i] = fn;
			if ( fn == "" ) {
				alert('Coverage Name should not be empty');
				document.getElementById('txtdiag1_' + i).value = "";
				document.getElementById('txtdiag1_' + i).focus();
				return false;
		}
		
			fvalue = document.getElementById('txtdiag2_' + i).value;
			if ( fvalue == "" ) {
				alert('Description should not be empty');
				document.getElementById('txtdiag2_' + i).value = "";
				document.getElementById('txtdiag2_' + i).focus();
				return false;					
			}		
		}
		if ( containsDoubles(dupfnames) ) {

			alert('Coverage Name should be unique');
			return false;
		}
	
		return true;
	}
	
	// checks whether the given value is integer value or not
	function chk4int(fint){

		var reg = /^\d{0,6}$/;

		if ( reg.test(fint) ){

			return true;
		}

		alert("Field integer value should be integer and of length 6");

		return false;
	} // end of chk4int()

	//checks whethe an array is having double values or not
	function containsDoubles(Q_array) {

		var Q_object = {};
		
		for (var i in Q_array) {

			if (Q_object[Q_array[i]]) {

				//if ( Q_array[i] != 'Select' ) {
					return true;
				//}
			}

			Q_object[Q_array[i]] = true;
		}

		return false;
	} // end of containsDoubles()


	id = '1';

	
	// This function is used to 
	function addInput(obj) {
		var morediv = document.getElementById('moredivid');

		tablebody = document.getElementById('mytbody');

		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);

		cell = document.createElement("TD");
		cell.setAttribute("id", 'value1_' + id)

		inputEl = document.createElement("INPUT");

		inputEl.setAttribute("id", 'userInput1_' + id);
		inputEl.setAttribute("name", 'field_name' + id);
		inputEl.setAttribute("maxlength", '11');
		var fnobjfoc = inputEl;
		
		if ( is_ie ) {
			
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 100;
		
		cell.appendChild(inputEl);		
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value2_' + id);
		fvalname = 'field_type' + id;
		fvalid = 'userInput2_' + id;
		inputEl = document.createElement("DIV");
		var presdiv = 'div_' + id;
		inputEl.setAttribute("id", presdiv);




		/* Product Plan */
		cell.appendChild(inputEl);		
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value4_' + id);
		fvalname2 = 'selnameplan' + id;
		fvalid2 = 'userInput4_' + id;
		inputEl = document.createElement("DIV");
		var presdiv2 = 'div1_' + id;
		inputEl.setAttribute("id", presdiv2);

		/* End of Product Plan */

		/* Product Name */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value3_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput3_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'field_value' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 150;
		/* End of Product Name */

		/* Product Description */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value5_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput5_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtnamepdesc' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 175;
		/* End of Product Description */

		/* Product AUTO Q */


		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value6_' + id);
		cell.setAttribute("valign", 'top');
		inputEl = document.createElement("SELECT");
		inputEl.setAttribute("id", 'userInput6_' + id);
		inputEl.setAttribute("name", 'selnameautoq' + id);
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.options[0]=new Option("Yes", '1');
		inputEl.options[1]=new Option("No", '0');
		inputEl.style.width = 47;
		/* End of Product AUTO Q */


		cell.appendChild(inputEl);

		row.appendChild(cell);

		tablebody.appendChild(row);


		var presdivid = document.getElementById(presdiv);
		presdivid.innerHTML = fvaltypes(fvalname, id);
		var presdivid2 = document.getElementById(presdiv2);
		presdivid2.innerHTML = fvaltypes_plan(fvalname2, id);

		id++; // increment for next to be added elements row
		if ( id > 1 ) {
			morediv.innerHTML = morebtnHTML;
		}




		fnobjfoc.focus();
		document.custannotform.no_of_fields.value = id;
	} // end of addInput()


	function addInput_diag(obj) {
		var morediv = document.getElementById('moredivid');

		tablebody = document.getElementById('mytbody');

		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);

		cell = document.createElement("TD");
		cell.setAttribute("id", 'value1_' + id)
		cell.setAttribute("align", 'center')

		inputEl = document.createElement("INPUT");

		inputEl.setAttribute("id", 'txtdiag1_' + id);
		inputEl.setAttribute("name", 'txtdiag_name' + id);
		inputEl.setAttribute("maxlength", '40');
		var fnobjfoc = inputEl;
		
		if ( is_ie ) {
			
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 170;
		
		/* Product Name */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value2_' + id);
		cell.setAttribute("align", 'center')
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'txtdiag2_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtdesc_name' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 230;
		/* End of Product Name */



		cell.appendChild(inputEl);

		row.appendChild(cell);

		tablebody.appendChild(row);



		id++; // increment for next to be added elements row
		if ( id > 1 ) {
			morediv.innerHTML = morebtnHTML_diag;
		}




		fnobjfoc.focus();
		document.custannotform.no_of_fields.value = id;
	} // end of addInput()


/*function for adding the basicdesign*/


function addInput_basicdesign(newid)
	{
		var type=document.getElementById('hidtype').value;
		var hidflag=document.getElementById('hidpageflag').value;  //design for print flag

		id	=	newid
		
		var morediv = document.getElementById('moredivid');
		tablebody = document.getElementById('mytbody');
		var max;

		if(type=="basicdesign"){
			max=6
		}else{
           max=16
		}
        if(id>=max)
		{
			alert("Only "+(max-1)+" files to be browsed for "+type);
			return false;
		}
		if(id<max){
		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);
        
		/*creating the label*/
		cell = document.createElement("TD");
		cell.setAttribute("align",'left');
		cell.setAttribute("width",'100px');
		cell.setAttribute("id", 'value1_' + id)
		inputEl = document.createElement("DIV");

		var presdiv = 'div1_' + id;
		flabel		= 'txtlabel'+id;
		flabelid	= 'txtlabelid'+id;	
		inputEl.setAttribute("align", "left")	
		inputEl.setAttribute("id", presdiv)
		cell.appendChild(inputEl);
		row.appendChild(cell);

		/*creating the upload file*/
		cell = document.createElement("TD");
		//alert(cell);
		cell.setAttribute("id", 'value2_' + id)
		inputEl = document.createElement("DIV");

		var presdiv2 = 'div2_' + id;
		ftxtname = 'uploadfile'+id;
		ftxtid = 'txtid' + id;
		
		inputEl.setAttribute("id", presdiv2);
		inputEl.setAttribute("align","left" );
		cell.appendChild(inputEl);
		row.appendChild(cell);

		tablebody.appendChild(row);		
		
		var presdivid = document.getElementById(presdiv);
		presdivid.innerHTML = flabelcreation(flabel,id);

		var presdivid2 = document.getElementById(presdiv2);
		presdivid2.innerHTML = ftltle(ftxtname,id);	
	}

		id++; // increment for next to be added elements row
	
	//alert(id+" "+max);
		if( hidflag==1){
			if( id==max ){
				//displaying only the Remove link if the id reaaches the max limit
				morediv.innerHTML = removebtnHTML_basicdesign;
			}else if( id >1 ){
				morediv.innerHTML = morebtnHTML_basicdesign;
			}
		}else
		if ( id >4 ) {
			morediv.innerHTML = morebtnHTML_basicdesign;
		}
			

	document.frmbasicdesign.no_of_fields.value = id;
	
}


/*label creation for title*/
function flabelcreation(fvalname,rid) 
		{

			  
		         var nooffields       =  rid
				 var textfval;				
						textfval = "<span class=required>*</span> <span class=arial_bold_10>"+"Upload File"+" "+nooffields+":</span>";
					
				return textfval;
		} 
/*function creation for text box */

function ftltle(fvalname,rid) 
		{
		         var nooffields       =  rid
				 var textfval;				
					textfval = "<INPUT  type=file  name=" + fvalname + " id=\"uploadfile"+rid+"\"  size=70 class=\"Formfield\" >";
				return textfval;
		} 




function removeInput_basicdesign() {

		var morediv = document.getElementById('moredivid');
		var type=document.getElementById('hidtype').value;
		var hidflag=document.getElementById('hidpageflag').value;

		var max;
		if(type=="basicdesign"){
			max=6
		}else{
           max=16
		}
        
			if(hidflag==1){   //design for print page

				if ( id >1 && id <=max ) {
			
					id--; // decrement to capture previously added elements row
					

					tablebody = document.getElementById('mytbody');
			
					remUI1 = document.getElementById('div1_' + id);
					remcell1 = document.getElementById('value1_' + id);		
					remcell1.removeChild(remUI1);

				
					remUI2=document.getElementById('div2_' + id);
					remcell2 = document.getElementById('value2_' + id);		
					remcell2.removeChild(remUI2);	


					remrow = document.getElementById('row' + id);
					remrow.removeChild(remcell1);
					remrow.removeChild(remcell2);
					tablebody.removeChild(remrow);

					document.getElementById("no_of_fields").value = id;
				} 

				if(id <= 1 ){
					morediv.innerHTML = '<a href="#section" onclick="addInput_basicdesign(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"  title="More" border="0"></span></a>';
				}
				else if(id >1){
					if((id == 2) && (document.getElementById("artworkoption2").value == 1)){
						morediv.innerHTML = '<a href="#section" onclick="addInput_basicdesign(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"  title="More" border="0"></span></a>';
					}else{
						morediv.innerHTML = morebtnHTML_basicdesign;
					}
			   }

			}else{
				if ( id >5 && id <=max ) {
			
			
					id--; // decrement to capture previously added elements row
					

					tablebody = document.getElementById('mytbody');
			
					remUI1 = document.getElementById('div1_' + id);
					remcell1 = document.getElementById('value1_' + id);		
					remcell1.removeChild(remUI1);

				
					remUI2=document.getElementById('div2_' + id);
					remcell2 = document.getElementById('value2_' + id);		
					remcell2.removeChild(remUI2);	


					remrow = document.getElementById('row' + id);
					remrow.removeChild(remcell1);
					remrow.removeChild(remcell2);
					tablebody.removeChild(remrow);

					
				
					document.getElementById("no_of_fields").value = id;

				}
				
				if ( id <= 5 ) {
					morediv.innerHTML = '<a href="#section" onclick="addInput_basicdesign(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"  title="More" border="0"></span></a>';
				}
			}
		
		
		
	}// end of  removeInput()



function addInput_basicdesign_edit(newid)
	{
		 num=newid
			 //alert(num)
		var type=document.getElementById('hidtype').value;
		//alert(type);
		//var hidflag=document.getElementById('hidpageflag').value;  //design for print flag

		id	=	newid
		
		var morediv = document.getElementById('moredivid');
		tablebody = document.getElementById('mytbody');
		var max;

		if(type=="basicdesign"|| type=="Basicdesign"){
			max=6
		}else{
           max=16
		}
        //alert(max);
		if(id<max){
		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);
        
		/*creating the label*/
		cell = document.createElement("TD");
		cell.setAttribute("align",'left');
		cell.setAttribute("width",'100px');
		cell.setAttribute("id", 'value1_' + id)
		inputEl = document.createElement("DIV");

		var presdiv = 'div1_' + id;
		flabel		= 'txtlabel'+id;
		flabelid	= 'txtlabelid'+id;	
		inputEl.setAttribute("align", "left")	
		inputEl.setAttribute("id", presdiv)
		cell.appendChild(inputEl);
		row.appendChild(cell);

		/*creating the upload file*/
		cell = document.createElement("TD");
		//alert(cell);
		cell.setAttribute("id", 'value2_' + id)
		inputEl = document.createElement("DIV");

		var presdiv2 = 'div2_' + id;
		ftxtname = 'uploadfile'+id;
		ftxtid = 'txtid' + id;
		
		inputEl.setAttribute("id", presdiv2);
		inputEl.setAttribute("align","left" );
		cell.appendChild(inputEl);
		row.appendChild(cell);

		tablebody.appendChild(row);		
		
		var presdivid = document.getElementById(presdiv);
		presdivid.innerHTML = flabelcreation(flabel,id);

		var presdivid2 = document.getElementById(presdiv2);
		presdivid2.innerHTML = ftltle(ftxtname,id);	
	}

		id++; // increment for next to be added elements row
	
	
		//if( hidflag==1){
			//alert(id+" "+max)
			if( id==max ){
				//displaying only the Remove link if the id reaaches the max limit
				morediv.innerHTML = removebtnHTML_basicdesign_edit;
			}
			else if( id > num){
				morediv.innerHTML = morebtnHTML_basicdesign_edit;
			}
		//}
		/*else
		if ( id >4 ) {
			morediv.innerHTML = morebtnHTML_basicdesign_edit;
		}*/
		
		

	document.frmbasicdesign.no_of_fields.value = id;
	
}


/*label creation for title*/
function flabelcreation(fvalname,rid) 
		{

			  
		         var nooffields       =  rid
				 var textfval;				
						textfval = "<span class=required>*</span> <span class=arial_bold_10>"+"Upload File"+" "+nooffields+":</span>";
					
				return textfval;
		} 
/*function creation for text box */

function ftltle(fvalname,rid) 
		{
		         var nooffields       =  rid

				 var textfval;				
					textfval = "<INPUT  type=file  name=" + fvalname + " id=\"uploadfile"+rid+"\"  class=Formfield><INPUT  type=hidden name=hidupload" + rid + " id=\"hidupload"+rid+"\"  class=Formfield>";
				return textfval;
		} 




function removeInput_basicdesign_edit() {

		var morediv = document.getElementById('moredivid');
		var type=document.getElementById('hidtype').value;
		var hidflag=document.getElementById('hidpageflag').value;

		var max;
		if(type=="basicdesign"){
			max=6
		}else{
           max=16
		}
        
			//if(hidflag==1){   //design for print page
             
				id2=document.frmbasicdesign.removef.value ;

				//alert(id2)
				if ( id >id2 && id <=max ) {
			
					id--; // decrement to capture previously added elements row
					

					tablebody = document.getElementById('mytbody');
			
					remUI1 = document.getElementById('div1_' + id);
					remcell1 = document.getElementById('value1_' + id);		
					remcell1.removeChild(remUI1);

				
					remUI2=document.getElementById('div2_' + id);
					remcell2 = document.getElementById('value2_' + id);		
					remcell2.removeChild(remUI2);	


					remrow = document.getElementById('row' + id);
					remrow.removeChild(remcell1);
					remrow.removeChild(remcell2);
					tablebody.removeChild(remrow);

					document.getElementById("no_of_fields").value = id;
				} 

				if(id <=id2){
					morediv.innerHTML = '<a href="#section" onclick="addInput_basicdesign_edit(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_b.gif"   title="More" border="0"></span></a>';
				}
				else if( id > id2){
				morediv.innerHTML = morebtnHTML_basicdesign_edit;
			}

			//}
			/*else{
				if ( id >4 && id <=max ) {
			
			
					id--; // decrement to capture previously added elements row
					

					tablebody = document.getElementById('mytbody');
			
					remUI1 = document.getElementById('div1_' + id);
					remcell1 = document.getElementById('value1_' + id);		
					remcell1.removeChild(remUI1);

				
					remUI2=document.getElementById('div2_' + id);
					remcell2 = document.getElementById('value2_' + id);		
					remcell2.removeChild(remUI2);	


					remrow = document.getElementById('row' + id);
					remrow.removeChild(remcell1);
					remrow.removeChild(remcell2);
					tablebody.removeChild(remrow);

					
				
					document.getElementById("no_of_fields").value = id;

				}
				if ( id <= 4 ) {
					morediv.innerHTML = '<a href="#" onclick="addInput_basicdesign_edit(document.frmbasicdesign.no_of_fields.value)"><span class="blue"><img src="images/more_btn.gif" title="More" border="0"></span></a>';
				}
			}*/
		
		
		
	}// end of  removeInput()

//function for adding the case

function addInput_cases(obj,newid) {
	id = newid;
	
		var morediv = document.getElementById('moredivid');

		tablebody = document.getElementById('mytbody');
		
		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);

		//cell = document.createElement("TD");
		/* Product Category */
		/*cell.setAttribute("id", 'value1_' + id)
		fvalname2 = 'field_category' + id;
		
		fvalid2 = 'userInput1_' + id;
	
		inputEl = document.createElement("DIV");
		var presdiv2 = 'div_1' + id;
		inputEl.setAttribute("id", presdiv2);*/
		/* End of Product Category */

		/* Product Code */
		/*
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value2_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput2_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'field_type' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 180;
		*/
		/* End of Product Code */


		/* Product Code */
		/*
		inputEl.setAttribute("id", 'userInput1_' + id);
		inputEl.setAttribute("name", 'field_name' + id);
		inputEl.setAttribute("maxlength", '11');
		var fnobjfoc = inputEl;
		
		if ( is_ie ) {
			
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 110;
		*/
		/*cell.appendChild(inputEl);
		row.appendChild(cell);*/


		cell = document.createElement("TD");
		cell.setAttribute("align",'center');
		cell.setAttribute("id", 'value6_' + id)
		inputEl = document.createElement("DIV");
		var presdiv = 'div_' + id;
		fvalname = 'field_button' + id;
		fvalid = 'userbutton6_' + id;
		
		ftxtname = 'field_productcode'+id;
		
		ftxtid	= 'userInput2_'+id;	
	
		inputEl.setAttribute("id", presdiv);

		/* End of Product code and display of button */
				

		/* Product Name */


		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value9_' + id)
		inputEl = document.createElement("DIV");
		var presdiv3 = 'div1_' + id;
		fvalname_casepname = 'field_type' + id;
		fvalid_casepname = 'userInput8_' + id;
		inputEl.setAttribute("id", presdiv3);

		/*cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value9_' + id);
		cell.setAttribute("align",'center');
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput8_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("disabled",'true');
		
		inputEl.setAttribute("name", 'txtproductname' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 170;*/
		/* End of Product Name */


	

		/* Product Quantity */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value4_' + id);
		cell.setAttribute("align",'center');
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput3_' + id);
		inputEl.setAttribute("value",'');

		inputEl.setAttribute("name", 'txtquantity' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 100;
		/* End of Product Plan */


		/* Product Price 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value3_' + id);
		cell.setAttribute("align",'center');
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput4_' + id);


		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtcost' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 100;
		 End of Product Price */

		 /* Product Price */

		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value3_' + id);
		cell.setAttribute("align",'center');
		inputEl = document.createElement("DIV");
		var presdiv2 = 'div2_' + id;
		fvalname2 = 'txtcost' + id;
		fvalid2 = 'userInput4_' + id;		
		inputEl.setAttribute("id", presdiv2);

		/* End of Product Price */

		/* Product Coverage */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value5_' + id)
		inputEl = document.createElement("DIV");
		var presdiv4 = 'div3_' + id;
		fvalname_casecoverage = 'txtcoverage' + id;
		fvalid_casecoverage = 'userInput5_' + id;
		inputEl.setAttribute("id", presdiv4);


		/* 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value5_' + id);
		cell.setAttribute("align",'center');
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput5_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtcoverage' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 100;
		*/		
		
		/* Product Excess */

		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value7_' + id)
		inputEl = document.createElement("DIV");
		var presdiv5 = 'div4_' + id;
		fvalname_caseexcess = 'txtexcess' + id;
		fvalid_caseexcess = 'userInput6_' + id;
		inputEl.setAttribute("id", presdiv5);

		/*cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value7_' + id);
		inputEl = document.createElement("INPUT");
		cell.setAttribute("align",'center');
		inputEl.setAttribute("id", 'userInput6_' + id);
		inputEl.setAttribute("value",'');
		//inputEl.setAttribute("readonly=true",'');
		inputEl.setAttribute("name", 'txtexcess' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 100;*/
	

		/* Product Excess */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value8_' + id);
		inputEl = document.createElement("INPUT");
		cell.setAttribute("align",'center');
		inputEl.setAttribute("id", 'userInput7_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtcoverageavailable' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.setAttribute("type", 'hidden');
		inputEl.style.width = 100;

		cell.appendChild(inputEl);
		row.appendChild(cell);
		tablebody.appendChild(row);


		var presdivid = document.getElementById(presdiv);
		presdivid.innerHTML = fvalbuttonvalues1(fvalname, id, ftxtname, ftxtid);

		var presdivid2 = document.getElementById(presdiv2);
		presdivid2.innerHTML = fvalprice(fvalname2, id,fvalid2);

		var presdivid3 = document.getElementById(presdiv3);
		presdivid3.innerHTML = fvalcasepname(fvalname_casepname, id);

	
		var presdivid4 = document.getElementById(presdiv4);
		presdivid4.innerHTML = fvalcasecoverage(fvalname_casecoverage,id);

		var presdivid5 = document.getElementById(presdiv5);
		presdivid5.innerHTML = fvalcaseexcess(fvalname_caseexcess, id);

		id++; // increment for next to be added elements row
		if ( id > 1 ) {
			morediv.innerHTML = morebtnHTML_cases;
		}




		//fnobjfoc.focus();
		document.custannotform.no_of_fields.value = id;
	} // end of addInput()




	function addInput_overriders(obj) {
		var morediv = document.getElementById('moredivid');

		tablebody = document.getElementById('mytbody');

		row = document.createElement("TR");
		row.setAttribute("id", 'row' + id);

		cell = document.createElement("TD");

		/*
		cell.setAttribute("id", 'value1_' + id)
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput1_' + id);
		inputEl.setAttribute("name", 'field_name' + id);
		inputEl.setAttribute("maxlength", '11');
		var fnobjfoc = inputEl;
		
		if ( is_ie ) {
			
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 80;
*/
	//	cell.appendChild(inputEl);
		cell.setAttribute("id", 'value6_' + id)
		inputEl = document.createElement("DIV");
		var presdiv = 'div_' + id;
		fvalname = 'field_button' + id;
		fvalid = 'userbutton6_' + id;
		inputEl.setAttribute("id", presdiv);


		/* Product category */
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value2_' + id)
		inputEl = document.createElement("DIV");
		var presdiv2 = 'div2_' + id;
		fvalname_cat = 'field_type' + id;
		fvalid_cat = 'userInput2_' + id;
		inputEl.setAttribute("id", presdiv2);
		/* End of Product category */	


				/* Product Category 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value2_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput2_' + id);
		inputEl.setAttribute("value",'');
		
		inputEl.setAttribute("name", 'field_type' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 150;
		End of Product category */


		/*product plan*/
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value4_' + id)
		inputEl = document.createElement("DIV");
		var presdiv3 = 'div3_' + id;
		fvalname_plan = 'txtnameplan' + id;
		fvalid_plan = 'userInput4_' + id;
		inputEl.setAttribute("id", presdiv3);

		/* Product Plan 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value4_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput4_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtnameplan' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 150;
		End of Product Plan */

		

		/*product Name*/
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id", 'value3_' + id)
		inputEl = document.createElement("DIV");
		var presdiv4 = 'div4_' + id;
		fvalname_pname = 'field_value' + id;
		fvalid_pname = 'userInput3_' + id;
		inputEl.setAttribute("id", presdiv4);

		/* Product Name 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value3_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput3_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'field_value' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 150;
		 End of Product Name */

		/*product Description*/
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell			= document.createElement("TD");
		cell.setAttribute("id", 'value5_' + id)
		inputEl			= document.createElement("DIV");
		var presdiv5	= 'div5_' + id;
		fvalname_pdesc	= 'txtnamepdesc' + id;
		fvalid_pdesc	= 'userInput5_' + id;
		inputEl.setAttribute("id", presdiv5);

		/* Product Description 
		cell.appendChild(inputEl);
		row.appendChild(cell);
		cell = document.createElement("TD");
		cell.setAttribute("id",'value5_' + id);
		inputEl = document.createElement("INPUT");
		inputEl.setAttribute("id", 'userInput5_' + id);
		inputEl.setAttribute("value",'');
		inputEl.setAttribute("name", 'txtnamepdesc' + id);		
		if ( is_ie ) {
			inputEl.setAttribute("className", 'Formfield');
		}
		else {
			inputEl.setAttribute("class", 'Formfield');
		}
		inputEl.style.width = 175;
	 End of Product Description */



		cell.appendChild(inputEl);

		row.appendChild(cell);

		tablebody.appendChild(row);


		var presdivid = document.getElementById(presdiv);
		presdivid.innerHTML = fvalbuttonvalues(fvalname, id);

		/* For Product category */
		var presdivid2 = document.getElementById(presdiv2);
		presdivid2.innerHTML = fvalue_pcat(fvalname_cat, id);


		/* For Product plan*/
		var presdivid3 = document.getElementById(presdiv3);
		presdivid3.innerHTML = fvalue_plan(fvalname_plan, id);


		/*for product name*/
		var presdivid4 = document.getElementById(presdiv4);
		presdivid4.innerHTML = fvalue_pname(fvalname_pname, id);

		/*for product description*/
		var presdivid5 = document.getElementById(presdiv5);
		presdivid5.innerHTML = fvalue_pdesc(fvalname_pdesc, id);
	
		

		id++; // increment for next to be added elements row
		if ( id > 1 ) {
			morediv.innerHTML = morebtnHTML_overriders;
		}
		//fnobjfoc.focus();
		document.custannotform.no_of_fields.value = id;
	} // end of addInput()




/*functions for plan overrides*/
function fvalue_pdesc(fvalname_pdesc, id)
{
						var textfval5;
						textfval5 = "<input type='text' name=txtnamepdesc"+id+" id=userInput5_"+id+" size=30 class='formfield' readonly>";
						return textfval5;
} 

function fvalue_pname(fvalname_pname, id)
{
						var textfval6;
						textfval6 = "<input type='text' name=field_value"+id+" id=userInput3_"+id+" size=26 class='formfield' readonly>";
						return textfval6;
} 

function fvalue_plan(fvalname_plan, id)
{
						var textfval3;
						textfval3 = "<input type='text' name=txtnameplan"+id+" id=userInput4_"+id+" size=26 class='formfield' readonly>";
						return textfval3;
} 

function fvalue_pcat(fvalname_cat, id)
	{
		var textfval1;
			textfval1 = "<input type='text' name=field_type"+id+" id=userInput2_"+id+" size=26 class='formfield' readonly>";
			return textfval1;
	} 

function fvalbuttonvalues(fvalname, rid) {
		var field1	=	"userInput1_"+rid
		var field2	=	"userInput2_"+rid
		var field3	=	"userInput4_"+rid
		var field4	=	"userInput3_"+rid
		var field5	=	"userInput5_"+rid
		var textfval;
		textfval = "<input type='text' name=field_name"+rid+" id=userInput1_"+rid+" size='12' class='formfield' readonly> <INPUT type=button onClick=\"openplanoverridesdialog(window, document.getElementById('"+field1+"'),document.getElementById('"+field2+"'),document.getElementById('"+field3+"'),document.getElementById('"+field4+"'),document.getElementById('"+field5+"'),'newplanoverride.php')\" name=" + fvalname + " id=userbutton6_" + rid + "  class=Formfield>";
		return textfval;
} 

/*end function for plan overrides*/



/*functions for cases*/

			
	function fvalcasepname(fvalname_casepname, id)
	{
			var textfval6;
			textfval6 = "<input type='text' name=txtproductname"+id+" id=userInput8_"+id+" size=30 class='formfield' readonly>";
			return textfval6;
	} 


	function fvalcasecoverage(fvalname_casecoverage, id)
	{
			var textfval7;
			textfval7 = "<input type='text' name=txtcoverage"+id+" id=userInput5_"+id+" size=16 class='formfield' readonly>";
			return textfval7;
	} 


	function fvalcaseexcess(fvalname_caseexcess, id)
	{
			var textfval8;
			textfval8 = "<input type='text' name=txtexcess"+id+" id=userInput6_"+id+" size=16 class='formfield' readonly>";
			return textfval8;
	} 
			
	function fvalprice(fvalname, rid,fvalid2) 
		{
		         var nooffields       =  parseInt(rid)+1
				 var textfval;				
				textfval = "<INPUT size=16 type=text  onBlur=\"getTotal(this.value,id="+rid+"); verify(this.value,id="+rid+",nooffields="+nooffields+")\" name=" + fvalname + " id=\"userInput4_"+rid+"\"  class=Formfield>";
				return textfval;
		} 




			function fvalbuttonvalues1(fvalname, rid, ftxtname, ftxtid) {	
				
					
						var textfval;

						var field1	=	"userInput2_"+rid
						var field2	=	"userInput3_"+rid
						var field3	=	"userInput7_"+rid
						var field4	=	"userInput8_"+rid
						
						textfval ="<input type='text' name="+ftxtname+" id="+ftxtid+" class='Formfield' size='12' readonly>&nbsp;<INPUT type=image src=images/lookup_icon.gif onClick=\"openwindowcase(window, document.getElementById('"+field1+"'),document.getElementById('"+field2+"'),document.getElementById('"+field3+"'),document.getElementById('"+field4+"'),'newcase.php?&memberid="+document.custannotform.selmemberid.value+"&providerid="+document.custannotform.selprovideid.value+"')\" name=" + fvalname + " id=userbutton6_" + rid + "  class=Formfield>";
						return textfval;
						
						
			} 


/*function end for  cases*/
			



	// Removes the last row of field name, value entry created
	function removeInput() {
		var morediv = document.getElementById('moredivid');

		if ( id > 1 ) {
		
			id--; // decrement to capture previously added elements row
			
			selType = document.getElementById('userInput2_' + id);
			if (selType.options[selType.selectedIndex].value == 6) {
				
				richdiv.style.display = 'none';
			}
		
			tablebody = document.getElementById('mytbody');
			
			remUI1 = document.getElementById('userInput1_' + id);
			//remUI2 = document.getElementById('userInput2_' + id);
			remUI2 = document.getElementById('div_' + id);
			remUI3 = document.getElementById('userInput3_' + id);
		
			remcell1 = document.getElementById('value1_' + id);
			remcell1.removeChild(remUI1);
		
			remcell2 = document.getElementById('value2_' + id);
			remcell2.removeChild(remUI2);

			remcell3 = document.getElementById('value3_' + id);
			remcell3.removeChild(remUI3);
		
			remrow = document.getElementById('row' + id);
			remrow.removeChild(remcell3);
			remrow.removeChild(remcell2);
			remrow.removeChild(remcell1);
		
			tablebody.removeChild(remrow);
		
			document.custannotform.no_of_fields.value = id;
		} 
		

		if ( id <= 1 ) {

			morediv.innerHTML = '<a href="#" onclick="addInput(document.custannotform)"><img src="./images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;';
		}
	}// end of  removeInput()


	// Removes the last row of field name, value entry created
	function removeInput_overriders() {
		var morediv = document.getElementById('moredivid');

		if ( id > 1 ) {
		
			id--; // decrement to capture previously added elements row
			
		
			tablebody = document.getElementById('mytbody');
			remUI1 = document.getElementById('userInput1_' + id);
			remUI2 = document.getElementById('userInput2_' + id);
			remUI3 = document.getElementById('userInput3_' + id);
			remUI4 = document.getElementById('userInput4_' + id);
			remUI5 = document.getElementById('userInput5_' + id);
			remUI6 = document.getElementById('userbutton6_' + id);
		

			//remcell2 = document.getElementById('value3_' + id);		
			//remcell2.removeChild(remUI2);

			remUI1 = document.getElementById('div_' + id);
			remcell1 = document.getElementById('value6_' + id);
			remcell1.removeChild(remUI1);
		
			remUI2 = document.getElementById('div2_' + id);
			remcell2 = document.getElementById('value2_' + id);
			remcell2.removeChild(remUI2);

			remUI3	 = document.getElementById('div3_' + id);
			remcell3 = document.getElementById('value4_' + id);
			remcell3.removeChild(remUI3);

			remUI4	= document.getElementById('div4_' + id);
			remcell4 = document.getElementById('value3_' + id);
			remcell4.removeChild(remUI4);

			remUI5	 = document.getElementById('div5_' + id);
			remcell5 = document.getElementById('value5_' + id);
			remcell5.removeChild(remUI5);


			remrow = document.getElementById('row' + id);
			//remrow.removeChild(remcell6);
			remrow.removeChild(remcell5);
			remrow.removeChild(remcell4);
			remrow.removeChild(remcell3);
			remrow.removeChild(remcell2);
			//remrow.removeChild(remcell1);
		
			tablebody.removeChild(remrow);
		
			document.custannotform.no_of_fields.value = id;
		} 
		

		if ( id <= 1 ) {

			morediv.innerHTML = '<a href="#" onclick="addInput_overriders(document.custannotform)"><img src="./images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;';
		}
	}// end of  removeInput()

	function removeInput_diag() {
		var morediv = document.getElementById('moredivid');

		if ( id > 1 ) {
		
			id--; // decrement to capture previously added elements row
			
		
			tablebody = document.getElementById('mytbody');
			remUI1 = document.getElementById('txtdiag1_' + id);
			remUI2 = document.getElementById('txtdiag2_' + id);
		
			remcell1 = document.getElementById('value1_' + id);
			remcell1.removeChild(remUI1);
		
			remcell2 = document.getElementById('value2_' + id);
			remcell2.removeChild(remUI2);


			remrow = document.getElementById('row' + id);
			//remrow.removeChild(remcell6);
			remrow.removeChild(remcell1);
			remrow.removeChild(remcell2);
		
			tablebody.removeChild(remrow);
		
			document.custannotform.no_of_fields.value = id;
		} 
		

		if ( id <= 1 ) {

			morediv.innerHTML = '<a href="#" onclick="addInput_diag(document.custannotform)"><img src="./images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;';
		}
	}// end of  removeInput()

	function removeInput_cases() {
		var morediv = document.getElementById('moredivid');
//		id =	document.custannotform.no_of_fields.value

		if ( id > 1 ) {
		
			id--; // decrement to capture previously added elements row
			

			tablebody = document.getElementById('mytbody');
			remUI3 = document.getElementById('userInput3_' + id);
			remUI4 = document.getElementById('userInput4_' + id);
			remUI5 = document.getElementById('userInput5_' + id);
			remUI6 = document.getElementById('userInput6_' + id);
			remUI7 = document.getElementById('userInput7_' + id);
			remUI8 = document.getElementById('userInput8_' + id);

			remUI1 = document.getElementById('div_' + id);
			remcell1 = document.getElementById('value6_' + id);		
			remcell1.removeChild(remUI1);

		
			remUI4=document.getElementById('div2_' + id);
			remcell2 = document.getElementById('value3_' + id);		
			remcell2.removeChild(remUI4);


			
			remcell3 = document.getElementById('value4_' + id);
			remcell3.removeChild(remUI3);

		

			remUI5 = document.getElementById('div3_' + id);
			remcell5 = document.getElementById('value5_' + id);
			remcell5.removeChild(remUI5);


			remUI6 = document.getElementById('div4_' + id);
			remcell6 = document.getElementById('value7_' + id);
			remcell6.removeChild(remUI6);

			
		
			remcell7 = document.getElementById('value8_' + id);
			remcell7.removeChild(remUI7);


			remUI8 = document.getElementById('div1_' + id);
			remcell8 = document.getElementById('value9_' + id);
			remcell8.removeChild(remUI8);


			remrow = document.getElementById('row' + id);
			remrow.removeChild(remcell7);
			remrow.removeChild(remcell6);
			remrow.removeChild(remcell5);
//			remrow.removeChild(remcell4);
			remrow.removeChild(remcell3);
			//remrow.removeChild(remcell2);
			//remrow.removeChild(remcell1);
		
			tablebody.removeChild(remrow);
		
			document.custannotform.no_of_fields.value = id;
		} 
		

		if ( id <= 1 ) {

			morediv.innerHTML = '<a href="#" onclick="addInput_cases(document.custannotform,document.custannotform.no_of_fields.value)"><img src="./images/more_01.gif" border="0" alt="Add a row" title=" Add a row "></a>&nbsp;&nbsp;&nbsp;';
		}
	}// end of  removeInput()



	function test() {

		obj = document.forms[0];
		mystr = "";
		for (i = 0; i < obj.elements.length; i++)
		{
			mystr += obj.elements[i].name + "=" + obj.elements[i].value + "&";
		}
		alert( mystr );
	}

	// This  function is used to enable the rich text
	function showrichtext( selfval, richid ) {

		var richdiv = document.getElementById('richdiv');
		var richfvalname = 'userInput3_' + richid;

		if (selfval == 6) {

			richdiv.style.display = 'block';
			document.custannotform.elements[richfvalname].readOnly = true;
			document.getElementById('doc_content').contentWindow.document.body.innerHTML = document.custannotform.elements[richfvalname].value;
			
			document.adddoc.richfieldval.value = richfvalname;
		}
		else {

			document.custannotform.elements[richfvalname].readOnly = false;
			document.custannotform.elements[richfvalname].value = "";
			richdiv.style.display = 'none';
		}
		
		richlink = 'richlink';

		window.location = '#' + richlink;

		if (document.all) {
			
			oRTE = frames['doc_content'];
		}
		else {
			
			oRTE = document.getElementById('doc_content').contentWindow;
		}
		oRTE.focus();
		
	} // end of showrichtext()


