var loading="<center><img src="+local+"style/images/loader.gif></center>";var wait="<center><img src="+local+"style/images/wait.gif></center>";var ok="<img src="+local+"style/images/success.gif>";var show=0;function __doget(url,id){	$.ajax({		   method: "get",url: local+"index.php?ajax_request=1",data: url,		   success: function(html){if(html != ""){	$('#'+id).hide();$('#'+id).html(html).fadeIn(700);}		   }	});}function __dopost(url,id,mess,pos){		var submit_text = $('#submit').val();	document.getElementById("submit").disabled = true;	$("#submit").val("please wait ...");	$.ajax({		   type: "POST",url: local+"index.php?ajax_request=1",data: url,		   success: function(msg){if(msg){	if(id == "alert"){if(msg == 1){	if(mess != '') alert(mess);	if(pos == true) window.location.reload();	else return 1;}else{alert(msg);}	}	else{$('#'+id).html(msg);}	document.getElementById("submit").disabled = false;	$("#submit").val(submit_text);}	   }	});	return true;}



function form_post(type){		if(type == 'login')	{		__dopost("mod=user&act=login&username="+$('#user_log').val()+"&password="+$('#pass_log').val(),'alert','',true);	}	

else if(type == 'register')	{__dopost("mod=user&act=register&username="+$('#user_reg').val()+"&pass1="+$('#pass1_reg').val()+"&pass2="+$('#pass2_reg').val()+"&email="+$('#email_reg').val()+"&ym="+$('#ym_reg').val()+"&code="+$('#code').val(),'alert','Đăng ký thành công',true);	}
else if(type == 'profile')	{__dopost("mod=user&act=change_profile&pass1="+$('#pass1_reg').val()+"&pass2="+$('#pass2_reg').val()+"&email="+$('#email_reg').val()+"&ym="+$('#ym_reg').val(),'alert','Cập nhật thông tin thành công',true);	}

else if(type == 'add_comment')	{	var submit_text = $('#submit').val();		id = $('#ID').val();		document.getElementById("submit").disabled = true;		$("#submit").val("please wait ...");		$.ajax({type: "POST",url: local+"index.php?ajax_request=1",data: "mod=comment&act=add&content="+$('#cm_content').val()+"&IDD="+id,success: function(msg){	if(msg){if(msg == 1){	document.getElementById("submit").disabled = false;	$("#submit").val(submit_text);	$('#cm_box').slideUp('slow');	ShowComment(id,1);}else{	alert(msg);	document.getElementById("submit").disabled = false;	$("#submit").val(submit_text);}	}		   }		});	}	return false;}function sndVote(value,id){	$("#vote-text").html("loading...");	$.ajax({		type: "POST",url: local+"index.php?ajax_request=1",data: "mod=rating&act=rate&value="+value+"&IDD="+id,		success: function(msg){if(msg){	if(msg == 1)	{$("#vote-text").html("Thank you !");	}	else{	alert(msg);	}}		  }	});}function Search(){	key = $('#keyword').val();	if(key == ''){		alert('Chưa nhập từ khóa tìm kiếm');		$('#keyword').focus();	}	else{		location.href = local+"search/"+key;	}	return false;	}function show_box_cm(){	if(show_cm == 1){ $('#cm_box').fadeIn(); show_cm = 0; $('#cm_content').val('')}	else {$('#cm_box').hide(); show_cm=1;}}function ShowComment(cm_media, page){	var ct = $('#note_view').html();	__doget('mod=comment&act=show&cm_media='+cm_media+'&page='+page,'comment_list');		$.ajax({		   method: "get",url: local+"index.php?ajax_request=1",data: 'mod=user&act=showads',		   success: function(html){if(html != ""){	$('#note_view').hide();$('#note_view').html(ct+' '+html).fadeIn(700);}		   }	});}function smile(code){	$("#cm_content").val($("#cm_content").val() + code);	$("#cm_content").focus();}
function ReportBroken(id){$("#ReportBroken").html("please wait...");	$.ajax({		type: "POST",url: local+"index.php?ajax_request=1",data: "mod=film&act=reportbroken&IDD="+id,		success: function(msg){if(msg){	if(msg == 1)	{$("#ReportBroken").html("Thank you !");	}	else{	alert(msg);	}}}});}