// JavaScript Document
$.fn.extend({ reset: function() {
  return this.each(function() {
	  $(this).is('form') && this.reset();
  });
}});
var is_null = function (proto){
	var results;		
	var textarray = proto.split("");
	for(var i=0;i<textarray.length;i++){
		if (textarray[i] == " " || textarray[i] == "¡@") {
			textarray[i]="";
		}
	}
	results = textarray.join("");
	if (results == "") {
		return true ;
	} else {
		return false ;
	}	
}
var  is_mail = function (strEmail) {
	if (strEmail.search(/^\w+((-\w+)|(.\w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z]+$/) != -1) {
		if( strEmail.indexOf(" ") >=0 ){
			return false;
		}
		var index1 = strEmail.indexOf("@");
		var index2 = strEmail.lastIndexOf(".");
		if( (index2 > index1) && ( index1 > 0 ))
			return true;
	} 
	return false;
}
var is_tel = function(data){
	if(data.search(/^[0][1-9]{1,2}-([0-9]{6,9})+((#([0-9]){1,5}){0,1})$/)!=-1)
		return true;
	else
		return false;
}
var is_passwd = function(data,num){
	data1 = data.replace(/[^0-9a-zA-Z]/g,'');
	data2 = data.replace(/[^a-zA-Z]/g,'');
	if(data.length >= num && data1.length > 0 && data2.length > 0){
		return true;
	} else 
		return false;
}
var is_phone = function(data){
	if(data.length == 10){
		if(data.search(/^09[0-9]{8}$/)!=-1)
			return true;
		else
			return false;
	} else 
		return false;
}
var h_keyword = function(a,b){
	$(a).each(function(i){
		$(this).data('keyword',b);
		$(this).focus(function(){
			if($(this).val() == $(this).data('keyword'))
				$(this).val('');
			else
				$(this).select();
		});
		$(this).blur(function(){
			if(is_null($(this).val()))
				$(this).val($(this).data('keyword'));
		});
	});	
}
var h_redio = function(){
	if($(this).attr('checked','checked')){
		$('.'+$(this).attr('className')).attr('checked','');
		$(this).attr('checked','checked');
	}
}
/* 鎖右鍵
$(document).ready(function(){   
   $(document).bind("contextmenu",function(e){   
	   return false;   
   });   
});
*/
