var dtCh= "-";
var minYear=1900;
var maxYear=2100;

var applyDefault = function(input, text){
	input.style.color = "#555";
	input.value = text;
	input.onfocus = function(){
		if(input.value == text){		
			input.value = "";
			input.style.color = "#000";
		}					
	}
	input.onblur = function(){
		if(input.value == ""){
			input.value = text;
			input.style.color = "#555";
		}
	
	}
}
var ge = function(id){
	return document.getElementById(id);
}

// The code that creates the default text in the input fields.
function ibizPasswordFields(){
	applyDefault(ge("email"), "Email");
	var email = ge("email");
	var placeholder = ge("password_placeholder");
	var password = ge("password"); 
	
	placeholder.innerHTML = "Password";
	placeholder.onclick = function(){
		this.style.display = "none";
		password.focus();
	}
	
	password.onfocus = function(){
		placeholder.style.display = "none";
	}
	
	email.onfocus = function(){
		email.value = "";
		placeholder.style.display = "none";
	}
	
	password.onblur = function(){
		if(password.value == "")
			placeholder.style.display = "block";
	}
}

function enableSearchFields()
{
	document.getElementById('scid').disabled=false;
	document.getElementById('semail').disabled=false;
	document.getElementById('slname').disabled=false;
	document.getElementById('sstatus').disabled=false;
	document.getElementById('sphone').disabled=false;
	document.getElementById('scompany').disabled=false;
	document.getElementById('sfdate').disabled=false;
	document.getElementById('stdate').disabled=false;
	document.getElementById('scustom1').disabled=false;
	document.getElementById('scustom2').disabled=false;
	document.getElementById('scustom3').disabled=false;
	document.getElementById('scid').style.backgroundColor="#d4e7f9";
	document.getElementById('semail').style.backgroundColor="#d4e7f9";
	document.getElementById('slname').style.backgroundColor="#d4e7f9";
	document.getElementById('sstatus').style.backgroundColor="#d4e7f9";
	document.getElementById('sphone').style.backgroundColor="#d4e7f9";
	document.getElementById('scompany').style.backgroundColor="#d4e7f9";
	document.getElementById('sfdate').style.backgroundColor="#d4e7f9";
	document.getElementById('stdate').style.backgroundColor="#d4e7f9";
	document.getElementById('scustom1').style.backgroundColor="#d4e7f9";
	document.getElementById('scustom2').style.backgroundColor="#d4e7f9";
	document.getElementById('scustom3').style.backgroundColor="#d4e7f9";
}

function disableSearchFields()
{
	document.getElementById('scid').disabled=true;
	document.getElementById('semail').disabled=true;
	document.getElementById('slname').disabled=true;
	document.getElementById('sstatus').disabled=true;
	document.getElementById('sphone').disabled=true;
	document.getElementById('scompany').disabled=true;
	document.getElementById('sfdate').disabled=true;
	document.getElementById('stdate').disabled=true;
	document.getElementById('scustom1').disabled=true;
	document.getElementById('scustom2').disabled=true;
	document.getElementById('scustom3').disabled=true;
	document.getElementById('scid').style.backgroundColor="#ffffff";
	document.getElementById('semail').style.backgroundColor="#ffffff";
	document.getElementById('slname').style.backgroundColor="#ffffff";
	document.getElementById('sstatus').style.backgroundColor="#ffffff";
	document.getElementById('sphone').style.backgroundColor="#ffffff";
	document.getElementById('scompany').style.backgroundColor="#ffffff";
	document.getElementById('sfdate').style.backgroundColor="#ffffff";
	document.getElementById('stdate').style.backgroundColor="#ffffff";
	document.getElementById('scustom1').style.backgroundColor="#ffffff";
	document.getElementById('scustom2').style.backgroundColor="#ffffff";
	document.getElementById('scustom3').style.backgroundColor="#ffffff";
}

function enableScheduleFields()
{
	document.getElementById('schdate').disabled=false;
	document.getElementById('schhour').disabled=false;
	document.getElementById('schmin').disabled=false;
	document.getElementById('schampm').disabled=false;
	document.getElementById('schdate').style.backgroundColor="#d4e7f9";
	document.getElementById('schhour').style.backgroundColor="#d4e7f9";
	document.getElementById('schmin').style.backgroundColor="#d4e7f9";
	document.getElementById('schampm').style.backgroundColor="#d4e7f9";
}

function disableScheduleFields()
{
	document.getElementById('schdate').disabled=true;
	document.getElementById('schhour').disabled=true;
	document.getElementById('schmin').disabled=true;
	document.getElementById('schampm').disabled=true;
	document.getElementById('schdate').style.backgroundColor="#ffffff";
	document.getElementById('schhour').style.backgroundColor="#ffffff";
	document.getElementById('schmin').style.backgroundColor="#ffffff";
	document.getElementById('schampm').style.backgroundColor="#ffffff";
}

function changePSvars()
{
	document.formpsprev.psvarprev.value = document.formpschange.lpsize.options[document.formpschange.lpsize.selectedIndex].value;
	document.formpsnext.psvarnext.value = document.formpschange.lpsize.options[document.formpschange.lpsize.selectedIndex].value;
	document.formpschange.submit();
}

function SubmitConPrevForm() {
	document.formpsprev.submit();
} // function SubmitConPrevForm()

function SubmitConNextForm() {
	document.formpsnext.submit();
} // function SubmitConNextForm

function RemoveContacts() {
	var answer = confirm ("You are about to remove selected contacts from your database!");
	
	if (answer) {
		document.formconlist.action = "index.php?action=dc";
		document.formconlist.submit();
	} // if (answer)
} // function RemoveContacts()

function updateProgBar(ival)
{
	document.getElementById('progtit').innerText = ival;
}

function displayDashProgBar(infld, inper, incurr, inmax) {

	var formattedper = inper * 100;
	
	if (infld == "emails") {
		//if (inmax == 10000) {
			document.write(incurr);
		//}
		//else {
		//	document.write(incurr + " / " + inmax + " (" + formattedper + "%)");
		//}
	}
	else {
		document.write(incurr + " / " + inmax + " (" + formattedper + "%)");
	}
	document.write("<div id='" + infld + "prog1'>");
	document.write("<div id='" + infld + "prog2'>");

	document.write("</div>");
	document.write("</div>");

	var fldvar = document.getElementById(infld + "prog2");
	fldvar.style.width = (inper * 200);
	
	return true;
} // function displayDashProgBar(infld, inper)

function SetFocusContactForm()
{	
	document.contactform.email.focus();
}

