// JavaScript Document
<!--
function pageLoad(id, url) {
	$('#'+id).load(url);
}



function showMesure(type) {
					$("#myMesures").load('/2011/ajax/mesure/'+type+'.php')
					}


function checkCode(){
					sentCode = $('#myCode').val();
					$("#codeMsg").load('/2011/scripts/redeemCode.php', { mycode : sentCode});
					}
function removeCode(){
					removeCode = true;
					$("#codeMsg").load('/2011/scripts/redeemCode.php', { removeCode : removeCode});
					}



function changeOption(page,subpage, norepeat){
					if (!norepeat) {
					$("#clothChoices").load('/2011/ajax/cloth_choices.php', { btnstep : page, substep : subpage});
					}
					$("#shirt2DShow").load('/2011/ajax/shirt.php', { btnstep : page, substep : subpage});
					if (subpage > 0) {
					$("#shirtResults").load('/2011/ajax/' + page + subpage + '.php');
					} else {
					$("#shirtResults").load('/2011/ajax/' + page  + '.php');
					}
					if (page=="cloth") {
					$("#shirtCol1").css('width','100px');
					$("#shirtCol2").css('width','538px');
					$("#shirtCol2").css('border-left','1px solid #339933');
					$("#shirtCol1").load('/2011/ajax/' + page + '_nav.php');
					} else {
					$("#shirtCol1").css('width','10px');
					$("#shirtCol1").empty();
					$("#shirtCol2").css('width','629px');
					$("#shirtCol2").css('border-left','0px solid #339933');
					}
					// sort out nav button
					var arr = [ "clothIcon", "collarIcon", "cuffIcon", "backIcon", "buttonsIcon", "pocketIcon", "embroideryIcon", "boxerIcon" ];

					$('#shirtIcons a').removeClass('active');
					$('#' + page +'Icon a').addClass('active');
}

function removeTissu(myCloth){
					$("#clothChoices").load('/2011/ajax/cloth_choices.php', { removeCloth : myCloth, step : 'cloth', substep : '0'});
					
					//changeOption('cloth',0);
					}
function addTissu(myCloth){
					$("#clothChoices").load('/2011/ajax/cloth_choices.php', { addCloth : myCloth, step : 'cloth', substep : '0'});
					//changeOption('cloth',0);
					}
					
function updateShirt(key, myValue, step, myOption, subpage){
					$("#clothChoices").load('/2011/ajax/cloth_choices.php', { key : key, value : myValue, option : myOption, step : step, substep : subpage});
					//changeOption(step, subpage);
					}

function updateClothChoice(key, myValue){
					$("#shirtResults").load('/2011/ajax/cloth.php', { key : key, value : myValue});
					$("#shirtCol1").load('/2011/ajax/cloth_nav.php');
	
}
function ClothMore(pageNum, totalRows){
					$("#shirtResults").load('/2011/ajax/cloth.php', { pageNum : pageNum, totalRows : totalRows});
	
}

function colorboxLink(url){
				//	$("#colorBoxSheet").attr({href: "/css/colorbox.css"});
			$.colorbox({href:url,close:"fermer x",scrolling:false});
		 }

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 afficheI(rub){
    for(var i=1; i<11; i++){
	myclass="inactive";
	if ((i==2) || (i==9)) {
	myclass="preselected";
	}
  document.getElementById('tr'+i).style.display='none';
  document.getElementById('tab_tr'+i).className=myclass;
  }
  document.getElementById(rub).style.display='inline';
  document.getElementById('tab_'+rub).className='active';
}

//-->
function ValiderEmail(str) {

  //var src = forma.email.value;
	if (window.RegExp)
	{
		var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
		var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
		var reg1 = new RegExp(reg1str);
		var reg2 = new RegExp(reg2str);
		if (!reg1.test(str) && reg2.test(str))
		{

		}
		else
		{
			alert("Votre email n'est pas correct");
			document.form_contact.email.focus();
			return;
		}
	}
	else
	{
		if(str.indexOf("@") >= 0)
		{

		}
		else
		{
			alert("Votre email n'est pas correct");
			document.form_contact.email.focus();
			return;
		}
	}
}
<!--

//document.form_contact.nom.focus();


function form_contact_onsubmit() 
{

	if (document.form_contact.nom.value=="")
	{
	alert("Veuillez entrer votre nom. Merci.");
	document.form_contact.nom.focus();
	return;
	}
	
	if (document.form_contact.prenom.value=="")
	{
	alert("Veuillez entrer votre prenom. Merci.");
	document.form_contact.prenom.focus();
	return;
	}
	
	if (document.form_contact.email.value=="")
	{
	alert("Veuillez entrer votre email. Merci.");
	document.form_contact.email.focus();
	return;
	}

	
document.form_contact.submit();

}

function mono_pos(step){
document.form_perso.idoption_monogramme_2.selectedIndex =step;
}

function mono_switch() {
if (document.form_perso.idparametre_monogramme[0].checked) {
document.form_perso.idoption_initiales.value = "";
document.form_perso.idoption_initiales.disabled = true;
document.form_perso.idoption_monogramme_1[0].selected = true;
document.form_perso.idoption_monogramme_1.disabled = true;
document.form_perso.idoption_monogramme_2[0].selected = true;
document.form_perso.idoption_monogramme_2.disabled = true;
} else {
document.form_perso.idoption_initiales.disabled = false;
document.form_perso.idoption_monogramme_1.disabled = false;
document.form_perso.idoption_monogramme_2.disabled = false;
}
}

function message_switch() {
if (document.form_perso.idparametre_message[0].checked) {
document.form_perso.idoption_message.value = "";
document.form_perso.idoption_message.disabled = true;
document.form_perso.idoption_message_1[0].selected = true;
document.form_perso.idoption_message_1.disabled = true;
} else {
document.form_perso.idoption_message.value = "";
document.form_perso.idoption_message.disabled = false;
document.form_perso.idoption_message_1.disabled = false;
document.form_perso.idoption_message_1[0].selected = true;
}
}

function cal_switch() {
if (document.form_perso.idparametre_cal[0].checked) {
document.form_perso.idoption_cal[0].selected = true;
document.form_perso.idoption_cal.disabled = true;
} else {
document.form_perso.idoption_cal.disabled = false;
document.form_perso.idoption_cal[0].selected = true;
}
}

function disable_pockets(str) {
nbparam = 3;
if ((str == "-1") || (str == "<?php echo POCHES_SANS; ?>"))
{
	document.form_poignet.idparametre_poche[0].checked = true;
	for ( i=0 ; i < nbparam ; i++ )
	{
		document.form_poignet.idparametre_poche[i].disabled = true;
	}

} else {
	for ( i=0 ; i < nbparam ; i++ )
	{
		document.form_poignet.idparametre_poche[i].disabled = false;
	}
}

}
function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function


function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function



//-->
