﻿// JavaScript Document

function createMem_editMem_userName()
{ var x=document.form2.userName.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")|| x.match("\\;")|| x.match("\\.")|| x.match("\\,")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............');return false}
	}
	
function createMem_editMem_pwd()
{ var x=document.form2.pwd.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")|| x.match("\\;")|| x.match("\\-")|| x.match("\\.")|| x.match("\\,")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............');return false}
	if (x.length<=5) {alert('password must 6 characters at least')}
	}

function createMem_editMem_website()
{ var x=document.form2.Website.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............\n標準寫法 www.keylites.com; www.keylites.co.jp\n其餘符號或字,不可加入');return false}
	}
	
function createMem_editMem_email()
{ var x=document.form2.companyEmail.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............\n標準寫法 peter.big@keylites.com; mela@keylites.co.jp\n其餘符號或字,不可加入');return false}
	}
	
function createMem_editMem_submit()
{ if (createMem_editMem_userName()==false) { return false}
	else if (createMem_editMem_pwd()==false) { return false}
		else if (createMem_editMem_website()==false) { return false}
			else if (createMem_editMem_email()==false) { return false}
}

//-----------------------------------------------------------------

function password_pwd()
{ var x=document.form1.pwd.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")|| x.match("\\;")|| x.match("\\-")|| x.match("\\.")|| x.match("\\,")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............');return false}
	if (x.length<=5) {alert('password must 6 characters at least')}
	}

function profile_website()
{ var x=document.form1.Website.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............\n Written format: www.keylites.com/nmore websites: add ; between');return false}
	}

function profile_email()
{ var x=document.form1.companyEmail.value;
if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) {alert('reject characters * / ` % < > $ # ^ & \"..............\n Written format: peter.bill@keylites.com/nmore E-mails: add ; between');return false}
	}

function profile_all()
{ if (form1websiteCheck()==false) { return false}
		else if (form1companyEmailCheck()==false) { return false}
}

//-----------------------------------------------------------------
function getPassword()  
{	x=Math.random()
	x=Math.floor(x * 159 +1)
	window.open("password.cfm?ID="+x , "123", "scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=no,width=150, height=100")
}

function addBookmark(title, url)
{ 
	if(navigator.appName.indexOf("Internet Explorer")!=-1)
		{window.external.AddFavorite(url, title); }
				else{window.sidebar.addPanel(title, url, "") ;}
}

function accountlogin_check()
{if (document.form1.userName.value==0 || document.form1.pwd.value==0)
	{alert('Please input your account'); return false}	
	}
	
function stafflogin_check()
{if (document.form_index.userName.value==0 || document.form_index.pwd.value==0)
	{alert('Please input your account'); return false}	
	}

//-----------------------------------------------------------------
function contactus_ck()
{
	var msg='' ; var x=document.frm_contactus
	if (x.companyName.value ==""){msg=msg+'☆ company name\n'}
	if (x.contactperson.value ==""){msg=msg+'☆ contact person\n'}
	if (contactus_emailck() ==false){msg=msg+'☆ e-mail\n'	}
	if (x.Country.selectedIndex ==0){msg=msg+'☆ country\n'	}
	if (x.contents.value ==0){msg=msg+'☆ comments\n' ; x.contents.focus()	}
	if (msg != ''){ alert('The required information is incomplete or contains errors:\t\n\n'+msg); return false}
	else{
		x.action='contactus/messageSent1.cfm';
		x.submit();
	}
}

function contactus_emailck()
{
	x = document.frm_contactus.emailAddress.value
	if (x.charAt(0)=="@" || x.charAt(x.length-1)=="@" || x.charAt(x.length-2)=="@" || x.charAt(x.length-4)=="@" )
	{ return false}
	
	flag = 0
	for ( i=2 ; i < (x.length - 1) ; i++ )
		{ 
			if (x.charAt(i)=="@") { flag = flag+1 }
		}
	
	if (flag==0) { return false}
	if (flag==1) { return true }
	if (flag >1) { return false }
}
//-----------------------------------------------------------------

