// JavaScript Document
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;}

//choose&unchoose
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function flevToggleCheckboxes() { // v1.1
	// Copyright 2002, Marja Ribbers-de Vroed, FlevOOware (www.flevooware.nl/dreamweaver/)
	var sF = arguments[0], bT = arguments[1], bC = arguments[2], oF = MM_findObj(sF);
    for (var i=0; i<oF.length; i++) {
		if (oF[i].type == "checkbox") {if (bT) {oF[i].checked = !oF[i].checked;} else {oF[i].checked = bC;}}} 
}
function MM_cho(){
document.getElementById(arguments[0]).style.display = 'none';
document.getElementById(arguments[1]).style.display = '';
}
//img move
function MM_imgmove(){
arguments[0].style.position='relative';
arguments[0].style.marginTop=arguments[1]+'px';
arguments[0].style.marginLeft=arguments[1]+'px';
}

//tw_site
function MM_country(){
document.getElementById(arguments[0]).style.display = "";
document.getElementById(arguments[1]).style.display = "none";
}
function site_inputValue(){
tw_Num = arguments[0];
	if(document.getElementsByName('country['+tw_Num+']')[0].checked == true){
	$('vpostcode['+tw_Num+']').value=$F('postcode['+tw_Num+']');
	$('vcity['+tw_Num+']').value=$F('citys['+tw_Num+']');
	$('vtown['+tw_Num+']').value=$F('towns['+tw_Num+']');
	$('vaddress['+tw_Num+']').value=$F('address_tw['+tw_Num+']');
	}
	else if(document.getElementsByName('country['+tw_Num+']')[1].checked == true){
	$('vpostcode['+tw_Num+']').value="0";
	$('vcity['+tw_Num+']').value=$F('outside_citys['+tw_Num+']');
	$('vtown['+tw_Num+']').value=$F('outside_towns['+tw_Num+']');
	$('vaddress['+tw_Num+']').value=$F('address_notw['+tw_Num+']');
	}
}
//upfile
function addFiles(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	if(arguments[1].value!='' && arguments[1]==lastobj){
   obj = document.getElementById(arguments[0]);
   elm = document.createElement("DIV");
   elm.innerHTML = '<img src="image/b_drop.png" alt="刪除" width="16" height="16" border="0" onClick="delFiles(\''+obj.id+'\',this)"><input name="'+arguments[1].name+'" type="file" class="upfile_botton" id="'+arguments[1].name+'" onChange="addFiles(\''+obj.id+'\',this)">';
   obj.appendChild(elm);
   }
}