function drawESBox(custid)
{
	ltext = document.all.lbltext.value;
	vlblcolor = document.all.lblcolor.value;
	bckcolor = document.all.bckcolor.value;
	btncaption = document.all.btncaption.value;
	vfontname = document.all.fontname1.options[document.all.fontname1.selectedIndex].text;
	vfontsize = document.all.fontsize1.options[document.all.fontsize1.selectedIndex].text;
	visbold = document.all.isbold1.checked;
	visitalic = document.all.isitalic1.checked;
	
	
	newfontname = "; font-family:" + vfontname;
	newfontsize = "; font-size:" + vfontsize;
	if (visbold)
	{
		newfontbold = "; font-weight: bold";
		document.getElementById("varlabel").style.fontWeight = "bold";
	}
	else
	{
		newfontbold = "";
		document.getElementById("varlabel").style.fontWeight = "normal";
	}
	if (visitalic)
	{
		newfontitalic = "; font-style: italic";
		document.getElementById("varlabel").style.fontStyle = "italic";
	}
	else
	{
		newfontitalic = "";
		document.getElementById("varlabel").style.fontStyle = "normal";
	}
	
	
	newtext = '<form action="http://www.ibizard.com/eupdate1.php?ei=' + custid + '" method="post" target="_blank"><table style="background-color: ' + bckcolor + '"><tr><td><font style="color:' + vlblcolor + newfontname + newfontsize + newfontbold + newfontitalic + '">' + ltext + '</font><input type="text" name="inemail" id="inemail"></td><td><input type="submit" name="signup" id="signup" value="' + btncaption + '"></td></tr></table></form>';
	
	document.getElementById("varlabel").innerText=ltext;
	document.getElementById("varlabel").style.color = vlblcolor;
	document.getElementById("varlabel").style.fontFamily = vfontname;
	document.getElementById("varlabel").style.fontSize = vfontsize;
	document.all.vartable.style.backgroundColor = bckcolor;
	document.all.varcaption.value=btncaption;
	
	document.all.cptext.value=newtext;
}

