<!-- Begin
window.onload=montre;

function montre(id) {
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('smenu'+i)) {
				document.getElementById('smenu'+i).style.display='none';
				document.getElementById('smenu'+i).style.width='auto';
			}
		}
	if (d) {
		d.style.display='block';
		d.style.width='280px';
	}
}

function montre2(id) {
	var d = document.getElementById(id);

	if (d) {
		d.style.display='block';
		
		if (document.getElementById('home_menu_prods').style.display == 'block') {
			d.style.width='490px';
		} else {
			d.style.width='280px';
		}
	}
	
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=320,height=240,left = 480,top = 392');");
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='You must type in a valid E-mail address.';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += ' '; }
  } if (errors) alert('All the fields must be filled.\n'+errors);
  document.MM_returnValue = (errors == '');
}

function showLoc(id) {
	document.getElementById(id).style.visibility = 'visible';
}
	
function hideLoc(id) {
	document.getElementById(id).style.visibility = 'hidden';
}

function checkinscription() {
	flag = false;	
	if ( document.form.email1.value=="" ) {
		alert('You must type in a valid E-mail address');
	}
	else if ( document.form.email1.value.indexOf('@') < 1 ) {
		alert('You must type in a valid E-mail address');
	}	
	else if ( document.form.password1.value=="" ) {
		alert('You must type in a password');
	}
	else if ( document.form.password1.value!=document.form.password2.value ) {
		alert('The two passwords does not match');
	}
	else if ( document.form.email1.value!=document.form.email2.value ) {
		alert('The two E-mail addresses does not match');
	}
	else if ( document.form.pbr.value=="" ) {
		alert('You must type in a security answer');
	}	
	else if (!document.form.accept.checked) {
		alert('You must have read an agree to the Terms of Service');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_vosdonnees() {
	flag = false;	
	if ( document.form.email1.value=="" ) {
		alert('You must type in a valid E-mail address');
	}
	else if ( document.form.email1.value.indexOf('@') < 1 ) {
		alert('You must type in a valid E-mail address');
	}	
	else if ( !document.form.radiobutton[0].checked && !document.form.radiobutton[1].checked) {
		alert('Are you registered to Singapore GST ?');
	}	
	else if ( document.form.name.value=="" ) {
		alert('You must type in your Name or Corporation name');
	}
	else if ( document.form.fname.value=="" ) {
		alert('You must type in your First Name or a Contact Name');
	}	
	else if ( document.form.adress1.value=="" ) {
		alert('You must type in your address');
	}	
	else if ( document.form.zip.value=="" ) {
		alert('You must type in your zip code');
	}	
	else if ( document.form.city.value=="" ) {
		alert('You must type in your city');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_changermdp() {
	flag = false;	
	if ( document.form.mdp1.value=="" ) {
		alert('You must type in a password');
	}
	else if ( document.form.mdp1.value!=document.form.mdp2.value ) {
		alert('The two passwords do not match');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_perdumdp1() {
	flag = false;	
	if ( document.form.email.value=="" ) {
		alert('You must type in a valid E-mail address');
	}
	else if ( document.form.email.value.indexOf('@') < 1 ) {
		alert('You must type in a valid E-mail address');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_perdumdp4() {
	flag = false;	
	if ( document.form.pbr.value=="" ) {
		alert('You must type in your security answer');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_creationboutique() {
	flag = false;	
	if ( document.form.shoplabel.value=="" ) {
		alert('You must type in a label for your shop');
	}
	else if ( document.form.shopname.value=="" ) {
		alert('You must type in a name for your shop');
	}
	else if ( document.form.category.options[document.form.category.selectedIndex].value=="0" ) {
		alert('You must choose a category for your shop');
	}
	else if (!document.form.accept.checked) {
		alert('You must have read an agree to the Terms of Service');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_infoboutique() {
	flag = false;	
	if ( document.form.shoplabel.value=="" ) {
		alert('You must type in a label for your shop');
	}
	else if ( document.form.shopname.value=="" ) {
		alert('You must type in a name for your shop');
	}
	else if ( document.form.category.options[document.form.category.selectedIndex].value=="0" ) {
		alert('You must choose a category for your shop');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_upload() {
	flag = false;	
	if (!document.form.checkbox.checked) {
		alert('You must read and agree to the Terms of Service');
		return false;
	}	
	else { 

	}	
}

function check_creationproduit() {
	flag = false;	
	if ( document.form.name.value=="" ) {
		alert('You must type in a name for this product');
	}		
	else if (isNaN(parseInt(document.form.surcout.value))) {
		alert('This margin is not valid');
	}
	else if (isNaN(parseInt(document.form.total.value))) {
		alert('This margin is not valid');
	}
	else if ( document.form.surcout.value > 10 ) {
		alert('The margin cannot exceed S$ 10');
	}
	else if ( document.form.surcout.value < 0  ) {
		alert('This margin is not valid');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_logoupload() {
	showWait('Upload in progress');
	return true;		
}

function check_selectproduit() {
	flag = false;	
	if ( document.form.qty.value=="" ) {
		alert('You must buy at least one product');
	}
	else if ( document.form.qty.value > 15 ) {
		alert('If you want to buy more than 15 units of this product, please contact us to get a special price: click on the [Corporate Solutions] link at the bottom of the page');
	}			
	else { 
		flag = true;
	}
	return flag;
}

function check_terminercommande() {
	flag = false;	
	if ( document.form.email1.value=="" ) {
		alert('You must type in a valid E-mail address');
	}
	else if ( document.form.email1.value.indexOf('@') < 1 ) {
		alert('You must type in a valid E-mail address');
	}	
	else if ( document.form.name_l.value=="" ) {
		alert('You must type in your billing Name or Corporation');
	}
	else if ( document.form.fname_l.value=="" ) {
		alert('You must type in your billing First Name or Corporation Contact');
	}	
	else if ( document.form.adress1_l.value=="" ) {
		alert('You must type in your billing Address');
	}	
	else if ( document.form.zip_l.value=="" ) {
		alert('You must type in your billing Zip Code');
	}	
	else if ( document.form.city_l.value=="" ) {
		alert('You must type in your billing City');
	}
	else if ( document.form.name_f.value=="" ) {
		alert('You must type in your shipping Name');
	}
	else if ( document.form.fname_f.value=="" ) {
		alert('You must type in your shipping First Name');
	}	
	else if ( document.form.adress1_f.value=="" ) {
		alert('You must type in your shipping Address');
	}	
	else if ( document.form.zip_f.value=="" ) {
		alert('You must type in your shipping Zip Code');
	}	
	else if ( document.form.city_f.value=="" ) {
		alert('You must type in your shipping City');
	}
	else if ( document.form.phone_f.value=="" ) {
		alert('You must type in a telephone number to be reached if a problem occurs');
	}		
	else { 
		flag = true;
	}
	return flag;
}

function check_unsubscribeshopletter() {
	flag = false;	
	if ( document.form.email.value=="" ) {
		alert('You must type in a valid E-mail address');
	}
	else if ( document.form.email.value.indexOf('@') < 1 ) {
		alert('You must type in a valid E-mail address');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function checkdemandepaiement() {
	flag = false;	
	if (!document.form.accept.checked) {
		alert('You must read and agree to the Terms of Service');
		return false;
	}	
	else { 		
		return true;
	}	
}

function check_hotstuffadd() {
	flag = false;	
	if ( document.form.prduid.value=="" ) {
		alert('You must type in a valid product reference number');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_hotstuffblogthis() {
	flag = false;	
	if ( document.form.yournick.value=="" ) {
		alert('You must type in a nickname');
	}
	else if ( document.form.blogthis.value=="" ) {
		alert('You must enter a comment');
	}
	else { 
		flag = true;
	}
	return flag;
}

function check_upload2_lf2() {
	flag = false;	
	if ( document.form.visuelname.value=="" ) {
		alert('You must enter a name for your design');
	}
	else if ( document.form.visueldes.value=="" ) {
		alert('You must enter a description for your design');
	}
	else if (!document.form.visuelthema[0].checked && !document.form.visuelthema[1].checked) {
		alert('You must choose a thema');
		return false;
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_newthema() {
	flag = false;	
	if ( document.formB.newthema.value=="" ) {
		alert('You must type in a thema');
	}	
	else { 
		flag = true;
	}
	return flag;
}

function check_vote4thema() {
	flag = false;	
	for (i=document.formA.vote4thema.length-1; i > -1; i--) {
		if (document.formA.vote4thema[i].checked) {
			flag = true;
		}
	}
	if ( flag == false ) {
		alert('You must vote for a Thema');
		return false;
	}	
	return flag;
}

// End -->

// AJOUT DE FONCTIONS POUR NOUVELLE INTERFACE BOUTIQUE


function checkComp() {
	if (document.form.zone_nav_haut.checked == false && document.form.zone_nav_bas.checked == false ) {
		alert('You must keep at least one navigation zone!');
		document.form.zone_nav_haut.checked = true;
		document.form.zone_nav_bas.checked = true;
	}
	
	if ( (document.form.zone_news.checked == true || document.form.zone_autopromo.checked == true || document.form.zone_liens.checked == true) && document.form.nbprdcols.selectedIndex==1 ) {
		alert('You cannot display 4 products per line if you keep the vertical right banner!');
		document.form.nbprdcols.selectedIndex=0;
	}
}

function checkMargin(i, j, k, l) {
	if (document.getElementById('_margin' + i).value > l) {
		alert('The margin cannot exceed S$ '+l);
		document.getElementById('_margin' + i).value = l;
		if(k==0) {
			document.getElementById('_price' + i).value = parseFloat(l + j);
		}
		if(k==1) {
			document.getElementById('_price' + i).value = parseFloat(l + j + 3);
		}
	}
}

function wait_for_load() {
  document.getElementById('form_validation_buttons').style.display = 'none';
	document.getElementById('upload_waiter').style.display = 'block';
}


// End -->
