// JavaScript Document

var theQuery = window.location.search.substring(1);
if(theQuery!=null){
	
	theQuery = decode64(theQuery);
	theparts = theQuery.split("&");
}

var line1 = null;
var line2 = null;
var line3 = null;
var line4 = null;
var charmFont = 'cour';
var metal = 'silver';
var charmMetal = 'Sterling Silver';
var textEnamel = 'black';
var stone1 = null;
var stone2 = null;
var stone3 = null;
var charmnum = 1;
var currentcharm = 1;
var charmstyle = null;
var nextsection = 'charmstyle';
var fontLabel = null;
var metalset = 0;
var thesteps = 4;

var tempMonth = null;


 

 
function encode64(input) {
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	var output = "";
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;
 
	while (i < input.length) {
		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);
 
		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;
 
		if (isNaN(chr2)) {
			enc3 = enc4 = 64;
		} else if (isNaN(chr3)) {
			enc4 = 64;
		}
 
		        output = output +
            keyStr.charAt(enc1) +
            keyStr.charAt(enc2) +
            keyStr.charAt(enc3) +
            keyStr.charAt(enc4);
   }
   
   return output.toString();
}
 
function decode64(input) {
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	var output = "";
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;
 
	// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
	input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
	while (i < input.length) {
		enc1 = keyStr.indexOf(input.charAt(i++));
		enc2 = keyStr.indexOf(input.charAt(i++));
		enc3 = keyStr.indexOf(input.charAt(i++));
		enc4 = keyStr.indexOf(input.charAt(i++));
 
		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;
 
		         output = output + String.fromCharCode(chr1);
 
		if (enc3 != 64) {
			 output = output + String.fromCharCode(chr2);
		}
		if (enc4 != 64) {
			output = output + String.fromCharCode(chr3);
		}
	}
 
	return output;
}


 
	function getXMLHttp()
{
  var xmlHttp

  try
  {
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    //Internet Explorer
    try
    {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}
var thePage = null;
function grabPage(direction)
{	
	var addOn = 0;
	if(direction!="prev"){previoussection = thePage;
	thePage = nextsection;
	addOn = 0;
	}

	if(direction=="prev"){nextsection = thePage; thePage = previoussection; addOn = 1; document.getElementById('controls').style.display = 'block';}
	if(addOn == 0){document.getElementById('controls').style.display = 'none';}
	if(thePage=="charmstyle"){document.getElementById('goPrev').style.display = 'none';} else {document.getElementById('goPrev').style.display = 'block';}
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
		HandleResponse(xmlHttp.responseText);
    }
  }
 
  	if(direction=="another"){thePage = "charmstyle";}
	callthis = "/sm_config/" + thePage + ".php?charm=" + charmstyle + '&addon=' + addOn + '&ran=' + Math.random();
	if(thePage=="summary"){
		
		callthis = "/sm_config/summary.php?charm=" + charmstyle + '&metal=' + metal + '&line1=' + line1 + '&line2=' + line2 + '&line3=' + line3 + '&line4=' + line4 + '&stone1=' + stone1 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&font=' + charmFont;	
		
	}
	if(thePage=="charmstone"){
		
		callthis = "/sm_config/charmstone.php?charm=" + charmstyle + '&metal=' + metal + '&line1=' + line1 + '&l2=' + line2 + '&l3=' + line3 + '&l4=' + line4 + '&stone1=' + stone1 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&font=' + charmFont;	
		
		
	}
	
	thesteps = 4;
	if((charmstyle=='3300') || (charmstyle=='3307') || (charmstyle=='3290') || (charmstyle=='3292') || (charmstyle=='3287') || (charmstyle=='3296')){thesteps = 5;}
	callthis = callthis + '&steps=' + thesteps;
	
  xmlHttp.open("GET", callthis, true); 
  xmlHttp.send(null);
}

function HandleResponse(response){
		
		document.getElementById('screenHolder').innerHTML = response;
		if(thePage =="charmstyle"){nextsection="charmmetal"; previoussection = "charmstyle";}
		if(thePage =="charmmetal"){nextsection="charmfont"; previoussection = "charmstyle";}
		if(thePage =="charmfont"){nextsection="charmtext"; previoussection = "charmmetal";}
		if(thePage =="charmtext"){nextsection="charmstone"; previoussection = "charmfont";}
		if(thePage =="charmstone"){nextsection="summary"; previoussection = "charmtext";}

	}




