function youtubecode(code){


			var flashvars = {};
			var params = {};
			params.autoplay = "1";
			params.menu = "false";
			params.quality = "high";
			params.scale = "noscale";
			params.Wmode = "Transparent";
			var attributes = {};
			swfobject.embedSWF("http://www.youtube.com/v/"+code+"&hl=en&fs=1&autoplay=1", "youtubeembed", "320", "265", "9.0.0", "", flashvars, params, attributes);
}


function forget(){
	var	username		=document.form_forget.username.value;

	$("#loading_text").fadeIn(300);
	var	url_load	="/th/member/forgetpassword.php";


		$.post(url_load, "username="+username, function(data){
			$("#loading_text").fadeOut(1000);
			$("#forget_ajax_block").html(data);
		});


}

function login(){
	var	username		=document.form_login.username.value;
	var	password		=document.form_login.password.value;
	if(document.form_login.remember.checked == true){
		var remember			="Y";
	}else{
		var remember			="N";
	}

	$("#loading_text").fadeIn(300);
	var	url_load	="/th/member/login.php";


		$.post(url_load, "username="+username+"&password="+password+"&remember="+remember+"&action=login", function(data){
			if (data =="OK")
			{
				window.location.href="/th/";
			}else{
					document.form_login.username.value="";
					document.form_login.password.value="";
					$("#loading_text").fadeOut(1000);
					alert("Login ผิดพลาดชื่อผู้ใช้หรือรหัสผ่านผิดพลาดกรุณาตรวจสอบอีกครั้ง");		
			}

		});


}

function register(){
	var	username		=document.form_register.username.value;
	var	password1		=document.form_register.password1.value;
	var email			=document.form_register.email.value;
	var nickname		=document.form_register.nickname.value;
	var occupation		=document.form_register.occupation.value;

	if(document.form_register.enews.checked == true){
		var enews			=document.form_register.enews.value;
	}else{
		var enews			="N";
	}

	$("#loading_text").fadeIn(300);
	var	url_load	="/th/member/register.php";


		$.post(url_load, "username="+username+"&password1="+password1+"&email="+email+"&nickname="+nickname+"&occupation="+occupation+"&enews="+enews+"&action=register", function(data){
			$("#loading_text").fadeOut(1000);
			$("#register_ajax_block").html(data);
		});


}



function profile(){

	var	password1		=document.form_profile.password1.value;
	var email			=document.form_profile.email.value;
	var nickname		=document.form_profile.nickname.value;
	var occupation		=document.form_profile.occupation.value;

	if(document.form_profile.enews.checked == true){
		var enews			=document.form_profile.enews.value;
	}else{
		var enews			="N";
	}

	$("#loading_text").fadeIn(300);
	var	url_load	="/th/member/profile.php";


		$.post(url_load, "password1="+password1+"&email="+email+"&nickname="+nickname+"&occupation="+occupation+"&enews="+enews+"&action=edit", function(data){

			$("#register_ajax_block").html(data);
		});


}

function display(sID) {
	oObj = document.getElementById(sID);
	if (oObj) {
		oObj.style.display='inline';
	} 
}

function hide(sID) {
	oObj = document.getElementById(sID);
	if (oObj) {
		oObj.style.display='none';
	}
}

function multimedia_tag(id,page){

				var URL	= "multimedia_detail.php?id="+id+"&p="+page+"&action=ajax";
				$.get(URL, "", function(data){
					if (data !="")
					{
						$('#vdo_ajax_block').hide();
						$('#vdo_ajax_block').html(data);
						$('#vdo_ajax_block').fadeIn(1000);
					}
				});

}



function VF_form_enews(){ //v2.0
<!--start_of_saved_settings-->
<!--type,text,name,email,required,true,isEmail,errMsg,กรุณาระบุ Email ให้ถูกต้อง-->
<!--end_of_saved_settings-->
	var theForm = document.form_enews;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var errMsg = "";
	var setfocus = "";

	if (!emailRE.test(theForm['email'].value)){
		errMsg = "กรุณาระบุ Email ให้ถูกต้อง";
		setfocus = "['email']";
	}
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else{
		var email		=document.form_enews.email.value;
		var	url_load	="/th/enewsletter/action.php";
		$("#loadingenews_text").fadeIn(300);
		$.post(url_load, "action=Y&email="+email, function(data){
			$("#loadingenews_text").fadeOut(1000);
			$("#email_sub_wrapper").html(data);
		});
	}
}