function delFiles(){
	if(confirm('確定刪除？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode);
	}
}



function delCS(){
	if(confirm('確定刪除此合作伙伴？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function delOfr(){
	if(confirm('確定刪除此代理廠商？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function delOfr2(){
	if(confirm('確定刪除此基金？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function delper(){
	if(confirm('確定刪除此保費佣金？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function YY_checkform() {
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(parseInt(myV))||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('您所填寫的資料有誤:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
  if(document.MM_returnValue != false) document.getElementById('Send_botton').disabled = true;
}


function MM_dism(){
	obj = document.getElementsByName('tagm');
	len = obj.length;
	num = arguments;
	total_num = num.length;
	
		for(i=0 ; i<len ; i++){
			obj[i].style.display = "none";
		}
		for(j=0 ; j<total_num ; j++){
			obj[num[j]].style.display = "";
		}
}


function Ct_cro(){
	var obj_check = document.getElementById("ct_check").value;
	document.getElementById("ct").style.display = '';
	document.getElementById('ct_msg').innerHTML = '';
	if(obj_check=='1'){
		tmt_divBoxIn('ct','1','0');
		document.getElementById("ct_check").value=0;
	}
	else {	
		tmt_divBoxOut('ct','1','0');	
		document.getElementById("ct_check").value=1;
	}
}


function tmt_divBoxIn(tl,dur,incr){
	var nn4=(document.layers)?true:false;transNo=parseInt(0);arHidden=new Array(1,3,14,16);
	var t=(document.getElementById)?tmt_findObj(tl):MM_findObj(tl);
	if(document.all&&t){t.style.filter="revealTrans(duration=" + dur + ",transition=0)";endState="hidden";
	for(i=0;i<arHidden.length;i++){if(arHidden[i]==transNo){endState="visible";t.style.visibility="hidden";}}
	t.filters.revealTrans.apply();t.style.visibility = endState;t.filters.revealTrans.play();return;}
	if(navigator.appName=="Netscape"&&t){intval=100;if(incr==0){if(nn4&&t){
	t.origLeft=t.Left=t.clip.left;t.origTop=t.Top=t.clip.top;t.origRight=t.Right=t.clip.right;
	t.origBottom=t.Bottom=t.clip.bottom;t.Width=t.clip.width;t.Height=t.clip.height;}else{
	t.style.overflow='hidden';t.Left=t.Top=0;t.Right=t.Width=t.offsetWidth;t.Bottom=t.Height=t.offsetHeight;}
    mSecs=dur*1000;visits=(mSecs/intval);fullW=t.Width;fullH=t.Height;halfW=fullW/2;halfH=fullH/2;
    alternateW=alternateH=true;incW=halfW/visits;incrementW=(incW>=1)?parseInt(incW):0;
    xtraPixW=Math.round((incW-incrementW)*visits);incH=halfH/visits;
    incrementH=(incH>=1)?parseInt(incH):0;xtraPixH=Math.round((incH-incrementH)*visits);        
    if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}}t.Left+=incrementW;t.Right-=incrementW;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}alternateH=!alternateH;}else{t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}t.Top+=incrementH;t.Bottom-=incrementH;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    visits--;}else{if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){
    t.Left++;t.Right--;if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left++;t.Right--;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}}t.Left+=incrementW;t.Right-=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}alternateH=!alternateH;}else{t.Top++;t.Bottom--;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip = "rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixH--;}}t.Top+=incrementH;t.Bottom-=incrementH;
    if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    visits--;}t.Width=t.Right-t.Left;t.Height=t.Bottom-t.Top;if(t.Height<=0&&t.Width<=0){
    if(nn4){t.visibility="hide";t.clip.left=t.origLeft;t.clip.top=t.origTop;
	t.clip.right=t.origRight;t.clip.bottom=t.origBottom;
    }else{t.style.visibility='hidden';t.style.clip="rect(auto)";}
	}else{setTimeout('tmt_divBoxIn("'+tl+'",'+dur+',1)',intval);}}
}

function tmt_divBoxOut(tl,dur,incr) {
	var nn4=(document.layers)?true:false;transNo=parseInt(1);arHidden=new Array(1,3,14,16);
	var t=(document.getElementById)?tmt_findObj(tl):MM_findObj(tl);
	if(document.all&&t){t.style.filter="revealTrans(duration="+dur+",transition=1)";endState="hidden";
	for(i=0;i<arHidden.length;i++){if(arHidden[i]==transNo){endState="visible";t.style.visibility="hidden";}}
    t.filters.revealTrans.apply();t.style.visibility=endState;t.filters.revealTrans.play();return;}
	if(navigator.appName=='Netscape'&&t){intval=100;if(incr==0){if(nn4){t.origLeft=t.Left=t.clip.left;
	t.origTop=t.Top=t.clip.top;t.origRight=t.Right=t.clip.right;t.origBottom=t.Bottom=t.clip.bottom;
	t.Width=t.clip.width;t.Height=t.clip.height;}else{t.style.overflow='hidden';
	t.Left=t.origLeft=t.Top=t.origTop=0;t.Right=t.Width=t.offsetWidth;t.Bottom=t.Height=t.offsetHeight;}
	mSecs=dur*1000;visits=(mSecs/intval);fullW=t.Width;fullH=t.Height;halfW=fullW/2;halfH=fullH/2;
	alternateW=alternateH=true;incW=halfW/visits;incrementW=(incW>=1)?parseInt(incW):0;
	xtraPixW=Math.round((incW-incrementW)*visits);incH=halfH/visits;incrementH=(incH>=1)?parseInt(incH):0;
	xtraPixH=Math.round((incH-incrementH)*visits);t.Left+=halfW;t.Right-=halfW;t.Top+=halfH;t.Bottom-=halfH;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;t.clip.top=t.Top;t.clip.bottom=t.Bottom;t.visibility="show";}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";
	t.style.visibility='visible';}if((t.Left-t.origLeft)<=incrementW){
	if(nn4){t.clip.left=t.origLeft;t.clip.right=t.origRight;}else{
	t.style.clip="rect("+t.Top+"px auto "+t.Bottom+"px auto)";}}
	else{if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    xtraPixW--;}alternateW=!alternateW;}else{t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}}}t.Left-=incrementW;t.Right+=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if((t.Top-t.origTop)<=incrementH){
    if(nn4){t.clip.top=t.origTop;t.clip.bottom=t.origBottom;}else{
    t.style.clip="rect(auto "+t.Right+"px auto"+t.Left+"px)";}}else{
    if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}alternateH=!alternateH;}else{t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}}t.Top-=incrementH;t.Bottom+=incrementH;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	visits--;}else{if((t.Left-t.origLeft)<=incrementW){
	if(nn4){t.clip.left=t.origLeft;t.clip.right=t.origRight;}else{
	t.style.clip="rect("+t.Top+"px auto "+t.Bottom+"px auto)";}}else{
	if(xtraPixW>0){if(xtraPixW<=visits){if(alternateW){t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}alternateW=!alternateW;}else{t.Left--;t.Right++;
	if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixW--;}}}t.Left-=incrementW;t.Right+=incrementW;
    if(nn4){t.clip.left=t.Left;t.clip.right=t.Right;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
    if((t.Top-t.origTop)<=incrementH){
	if(nn4){t.clip.top=t.origTop;t.clip.bottom=t.origBottom;}else{
	t.style.clip="rect(auto "+t.Right+"px auto "+t.Left+"px)";}}else{
	if(xtraPixH>0){if(xtraPixH<=visits){if(alternateH){t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}alternateH=!alternateH;}else{t.Top--;t.Bottom++;
	if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
	t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}
	xtraPixH--;}}}t.Top-=incrementH;t.Bottom+=incrementH;
    if(nn4){t.clip.top=t.Top;t.clip.bottom=t.Bottom;}else{
    t.style.clip="rect("+t.Top+"px "+t.Right+"px "+t.Bottom+"px "+t.Left+"px)";}visits--;}
	if(t.Left<=t.origLeft&&t.Top<=t.origTop){
	if(nn4){t.clip.left=t.origLeft;t.clip.top=t.origTop;t.clip.right=t.origRight;
	t.clip.bottom=t.origBottom;}else{t.style.clip="rect(auto)";}}else{
	setTimeout('tmt_divBoxOut("'+tl+'",'+dur+',1)',intval);}}
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}


