
function check_IsEmpty(obj){
if(obj.value=='')
return true;
return false;
}



function check_phone(obj) 
{ 
if(obj.value!=''){
var patrn =/^[+]{0,1}(\d){1,3}[ ]?([-]?(\d){1,12})+$/; 
if (!patrn.test(obj.value)){
obj.value='';
alert('Please enter a correct format of phone number!');
}
}
}

function IsMail(mail) 
{ 
if(mail.value!=''){
var patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
if (!patrn.test(mail.value)){
mail.value='';
alert('Please enter a correct format of email address!');
mail.focus();
}
}
}


function check_field(_object){
if(_object.value!=''){
var patrn = /[^\w\.\/]/ig;
if (patrn.test(_object.value)){
_object.value='';
alert('Can only contain letters and numbers!');
}else if(_object.value.length<6){
alert('Please enter at least 6 digits');
}
}
}


function isInt(_object){
if(_object.value!=''){
	if(isNaN(_object.value)){
	   alert('Please enter number!');
	   _object.focus();
	   _object.value='';
		return false;
	}
	}
}


function check_nickname(_object){
if(_object.value!=''){
var patrn = /[^\w\.\/]/ig; 
if (patrn.test(_object.value)){
_object.value='';
alert('Name to be composed of numbers or letters of the alphabet!');
}
}
}

function check_name(_object){
if(_object.value!=''){
var patrn =/^[a-zA-Z0-9]{1}([a-zA-Z0-9]|[._@]){0,50}$/; 
if (!patrn.test(_object.value)){
_object.value='';
alert('Can only enter the letter at the beginning of 1-50 months, Pets and figure _. @ String');
}
}
}

function check_IsEmpty(obj){
if(obj.value=='')
return true;
return false;
}

function check_repeat_email(o_email,n_email){
if(o_email==n_email){
alert('New e-mail addresses should not the same as with the old e-mail address, please enter a new e-mail address!');
}
}

function categories_code_change(categories_code){
  window.location.href="cpPublishing_bookSearch.php?categories_code="+categories_code;
}

function is_ie(){
    return ( navigator.appName=="Microsoft Internet Explorer" ); 
}

function checks_email(obj){
	var email_obj=document.getElementById(obj);
	if(email_obj.value!=''){
		var patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
		if (!patrn.test(email_obj.value)){
			email_obj.value='';
			alert('Please enter a correct format of email address!');
			email_obj.focus();
			return false
		}else{
			return true;
		}
	}else{
		alert('Please enter email address');
		return false;
	}
	return true;
}

function showdiv(p_id){
	var h=1200;
	var url='';
	if(h > window.screen.height)	h = window.screen.height;//屏幕分辨率高度
   
   //如果p_id不為空，增加產品到ShoppingCart,否則直接跳到購物籃頁
    if(p_id && p_id!='') 	url = CP_HTTP_HOME+'shopping_cart.php?action=add_product&products_id='+p_id;
    else 					url = CP_HTTP_HOME+'shopping_cart.php';
    
    open_html=window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=960px,height='+h+'px,left=35px,top=50px');
    showBox(p_id);
	timer = window.setInterval("findwindow()",300);
  }
function next_page(url){
  window.location.href=url;
}
function set_number_per_page(url){
  window.location.href=url;
}