$(function(){
	$('#formId').jqTransform({imgPath:'jqtransformplugin/img/'});
	
	var optionText = "";
	var classText = "";
	
	$("#div_add_other ul li a").click(function() {
			var addIndex = $(this).attr('index');
			switch(addIndex) {
				case '1' :
					optionText = '<option>移动电话</option>' +
								'<option>家庭电话</option>' +
								'<option>工作电话</option>' +
								'<option>工作传真</option>' +
								'<option>家庭传真</option>' +
								'<option>传呼机</option>' +
								'<option>其他电话</option>';
					classText = 'parentsMobile';						
					break;
				case '2' :
					optionText = '<option>家庭邮箱</option>' +
								'<option>工作邮箱</option>' +
								'<option>其他邮箱</option>';
					classText = 'parentsEmail';						
					break;
				case '3' :
					optionText = '<option>AIM</option>' +
								'<option>MSN</option>' +
								'<option>Yahoo</option>' +
								'<option>Skype</option>' +
								'<option>QQ</option>' +
								'<option>Gtalk</option>' +
								'<option>ICQ</option>' +
								'<option>jabber</option>';	
					classText = 'parentsQq';	
					break;
				case '4' :
					optionText = '<option>家庭地址</option>' +
							'<option>工作地址</option>' +
							'<option>其他地址</option>';
					classText = 'parentsAdr';						
					break;
				case '5' :
					optionText = '<option>公司</option>' +
							'<option>其他</option>';
					classText = 'parentsCompany';						
					break;
				default : return;		
			
			}
			
			var beforeSlt = '<div class="parentsMobile">' +
							'<div class="clearfix" id="div_mobile">' +
							'<select class="sestyle" name="mobile">' +
							optionText +
							'</select>' +
							'<input type="text" class="" />' +
							'<a class="delete">删除</a>' +
							'</div>' +
							'</div>';
			//jqTransformHidden
			var brotherDom = $('.'+classText);
			brotherDom.eq(brotherDom.length - 1).after(beforeSlt);
			var deleteDom = brotherDom.next().eq(0);
			//$('#div_add_other').prev().jqTransSelect();
			$('#formId').jqTransform({imgPath:'jqtransformplugin/img/'});
			$('.jqTransformSelectWrapper').each(function(index) {
				$(this).css('zIndex', 100 - index);
				deleteDom.find('a.delete').data('delete', deleteDom).click(function() {
					$(this).data('delete').remove();
					$('#formId').jqTransform({imgPath:'jqtransformplugin/img/'});
				})
			})
	})
	
	$("#div_add_other").change(function() {
		var beforeSlt = '<div>' + $('.parentsMobile').html() + '</div>';
		$('.parentsMobile').after(beforeSlt);  
	})
});