function priceupdate(){
	
	if((charmstyle!="3289") && (charmstyle!="3291") && (charmstyle!="3292") && (charmstyle!="3290")){line2=null; line3=null; line4=null;}
	
	var charmPrice=0;
	if(charmstyle=="3312"){charmMetal = "Sterling Silver"; metal = "silver";}
	if(charmMetal=="Sterling Silver"){	
				if(charmstyle=="3299"){charmPrice = 50;}
			if(charmstyle=="3300"){charmPrice = 50;}
			if(charmstyle=="3305"){charmPrice = 50;}
			if(charmstyle=="3307"){charmPrice = 75;}
			if(charmstyle=="3289"){charmPrice = 75;}
			if(charmstyle=="3290"){charmPrice = 100;}
			if(charmstyle=="3291"){charmPrice = 75;}
			if(charmstyle=="3292"){charmPrice = 100;}
			if(charmstyle=="3312"){charmPrice = 110;}
			if(charmstyle=="3285"){charmPrice = 50;}
			if(charmstyle=="3287"){charmPrice = 50;}
			if(charmstyle=="3294"){charmPrice = 75;}
			if(charmstyle=="3296"){charmPrice = 75;}
}

if(charmMetal=="14k White Gold"){
				if(charmstyle=="3299"){charmPrice = 175;}
			if(charmstyle=="3300"){charmPrice = 175;}
			if(charmstyle=="3305"){charmPrice = 225;}
			if(charmstyle=="3307"){charmPrice = 225;}
			if(charmstyle=="3289"){charmPrice = 400;}
			if(charmstyle=="3290"){charmPrice = 450;}
			if(charmstyle=="3291"){charmPrice = 375;}
			if(charmstyle=="3292"){charmPrice = 375;}
			if(charmstyle=="3312"){charmPrice = 0;}
			if(charmstyle=="3285"){charmPrice = 275;}
			if(charmstyle=="3287"){charmPrice = 285;}
			if(charmstyle=="3294"){charmPrice = 325;}
			if(charmstyle=="3296"){charmPrice = 325;}
}
if(charmMetal=="14k Yellow Gold"){
			if(charmstyle=="3299"){charmPrice = 175;}
			if(charmstyle=="3300"){charmPrice = 175;}
			if(charmstyle=="3305"){charmPrice = 225;}
			if(charmstyle=="3307"){charmPrice = 225;}
			if(charmstyle=="3289"){charmPrice = 400;}
			if(charmstyle=="3290"){charmPrice = 475;}
			if(charmstyle=="3291"){charmPrice = 375;}
			if(charmstyle=="3292"){charmPrice = 375;}
			if(charmstyle=="3312"){charmPrice = 0;}
			if(charmstyle=="3285"){charmPrice = 275;}
			if(charmstyle=="3287"){charmPrice = 285;}
			if(charmstyle=="3294"){charmPrice = 325;}
			if(charmstyle=="3296"){charmPrice = 325;}
}
if(charmMetal!=null){charmPrice = charmPrice;} else {charmPrice = 0;}
	
	if(stone1!=null){stone1Price = 15;} else {stone1Price = 0;}
	if(stone2!=null){stone2Price = 15;} else {stone2Price = 0;}
	if(stone3!=null){stone3Price = 15;} else {stone3Price = 0;}
	if((charmstyle=='3292') && (stone1!=null)){stone1Price = 30;}
		charmTotalPrice = charmPrice + stone1Price;
		if(charmstyle=='3290'){charmTotalPrice = charmTotalPrice + stone2Price + stone3Price;}
		
		theInformation = 'SKU: ' + charmstyle;
	if(charmMetal!=null){theInformation = theInformation + '<br />Metal: ' + charmMetal;}
	if(fontLabel!=null){theInformation = theInformation + '<br />Font: ' + fontLabel;}
	if(line1!=null){theInformation = theInformation + '<br />Engraving Line 1: ' + line1;}
	if(line2!=null){theInformation = theInformation + '<br />Engraving Line 2: ' + line2;}
	if(line3!=null){theInformation = theInformation + '<br />Engraving Line 3: ' + line3;}
	if(line4!=null){theInformation = theInformation + '<br />Engraving Line 4: ' + line4;}
	
	if(stone1!=null){theInformation = theInformation + '<br />Birthstone 1: ' + expandMonth(stone1);}
	if((stone2!=null) && (charmstyle=="3290")){theInformation = theInformation + '<br />Birthstone 2: ' + expandMonth(stone2);}
	if((stone3!=null) && (charmstyle=="3290")){theInformation = theInformation + '<br />Birthstone 3: ' + expandMonth(stone3);}
	if(metalset==1){
		theInformation = theInformation + '<br /><br /><span style="font-weight: bold; font-size: 16px;">Price: $' + charmTotalPrice + '</span>';
	}
	document.getElementById('charmdescription').innerHTML = theInformation;
	
	
	
}

