function changePage(to) {
page_link = document.URL;
if(page_link.indexOf('/en/')!=-1) {
str_location = page_link.indexOf('/en/');
new_link = page_link.substr(0,str_location)+to+page_link.substr(str_location+4,page_link.length);
window.location.href=new_link;
}
else if(page_link.indexOf('/jp/')!=-1) {
str_location = page_link.indexOf('/jp/');
new_link = page_link.substr(0,str_location)+to+page_link.substr(str_location+4,page_link.length);
window.location.href=new_link;
}
else if(page_link.indexOf('/es/')!=-1) {
str_location = page_link.indexOf('/es/');
new_link = page_link.substr(0,str_location)+to+page_link.substr(str_location+4,page_link.length);
window.location.href=new_link;
}
else {
str_location = page_link.indexOf('/fr/');
new_link = page_link.substr(0,str_location)+to+page_link.substr(str_location+4,page_link.length);
window.location.href=new_link;
}
}
function registrationValidation() {
df = document.forms["register"];
if (checkTextField(df.user_username,"Login")
&& checkPass(df.user_password)
&& confirmPassword(df.user_password, df.retype_password)
&& checkTextField(df.user_firstname,"First Name")
&& checkTextField(df.user_lastname,"Last Name")
&& checkTextField(df.user_company_name,"Company Name")
&& checkEmailAddr(df.user_email)
&& confirmEmail(df.user_email,df.retype_email)
&& checkTextField(df.user_address,"Address")
&& checkTextField(df.user_city,"City")
&& checkTextField(df.user_state,"State")
&& checkTextField(df.user_postal_code,"Postal Code")
&& checkSelect(df.user_country,"Country")
) {
return true;
}
else{
return false;
}
}
function confirmEmail(adr1, adr2) {
if(adr1.value == adr2.value)
return true;
else {
alert("The confirmation e-mail is not correct!");
adr1.focus();
return false;
}
}
function confirmPassword(adr1, adr2) {
if(adr1.value == adr2.value)
return true;
else {
alert("The confirmation password is not correct!");
adr1.focus();
return false;
}
}
function checkPass(pass) {
if (pass.value.length >= 6)
return true;
else {
alert("The password must be at least 6 characters long!");
pass.focus();
return false;
}
}
function checkEmailAddr(contr) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(contr.value)){
return true;
}
else{
alert("The e-mail address is not valid!");
contr.focus();
return false;
}
}
function checkTextField(contr,name){
if (contr.value == ""){
alert ("The "+name+" field is required!");
contr.focus();
return false;
}
else{
return true;
}
}
function checkSelect(contr,input_name) {
if (contr.selectedIndex == 0) {
alert ("The "+input_name+" field is required");
contr.focus();
return false;
}
else{
return true;
}
}

function openWindow(url,title) {
	imageWindow = window.open(url,title,"status=0,menubar=0,height=440,width=660");
	imageWindow.focus();
}
