oldcss = "smoothtaste.css";
function createjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 return fileref
}

function replacejscssfile(oldfilename, newfilename, filetype){
 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using
 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
 var allsuspects=document.getElementsByTagName(targetelement)
 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
  if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){
   var newelement=createjscssfile(newfilename, filetype)
   allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])
  }
 }
}

replacejscssfile("oldscript.js", "newscript.js", "js") //Replace all occurences of "oldscript.js" with "newscript.js"
 //Replace all occurences "oldstyle.css" with "newstyle.css"

function changecssfct(){
newcss = document.getElementById('changecss').value;
replacejscssfile(oldcss , './includesyo/'+newcss , 'css')
oldcss = newcss;

}



function checkform(){
checkoffer_1();
checkoffer_2();
checkoffer_3();

//Verifie quelle offre a etait selectionner
if(document.tarif.check_offer[0].checked){grille=1;}
if(document.tarif.check_offer[1].checked){grille=2;}

//calcul le prix global
if(grille==1){
	document.getElementById('tt_general_pricett').innerHTML= eval(offer_1_tt+offer_3_tt)+" &euro;" ;
	document.getElementById('paymentpaypal').value=eval(offer_1_tt+offer_3_tt);
}
if(grille==2){
	document.getElementById('tt_general_pricett').innerHTML= eval(offer_2_tt+offer_3_tt)+" &euro;" ;
	document.getElementById('paymentpaypal').value=eval(offer_2_tt+offer_3_tt);
}

}
//###########################Création site de présentation
function checkoffer_1(){
	//on force le check
	if(!document.getElementById('offer_1_checkmodul_1').checked){
	document.getElementById('offer_1_checkmodul_1').checked=true;
	}
	if(!document.getElementById('offer_1_checkmodul_2').checked){
	document.getElementById('offer_1_checkmodul_2').checked=true;
	}
	if(!document.getElementById('offer_1_checkmodul_3').checked){
	document.getElementById('offer_1_checkmodul_3').checked=true;
	}

	//on initialise les grille de prix
	offer_1_tt=0;

	if(document.getElementById('offer_1_checkmodul_1').checked){
		tmp = document.getElementById('offer_1_inputmodul_1').value*document.getElementById('offer_1_unitprice_1').value;
		document.getElementById('offer_1_pricett').innerHTML= tmp+" &euro;" ;
		offer_1_tt += eval(tmp);
	}
	if(document.getElementById('offer_1_checkmodul_2').checked){
		tmp = document.getElementById('offer_1_inputmodul_2').value*document.getElementById('offer_1_unitprice_2').value;
		document.getElementById('offer_1_pricett_2').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	if(document.getElementById('offer_1_checkmodul_3').checked){
		tmp = document.getElementById('offer_1_inputmodul_3').value*document.getElementById('offer_1_unitprice_3').value;
		document.getElementById('offer_1_pricett_3').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	if(document.getElementById('offer_1_checkmodul_4').checked){
		tmp = document.getElementById('offer_1_inputmodul_4').value*document.getElementById('offer_1_unitprice_4').value;
		document.getElementById('offer_1_pricett_4').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_4').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_5').checked){
		tmp = document.getElementById('offer_1_inputmodul_5').value*document.getElementById('offer_1_unitprice_5').value;
		document.getElementById('offer_1_pricett_5').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_5').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_6').checked){
		tmp = document.getElementById('offer_1_inputmodul_6').value*document.getElementById('offer_1_unitprice_6').value;
		document.getElementById('offer_1_pricett_6').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_6').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_7').checked){
		tmp = document.getElementById('offer_1_inputmodul_7').value*document.getElementById('offer_1_unitprice_7').value;
		document.getElementById('offer_1_pricett_7').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_7').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_8').checked){
		tmp = document.getElementById('offer_1_inputmodul_8').value*document.getElementById('offer_1_unitprice_8').value;
		document.getElementById('offer_1_pricett_8').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_8').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_9').checked){
		tmp = document.getElementById('offer_1_inputmodul_9').value*document.getElementById('offer_1_unitprice_9').value;
		document.getElementById('offer_1_pricett_9').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_9').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_10').checked){
		tmp = document.getElementById('offer_1_inputmodul_10').value*document.getElementById('offer_1_unitprice_10').value;
		document.getElementById('offer_1_pricett_10').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_10').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_11').checked){
		tmp = document.getElementById('offer_1_inputmodul_11').value*document.getElementById('offer_1_unitprice_11').value;
		document.getElementById('offer_1_pricett_11').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_11').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_1_checkmodul_12').checked){
		tmp = document.getElementById('offer_1_inputmodul_12').value*document.getElementById('offer_1_unitprice_12').value;
		document.getElementById('offer_1_pricett_12').innerHTML= tmp+" &euro;" ;
		offer_1_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_1_pricett_12').innerHTML= "0 &euro;" ;
	}

	//on calcule le total
	document.getElementById('offer_1_pricett').innerHTML= offer_1_tt+" &euro;" ;
}