function drawSignupForm(custid,cuslbl1,cuslbl2,cuslbl3)
{
	
	vsal=document.all.chksal.checked;
	vtit=document.all.chktit.checked;
	vco=document.all.chkco.checked;
  	va1=document.all.chka1.checked;
  	va2=document.all.chka2.checked;
  	vcity=document.all.chkcity.checked;
  	vst=document.all.chkst.checked;
  	vzip=document.all.chkzip.checked;
	vcountry=document.all.chkcountry.checked;
	vpcode=document.all.chkpcode.checked;
  	vwph = document.all.chkwph.checked;
  	vhph = document.all.chkhph.checked;
	vfax=document.all.chkfax.checked;
  	vaph = document.all.chkaph.checked;
  	vurl = document.all.chkurl.checked;
	vcus1=document.all.chkcus1.checked;
	vcus2=document.all.chkcus2.checked;
	vcus3=document.all.chkcus3.checked;
	
	vbckcolor = document.all.bckcolor.value;
	vbtncaption = document.all.btncaption.value;
	vfrmtitle = document.all.frmtitle.value;
	vfrmtitlecolor = document.all.titlecolor.value;
	vfrmtitlefontname = document.all.fontname1.options[document.all.fontname1.selectedIndex].text;
	newtitlefontname = ";font-family:" + vfrmtitlefontname;
	vfrmtitlefontsize = document.all.fontsize1.options[document.all.fontsize1.selectedIndex].text;
	newtitlefontsize = ";font-size:" + vfrmtitlefontsize;
	
	vlblcolor = document.all.lblcolor.value;
	vlblfontname = document.all.fontname2.options[document.all.fontname2.selectedIndex].text;
	newlblfontname = ";font-family:" + vlblfontname;
	vlblfontsize = document.all.fontsize2.options[document.all.fontsize2.selectedIndex].text;
	newlblfontsize = ";font-size:" + vlblfontsize;
	
	visfrmtitlebold = document.all.isbold1.checked;
	visfrmtitleitalic = document.all.isitalic1.checked;
	vislblbold = document.all.isbold2.checked;
	vislblitalic = document.all.isitalic2.checked;
	
	if (visfrmtitlebold)
	{
		document.getElementById("varlabel").style.fontWeight = "bold";
		newtitlebold = "; font-weight: bold";
	}
	else
	{
		document.getElementById("varlabel").style.fontWeight = "normal";
		newtitlebold = "";
	}
	if (visfrmtitleitalic)
	{
		newtitleitalic = "; font-style: italic";
		document.getElementById("varlabel").style.fontStyle = "italic";
	}
	else
	{
		newtitleitalic = "";
		document.getElementById("varlabel").style.fontStyle = "normal";
	}
	
	if (vislblbold)
	{
		newlblbold = "; font-weight: bold";
		document.getElementById("inlblemail").style.fontWeight = "bold";
		document.getElementById("inlblfirst").style.fontWeight = "bold";
		document.getElementById("inlbllast").style.fontWeight = "bold";
		document.getElementById("inlblsal").style.fontWeight = "bold";
		document.getElementById("inlbltit").style.fontWeight = "bold";
		document.getElementById("inlblco").style.fontWeight = "bold";
		document.getElementById("inlbla1").style.fontWeight = "bold";
		document.getElementById("inlbla2").style.fontWeight = "bold";
		document.getElementById("inlblcity").style.fontWeight = "bold";
		document.getElementById("inlblst").style.fontWeight = "bold";
		document.getElementById("inlblzip").style.fontWeight = "bold";
		document.getElementById("inlblcountry").style.fontWeight = "bold";
		document.getElementById("inlblpcode").style.fontWeight = "bold";
		document.getElementById("inlblwph").style.fontWeight = "bold";
		document.getElementById("inlblhph").style.fontWeight = "bold";
		document.getElementById("inlblfax").style.fontWeight = "bold";
		document.getElementById("inlblaph").style.fontWeight = "bold";
		document.getElementById("inlblurl").style.fontWeight = "bold";
		document.getElementById("inlblcus1").style.fontWeight = "bold";
		document.getElementById("inlblcus2").style.fontWeight = "bold";
		document.getElementById("inlblcus3").style.fontWeight = "bold";
	}
	else
	{
		newlblbold = "";
		document.getElementById("inlblemail").style.fontWeight = "normal";
		document.getElementById("inlblfirst").style.fontWeight = "normal";
		document.getElementById("inlbllast").style.fontWeight = "normal";
		document.getElementById("inlblsal").style.fontWeight = "normal";
		document.getElementById("inlbltit").style.fontWeight = "normal";
		document.getElementById("inlblco").style.fontWeight = "normal";
		document.getElementById("inlbla1").style.fontWeight = "normal";
		document.getElementById("inlbla2").style.fontWeight = "normal";
		document.getElementById("inlblcity").style.fontWeight = "normal";
		document.getElementById("inlblst").style.fontWeight = "normal";
		document.getElementById("inlblzip").style.fontWeight = "normal";
		document.getElementById("inlblcountry").style.fontWeight = "normal";
		document.getElementById("inlblpcode").style.fontWeight = "normal";
		document.getElementById("inlblwph").style.fontWeight = "normal";
		document.getElementById("inlblhph").style.fontWeight = "normal";
		document.getElementById("inlblfax").style.fontWeight = "normal";
		document.getElementById("inlblaph").style.fontWeight = "normal";
		document.getElementById("inlblurl").style.fontWeight = "normal";
		document.getElementById("inlblcus1").style.fontWeight = "normal";
		document.getElementById("inlblcus2").style.fontWeight = "normal";
		document.getElementById("inlblcus3").style.fontWeight = "normal";
	}
	if (vislblitalic)
	{
		newlblitalic = "; font-style: italic";
		document.getElementById("inlblemail").style.fontStyle = "italic";
		document.getElementById("inlblfirst").style.fontStyle = "italic";
		document.getElementById("inlbllast").style.fontStyle = "italic";
		document.getElementById("inlblsal").style.fontStyle = "italic";
		document.getElementById("inlbltit").style.fontStyle = "italic";
		document.getElementById("inlblco").style.fontStyle = "italic";
		document.getElementById("inlbla1").style.fontStyle = "italic";
		document.getElementById("inlbla2").style.fontStyle = "italic";
		document.getElementById("inlblcity").style.fontStyle = "italic";
		document.getElementById("inlblst").style.fontStyle = "italic";
		document.getElementById("inlblzip").style.fontStyle = "italic";
		document.getElementById("inlblcountry").style.fontStyle = "italic";
		document.getElementById("inlblpcode").style.fontStyle = "italic";
		document.getElementById("inlblwph").style.fontStyle = "italic";
		document.getElementById("inlblhph").style.fontStyle = "italic";
		document.getElementById("inlblfax").style.fontStyle = "italic";
		document.getElementById("inlblaph").style.fontStyle = "italic";
		document.getElementById("inlblurl").style.fontStyle = "italic";
		document.getElementById("inlblcus1").style.fontStyle = "italic";
		document.getElementById("inlblcus2").style.fontStyle = "italic";
		document.getElementById("inlblcus3").style.fontStyle = "italic";
	}
	else
	{
		newlblitalic = "";
		document.getElementById("inlblemail").style.fontStyle = "normal";
		document.getElementById("inlblfirst").style.fontStyle = "normal";
		document.getElementById("inlbllast").style.fontStyle = "normal";
		document.getElementById("inlblsal").style.fontStyle = "normal";
		document.getElementById("inlbltit").style.fontStyle = "normal";
		document.getElementById("inlblco").style.fontStyle = "normal";
		document.getElementById("inlbla1").style.fontStyle = "normal";
		document.getElementById("inlbla2").style.fontStyle = "normal";
		document.getElementById("inlblcity").style.fontStyle = "normal";
		document.getElementById("inlblst").style.fontStyle = "normal";
		document.getElementById("inlblzip").style.fontStyle = "normal";
		document.getElementById("inlblcountry").style.fontStyle = "normal";
		document.getElementById("inlblpcode").style.fontStyle = "normal";
		document.getElementById("inlblwph").style.fontStyle = "normal";
		document.getElementById("inlblhph").style.fontStyle = "normal";
		document.getElementById("inlblfax").style.fontStyle = "normal";
		document.getElementById("inlblaph").style.fontStyle = "normal";
		document.getElementById("inlblurl").style.fontStyle = "normal";
		document.getElementById("inlblcus1").style.fontStyle = "normal";
		document.getElementById("inlblcus2").style.fontStyle = "normal";
		document.getElementById("inlblcus3").style.fontStyle = "normal";
	}
	
	// Submit button caption
	document.getElementById("varcaption").value=vbtncaption;
		
	// Table/form background
	document.getElementById("vartable").style.backgroundColor = vbckcolor;
	
	// Form Title
	document.getElementById("varlabel").innerText=vfrmtitle;
	document.getElementById("varlabel").style.color = vfrmtitlecolor;
	document.getElementById("varlabel").style.fontSize = vfrmtitlefontsize;
	document.getElementById("varlabel").style.fontFamily = vfrmtitlefontname;
	
	document.getElementById("inlblemail").style.color = vlblcolor;
	document.getElementById("inlblemail").style.fontSize = vlblfontsize;
	document.getElementById("inlblemail").style.fontFamily = vlblfontname;
	
	document.getElementById("inlblfirst").style.color = vlblcolor;
	document.getElementById("inlblfirst").style.fontSize = vlblfontsize;
	document.getElementById("inlblfirst").style.fontFamily = vlblfontname;
	
	document.getElementById("inlbllast").style.color = vlblcolor;
	document.getElementById("inlbllast").style.fontSize = vlblfontsize;
	document.getElementById("inlbllast").style.fontFamily = vlblfontname;
	
	newtext = "<form action=\"http://www.ibizard.com/eupdate2.php?ei=" + custid + "\" method=\"post\" target=\"_blank\">";
	newtext = newtext + "<table style=\"background-color: " + vbckcolor + "\"><tr><td colspan=\"2\" align=\"center\"><font style=\"color:"+vfrmtitlecolor+newtitlefontname+newtitlefontsize+newtitlebold+newtitleitalic+"\">" + vfrmtitle + "</font></td></tr>";
	newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Email:</font></td><td><input type=\"text\" name=\"inemail\" id=\"inemail\"></td></tr>";
	newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">First Name:</font></td><td><input type=\"text\" name=\"infirst\" id=\"infirst\"></td></tr>";
	newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Last Name:</font></td><td><input type=\"text\" name=\"inlast\" id=\"inlast\"></td></tr>";

	if (vsal)
	{ 
		newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Salutation:</font></td><td><input type=\"text\" name=\"insal\" id=\"insal\"></td></tr>";
		document.getElementById("intrsal").style.display = "block";
	  	document.getElementById("inlblsal").style.display = "block";
		document.getElementById("inlblsal").style.color = vlblcolor;
	  	document.getElementById("insal").style.display = "block";
		document.getElementById("inlblsal").style.fontSize = vlblfontsize;
		document.getElementById("inlblsal").style.fontFamily = vlblfontname;
		document.getElementById("inlblsal").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrsal").style.display = "none";
	  	document.getElementById("inlblsal").style.display = "none";
	  	document.getElementById("insal").style.display = "none";
	}
	if (vtit)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Title:</font></td><td><input type=\"text\" name=\"intit\" id=\"intit\"></td></tr>";
	document.getElementById("intrtit").style.display = "block";
		document.getElementById("inlbltit").style.display = "block";
		document.getElementById("inlbltit").style.color = vlblcolor;
	  document.getElementById("intit").style.display = "block";
	  document.getElementById("inlbltit").style.fontSize = vlblfontsize;
		document.getElementById("inlbltit").style.fontFamily = vlblfontname;
		document.getElementById("inlbltit").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrtit").style.display = "none";
	  document.getElementById("inlbltit").style.display = "none";
	  document.getElementById("intit").style.display = "none";
	}
	if (vco)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Company:</font></td><td><input type=\"text\" name=\"inco\" id=\"inco\"></td></tr>";
	document.getElementById("intrco").style.display = "block";
	document.getElementById("inlblco").style.display = "block";
	document.getElementById("inlblco").style.color = vlblcolor;
	  document.getElementById("inco").style.display = "block";
	  document.getElementById("inlblco").style.fontSize = vlblfontsize;
		document.getElementById("inlblco").style.fontFamily = vlblfontname;
		document.getElementById("inlblco").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrco").style.display = "none";
	  document.getElementById("inlblco").style.display = "none";
	  document.getElementById("inco").style.display = "none";
	}
	if (va1)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Address 1:</font></td><td><input type=\"text\" name=\"ina1\" id=\"ina1\"></td></tr>";
	document.getElementById("intra1").style.display = "block";
	document.getElementById("inlbla1").style.display = "block";
	document.getElementById("inlbla1").style.color = vlblcolor;
	  document.getElementById("ina1").style.display = "block";
	  document.getElementById("inlbla1").style.fontSize = vlblfontsize;
		document.getElementById("inlbla1").style.fontFamily = vlblfontname;
		document.getElementById("inlbla1").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intra1").style.display = "none";
	  document.getElementById("inlbla1").style.display = "none";
	  document.getElementById("ina1").style.display = "none";
	}
	if (va2)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Address 2:</font></td><td><input type=\"text\" name=\"ina2\" id=\"ina2\"></td></tr>";
	document.getElementById("intra2").style.display = "block";
	document.getElementById("inlbla2").style.display = "block";
	document.getElementById("inlbla2").style.color = vlblcolor;
	  document.getElementById("ina2").style.display = "block";
	  document.getElementById("inlbla2").style.fontSize = vlblfontsize;
		document.getElementById("inlbla2").style.fontFamily = vlblfontname;
		document.getElementById("inlbla2").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intra2").style.display = "none";
	  document.getElementById("inlbla2").style.display = "none";
	  document.getElementById("ina2").style.display = "none";
	}
	if (vcity)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+ "\">City:</font></td><td><input type=\"text\" name=\"incity\" id=\"incity\"></td></tr>";
	document.getElementById("intrcity").style.display = "block";
	document.getElementById("inlblcity").style.display = "block";
	document.getElementById("inlblcity").style.color = vlblcolor;
	  document.getElementById("incity").style.display = "block";
	  document.getElementById("inlblcity").style.fontSize = vlblfontsize;
		document.getElementById("inlblcity").style.fontFamily = vlblfontname;
		document.getElementById("inlblcity").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrcity").style.display = "none";
	  document.getElementById("inlblcity").style.display = "none";
	  document.getElementById("incity").style.display = "none";
	}
	if (vst)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+ "\">State:</font></td><td><input type=\"text\" name=\"inst\" id=\"inst\"></td></tr>";
	document.getElementById("intrst").style.display = "block";
	document.getElementById("inlblst").style.display = "block";
	document.getElementById("inlblst").style.color = vlblcolor;
	  document.getElementById("inst").style.display = "block";
	  document.getElementById("inlblst").style.fontSize = vlblfontsize;
		document.getElementById("inlblst").style.fontFamily = vlblfontname;
		document.getElementById("inlblst").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrst").style.display = "none";
	  document.getElementById("inlblst").style.display = "none";
	  document.getElementById("inst").style.display = "none";
	}
	if (vzip)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Zip:</font></td><td><input type=\"text\" name=\"inzip\" id=\"inzip\"></td></tr>";
	document.getElementById("intrzip").style.display = "block";
	document.getElementById("inlblzip").style.display = "block";
	document.getElementById("inlblzip").style.color = vlblcolor;
	  document.getElementById("inzip").style.display = "block";
	  document.getElementById("inlblzip").style.fontSize = vlblfontsize;
		document.getElementById("inlblzip").style.fontFamily = vlblfontname;
		document.getElementById("inlblzip").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrzip").style.display = "none";
	  document.getElementById("inlblzip").style.display = "none";
	  document.getElementById("inzip").style.display = "none";
	}
	if (vcountry)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Country:</font></td><td><input type=\"text\" name=\"incountry\" id=\"incountry\"></td></tr>";
	document.getElementById("intrcountry").style.display = "block";
	document.getElementById("inlblcountry").style.display = "block";
	document.getElementById("inlblcountry").style.color = vlblcolor;
	  document.getElementById("incountry").style.display = "block";
	  document.getElementById("inlblcountry").style.fontSize = vlblfontsize;
		document.getElementById("inlblcountry").style.fontFamily = vlblfontname;
		document.getElementById("inlblcountry").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrcountry").style.display = "none";
	  document.getElementById("inlblcountry").style.display = "none";
	  document.getElementById("incountry").style.display = "none";
	}
	if (vpcode)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Postal Code:</font></td><td><input type=\"text\" name=\"inpcode\" id=\"inpcode\"></td></tr>";
	document.getElementById("intrpcode").style.display = "block";
	document.getElementById("inlblpcode").style.display = "block";
	document.getElementById("inlblpcode").style.color = vlblcolor;
	  document.getElementById("inpcode").style.display = "block";
	  document.getElementById("inlblpcode").style.fontSize = vlblfontsize;
		document.getElementById("inlblpcode").style.fontFamily = vlblfontname;
		document.getElementById("inlblpcode").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrpcode").style.display = "none";
	  document.getElementById("inlblpcode").style.display = "none";
	  document.getElementById("inpcode").style.display = "none";
	}
	if (vwph)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Work Phone:</font></td><td><input type=\"text\" name=\"inwph\" id=\"inwph\"></td></tr>";
	document.getElementById("intrwph").style.display = "block";
	document.getElementById("inlblwph").style.display = "block";
	document.getElementById("inlblwph").style.color = vlblcolor;
	  document.getElementById("inwph").style.display = "block";
	  document.getElementById("inlblwph").style.fontSize = vlblfontsize;
		document.getElementById("inlblwph").style.fontFamily = vlblfontname;
		document.getElementById("inlblwph").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrwph").style.display = "none";
	  document.getElementById("inlblwph").style.display = "none";
	  document.getElementById("inwph").style.display = "none";
	}
	if (vhph)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Home Phone:</font></td><td><input type=\"text\" name=\"inhph\" id=\"inhph\"></td></tr>";
	document.getElementById("intrhph").style.display = "block";
	document.getElementById("inlblhph").style.display = "block";
	document.getElementById("inlblhph").style.color = vlblcolor;
	  document.getElementById("inhph").style.display = "block";
	  document.getElementById("inlblhph").style.fontSize = vlblfontsize;
		document.getElementById("inlblhph").style.fontFamily = vlblfontname;
		document.getElementById("inlblhph").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrhph").style.display = "none";
	  document.getElementById("inlblhph").style.display = "none";
	  document.getElementById("inhph").style.display = "none";
	}
	if (vfax)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Fax:</font></td><td><input type=\"text\" name=\"infax\" id=\"infax\"></td></tr>";
	document.getElementById("intrfax").style.display = "block";
	document.getElementById("inlblfax").style.display = "block";
	document.getElementById("inlblfax").style.color = vlblcolor;
	  document.getElementById("infax").style.display = "block";
	  document.getElementById("inlblfax").style.fontSize = vlblfontsize;
		document.getElementById("inlblfax").style.fontFamily = vlblfontname;
		document.getElementById("inlblfax").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrfax").style.display = "none";
	  document.getElementById("inlblfax").style.display = "none";
	  document.getElementById("infax").style.display = "none";
	}
	if (vaph)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Alt Phone:</font></td><td><input type=\"text\" name=\"inaph\" id=\"inaph\"></td></tr>";
	document.getElementById("intraph").style.display = "block";
	document.getElementById("inlblaph").style.display = "block";
	document.getElementById("inlblaph").style.color = vlblcolor;
	  document.getElementById("inaph").style.display = "block";
	  document.getElementById("inlblaph").style.fontSize = vlblfontsize;
		document.getElementById("inlblaph").style.fontFamily = vlblfontname;
		document.getElementById("inlblaph").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intraph").style.display = "none";
	  document.getElementById("inlblaph").style.display = "none";
	  document.getElementById("inaph").style.display = "none";
	}
	if (vurl)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">Web URL:</font></td><td><input type=\"text\" name=\"inurl\" id=\"inurl\"></td></tr>";
	document.getElementById("intrurl").style.display = "block";
	document.getElementById("inlblurl").style.display = "block";
	document.getElementById("inlblurl").style.color = vlblcolor;
	  document.getElementById("inurl").style.display = "block";
	  document.getElementById("inlblurl").style.fontSize = vlblfontsize;
		document.getElementById("inlblurl").style.fontFamily = vlblfontname;
		document.getElementById("inlblurl").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrurl").style.display = "none";
	  document.getElementById("inlblurl").style.display = "none";
	  document.getElementById("inurl").style.display = "none";
	}
	if (vcus1)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">" + cuslbl1 + ":</font></td><td><input type=\"text\" name=\"incus1\" id=\"incus1\"></td></tr>";
	document.getElementById("intrcus1").style.display = "block";
	document.getElementById("inlblcus1").style.display = "block";
	document.getElementById("inlblcus1").style.color = vlblcolor;
	  document.getElementById("incus1").style.display = "block";
	  document.getElementById("inlblcus1").style.fontSize = vlblfontsize;
		document.getElementById("inlblcus1").style.fontFamily = vlblfontname;
		document.getElementById("inlblcus1").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrcus1").style.display = "none";
	  document.getElementById("inlblcus1").style.display = "none";
	  document.getElementById("incus1").style.display = "none";
	}
	if (vcus2)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">" + cuslbl2 + ":</font></td><td><input type=\"text\" name=\"incus2\" id=\"incus2\"></td></tr>";
	document.getElementById("intrcus2").style.display = "block";
	document.getElementById("inlblcus2").style.display = "block";
	document.getElementById("inlblcus2").style.color = vlblcolor;
	  document.getElementById("incus2").style.display = "block";
	  document.getElementById("inlblcus2").style.fontSize = vlblfontsize;
		document.getElementById("inlblcus2").style.fontFamily = vlblfontname;
		document.getElementById("inlblcus2").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrcus2").style.display = "none";
	  document.getElementById("inlblcus2").style.display = "none";
	  document.getElementById("incus2").style.display = "none";
	}
	if (vcus3)
	{ newtext = newtext + "<tr><td><font style=\"color:"+vlblcolor+newlblfontname+newlblfontsize+newlblbold+newlblitalic+"\">" + cuslbl3 + ":</font></td><td><input type=\"text\" name=\"incus3\" id=\"incus3\"></td></tr>";
	document.getElementById("intrcus3").style.display = "block";
	document.getElementById("inlblcus3").style.display = "block";
	document.getElementById("inlblcus3").style.color = vlblcolor;
	  document.getElementById("incus3").style.display = "block";
	  document.getElementById("inlblcus3").style.fontSize = vlblfontsize;
		document.getElementById("inlblcus3").style.fontFamily = vlblfontname;
		document.getElementById("inlblcus3").style.color = vlblcolor;
	}
	else
	{
		document.getElementById("intrcus3").style.display = "none";
	  document.getElementById("inlblcus3").style.display = "none";
	  document.getElementById("incus3").style.display = "none";
	}
	
	newtext = newtext + "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"btnsignup\" id=\"btnsignup\" value=\"" + vbtncaption + "\"></td></tr>";
	newtext = newtext + "</table>";
	newtext = newtext + "</form>";
	
	document.all.cptext.value=newtext;
	
}