function expandMonth(theAbb){
	var thefullmonth = null;
	if(theAbb=="jan"){	thefullmonth = "January"; }
	if(theAbb=="feb"){	thefullmonth = "February"; }
	if(theAbb=="mar"){	thefullmonth = "March"; }
	if(theAbb=="apr"){	thefullmonth = "April"; }
	if(theAbb=="may"){	thefullmonth = "May"; }
	if(theAbb=="jun"){	thefullmonth = "June"; }
	if(theAbb=="jul"){	thefullmonth = "July"; }
	if(theAbb=="aug"){	thefullmonth = "August"; }
	if(theAbb=="sep"){	thefullmonth = "September"; }
	if(theAbb=="oct"){	thefullmonth = "October"; }
	if(theAbb=="nov"){	thefullmonth = "November"; }
	if(theAbb=="dec"){	thefullmonth = "December"; }
	
	return thefullmonth;
	
}


function setCharmStyle(theCharm){
	charmstyle = theCharm;
	if(charmstyle=="3312"){charmMetal = "Sterling Silver"; metal = "silver";}
		var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=' + textEnamel + '&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&charmnum=' + currentcharm + '&dispHeight=180&dispWidth=0';

	document.getElementById('previewCharm').src = theproof;
	
	nextsection = "charmmetal";
	previoussection = "charmstyle";
	priceupdate();
	if((charmstyle=='3300') || (charmstyle=='3307') || (charmstyle=='3290') || (charmstyle=='3292') || (charmstyle=='3287') || (charmstyle=='3296')){document.getElementById('stepNums').innerHTML = 'Step 1 of 5 - Select a charm';}
	if((charmstyle!='3300') && (charmstyle!='3307') && (charmstyle!='3290') && (charmstyle!='3292') && (charmstyle!='3287') && (charmstyle!='3296')){document.getElementById('stepNums').innerHTML = 'Step 1 of 4 - Select a charm';}
	
	document.getElementById('controls').style.display = 'block';
	
}

function setCharmMetal(theMetal){
	
	charmMetal = theMetal;
	if(theMetal=="14k Yellow Gold"){metal="gold";}
	if(theMetal=="14k White Gold"){metal="silver";}
	if(theMetal=="Sterling Silver"){metal="silver";}
	
		var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=' + textEnamel + '&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&charmnum=' + currentcharm + '&dispHeight=180&dispWidth=0';

	document.getElementById('previewCharm').src = theproof;
	
	nextsection = "charmfont";
	previoussection = "charmstyle";
	metalset = 1;
	priceupdate();
	
	document.getElementById('controls').style.display = 'block';
	
}

function setCharmFont(theFont){
	
	charmFont = theFont;
	
		var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=' + textEnamel + '&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&charmnum=' + currentcharm + '&dispHeight=180&dispWidth=0';

	document.getElementById('previewCharm').src = theproof;
	
	nextsection = "charmtext";
	previoussection = "charmmetal";
	if(theFont=="cour"){fontLabel="Courier New";}
	if(theFont=="brad"){fontLabel="Bradley Hand ITC";}
	
	priceupdate();

	
	document.getElementById('controls').style.display = 'block';
	
}