//###########################Calcul Création de catalogue en ligne
function checkoffer_2(){
	//on force le check
	if(!document.getElementById('offer_2_checkmodul_1').checked){
	document.getElementById('offer_2_checkmodul_1').checked=true;
	}
	if(!document.getElementById('offer_2_checkmodul_2').checked){
	document.getElementById('offer_2_checkmodul_2').checked=true;
	}
	if(!document.getElementById('offer_2_checkmodul_3').checked){
	document.getElementById('offer_2_checkmodul_3').checked=true;
	}

	//on initialise les grille de prix
	offer_2_tt=0;

	if(document.getElementById('offer_2_checkmodul_1').checked){
		tmp = document.getElementById('offer_2_inputmodul_1').value*document.getElementById('offer_2_unitprice_1').value;
		document.getElementById('offer_2_pricett').innerHTML= tmp+" &euro;" ;
		offer_2_tt += eval(tmp);
	}
	if(document.getElementById('offer_2_checkmodul_2').checked){
		tmp = document.getElementById('offer_2_inputmodul_2').value*document.getElementById('offer_2_unitprice_2').value;
		document.getElementById('offer_2_pricett_2').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	if(document.getElementById('offer_2_checkmodul_3').checked){
		tmp = document.getElementById('offer_2_inputmodul_3').value*document.getElementById('offer_2_unitprice_3').value;
		document.getElementById('offer_2_pricett_3').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	if(document.getElementById('offer_2_checkmodul_4').checked){
		tmp = document.getElementById('offer_2_inputmodul_4').value*document.getElementById('offer_2_unitprice_4').value;
		document.getElementById('offer_2_pricett_4').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_4').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_5').checked){
		tmp = document.getElementById('offer_2_inputmodul_5').value*document.getElementById('offer_2_unitprice_5').value;
		document.getElementById('offer_2_pricett_5').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_5').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_6').checked){
		tmp = document.getElementById('offer_2_inputmodul_6').value*document.getElementById('offer_2_unitprice_6').value;
		document.getElementById('offer_2_pricett_6').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_6').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_7').checked){
		tmp = document.getElementById('offer_2_inputmodul_7').value*document.getElementById('offer_2_unitprice_7').value;
		document.getElementById('offer_2_pricett_7').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_7').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_8').checked){
		tmp = document.getElementById('offer_2_inputmodul_8').value*document.getElementById('offer_2_unitprice_8').value;
		document.getElementById('offer_2_pricett_8').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_8').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_9').checked){
		tmp = document.getElementById('offer_2_inputmodul_9').value*document.getElementById('offer_2_unitprice_9').value;
		document.getElementById('offer_2_pricett_9').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_9').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_10').checked){
		tmp = document.getElementById('offer_2_inputmodul_10').value*document.getElementById('offer_2_unitprice_10').value;
		document.getElementById('offer_2_pricett_10').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_10').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_11').checked){
		tmp = document.getElementById('offer_2_inputmodul_11').value*document.getElementById('offer_2_unitprice_11').value;
		document.getElementById('offer_2_pricett_11').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_11').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_12').checked){
		tmp = document.getElementById('offer_2_inputmodul_12').value*document.getElementById('offer_2_unitprice_12').value;
		document.getElementById('offer_2_pricett_12').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_12').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_13').checked){
		tmp = document.getElementById('offer_2_inputmodul_13').value*document.getElementById('offer_2_unitprice_13').value;
		document.getElementById('offer_2_pricett_13').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_13').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_14').checked){
		tmp = document.getElementById('offer_2_inputmodul_14').value*document.getElementById('offer_2_unitprice_14').value;
		document.getElementById('offer_2_pricett_14').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_14').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_2_checkmodul_15').checked){
		tmp = document.getElementById('offer_2_inputmodul_15').value*document.getElementById('offer_2_unitprice_15').value;
		document.getElementById('offer_2_pricett_15').innerHTML= tmp+" &euro;" ;
		offer_2_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_2_pricett_15').innerHTML= "0 &euro;" ;
	}
	//on calcule le total
	document.getElementById('offer_2_pricett').innerHTML= offer_2_tt+" &euro;" ;
}

//###########################Options complémentaire
function checkoffer_3(){
	//on initialise les grille de prix
	offer_3_tt=0;

	if(document.getElementById('offer_3_checkmodul_1').checked){
		tmp = document.getElementById('offer_3_inputmodul_1').value*document.getElementById('offer_3_unitprice_1').value;
		document.getElementById('offer_3_pricett_1').innerHTML= tmp+" &euro;" ;
		offer_3_tt += eval(tmp);
	}
	else{
		document.getElementById('offer_3_pricett_1').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_3_checkmodul_2').checked){
		tmp = document.getElementById('offer_3_inputmodul_2').value*document.getElementById('offer_3_unitprice_2').value;
		document.getElementById('offer_3_pricett_2').innerHTML= tmp+" &euro;" ;
		offer_3_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_3_pricett_2').innerHTML= "0 &euro;" ;
	}
	if(document.getElementById('offer_3_checkmodul_3').checked){
		tmp = document.getElementById('offer_3_inputmodul_3').value*document.getElementById('offer_3_unitprice_3').value;
		document.getElementById('offer_3_pricett_3').innerHTML= tmp+" &euro;" ;
		offer_3_tt +=eval(tmp);
	}
	else{
		document.getElementById('offer_3_pricett_3').innerHTML= "0 &euro;" ;
	}
	//on calcule le total
	document.getElementById('offer_3_pricett').innerHTML= offer_3_tt+" &euro;" ;
}

function display(){
	if(document.tarif.check_offer[0].checked){grille=1;}
	if(document.tarif.check_offer[1].checked){grille=2;}
	if (typeof offer_1_tt == 'undefined'){offer_1_tt=800}
	if (typeof offer_2_tt == 'undefined'){offer_2_tt=800}
	if (typeof offer_3_tt == 'undefined'){offer_3_tt=0}
	if(grille==1){
		document.getElementById('offer_1').style.display='block';
		document.getElementById('offer_2').style.display='none';
		document.getElementById('offer_3').style.display='block';
		document.getElementById('tt_general').style.display='block';
	}
	if(grille==2){
		document.getElementById('offer_1').style.display='none';
		document.getElementById('offer_2').style.display='block';
		document.getElementById('offer_3').style.display='block';
		document.getElementById('tt_general').style.display='block';
	}
}