function writeMySpry()
{
	var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
	
}


function storeHTMLBody()
{
	
	var oDivHTML = document.getElementById("otablecontainer").innerHTML;
	
	var myHTMLArea = document.getElementById("ohtmlarea");
	myHTMLArea.innerText = oDivHTML;
	
	document.finalemailform.submit();
	
} // function storeHTMLBody()

function testHTMLBody()
{
	
	document.finalemailform.action = "emailindex.php?action=test-copy-template";
	document.finalemailform.submit();
	
} // function storeHTMLBody()

function testHTMLBodyUpdate()
{
	
	document.finalemailform.action = "emailindex.php?action=test-update-template";
	document.finalemailform.submit();
	
} // function storeHTMLBody()

function getX(evt) {
      if (document.all) { return (evt.clientX); }
      return (evt.layerX);
}
function getY(evt) {
      if (document.all) { return (evt.clientY); }
      return (evt.layerY);
}
function getScrollX() {
      if (document.all) { return (document.body.scrollLeft); }
      return (window.pageXOffset);
}
function getScrollY() {
      if (document.all) { return (document.body.scrollTop); }
      return (window.pageYOffset);
}
function showValues(e) {
     var posx = 0;
     var posy = 0;
       posx= getX(e) + getScrollX();
       posy= getY(e) + getScrollY();
       var posStr = 'posX = ' + posx + ' posY = ' + posy
       window.status = posStr;
}

