// JavaScript Document
	jQuery(document).ready(function() {
		jQuery('.slideshowbg').cycle({
				    fx:     'fade', 
					speed:   1500, 
					timeout: 3500

		});
	});
function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}

function formFocus(v,i) {
	if(v.value==i){v.value=''} 
}
function formBlur(v,i) {
	if(v.value==''){v.value=i}
}
// ####################################### Start Img ################################################# //

		function onImgPreview(albumID,masterkey) {
	
	jQuery("#load_waitingdata").show();

	var TYPE="POST";
	var URL="gallery_viewimg.php";
	
		var dataSet={ 
	albumID : albumID,
	key : masterkey
	};
		
	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			onImgPreviewData(albumID,masterkey);
			jQuery("#load_previewimg").show();
			jQuery("#load_previewimg").html(html);
			jQuery("#load_waitingdata").hide();
		}
	}); 
	}
	
	function onImgPreviewData(albumID,masterkey) {
	
	jQuery("#load_waitingdata").show();

	var TYPE="POST";
	var URL="gallery_viewdata.php";
	
		var dataSet={ 
	albumID : albumID,
	key : masterkey
	};
		
	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			
			jQuery("#load_dataimg").show();
			jQuery("#load_dataimg").html(html);
			jQuery("#load_waitingdata").hide();
		}
	}); 
	}

// ####################################### End Img ################################################# //

// ####################################### Start Contact US ################################################# //	

function insertContactUsTh() {
	
	jQuery("#load_mainwaiting").show();

	var TYPE="POST";
	var URL="load_contactus.php";
	
	var dataSet= jQuery("#myForm").serialize();
		
	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			
			jQuery("#load_mainContant").show();
			jQuery("#load_mainContant").html(html);
			jQuery("#load_mainwaiting").hide();
		}
	}); 
	}	
	
		
		function loadNewCaptcha() {
var c_currentTime = new Date();
var c_miliseconds = c_currentTime.getTime();
document.getElementById('captcha').src = 'captchanew/image.php?x='+ c_miliseconds;
	}	

// ####################################### End Contact US ################################################# //	
// ####################################### Start Index ################################################# //	
function loadIndexNews() {
	
	jQuery("#load_waitingpromotion").show();

	var TYPE="POST";
	var URL="load_news.php";
	
	var dataSet= "";
		
	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			
			jQuery("#load_contantnews").show();
			jQuery("#load_contantnews").html(html);
			jQuery("#load_waitingpromotion").hide();
		}
	}); 
	}	
	
	function loadIndexPhoto() {
	
	jQuery("#load_waitingproduct").show();

	var TYPE="POST";
	var URL="load_photo.php";
	
	var dataSet= "";
		
	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			
			jQuery("#load_contantphoto").show();
			jQuery("#load_contantphoto").html(html);
			jQuery("#load_waitingproduct").hide();
		}
	}); 
	}	
// ####################################### End Index ################################################# //	
// ####################################### Start E-News ################################################# //	
function onRegisterEnewsStep1(typeRegister) {
	
	jQuery("#load_waitingenews").show();

	var TYPE="POST";
	var URL="load_checkenews.php";
	
	var dataSet= jQuery("#myFormEnews2").serialize();

	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			if(typeRegister=='yes'){
			alert('กรุณากรอกข้อมูลเพิ่มเติม');
			}
			jQuery("#load_registerenews").show();
			jQuery("#load_registerenews").html(html);
			jQuery("#load_waitingenews").hide();
		}
	}); 
	}	
	
	function onRegisterEnewsStep2() {
	
	jQuery("#load_waitingenews").show();

	var TYPE="POST";
	var URL="load_checkenews2.php";
	
	var dataSet= jQuery("#myFormEnewsAll").serialize();

	jQuery.ajax({type:TYPE,url:URL,data:dataSet,
		success:function(html){
			jQuery("#load_registerenews").show();
			jQuery("#load_registerenews").html(html);
			jQuery("#load_waitingenews").hide();
		}
	}); 
	}	


// ####################################### End E-News ################################################# //	