function Ct_cro(){
	var obj_check = document.getElementById("ct_check").value;
	document.getElementById("ct").style.display = '';
	document.getElementById('ct_msg').innerHTML = '';
	if(obj_check=='1'){
		tmt_divBoxIn('ct','1','0');
		document.getElementById("ct_check").value=0;
	}
	else {	
		tmt_divBoxOut('ct','1','0');	
		document.getElementById("ct_check").value=1;
	}
}

function CT_turn(){
var obj = document.getElementById('ct_value');
	if(arguments[0]=='1'){
		obj.innerHTML = '<input name="city_name" type="text" class="input_textfield_150" id="city_name">';
	}
	else {
		obj.innerHTML = '<select name="city_opt" id="city_opt"></select><input name="country_name" type="text" class="input_textfield_150" id="country_name">';
		MJ_update("ct_value", "dhtml/ct_country.php", "?city=1");
	}
}

function CT_submit(){
	var ct_action = document.getElementById('ct_action').value;
	var city_name = document.getElementById('city_name')==null?'':document.getElementById('city_name').value;
	var city_opt = document.getElementById('city_opt')==null?'':document.getElementById('city_opt').value;
	var country_name = document.getElementById('country_name')==null?'':document.getElementById('country_name').value;
	var ct_type_obj = document.getElementsByName('ct_type');
	var ct_type = ct_type_obj[0].checked==true?1:2;
		if( city_name!='' || country_name!='' ){
			MJ_update('ct_msg', "dhtml/ct_sumit.php", "?ct_action="+ct_action+"&city_name="+city_name+"&city_opt="+city_opt+"&country_name="+country_name+"&ct_type="+ct_type);
		}
		else {
			document.getElementById('ct_msg').innerHTML = "請輸入資料!";
		}
}