function checkMandatory(varfldname, varfldtitle, varform) {
	
	var fieldvalue = document.getElementById(varfldname).value;

	if (fieldvalue == "") {
		alert ("Please enter " + varfldtitle + " to proceed!");
	}
	else
	{
		var thisdocument = document.getElementById(varform);
		thisdocument.submit();
	}
}  // function checkMandatory

function checkMandatory2(varfldname1, varfldname2, varfldtitle1, varfldtitle2, varform) {
	
	var fieldvalue1 = document.getElementById(varfldname1).value;
	var fieldvalue2 = document.getElementById(varfldname2).value;
	
	if (fieldvalue1 == "") {
		alert ("Please enter " + varfldtitle1 + " to proceed!");
	}
	else if (fieldvalue2 =="" ) {
		alert ("Please enter " + varfldtitle2 + " to proceed!");
	}
	else {
		var thisdocument = document.getElementById(varform);
		thisdocument.submit();
	}
}  // function checkMandatory

function checkTemplateMandatory() {
	var tempflag;

	var varintcat = document.getElementById("intcat").value;

	tempflag = false;
	if (varintcat == "owncode") {
		//var varmyowncode = document.getElementById("inowncode").innerText;
		//if (varmyowncode != "") {
			tempflag = true;
		//}
	}
	else {
		var radioObj = document.emailform.radiouse;

		for (i=0; i < radioObj.length; i++) {
			if (radioObj[i].checked == true)
			{
				tempflag = true;
			}
		}
	} // else if varintcat = "owncode"
	
	if (tempflag) {
		document.forms.emailform.submit();
	}
	else {
		alert("You must select a template or enter your own code to proceed!");
	}
	
} // function checkTemplateMandatory