function setthetext(){
		line1 = document.getElementById('charmtext1').value;

		if((charmstyle=="3291") || (charmstyle=="3292") || (charmstyle=="3289") || (charmstyle=="3290")){line2 = document.getElementById('charmtext2').value;}

		if((charmstyle=="3289") || (charmstyle=="3290")){line3 = document.getElementById('charmtext3').value;}
		
		if(charmstyle=="3289"){line4 = document.getElementById('charmtext4').value;}
	
	var charmmetallabel = null;
	if(charmMetal=='14k Yellow Gold'){charmmetallabel = 'gold';} else {charmmetallabel = 'silver';}
	var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=' + textEnamel + '&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=180&dispWidth=0';
		var theproof2 = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + charmMetal + '&enamel=' + textEnamel + '&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=200&dispWidth=0';
	
		var theimage = 'previewCharm';
		document.getElementById(theimage).src = theproof;

		
		var textProof = '/fontPreview.php?t=' + line1 + '&ft=' + charmFont;
		var textProof2 = '/fontPreview.php?t=' + line2 + '&ft=' + charmFont;
		var textProof3 = '/fontPreview.php?t=' + line3 + '&ft=' + charmFont;
		var textProof4 = '/fontPreview.php?t=' + line4 + '&ft=' + charmFont;
	
	document.getElementById('previewCHM').src = textProof;
	document.getElementById('previewCHM2').src = textProof2;
	document.getElementById('previewCHM3').src = textProof3;
	document.getElementById('previewCHM4').src = textProof4;
	
		previoussection = "charmtext";
		nextsection = "summary";
	if((charmstyle=="3300") || (charmstyle=="3307") || (charmstyle=="3290") ||(charmstyle=="3292") || (charmstyle=="3287") || (charmstyle=="3296")){
		nextsection = "charmstone";
	}


	priceupdate();
	
	document.getElementById('controls').style.display = 'block';


}

function stonechoose(themonth){
		
		stone1 = themonth;
	var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=black&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=180&dispWidth=0';
	
	var theproof2 = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=black&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=200&dispWidth=0';

		document.getElementById('previewCharm').src = theproof;
		document.getElementById('stonePrev').src = theproof2;
		
		nextsection = "summary";
		previoussection = "charmtext";
		priceupdate();
	
		document.getElementById('controls').style.display = 'block';
		
		
	}
	
	
	
function stonechoose2(themonth){
	
	document.getElementById('tmpStoneImg').src='/sm_config/imgs/' + themonth + '_stn_swatch.png';
	document.getElementById('myMessage').innerHTML = "Click on a placement for this stone";
	
	tempMonth = themonth;
		
	}
	
	function multiStone(position){
		if(tempMonth!=null){
			if(position=="1"){stone1 = tempMonth;}
			if(position=="2"){stone2 = tempMonth;}
			if(position=="3"){stone3 = tempMonth;}
	var theproof = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=black&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=180&dispWidth=0';
	
	var theproof2 = 'http://bellatrue.com/imtest2.php?t=' + line1 + '&ft=' + charmFont + '&metal=' + metal + '&enamel=black&charm=' + charmstyle + '&stone1=' + stone1 + '&nc=254&t2=' + line2 + '&t3=' + line3 + '&t4=' + line4 + '&stone2=' + stone2 + '&stone3=' + stone3 + '&dispHeight=130&dispWidth=0';

		document.getElementById('previewCharm').src = theproof;
		document.getElementById('stonePrev').src = theproof2;
		
		nextsection = "summary";
		previoussection = "charmtext";
		priceupdate();
		document.getElementById('tmpStoneImg').src='/sm_config/imgs/temper.jpg';
		document.getElementById('myMessage').innerHTML = "";
		document.getElementById('controls').style.display = 'block';
		tempMonth = null;
		}
	}
	
		function getXMLHttp()
{
  var xmlHttp

  try
  {
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    //Internet Explorer
    try
    {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}

//-----------------------------------------------------------------------------------------------

function MakeRequest()
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
		summaryResponse(xmlHttp.responseText);
    }
  }
  
  document.getElementById('goPrev').style.display = 'none';
  var theProduct = null;


  var theFinalMetal = charmMetal;
  var txtoption1 = null;


  if(charmstyle=="3285"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3285&metal=silver&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3285&metal=white&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3285&metal=yellow&text1=" + line1 + "&font=" + charmFont;	
	}
  }
  
    if(charmstyle=="3299"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3299&metal=silver&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3299&metal=white&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3299&metal=yellow&text1=" + line1 + "&font=" + charmFont;	
	}
  }
  
      if(charmstyle=="3305"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3305&metal=silver&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3305&metal=white&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3305&metal=yellow&text1=" + line1 + "&font=" + charmFont;	
	}
	  }
	  
      if(charmstyle=="3294"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3294&metal=silver&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3294&metal=white&text1=" + line1 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3294&metal=yellow&text1=" + line1 + "&font=" + charmFont;	
	}
	  }
	  
	      if(charmstyle=="3291"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3291&metal=silver&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3291&metal=white&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3291&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2;	
	}
	  }
  
  	      if(charmstyle=="3289"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3289&metal=silver&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2 + '&text3=' + line3 + '&text4=' + line4;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3289&metal=white&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2 + '&text3=' + line3 + '&text4=' + line4;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3289&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2 + '&text3=' + line3 + '&text4=' + line4;	
	}
	  }
	  
	  	      if(charmstyle=="3312"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3312&metal=silver&text1=" + line1 + "&font=" + charmFont + '&text2=' + line2 + '&text3=' + line3 + '&text4=' + line4;	
	}
	  }
	  
	if(charmstyle=="3300"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3300&metal=silver&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3300&metal=white&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3300&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	  }
	  
	if(charmstyle=="3307"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3307&metal=silver&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3307&metal=white&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3307&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	  }
	  
