// edit time:2011.1.10 by: longzhong
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.rel +"' alt='"+this.title+"' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
$(document).ready(function(){ 
						   imagePreview();
 $("#prodorderbtn").click(function(){
  $.ajax({
   type:'POST',
   url:'ajaxget.asp?action=prodorder',
   data:"Title="+escape($("#Title").val())+"&Uname="+escape($("#Uname").val())+"&Email="+escape($("#Email").val())+"&Tel="+escape($("#Tel").val())+"&Content="+escape($("#Content").val()),
   dataType:'html',
   success:function(msg){
    msg = msg.replace(/^\s+|\s+$/g,"");
	if(msg=="ok"){
	//$("#Title").attr("value","");
	$("#Uname").attr("value","");
	$("#Tel").attr("value","");
	$("#Email").attr("value","");
	$("#Content").attr("value","");	
    alert("Thank you submit information has been preserved!");}else{alert(msg);}
   }
  });
 });
 //
 $("#efrmbtn").click(function(){
  $.ajax({
   type:'POST',
   url:'ajaxget.asp?action=order',
   data:"Title="+escape($("#Title").val())+"&Uname="+escape($("#Uname").val())+"&Tel="+escape($("#Tel").val())+"&MSN="+escape($("#MSN").val())+"&Content="+escape($("#Content").val()),
   dataType:'html',
   success:function(msg){
    msg = msg.replace(/^\s+|\s+$/g,"");
	if(msg=="ok"){
	$("#Title").attr("value","Title");
	$("#Uname").attr("value","Uname");
	$("#Tel").attr("value","Tel");
	$("#MSN").attr("value","MSN");
	$("#Content").attr("value","Content");
    alert("Thank you submit information has been preserved!");
	}else{
	alert(msg);	
	}
   }
  });
 });
 //
 $("#orderbtn").click(function(){
  $.ajax({
   type:'POST',
   url:'ajaxget.asp?action=order2',
   data:"Title="+escape($("#Title").val())+"&Uname="+escape($("#Uname").val())+"&Email="+escape($("#Email").val())+"&Tel="+escape($("#Tel").val())+"&Msn="+escape($("#Msn").val())+"&Content="+escape($("#Content").val()),
   dataType:'html',
   success:function(msg){
    msg = msg.replace(/^\s+|\s+$/g,"");
	if(msg=="ok"){
	$("#Title").attr("value","");
	$("#Uname").attr("value","");
	$("#Tel").attr("value","");
	$("#Email").attr("value","");
	$("#Content").attr("value","");	
	$("#Msn").attr("value","");
    alert("Thank you submit information has been preserved!");}else{alert(msg);}
   }
  });
 });
 //
 $("#omailbtn").click(function(){
  var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
  var email_val = $("#oemail").val();
  if(!search_str.test(email_val)){        
  alert("please input right email !");
  $('#oemail').focus();
  return false;
  }
  $.ajax({
   type:'POST',
   url:'ajaxget.asp?action=email',
   data:"oemail="+escape($("#oemail").val()),
   dataType:'html',
   success:function(msg){
    msg = msg.replace(/^\s+|\s+$/g,"");
	if(msg=="ok"){
	$("#oemail").attr("value","enter your email");
    alert("Thank you submit information has been preserved!");}else{alert(msg);}
   }
  });
 });
 //
});
function flashWrite(url,w,h){
	if(url!=null){
		var flashStr="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' align='middle'>"+
		"<param name='movie' value='"+url+"' />"+
		"<param name='wmode' value='transparent' />"+
		"<embed src='"+url+"' menu='false' quality='high' width='"+w+"' height='"+h+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
		"</object>";
		document.write(flashStr);
	}
}