function submitTemplateOwnCode() {
	
	var varintcat = document.getElementById("intcat");
	varintcat.value = "owncode";
	
	document.forms.emailform.submit();
	
} // function submitTemplateOwnCode()

function submitPrevEmailForm(prevform)
{
	document.forms.emailform.action = prevform;
	document.forms.emailform.submit();
} // function submitOtherForm

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30};
		if (i==2) {this[i] = 29};
   } 
   return this;
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm-dd-yyyy");
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day");
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date");
		return false;
	}
return true;
}

function checkScheduleMailSubmit()
{
	var schdate = document.getElementById("schdate").value;
	var inhour = parseInt(document.getElementById("schhour").value);
	if (inhour < 10) {
		inhour = "0" + inhour;
	}
	var inmin = parseInt(document.getElementById("schmin").value);
	
	var schampm = document.getElementById("schampm").value;
	
	if (schampm == "PM") {
		if (inhour < 12) {
			inhour = inhour + 12;
		}
	}
	else {
		if (inhour == 12) {
			inhour = inhour + 12;
		}
	}
	
	var SplitResults = schdate.split("-");
	var inmonth = SplitResults[0];
	if (inmonth < 10) {
		inmonth = "0" + inmonth;
	}
	var inday = SplitResults[1];
	if (inday < 10) {
		inday = "0" + inday;
	}
	var inyear = SplitResults[2];
	
	var infullvar = parseInt(inyear + inmonth + inday + inhour + inmin);
	
	var today = new Date();
	
	var nowhour = today.getHours();
	if (nowhour < 10) {
		nowhour = "0" + nowhour;
	}
	var nowmin = today.getMinutes();
	if (nowmin < 10) {
		nowmin = "0" + nowmin;
	}
	var nowyear = today.getYear();
	var nowmonth = today.getMonth();
	if (nowmonth < 10) {
		nowmonth = "0" + nowmonth;
	}
	var nowday = today.getDate();
	if (nowday < 10) {
		nowday = "0" + nowday;
	}
	
	document.forms.emailform.submit();
	
} // function checkScheduleMailSubmit()

function updateSaveContinue(mf)
{
	document.finalemailform.action = "emailindex.php?action=update-template&ut=continue&mf=" + mf;
	document.finalemailform.submit();
} // function changeSaveContinue()

function copySaveContinue()
{
	document.finalemailform.action = "emailindex.php?action=copy-template&ut=continue";
	document.finalemailform.submit();
} // function changeSaveContinue()

function CheckUncheckAll(fieldname) {

	var chkall = document.getElementById('chkall');
	var chkallval = chkall.checked;
	
	var allfields = document.all.slcon;
	
	if (chkallval) {
		for (i=0; i<allfields.length; i++)
			allfields[i].checked = true;
	} // if (chkallval)
	else {
		for (i=0; i<allfields.length; i++)
			allfields[i].checked = false;
	} // else if (chkallval)
	
} // function sublistCheckAll()

function Changetrbgcolor(trid, ioflag)
{
	if (ioflag == "1")
		trid.style.backgroundColor = "#7ccf03";
	else
		trid.style.backgroundColor = "#ffffff";
} // function Changetrbgcolor()

function RemoveAddAllsl(infn, incnt, insl)
{
	if (infn == "remove")
		var answer = confirm ("You are about to remove " + incnt + " records from sub-list: " + insl);
	else if (infn == "add")
		var answer = confirm ("You are about to add " + incnt + " records to sub-list: " + insl);
	else
		var answer = false;
		
	if (answer) {
		if (infn == "remove") {
		document.formconlist.action = "emailindex.php?action=rem-mail-all";
		document.formconlist.submit();
		}
		else if (infn == "add") {
			document.formconlist.action = "emailindex.php?action=add-mail-all";
			document.formconlist.submit();
		}
	}
	
} // function RemoveAddAllsl()