function register_all()
{
	var msg='' ; var x= document.form2
	if (x.userName.value ==""){msg=msg+'☆ username\n'}
	if (x.pwd.value ==""){msg=msg+'☆ password\n'}
	if (register_comfirm_pwd() ==false){msg=msg+'☆ comfirm password\n'}
	if (x.companyName.value ==""){msg=msg+'☆ company name\n'}
	if (x.contactPerson.value ==""){msg=msg+'☆ contact person\n'}
	if (register_appellation() ==false){msg=msg+'☆ Mr. or Ms. ?\n'}
	if (x.Telephone.value ==""){msg=msg+'☆ telephone\n'}
	if (x.companyAddress.value ==0){msg=msg+'☆ company address\n' 	}
	if (x.Country.selectedIndex ==0){msg=msg+'☆ country\n'	}
	if (x.companyEmail.value ==""){msg=msg+'☆ e-mail\n'	 ; x.companyEmail.focus()}

	if (msg != ''){ alert('The required information is incomplete or contains errors:\t\n\n'+msg); return false}
	else{
		x.action='register1.cfm' ;
		x.submit();
	}
}

function register_appellation()
{
	var x=document.form2
	var j=0
	for(i=0;i<2;i++)
	{
		if(x.appellation[i].checked == false) 
		j++;
		if(j==2){return false}
	}	 
}

function register_comfirm_pwd()
{
	var x=document.form2.pwd.value;
	var y=document.form2.Password2.value;
	if ( x != y){alert('password must be match');return false} 
}

function register_username()
{ 
	var x=document.form2.userName.value;
	if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")|| x.match("\\;")|| x.match("\\.")|| x.match("\\,")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／"))
	{alert('reject characters * / ` % < > $ # ^ & \"..............');return false}
}
	
function register_pwd()
{ 
	var x=document.form2.pwd.value;
	if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")|| x.match("\\;")|| x.match("\\-")|| x.match("\\.")|| x.match("\\,")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) 
	{alert('reject characters * / ` % < > $ # ^ & \"..............');return false}
		if (x.length<=5) {alert('password must 6 characters at least')}
}

function register_website()
{ 
	var x=document.form2.Website.value;
	if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")|| x.match("\\@")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／"))
	{alert('reject characters * / ` % < > $ # ^ & \"..............\n標準寫法 www.keylites.com; www.keylites.co.jp\n其餘符號或字,不可加入');return false}
}
	
function register_email()
{
	var x=document.form2.companyEmail.value;
	if (x.match("<") || x.match(">") || x.match("\\\\") || x.match("\"") || x.match("/") || x.match("`") || x.match("%") || x.match("#") || x.match("&") || x.match("=") || x.match("!") || x.match("~") || x.match("{") || x.match("}") || x.match(":")|| x.match("\\)") || x.match("\\(") || x.match("\\!")|| x.match("\\?") || x.match("\\|") || x.match("\\[") || x.match("\\]")|| x.match("\\^")|| x.match("\\*")|| x.match("\\+")|| x.match("\\'")|| x.match("\\$")/*upper case from here*/|| x.match("‘")|| x.match("～")|| x.match("！")|| x.match("＠")|| x.match("＃")|| x.match("＄")|| x.match("％")|| x.match("＾")|| x.match("＆")|| x.match("＊")|| x.match("（")|| x.match("）")|| x.match("＿")|| x.match("－")|| x.match("＝")|| x.match("＋")|| x.match("〔")|| x.match("〕")|| x.match("｛")|| x.match("｝")|| x.match("＼")|| x.match("｜")|| x.match("；")|| x.match("：")|| x.match("’")|| x.match("“")|| x.match("＜")|| x.match("＞")|| x.match("，")|| x.match("．")|| x.match("？")|| x.match("／")) 
	{alert('reject characters * / ` % < > $ # ^ & \"..............\n標準寫法 peter.big@keylites.com; mela@keylites.co.jp\n其餘符號或字,不可加入');return false}
}
