//Specify spectrum of different font sizes:

function oc(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}

	var onefortf = new Array(28,29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,85 ,94 ,96 ,97 ,98);
	var tenomore = new Array(75, 76);
	var carray = new Array(81,82,83,84);
	
/*function quantityalert( pid,pqty,pprice,pname ) {	

	if( pid in oc(onefortf) ) {
		if(pqty >= 7 && pqty <= 24)
		//$('#alertdiv').innerhtml( '<img src="images/alertimg.gif" align="left">Please note that if you order a combined total of 25 or more copies of Five Wishes, My Wishes, Cinco Deseos and Bilingual Five Wishes, you will pay only $1 per copy!  You may want to revise your order to receive the best value for your money.' );
		
	} else if( pid in oc(tenomore) ) {
		if(pqty >= 6 && pqty <= 9)
		alert( 'Please note that if you order a combined total of 10 or more copies of the Next Steps Guide and Siguientes Pasos, you will pay only $2 per copy!  You may want to revise your order to receive the best value for your money.' );
		
	} 
}*/

function checkquantities( pid,pqty,pprice,pname) {
	aamout=0;
	bamout=0;
	camout=0;
	for (i = 0; (i < pid.length); i++) {	
		//alert(pid[i]+pqty[i]+pprice[i]+pname[i]);
		//quantityalert(pid[i],pqty[i],pprice[i],pname[i]);
		if( pid[i] in oc(onefortf) ) aamout+=parseInt(pqty[i]); 
		if( pid[i] in oc(tenomore) ) bamout+=parseInt(pqty[i]);
		if( pid[i] in oc(carray) ) camout+=parseInt(pqty[i]);
	}
	/*if(camout && (aamout>= 25 || bamout >=10)) {}
		if((aamout>=7 && aamout <= 24) || (bamout>=6 && bamout<=9)) {*/
		//alert(camout +aamout+bamout); 
		//alert(camout+" "+aamout+" "+bamout); 
	
	if(!(camout >= 1 && (aamout>=25 || bamout>=10)) && ((aamout>=7 && aamout<=24)||(bamout>=6 && bamout <=9))) {	
	if(aamout >= 7 && aamout <= 24) {
		$('#alertdiv').html( '<img src="images/alertimg.gif" align="left">Please note that if you order a combined total of 25 or more copies of <em>Five Wishes</em>, <em>My Wishes</em>, <em>Mis Deseos</em>, <em>Cinco Deseos</em> and Bilingual <em>Five Wishes</em>, you will pay only $1 per copy!  You may want to revise your order to receive the best value for your money.' ); }
	if(bamout >= 6 && bamout <= 9) {
		$('#alertdiv2').html('<img src="images/alertimg.gif" align="left">Please note that if you order a combined total of 10 or more copies of the Next Steps Guide and Siguientes Pasos, you will pay only $2 per copy!  You may want to revise your order to receive the best value for your money.'); }
	if(camout >= 1 && (aamout+bamout) >= 5) {
		$('#alertdiv3').html('<img src="images/alertimg.gif" align="left">Please note that for only $40.95 you can purchase the Family Package, which contains 10 copies of <em>Five Wishes</em>, two Next Steps guides and the <em>Five Wishes</em> instructional DVD.  You may wish to revise your order to receive the best value for your money.'); }
	} 
	
	/* if(camout && (aamout+bamout >=5)) {
		alert("You can receive a bulk discount if you order more than 25 items.");
} */
}

function agingem(theName,theExtras,theLink,theExt,theDomain) {
//var theDomain ="SunCapPart.com";
//var theDomain ="jamesrossadvertising.com";
var theEmail = theName+"@"+theDomain+"."+theExt;
if (theName == ""){
	theName = "ERROR";
	theLink = "ERROR";
	myEmail = theName;
	myLink = theLink;
}else{
	if ((theExtras == "") && (theLink =="")){
		myEmail = theEmail;
		myLink = theEmail;
	}
	if ((theLink == "") && (theExtras != "")){
		myLink = theEmail;
		myEmail = theEmail+theExtras;
	}
	if 	((theLink != "") && (theExtras != "")){
		myLink = theLink;
		myEmail = theEmail+theExtras;
	}
	if 	((theLink != "") && (theExtras == "")){
		myLink = theLink;
		myEmail = theEmail;
	}
}
	document.write('<a href=mailto:' + myEmail + '>' + myLink + '</a>');
}


function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

function open_win(page) {window.open(page,"","height=810,width=700,toolbar=no,statusbar=no,scrollbars=yes").focus(); }
function open_testimonial(page) {window.open(page,"","height=350,width=400,toolbar=no,statusbar=no,scrollbars=yes").focus(); }

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}