function addContactFields() {
	
	var selbox1 = document.getElementById("confields1");
	var selbox2 = document.getElementById("confields2");
	
	var i;
	var j;
	for(j=0; j < selbox1.options.length; j++)
	{
		if(selbox1.options[j].selected) {
			var selvalue = selbox1.options[j].value;
			var seltext = selbox1.options[j].text;
			var addflag = true;
			for (i=selbox2.options.length-1; i>=0; i--) {
				if (selbox2.options[i].value == selvalue) {
					addflag = false;
				}
			}
	
			if (addflag) {
				var opt = document.createElement("OPTION");
				opt.text = seltext;
				opt.value = selvalue;
				selbox2.options.add(opt);
			}
		} // if (selbox1.options[j].selected
	} // for (j=selbox1...
	
} // function addContactFields()

function remContactFields() {
	
	var selbox2 = document.getElementById("confields2");
	
	var i;
	for(i=selbox2.options.length-1;i>=0;i--)
	{
		if(selbox2.options[i].selected)
		selbox2.remove(i);
	}

	
} // function remContactFields()

function saveContactFields() {
	var selbox2 = document.getElementById("confields2");
	
	var i;
	for(i=selbox2.options.length-1;i>=0;i--)
	{
		selbox2.options[i].selected = true;
	}
	document.formconfields.submit();
	
	return true;
} // function saveContactFields()

function closeWidget(imgid,divid) {
	
	var divwidget = document.getElementById(divid)
	divwidget.style.height = -100;
	
	var imgwidget = document.getElementById(imgid);
	imgwidget.src = "../images/widget-open.gif";
	
	var clickfunc = "openWidget('" + imgid + "','" + divid + "')";
	imgwidget.onclick = Function(clickfunc);
	
	return true;
	
} // function openWidget()

function openWidget(imgid,divid) {
	
	var divwidget = document.getElementById(divid)
	divwidget.style.height = auto;
	
	var imgwidget = document.getElementById(imgid);
	imgwidget.src = "../images/widget-close.gif";
	
	var clickfunc = "closeWidget('" + imgid + "','" + divid + "')";
	imgwidget.onclick = Function(clickfunc);
	
	return true;
	
} // function openWidget()

function showGalleryView(imgfile)
{
	var posx = 0;
    var posy = 0;
	var sWidth = document.body.clientWidth;
	var sHeight = document.body.clientHeight;
	
    //posx= getX(e) + getScrollX();
    //posy= getY(e) + getScrollY();
	document.getElementById("galleryimg").src = imgfile;
	var divname = document.getElementById("divgalleryview");
	divname.style.top = 20 + getScrollY();
	divname.style.left = (sWidth - 500)/2;
}  // view template

function hideGalleryView()
{
	document.getElementById("galleryimg").src = "";
	var divname = document.getElementById("divgalleryview");
	divname.style.top = -1000;
	divname.style.left = -1000;
	
}  // view template

function createSubdomain(indexprog)
{
	
	document.frmsubdomain.action = indexprog + "?action=choose-template";
	document.frmsubdomain.submit();
	
} // function createSubdomain()

function createSubdomain2()
{
	
	document.frmsubdomain.action = "subscribeindex.php?action=create-sd";
	document.frmsubdomain.submit();
	
} // function createSubdomain()

function checkSkinMandatory() {
	var tempflag;

	var varintcat = document.getElementById("intcat").value;

	tempflag = false;
	
	if (varintcat == "customcolor") {
		tempflag = true;
	}
	else {
		var radioObj = document.skinform.radiouse;

		for (i=0; i < radioObj.length; i++) {
			if (radioObj[i].checked == true)
			{
				tempflag = true;
			}
		}
	} // else if (varintcat == "customcolor")
	
	if (tempflag) {
		document.forms.skinform.submit();
	}
	else {
		alert("You must select a template!");
	}
	
} // function checkSkinMandatory

function changeSubscription(subtype) {

		//var fldInvoice = document.getElementById("invoice");
		var d = new Date();
		var nowtime = d.getTime();
		
		var sub_value = "iBizard.com Monthly Subscription TYPE=";
		var sub_number = "";
		//sub_value = nowtime;
		
		var sub_total = 0;
		
		if ( (subtype == "ECB") || (subtype == "ECP") ) {
			
				document.all.rdEB.checked = false;
				document.all.rdEP.checked = false;
				document.all.rdCB.checked = false;
				document.all.rdCP.checked = false;
				if (subtype == "ECB") {
					sub_value = sub_value + "EMAIL-CART-BASIC";
				}
				else if (subtype == "ECP") {
					sub_value = sub_value + "EMAIL-CART-PRO";
				}
				
				sub_number = subtype;
				if (subtype == "ECB") {
					sub_total = 14.99;
				}
				else {
					sub_total = 34.99;
				}

		}
		else {
			document.all.rdECB.checked = false;
			document.all.rdECP.checked = false;
			
			if (document.all.rdEB.checked == true) {
				sub_value = sub_value + "EMAIL-BASIC";
				sub_number = "EB";
				sub_total = 9.99;
			}
			else if (document.all.rdEP.checked == true) {
				sub_value = sub_value + "EMAIL-PRO";
				sub_number = "EP";
				sub_total = 19.99;
			}
			
			
			if (document.all.rdCB.checked == true) {
				sub_value = sub_value + "CART-BASIC";
				sub_number = sub_number + "*CB";
				sub_total += 9.99;
			}
			else if (document.all.rdCP.checked == true) {
				sub_value = sub_value + "CART-PRO";
				sub_number = sub_number + "*CP";
				sub_total += 19.99;
			}
			
		} // else if (subtype == ECB...

		document.all.item_name.value = sub_value;
		document.all.item_number.value = sub_number;
		document.all.a3.value = sub_total;
		

} // changeSubscription(subtype)

function submitSubscription(subtype) {
		
		var sub_value = "iBizard.com Monthly Subscription TYPE=";
		var sub_number = "";
		
		var sub_total = 0;
		
		if ( (subtype == "free") || (subtype == "basic") || (subtype == "plus") || (subtype == "pro") || (subtype == "enterprise") ) {

			sub_number = subtype;
			
			if (subtype == "free") {
				sub_value = sub_value + "Free Plan";
				sub_total = 0;
			}
			else if (subtype == "basic") {
				sub_value = sub_value + "Basic Plan";
				sub_total = 9.99;
			}
			else if (subtype == "plus") {
				sub_value = sub_value + "Plus Plan";
				sub_total = 19.99;
			}
			else if (subtype == "pro") {
				sub_value = sub_value + "Pro Plan";
				sub_total = 29.99;
			}
			else  {
				sub_value = sub_value + "Enterprise Plan";
				sub_total = 39.99;
			}
			
			document.all.item_name.value = sub_value;
			document.all.item_number.value = sub_number;
			document.all.a3.value = sub_total;
			
			document.all.frmsubscr.submit();
		}
		else {
			alert ("Unknown subscription type! Please contact support if problem persists.");
			return false;
		}
		

} // submitSubscription(subtype)
      