if(charmstyle=="3287"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3287&metal=silver&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3287&metal=white&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3287&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	  }
	  
if(charmstyle=="3296"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3296&metal=silver&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3296&metal=white&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3296&metal=yellow&text1=" + line1 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	  }
	  
if(charmstyle=="3292"){
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3292&metal=silver&text1=" + line1 + "&text2=" + line2 + "&font=" + charmFont + '&stone1=' + stone1;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3292&metal=white&text1=" + line1 + "&text2=" + line2 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3292&metal=yellow&text1=" + line1 + "&text2=" + line2 + "&font=" + charmFont + '&stone1=' + stone1;
	}
	  }
	  
	  if(charmstyle=="3290"){
		  if(line2==null){line2 = "null";}
		   if(line3==null){line3 = "null";}
		    if(stone1==null){stone1 = "null";}
			 if(stone2==null){stone2 = "null";}
			  if(stone3==null){stone3 = "null";}
	if(theFinalMetal=="Sterling Silver"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3290&metal=silver&text1=" + line1 + "&text2=" + line2 + "&text3=" + line3 + '&stone1=' + stone1 + '&stone2=' + stone2 + '&stone3=' + stone3 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k White Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3290&metal=white&text1=" + line1 + "&text2=" + line2 + "&text3=" + line3 + '&stone1=' + stone1 + '&stone2=' + stone2 + '&stone3=' + stone3 + "&font=" + charmFont;	
	}
	
	if(theFinalMetal=="14k Yellow Gold"){
	  var callthis = "http://bellatrue.com/addSMtocart.php?charmstyle=3290&metal=yellow&text1=" + line1 + "&text2=" + line2 + "&text3=" + line3 + '&stone1=' + stone1 + '&stone2=' + stone2 + '&stone3=' + stone3 + "&font=" + charmFont;	
	}
	  }
  

  xmlHttp.open("GET", callthis, true); 
  xmlHttp.send(null);
}

//----------------------------------------------------------------------------------------------------------------


	function summaryResponse(response){
		document.getElementById('itemNums5').value = response;
		document.getElementById('linkTitle5').label = response;
		
		document.getElementById('addit').style.display = 'none';
		document.getElementById('addmore').style.display = 'block';
		
	}

	function addtoMycart(){
		 
		MakeRequest();
		
	}
	
	function addmore(){
		
		line1 = null;
		line2 = null;
		line3 = null;
		line4 = null;
		charmFont = 'cour';
		metal = 'silver';
		charmMetal = 'Sterling Silver';
		textEnamel = 'black';
		stone1 = null;
		stone2 = null;
		stone3 = null;
		charmnum = 1;
		currentcharm = 1;
		charmstyle = null;
		nextsection = 'charmstyle';
		fontLabel = null;

		tempMonth = null;
		
		document.getElementById('charmdescription').innerHTML = '';
		document.getElementById('previewCharm').src="/sm_config/imgs/temper.jpg";
		
		grabPage('another');
		
	}
