/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function editTagsBox(id){
    $.ajax({
		url:'modules/tags/formEditTags.php',
		cache: false,
		data:{'reqType':'ajax', 'contId':id},
		type:'POST',
		success:function(data){
            dynamicPopup(data,400,80);
		}//E-succ
	});
}

function editTags(){
    var tmp = $('#tmpTag').val();
    var refId = $('#contTypeId').val();
    var option = $('#option').val();
    addStringTag(option+'Tag', 'tmpTag', 'newTag');
	/*for(j=0;j<tmp;j++){
	   addStringTag(option+'Tag'+j, 'tmpTag', 'newTag'+j);
	}*/
    updateTag();
}

function updateTag(){
    var refId = $('#contTypeId').val();
    var option = $('#option').val();
    var newTag = $('#newTag').val();
    $.ajax({
		url:'modules/tags/formEditTagsSub.php',
		cache: false,
		data:{'reqType':'ajax', 'refId':refId, 'option':option, 'newTag':newTag},
		type:'POST',
		success:function(data){
           //alert(data);
           if(data == 1){
               msgSuccess('บันทึกข้อมูลเรียบร้อยแล้วค่ะ');
               location.reload();
           }else{
               msgSuccess('ระบบขัดข้อง กรุณาลองใหม่อีกครั้ง');
           }
		}//E-succ
	});
}