function go_conversion(url)
{
	newrub = window.open(url,'conversion','scrollbars=1,top=0,left=0,status=0,location=0, menubar=0,toolbar=0,resizable=1,width=650,height=300');

}

function go_print_fax()
{
	//if (check_form_fax()) {
		if (document.laforme.email.value != "" ) {
			if (nb_rec !=  0) {
				
				para = "first_name_card=" + escape(document.laforme.first_name_card.value) + "&last_name_card=" + escape(document.laforme.last_name_card.value)  + "&card_type=" + escape(document.laforme.card_type.value)   + "&exp_mois=" + escape(document.laforme.exp_mois.value)   + "&exp_annee=" + escape(document.laforme.exp_annee.value)  +  "&ref_bill=" + document.laforme.ref_bill.value   +  "&ref_client=" + document.laforme.ref_client.value   +  "&id_pays=" + document.laforme.id_pays.value    +  "&id_plateforme=" + document.laforme.id_plateforme.value   +  "&id_licence=" + document.laforme.id_licence.value   +  "&num_vat=" + document.laforme.num_vat.value    +  "&email=" + document.laforme.email.value + "&payment_methode=1&ref_commande=" + document.laforme.ref_commande.value;
				if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appName.indexOf("Netscape") != -1)) document.laforme.target = "newfax"
				else {
					window.open("vide.htm",'fax','width=590,height=420,scrollbars=yes,resizable=yes,status=yes')
					document.laforme.target = "fax"
				}
				
				document.laforme.action = "fax.php?para=" + para;
				document.laforme.submit()
				
			}
			else alert('Your cart is empty!');
			
			
		}
		else
		{
			document.location = "information.php";
		}
	
	
	//}
}

function go_verif_cb(url)
{
	if (check_form_cb()) {
		if (nb_rec !=  0) {
			document.laforme.action = url + "check_build_cb_trans.php"
			document.laforme.submit()
		}
		else alert('Your cart is empty!');
		//alert("go to ilag");
		
	}
}

function go_verif_cb_test(url)
{
	if (check_form_cb()) {
		if (nb_rec !=  0) {
			document.laforme.action = url + "check_build_cb_trans_test.php"
			document.laforme.submit()
		}
		else alert('Your cart is empty!');
		//alert("go to ilag");
		
	}
}




function go_etape2(url)
{
	if (document.laforme.cmp_panier.value > 0) {

		if ((document.laforme.ot_on.value >= 1) && (document.laforme.id_plateforme.options[document.laforme.id_plateforme.selectedIndex].value != 6)) alert('The selected typeface(s) is available in OpenType format only, please selected OpenType in the menu.');
		else { 
			if ((document.laforme.id_plateforme.selectedIndex <2) || (document.laforme.id_licence.selectedIndex <2)) {
					alert("Please, choose a format and a licence!");
			}
			else {
				if (document.laforme.id_licence.options[document.laforme.id_licence.selectedIndex].value == "more") alert("Software licences for more than 20 computers are delivered on request at : info@optimo.ch");
				else {
					document.laforme.target = "_top"
					document.laforme.action = url;
					document.laforme.submit();
				}
			}
		}
	}
	else alert('Your shopping cart is empty!')
}

function go_etape4(url)
{
	document.laforme.target = "_top"
	if (document.laforme.payment_method[0].checked) document.laforme.action = "build_cb.php";
	else  document.laforme.action = "build_fax.php";
	document.laforme.submit();

}

function go_etape4_test(url)
{
	document.laforme.target = "_top"
	document.laforme.action = "build_cb_test.php";
	document.laforme.submit();

}



function go_etape3(url)
{
	document.laforme.target = "_top"
	document.laforme.action = "mode_command.php";
	document.laforme.submit();

}



function go_etape1(url)
{
	document.laforme.target = "_top"
	document.laforme.action = url;
	document.laforme.submit();
	
}



