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 mod_text(divID,txtObject){
	document.getElementById(divID).innerHTML = txtObject.value;
}

function mod_image(divID,image_id,txtObject,width,height,fsize,ypos,font,font_bold){
	/*
	if(font == '' && typeof(txtObject.form.customer_info_font) != null){
		if(txtObject.form.customer_info_font.value != ''){
			font = txtObject.form.customer_info_font.value;
		}
	}
	*/
	if(font_bold == 'undefined' ){
		font_bold = false;
	}
	
	if(getSelectedRadio(txtObject.form.color) >= 0){
		var url = "?text=" + encodeURIComponent(txtObject.value) + "&fsize=" + fsize + "&h=" + height + "&w=" + width + "&y=" + ypos + "&font=" + font + "&font_bold=" + font_bold;	
		document.getElementById(image_id).src = STR_IMAGE_URL + url;
		document.getElementById(divID).style.display = "inline";	
	}
}

function mod_image_replicate(divID,image_id,divID1,image_id1,divID2,image_id2,txtObject,width,height,fsize,ypos,strFont){
	if(getSelectedRadio(txtObject.form.color) >= 0){
		mod_image(divID,image_id,txtObject,width,height,fsize,ypos,strFont);
		mod_image(divID1,image_id1,txtObject,width,height,fsize,ypos,strFont);
		mod_image(divID2,image_id2,txtObject,width,height,fsize,ypos,strFont);
	}
}

function mod_selectcheckline(name,value,id,show,hide){	
	if(value=='Yes'){
		document.getElementById(id).src="http://www.checkomatic.com/"+hide;
	}
	if(value=='No')
	{
	  document.getElementById(id).src="http://www.checkomatic.com/"+show;
	}
}

function change_font(objForm){
	var strFont = objForm.customer_info_font.value;
	var blnFontBold = objForm.customer_line2_font_weight.checked;


	var customer_line1 = document.getElementsByName("customer_line1");
	var customer_line2 = document.getElementsByName("customer_line2");
	var customer_line3 = document.getElementsByName("customer_line3");
	var customer_line4 = document.getElementsByName("customer_line4");
	var customer_line5 = document.getElementsByName("customer_line5");
	mod_image_replicate('divImgLine1','imgLine1','divImgLine11','imgLine11','divImgLine12','imgLine12',customer_line1[0],400,20,14,15,strFont,false)
	mod_image('divImgLine2','imgLine2',customer_line2[0],400,15,9,10,strFont,blnFontBold);
	mod_image('divImgLine3','imgLine3',customer_line3[0],400,15,9,10,strFont,false);
	mod_image('divImgLine4','imgLine4',customer_line4[0],400,15,9,10,strFont,false);
	mod_image('divImgLine5','imgLine5',customer_line5[0],400,15,9,10,strFont,false);
}	