function show_help(id) {          
var url = 'help/shop_config.php';          
var pars = '?id=' + id;          
var myAjax = new Ajax.Request(url,
	{
	method: 'get',
	parameters: pars,
	onSuccess: show_overlib
	});       
}      

function show_help2(helpfile,id) {          
var url = 'help/' + helpfile + '.php';          
var pars = '?id=' + id;          
var myAjax = new Ajax.Request(url,
	{
	method: 'get',
	parameters: pars,
	onSuccess: show_overlib
	});       
}

function show_help_tips_div(helpfile,id) {          
var url = 'help/' + helpfile + '.php';          
var pars = '?id=' + id;  

var myAjax = new Ajax.Request(url,
	{
	method: 'get',
	parameters: pars,
	onSuccess: populate_help_tips_div
	});       
} 

function show_help_tips_html(helpfile,id,divname) {          
var url = helpfile + '.php';          
var pars = '?id=' + id; 

var myAjax = new Ajax.Request(url,
	{
	method: 'get',
	parameters: pars,
	onSuccess: function pop2(request) {
		var helptipsdiv = document.getElementById(divname);
		helptipsdiv.innerHTML = request.responseText;
	}
	});       
}

function populate_help_tips_div(request) {
	var helptipsdiv = document.getElementById("helptipsdiv");
	helptipsdiv.innerHTML = request.responseText;
}

function populate_help_tips_html(request) {
	var helptipsdiv = document.getElementById("listorders");
	helptipsdiv.innerHTML = request.responseText;
}


function show_overlib(request) {          
	overlib(request.responseText,STICKY,CAPTION,'iBizard Tips',WIDTH,300);       
}    

function updateElementWithStyle() {
					var selObj = document.getElementById("selelements");
					var selIndex = selObj.selectedIndex;
					var seltext = selObj.options[selIndex].text; 
					var selcode = selObj.options[selIndex].value;
					
					selObj = document.getElementById("fontname");
					selIndex = selObj.selectedIndex;
					var valfontname = selObj.options[selIndex].value;
					
					selObj = document.getElementById("fontalign");
					selIndex = selObj.selectedIndex;
					var valfontalign = selObj.options[selIndex].value;
					
					var valfontname  = document.getElementById("fontname").value;
					var valfontcolor = document.getElementById("fontcolor").value;
					var valfontsize  = document.getElementById("fontsize").value;
					var valbckcolor  = document.getElementById("bckcolor").value;
					var valisbold    = document.getElementById("isbold").checked;
					var valisitalic    = document.getElementById("isitalic").checked;
					var valisunderline    = document.getElementById("isunderline").checked;
					
					var styletext = "";
					if (valfontname != "") {
						styletext = "font-family: " + valfontname + ";";
					}
					if (valfontalign != "") {
						styletext += "text-align: " + valfontalign + ";";
					}
					if (valfontcolor != "") {
						styletext += "color: " + valfontcolor + ";";
					}
					if (valfontsize != "") {
						styletext += "font-size: " + valfontsize + ";";
					}
					if (valbckcolor != "") {
						styletext += "background-color: " + valbckcolor + ";";
					}
					if (valisbold) {
						styletext += "font-weight: bold;";
					}
					if (valisitalic) {
						styletext += "font-style: italic;";
					}
					if (valisunderline) {
						styletext += "text-decoration: underline;";
					}
					
					if (seltext != "") {
						
						var eHTML = "<span style='" + styletext + "' >" + seltext + "</span>";
						document.getElementById("elementpreview").innerHTML = eHTML;
					}
				
} // function updateEditorWithStyle()

function ConfirmDropFile(fid) {
	var answer = confirm ("Warning: Deleting this picture will remove the image from all active blogs, web pages and emails it is attached to.  Are you sure you want to delete?");
	
	if (answer) {
		location.href="toolsindex.php?action=drop-file&fid=" + fid;
	} // if (answer)
} // function RemoveContacts()

function blogSaveandPost() {

	document.all.formblogentry.action = "blogindex.php?action=save-new-entry";
	return true;

} // function blogSaveandPost(eid)

function blogUpdateandPost(eid) {

	document.all.formblogentry.action = "blogindex.php?action=update-entry&id=" + eid;
	return true;

} // function blogSaveandPost(eid)

function ChangeToolbar()
{
	document.frmWYSIWYGEditor.action = window.location.href;
	return true;
	//window.location.href = window.location.href + "&autoconfig=" + toolbar ;
}

function enableBlogSortOrder(inFld, inImg) {
	
	var newclick = "defaultBlogSortOrder(\"" + inFld + "\", this)";
	
	var txtFld;
	txtFld = document.getElementById(inFld);
	txtFld.value = "";
	txtFld.disabled = false;
	txtFld.focus();
	
	inImg.src = "../images/b_drop.png";
	inImg.onclick = Function(newclick);
	inImg.alt = "Revert back to DEFAULT sort order";
	
} // function enableBlogSortOrder(inFld)

function defaultBlogSortOrder(inFld, inImg) {
	
	var newclick = "enableBlogSortOrder(\"" + inFld + "\", this)";
	
	var txtFld;
	txtFld = document.getElementById(inFld);
	txtFld.value = "DEFAULT";
	//txtFld.disabled = true;
	
	inImg.src = "../images/b_edit.png";
	inImg.onclick = Function(newclick);
	inImg.alt = "Edit sort order";
	
} // function defaultBlogSortOrder(inFld)

function ConfirmAction(inmsg, inaction) {
	var answer = confirm (inmsg);
	
	if (answer) {
		location.href=inaction;
	} // if (answer)
} // function RemoveContacts()

function toggle_getting_started(rcustid, toggle_flag) {          
var url = "ajax_update_file.php";

var pars = '?rcid=' + rcustid + "&tf=" + toggle_flag; 

var myAjax = new Ajax.Request(url,
	{
	method: 'get',
	parameters: pars,
	onSuccess: function pop2(request) {
		var aresp = request.responseText;
		if (toggle_flag == 0) {
			document.getElementById('panelGettingStarted').style.display = 'none';
			document.getElementById('panelGettingStartedOff').style.display = 'block';
		}
		else {
			document.getElementById('panelGettingStarted').style.display = 'block';
			document.getElementById('panelGettingStartedOff').style.display = 'none';
		}
	}
	});
	
}