function return_city(){
	MJ_update("citys_area2[1]", "dhtml/ct_country.php", "?city=2");
}

function return_town(){
	var val = $F('outside_citys[1]');
	MJ_update('town_area2[1]','dhtml/outside_site.php?','citys=' + val + '&tw_Num=' + 1);
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function addCoper(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
	   obj = document.getElementById(arguments[0]);
	   elm = document.createElement("DIV");
	   strings = '<div align="left">';
	   strings += '<div style="width:25%; height:25px; float:left;" class="key_word">';	   
	   strings += '財顧關鍵字 ：';
	   strings += '<input name="agentcode[]" type="text" class="input_textfield_100" id="agentcode[]" onBlur="MJ_coper(this)">';
	   strings += '</div>';
	   strings += '<div style="width:35%; height:20px; float:left; margin-top:5px">&nbsp;';
	   strings += '</div>';
	   strings += '<div style="width:10%; height:20px; float:left; margin-top:5px " class="key_word">所佔業績</div>';
	   strings += '<div style="width:29%; height:25px; float:left"><input name="co_per[]" type="text" class="input_textfield_50" id="co_per[]" value="0"   onChange="addCoper(\'coper\',this)">';
	   strings += '<span class="key_word2">%</span> </div>';
	   strings += '</div>';

	   elm.innerHTML = strings;
	   elm.align = 'left';
	   obj.appendChild(elm);
   }
}