function check_form_etape2()
{
	ok = true;
	
	if (!document.laforme.ok_licence.checked) {
		alert('Please check our Licence Agreement!')
		ok = false;
		document.laforme.ok_licence.focus();
	} 

	if ((document.laforme.first_name.value == "") && (ok)){
		alert('Please, enter your first name!')
		ok = false;
		document.laforme.first_name.focus();
	}
	
	if ((document.laforme.last_name.value == "") && (ok)){
		alert('Please, enter your last name!')
		ok = false;
		document.laforme.last_name.focus();
	}
	

	if ((document.laforme.street.value == "") && (ok)){
		alert('Please, enter your street!')
		ok = false;
		document.laforme.street.focus();
	}
	
	if ((document.laforme.zip.value == "") && (ok)){
		alert('Please, enter your zip!')
		ok = false;
		document.laforme.zip.focus();
	}
	
	if ((document.laforme.city.value == "") && (ok)){
		alert('Please, enter your city!')
		ok = false;
		document.laforme.city.focus();
	}
	
	if ((document.laforme.country.selectedIndex == 0) && (ok)){
		alert('please select your country!')
		ok = false;
		document.laforme.country.focus();
	}
	
	if ((document.laforme.telephone.value == "") && (ok)){
		alert('Please, enter your telephone!')
		ok = false;
		document.laforme.telephone.focus();
	}
	
	if ((!valid_email (document.laforme.email.value,'Please enter a correct email address!')) && (ok)){
		ok = false;
		document.laforme.email.focus();
	}
	
	if (!document.laforme.same_adress.checked)
	{
		if ((document.laforme.compagny_other.value == "") && (ok)){
		alert('Please fill in the required Billing Information fields!')
		ok = false;
		//scroll_info();
		document.laforme.compagny_other.focus();
		}
		
		if ((document.laforme.street_other.value == "") && (ok)){
			alert('Please, enter your street for the licensing information!')
			ok = false;
			document.laforme.street_other.focus();
		}
		
		if ((document.laforme.zip_other.value == "") && (ok)){
			alert('Please, enter your zip for the licensing information!')
			ok = false;
			document.laforme.zip_other.focus();
		}
		
		if ((document.laforme.city_other.value == "") && (ok)){
			alert('Please, enter your city for the licensing information!')
			ok = false;
			document.laforme.city_other.focus();
		}
		
		if ((document.laforme.country_other.selectedIndex == 0) && (ok)){
			alert('Please, select your country for the licensing information!')
			ok = false;
			document.laforme.country_other.focus();
		}
	}
	
	if (ok) {
		go_etape3('')
	}
	
}

function scroll_info()
{
	if (NS4) document.scrollTo = -500;
	else {
		if (NS6) document.scrollTo = -500;
		else Fbuffer.scrollTo(0,500);
	}
}
function check_form_cb()
{
	ok = true;
	if (document.laforme.first_name_cb.value == "") {
		alert('Please, enter your first name!')
		ok = false;
		document.laforme.first_name_cb.focus();
	}
	
	if ((document.laforme.last_name_cb.value == "") && (ok)){
		alert('Please, enter your last name!')
		ok = false;
		document.laforme.last_name_cb.focus();
	}
	
	if ((document.laforme.card_number.value == "") && (ok)){
		alert('Please, enter your card number!')
		ok = false;
		document.laforme.card_number.focus();
	}
	s_card = document.laforme.card_number.value
	if ((s_card.indexOf(" ") != -1) && (ok)){
		alert('Please, enter your card number without space!')
		ok = false;
		document.laforme.card_number.focus();
	}
	
	if ((document.laforme.verif.value == "") && (ok)){
		alert('Please, enter the card verification number!')
		ok = false;
		document.laforme.verif.focus();
	}
	return ok
}

function check_form_fax()
{
	ok = true;
	if (document.laforme.first_name_card.value == "") {
		alert('Please, enter your first name!')
		ok = false;
		document.laforme.first_name_card.focus();
	}
	
	if ((document.laforme.last_name_card.value == "") && (ok)){
		alert('Please, enter your last name!')
		ok = false;
		document.laforme.last_name_card.focus();
	}

	return ok
}

function valid_email(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[0].email.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      return false;
    } 
    return true; 
}

function valid_email_old (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert(message)
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert(message)
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert(message)
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert(message)
    return false
}


var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 ||
    domArr[domArr.length-1].length>3) {
   alert(message)
   return false
}

if (len<3) {
   var errStr=message
   alert(errStr)
   return false
}

if (emailStr.indexOf("'") != -1) {
   var errStr=message
   alert(errStr)
   return false
}


return true;
}