function delCoper(){
	if(confirm('確定刪除此財顧？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}


function addcollect(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
	   obj = document.getElementById(arguments[0]);
	   elm = document.createElement("DIV");
	   strings = '<div style="width:25%; height:25px; float:left;" class="key_word"> 客戶關鍵字 ： ';
	   strings += '<input name="cu_code[]" type="text" class="input_textfield_100" id="cu_code[]" onBlur="addcollect(\'collect\',this);MJ_cucollect(this);">';
	   strings += '</div>';
	   strings += '<div>';
	   strings += '<div style="width:74%; height:25px; float:left; padding-top:5px" class="key_word">請輸入客戶中文或英文姓名 </div>';
	   strings += '</div>';
									
	   elm.innerHTML = strings;
	   elm.align = 'left';
	   obj.appendChild(elm);
   }
}

function delcollect(){
	if(confirm('確定刪除此聯名人？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function addwanted(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
		obj = document.getElementById(arguments[0]);
		elm = document.createElement("DIV");
		strings = '<div align="left">';
		strings += '<div style="width:20%; height:25px; float:left;" class="key_word">';
		strings += '要保人  ';
		strings += '<input name="wanted_name[]" type="text" class="input_textfield_100" id="wanted_name[]" onBlur="addwanted(\'wanted\',this)">';
		strings += '</div>';
		strings += '<div style="width:15%; height:25px; float:left;">';
		strings += '&nbsp;關係： ';
		strings += '<input name="wanted_relation[]" type="text" class="input_textfield_50" id="wanted_relation[]">';
		strings += '</div>';
		strings += '<div style="width:40%; height:25px; float:left;" class="key_word">地址： ';
		strings += '<input name="wanted_address[]" type="text" class="input_textfield_250" id="wanted_address[]">';
		strings += '</div>';
		strings += '<div style="width:24%; height:25px; float:left">身份證： ';
		strings += '<input name="wanted_identity[]" type="text" class="input_textfield_100" id="wanted_identity[]">';
		strings += '</div>';
		strings += '</div>';
		elm.innerHTML = strings;
		elm.align = 'left';
		obj.appendChild(elm);
   }
}

function delwanted(){
	if(confirm('確定刪除此要保人？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function addassured(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
		obj = document.getElementById(arguments[0]);
		elm = document.createElement("DIV");
		strings = '<div align="left">';
		strings += '<div style="width:20%; height:25px; float:left;" class="key_word">';
		strings += '被保人  ';
		strings += '<input name="assured_name[]" type="text" class="input_textfield_100" id="assured_name[]" onBlur="addassured(\'assured\',this)">';
		strings += '</div>';
		strings += '<div style="width:15%; height:25px; float:left;">';
		strings += '&nbsp;關係： ';
		strings += '<input name="assured_relation[]" type="text" class="input_textfield_50" id="assured_relation[]">';
		strings += '</div>';
		strings += '<div style="width:40%; height:25px; float:left;" class="key_word">地址： ';
		strings += '<input name="assured_address[]" type="text" class="input_textfield_250" id="assured_address[]">';
		strings += '</div>';
		strings += '<div style="width:24%; height:25px; float:left">身份證： ';
		strings += '<input name="assured_identity[]" type="text" class="input_textfield_100" id="assured_identity[]">';
		strings += '</div>';
		strings += '</div>';
		elm.innerHTML = strings;
		elm.align = 'left';
		obj.appendChild(elm);
   }
}

function delassured(){
	if(confirm('確定刪除此被保人？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}

function addBenefit(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
		obj = document.getElementById(arguments[0]);
		elm = document.createElement("DIV");
		strings = '<div align="left">';
		strings += '<div style="width:20%; height:25px; float:left;" class="key_word">';
		strings += '受益人  ';
		strings += '<input name="benefit_name[]" type="text" class="input_textfield_100" id="benefit_name[]" onBlur="addBenefit(\'benefit\',this)">';
		strings += '</div>';
		strings += '<div style="width:15%; height:25px; float:left;">';
		strings += '&nbsp;關係： ';
		strings += '<input name="benefit_relation[]" type="text" class="input_textfield_50" id="benefit_relation[]">';
		strings += '</div>';
		strings += '<div style="width:40%; height:25px; float:left;" class="key_word">地址： ';
		strings += '<input name="benefit_address[]" type="text" class="input_textfield_250" id="benefit_address[]">';
		strings += '</div>';
		strings += '<div style="width:24%; height:25px; float:left">身份證： ';
		strings += '<input name="benefit_identity[]" type="text" class="input_textfield_100" id="benefit_identity[]">';
		strings += '</div>';
		strings += '</div>';
		elm.innerHTML = strings;
		elm.align = 'left';
		obj.appendChild(elm);
   }
}

function delBenefit(){
	if(confirm('確定刪除此受益人？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}



function addCsper(){
	group = document.getElementsByName(arguments[1].name);
	lastobj = group[group.length-1];
	
	if(arguments[1].value!='' && arguments[1]==lastobj){
	   obj = document.getElementById(arguments[0]);
	   elm = document.createElement("DIV");

	   strings = '<div align="left">';
	   strings += '<div style="width:25%; height:25px; float:left;" class="key_word">';
	   strings += '合作伙伴關鍵字<input name="cscode[]" type="text" class="input_textfield_100" id="cscode[]" onBlur="MJ_csper(this)">';
	   strings += '</div>';
	   strings += '<div style="width:25%; height:25px; float:left;"> &nbsp; </div>';
	   strings += '<div style="width:14%; height:25px; float:left">';
	   strings += '<input name="cs_per[]" type="text" class="input_textfield_50" id="cs_per[]" value="0">';
	   strings += '<span class="key_word2">%</span> </div>';
	   strings += '<div style="width:16%; height:25px; float:left;" class="key_word">';
	   strings += '<input name="take_per[]" type="text" class="input_textfield_50" id="take_per[]" value="0" >';
	   strings += '<span class="key_word2">%</span>';
	   strings += '</div>';
	   strings += '<div style="width:19%; height:25px; float:left">';
	   strings += '<input name="cs_money[]" type="text" class="input_textfield_100" id="cs_money[]" value="0" onChange="addCsper(\'csper\',this)">';
	   strings += '</div>';
	   strings += '</div>';
	   
	   elm.innerHTML = strings;
	   elm.align = 'left';
	   obj.appendChild(elm);
   }
}

function delCsper(){
	if(confirm('確定刪除此合作伙伴？')){
	obj = document.getElementById(arguments[0]);
	obj.removeChild(arguments[1].parentNode.parentNode);
	}
}
