function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function P7_hideEl(evt) { //v1.5 by PVII-www.projectseven.com
 var b,r,m=false;if(document.layers){b=evt.target;if(b.p7aHide){
 b.visibility="hidden";}else{routeEvent(evt);}
 }else if(document.all&&!window.opera){b=event.srcElement;while(b){
 if(b.p7aHide){break;}b=b.parentElement;}if(!b.contains(event.toElement)){
 b.style.visibility="hidden";}}else if(document.getElementById){
 b=evt.currentTarget;r=evt.relatedTarget;while(r){if(b==r){m=true;
 break;}r=r.parentNode;}if(!m){b.style.visibility="hidden";}}
}

function P7_autoHide() { //v1.5 by PVII-www.projectseven.com
 var i,g;for(i=0;i<arguments.length;i++){
 if((g=MM_findObj(arguments[i]))!=null){g.p7aHide=true;if(document.layers){
 g.captureEvents(Event.MOUSEOUT);}g.onmouseout=P7_hideEl;}}
}

function P7_Snap() { //v2.67 by PVII
 var g,x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}

function P7_autoLayers() { //v1.5 by PVII
 var g,b,k,f,u,k,j,args=P7_autoLayers.arguments,a=parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.visibility="hidden";}}for(k=1;k<args.length;k++){
 if((g=MM_findObj(args[k]))!=null){b=(document.layers)?g:g.style;b.visibility="visible";f=false;
 for(j=0;j<p7c[a].length;j++){if(args[k]==p7c[a][j]) {f=true;}}
 if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

// isSalesProductChange - 1 - 
// 	                    - 100 - special add request to Special Instructions for RunStart
//
function changeTotalPrice(isSalesProductChange)
{
	var quantity = $F('quantity');
	var shipMethod = $F('shipMethod');
	var price = 0;
	var shippingCost = 0;
	var isSalesForm = $F('sales');
	var isPremiumSupport;
	var isDEBUG = $F('debug');
	var premiumSupportSingleCost;
	var premiumSupportCost = 0.0;
	var runStartCost = 0.0;
	var productDescription;
 
	
	if (quantity <= 0)
	{
		quantity = 1;
		document.getElementById("quantity").value = "1";
	}

	if (isSalesForm == false)
	{
	  	// Add RunStart option - support will install CL for the User - 6/3/09
		var tr = document.getElementById("hiddenRunStartRow");
		if (tr)
		{
			if (tr.style.display != "none")
			{
				if (isChecked('runstart_checkbox'))
				{
					runStartCost = 49.0 * quantity;				// $29 to $39 - 7/27/09
				}
			}
		}
		
		// RunStart Act has differnt price (and display row) - 6/24/09	
		tr = document.getElementById("hiddenRunStartRowAct");
		if (tr)
		{
			if (tr.style.display != "none")
			{
				if (isChecked('runstart_checkbox_act'))
				{
					runStartCost = 49.0 * quantity;
				}
			}
		}
			
		// normal order form
		premiumSupportSingleCost = 129.0;
		
		// read checkbox, $F = Form.Element.getValue;
		isPremiumSupport = isChecked('premium_support');
		if (isPremiumSupport == 1)
		{
			premiumSupportCost = premiumSupportSingleCost * quantity;						// STC 3/11/09
		}
		else
		{
			premiumSupportCost = 0.0;
		}
	}
	else
	{
		// salesform
		premiumSupportSingleCost = 129.0;
		// In sales form Premium Support is a supplied value
		premiumSupportCost = $F('iPremiumSupportSubTotal');				
		if (premiumSupportCost > 0.0)
		{
			isPremiumSupport = 1;
		}
		else
		{
			isPremiumSupport = 0;
		}
		
		runStartCost = $F('iRunStartSubTotal');
		
		// moved inside sales only - web does not ship anymore
		if(shipMethod == "None")
		{
			shippingCost = 0;
		}
		else if(shipMethod == "USPSGround")
		{
			shippingCost = 6.95;
		}
	}
	
	if ((isSalesForm == false) ||
		(isSalesForm == true) && (isSalesProductChange == 1))
	{
		var product = $F('product');

		if(product == "CLO40")																// 10/19/10			RSC
		{
		  price = 49.95;
		  productDescription = "CompanionLink 4.0 for Outlook";
		}
		else if(product == "CLPDT40")														// 10/19/10			RSC
		{
		  price = 49.95;
		  productDescription = "CompanionLink 4.0 for Palm Desktop & Pimlical";
		}
		else if(product == "CLTC40")														// 10/25/10			RSC
		{
		  price = 49.95;
		  productDescription = "CompanionLink 4.0 for Time & Chaos";
		}
		else if(product == "CLX40")															// 6/30/10			RSC
		{
		  price = 79.95;  
		  productDescription = "CompanionLink Express 4.0";
		}
		else if(product == "CLP40")															// 6/30/10			RSC
		{
		  price = 129.95;
		  productDescription = "CompanionLink Professional 4.0";
		}
		else if(product == "CLFA40")														// 10/19/10			RSC
		{
		  price = 129.95;
		  productDescription = "CompanionLink FA 4.0";
		}
		else if(product == "CLX20")
		{
		  price = 49.95;
		  productDescription = "CompanionLink Express 2.0";
		}
		else if(product == "CLX30")					// STC 11/5/07
		{
		  price = 49.95;  
		  productDescription = "CompanionLink Express 3.0";
		}
		else if(product == "CLP20")
		{
		  price = 99.95;
		  productDescription = "CompanionLink Professional 2.0";
		}
		else if(product == "CLP30")					// STC 11/5/07
		{
		  price = 99.95;
		  productDescription = "CompanionLink Professional 3.0";
		}
		else if(product == "CLIN")					// STC 7/27/09
		{
		  price = 99.95;
		  productDescription = "CompanionLink for Infusionsoft";
		}
		else if(product == "CLW")					// STC 8/31/09
		{
		  price = 39.95;
		  productDescription = "CompanionLink for webOS USB";
		}
		else if(product == "CLW40")					// RSC 6/30/10
		{
		  price = 39.95;
		  productDescription = "CompanionLink for webOS USB 4.0";
		}
		else if(product == "CLU")					// AWS 12/16/09
		{
		  price = 39.95;
		  productDescription = "CompanionLink USB";
		}
		else if(product == "CLU40")					// RSC 6/30/10
		{
		  price = 39.95;
		  productDescription = "CompanionLink USB 4.0";
		}
		else if(product == "CLG20")
		{
		  price = 39.95;							// 29.95;		7/27/09 
		  productDescription = "CompanionLink for Google Calendar 2.0";
		}
		else if(product == "CLG30")					// STC 11/5/07
		{
		  price = 39.95;							// 29.95;		7/27/09 
		  productDescription = "CompanionLink for Google 3.0";
		}
		else if(product == "CLG40")					// RSC 6/22/10
		{
		  price = 39.95;
		  productDescription = "CompanionLink for Google 4.0";
		}
		else if(product == "JCLG20")				// Japanese Google - STC 5/31/07
		{
		  price = 39.95;							// 29.95;		7/27/09 
		  productDescription = "CompanionLink for Google Calendar JAPANESE 2.0";  
		}
		else if(product == "JCLG30")				// Japanese Google - STC 11/5/07
		{
		  price = 39.95;							// 29.95;  		7/27/09 
		  productDescription = "CompanionLink for Google JAPANESE 3.0";  
		}
		else if(product == "JCLG40")				// Japanese Google - RSC 7/28/10
		{
		  price = 39.95;							
		  productDescription = "CompanionLink for Google JAPANESE 4.0";  
		}
		else if(product == "DL40")					// RSC 7/28/10
		{
		  price = 129.95;
		  productDescription = "DoubleLook 4.0";
		}
		else if(product == "DL30")					// STC 2/13/08
		{
		  price = 99.95;
		  productDescription = "DoubleLook 3.0";
		}
		else if(product == "DL20")					// STC 2/13/08
		{
		  price = 99.95;
		  productDescription = "DoubleLook 2.0";
		}
		else if(product == "DN40")					// RSC 7/28/10
		{
		  price = 129.95;
		  productDescription = "DoubleNotes 4.0";
		}
		else if(product == "DN30")					// STC 2/13/08
		{
		  price = 99.95;
		  productDescription = "DoubleNotes 3.0";
		}
		else if(product == "DN20")					// STC 2/13/08
		{
		  price = 99.95;
		  productDescription = "DoubleNotes 2.0";
		}
		else if(product == "O2G-CLG40")
		{
		  price = 29.95;
		  productDescription = "Upgrade: O2g to CompanionLink for Google";
		}
		else if(product == "CLG-CLG40")				// RSC 6/22/10
		{
		  price = 29.95;
		  productDescription = "Upgrade: CompanionLink for Google 4.0";
		}
		else if(product == "CLX13-X20")
		{
		  price = 29.95;
		  productDescription = "Upgrade: Express 1.3 to Express 2.0";
		}
		else if(product == "CLU-CLX40")				// RSC 8/18/10
		{
		  price = 29.95;
		  productDescription = "Upgrade: Any CompanionLink USB to Express 4.0";
		}
		else if(product == "CL40-CLP40")				// RSC 10/27/10
		{
		  price = 89.95;
		  productDescription = "Upgrade: Any CompanionLink 4.0 to CompanionLink Pro 4.0";
		}
		else if(product == "CLU-CLP40")				// RSC 10/19/10
		{
		  price = 89.95;
		  productDescription = "Upgrade: Any CompanionLink USB to CompanionLink Professional 4.0";
		}
		else if(product == "CLG-CLX40")				// RSC 8/30/10
		{
		  price = 29.95;
		  productDescription = "Upgrade: Any CompanionLink Google to CompanionLink Express 4.0";
		}
		else if(product == "CLX-CLX40")				// RSC 6/30/10
		{
		  price = 39.95;
		  productDescription = "Upgrade: Any Express to Express 4.0";
		}
		else if(product == "CLX40-CLP40")			// RSC 8/9/10
		{
		  price = 59.95;
		  productDescription = "Upgrade: Express 4.0 to Professional 4.0";
		}
		else if(product == "CLX-CLP40")				// RSC 6/30/10
		{
		  price = 79.95;
		  productDescription = "Upgrade: Any Express to Professional 4.0";
		}
		else if(product == "CLX20-P20")
		{
		  price = 49.95;
		  productDescription = "Upgrade: Express 2.0 to Professional 2.0";
		}
		else if(product == "CLX13-P20")
		{
		  price = 59.95;
		  productDescription = "Upgrade: Express 1.3 to Professional 2.0";
		}
		else if(product == "CLP13-P20")
		{
		  price = 49.95;
		  productDescription = "Upgrade: Professional 1.3 to Professional 2.0";
		}
		else if(product == "CLP-CLP40")				// RSC 6/30/10
		{
		  price = 49.95;
		  productDescription = "Upgrade: Any Professional to Professional 4.0";
		}
		else if(product == "CLTC20")				// not going to 3.0
		{
		  price = 49.95;
		  productDescription = "CompanionLink for Time and Chaos";
		}
		else if(product == "CL13-CLP30")			// STC 11/5/07
		{
		  price = 59.95;  
		  productDescription = "Upgrade: Any 1.3 to Professional 3.0";
		}
		else if(product == "CLX20-P30")				// STC 11/5/07
		{
		  price = 49.95;
		  productDescription = "Upgrade: Express 2.0 to Professional 3.0";
		}
		else if(product == "PSP1")					// STC 1/31/09
		{
		  price = premiumSupportSingleCost;
		  productDescription = "Premium Support (1-user)";
		}
		else if(product == "PSP5")					// STC 1/31/09
		{
		  price = 399.00;
		  productDescription = "Premium Support (5-user)";
		}
		else if(product == "RSTOL")					// 6/4/09
		{
		  price = 49.00;							// 29.00; 7/27/09
		  productDescription = "RunStart for Outlook";
		}		  
		else if(product == "RSTPD")					// 6/4/09
		{
		  price = 49.00;							// 29.00; 7/27/09
		  productDescription = "RunStart for Palm Desktop";
		}
		else if(product == "RSTACT")					// 6/24/09
		{
		  price = 49.00;
		  productDescription = "RunStart for Act!";
		}
		else if(product == "RA")			// not in use
		{
		  price = 49.95;
		  productDescription = "ReportAbility";
		}
		else if(product == "AA")
		{
		  price = 199.95;
		  productDescription = "AdjustAbility";
		}
		else if(product == "SWS")
		{
		  price = 54.95;
		  productDescription = "Split Wizard - Single User";
		}
		else if(product == "SWN")
		{
		  price = 194.95;
		  productDescription = "Split Wizard - Network";
		}
		else if(product == "RLP")
		{
		  price = 99.95;			// $39.95 - pre 6/15/09 
		  productDescription = "RegisterLink Pro";
		}
		else if(product == "PB")
		{
		  price = 0.00;
		  productDescription = "PDO Backup";
		}
		else if(product == "PD")
		{
		  price = 29.95;
		  productDescription = "PDO Desktop";
		}
		else if(product == "WL")
		{
		  price = 29.95;
		  productDescription = "WindowsLink";
		}		  
		
		// this is a User field for Rox on salesform.php - 3/16/09
		document.getElementById("itemDesc").value = productDescription;
		document.getElementById("itemId").value = product;
  		document.getElementById("itemPrice").value = price;
	}
	else
	{
		// use salesForm entered  values
		price = $F('itemPrice');	
	}

	document.getElementById("iPremiumSupportSingleCost").value = premiumSupportSingleCost;
	document.getElementById("PremiumSupportSubTotal_Label").value = "Premium Support";  

	// new product/premium support subtotals - STC 3/12/09
	document.getElementById("iProductSubTotal").value = (price * quantity);
	document.getElementById("sProductSubTotal").value = "$" + formatCurrency(price * quantity);

	/* just use the one with added RunStart - 6/4/09
	if (isPremiumSupport != 1)
	{
		document.getElementById("iPremiumSupportSubTotal").value = 0;
		document.getElementById("sPremiumSupportSubTotal").value = 0;
							
		// old code before Premium Support - 3/11/09 STC
		document.getElementById("iSubTotal").value = price * quantity;
		document.getElementById("sSubTotal").value = formatCurrency(price * quantity);
		if(isSalesForm == true)
		{
			document.getElementById("iTotal").value = (price * quantity) + shippingCost;
			document.getElementById("sTotal").value = formatCurrency((price * quantity) + shippingCost);
		}
	}
	else	*/
	{
		// new Premium Support - 3/11/09 STC
		document.getElementById("iPremiumSupportSubTotal").value = Number(premiumSupportCost);
		document.getElementById("sPremiumSupportSubTotal").value = "$" + formatCurrency(premiumSupportCost);		
		
		document.getElementById("iRunStartSubTotal").value = Number(runStartCost);				// 6/4/09
		
		document.getElementById("iSubTotal").value = (price * quantity) + Number(premiumSupportCost) + Number(runStartCost);
		document.getElementById("sSubTotal").value = formatCurrency((price * quantity) + Number(premiumSupportCost) + Number(runStartCost));
		if(isSalesForm == true)
		{
			// document.getElementById("stcDebugStr").value = Number(premiumSupportCost);
		
			document.getElementById("iTotal").value = (price * quantity) + Number(premiumSupportCost) + Number(runStartCost) + shippingCost;
			document.getElementById("sTotal").value = formatCurrency((price * quantity) + Number(premiumSupportCost) + Number(runStartCost) + shippingCost);
		}
	}
	
	// add special instructions text to ask what time support should call - 6/11/09
	if (isSalesProductChange == 100)
	{
		trRunStart = document.getElementById("hiddenRunStartRow");
		if (trRunStart) 
		{
			if (trRunStart.style.display == "table-row")			
			{	
				// RunStart showing
				if (isChecked('runstart_checkbox'))			
				{
					// and RunStart is checked
					trSpecialInstructions = document.getElementById("instructions");
					if (trSpecialInstructions)
					{
						trSpecialInstructions.value = "When is the best time to call you for RunStart service?";
					}
				}
			}
		}
	}
	// add special Act RunStart - instructions text to ask what time support should call - 6/24/09
	if (isSalesProductChange == 101)
	{
		trRunStart = document.getElementById("hiddenRunStartRowAct");
		if (trRunStart) 
		{
			if (trRunStart.style.display == "table-row")			
			{	
				// RunStart showing
				if (isChecked('runstart_checkbox_act'))			
				{
					// and RunStart is checked
					trSpecialInstructions = document.getElementById("instructions");
					if (trSpecialInstructions)
					{
						trSpecialInstructions.value = "When is the best time to call you for RunStart service?";
					}
				}
			}
		}
	}
}

// NOT USED 3/16/09 
// Using changeTotalPrice(1) 
//
function fillProductFields()
{
  var product = $F('product');
  var price = 0;
  var quantity = $F('quantity');
  var description = "";
  var shipMethod = $F('shipMethod');
  var shippingCost = 0;
  
  if(quantity <= 0)
    quantity = 1;
  
  if(shipMethod == "None")
    shippingCost = 0;
  else if(shipMethod == "USPSGround")
    shippingCost = 6.95;
  
  switch(product)
  {
    case "CLX20":
	case "CLX30":				// STC 11/5/07
      price = 49.95;
      description = "CompanionLink Express";
      break;
	
    case "CLP20":
	case "CLP30":				// STC 11/5/07
      price = 99.95;
      description = "CompanionLink Professional";
      break;
	  
	case "CLIN":				// STC 7/27/09
      price = 99.95;
      description = "CompanionLink for Infusionsoft";
      break;
	
    case "CLW":					// STC 8/31/09
	  price = 39.95;
	  description = 'CompanionLink for webOS USB';	
	  break;
	  
    case "CLU":					// AWS 12/16/09
	  price = 39.95;
	  description = 'CompanionLink USB';	
	  break;
	  
    case "CLG20":
    case "CLG30":				// STC 11/5/07
      price = 39.95;			// 29.95;  		7/27/09 
      description = "CompanionLink for Google Calendar";
      break;
	  
	case "JCLG20":				// Japanese Google - STC 5/31/07
	case "JCLG30":				// STC 11/5/07
      price = 39.95;			// 29.95;  		7/27/09 
	  description = "CompanionLink for Google Calendar JAPANESE";
      break;
	  
    case "DL20":
    case "DL30":
      price = 99.95;
      description = "DoubleLook";
      break;

	case "DN20":
    case "DN30":
      price = 99.95;
      description = "DoubleNotes";
      break;
	  
    case "O2G-CLG40":
      price = 29.95;
      description = "Upgrade: O2g to CompanionLink for Google";
      break;
    case "CLX13-X20":
      price = 29.95;
      description = "Upgrade: Express 1.3 to Express 2.0";
      break;
    case "CLX20-P20":
      price = 49.95;
      description = "Upgrade: Express 2.0 to Professional 2.0";
      break;
    case "CLX13-P20":
      price = 59.95;
      description = "Upgrade: Express 1.3 to Professional 2.0";
      break;
    case "CLP13-P20":
      price = 49.95;
      description = "Upgrade: Professional 1.3 to Professional 2.0";
      break;
	
	case "CL13-CLP30":				// STC 11/5/07
      price = 59.95;  
	  description = "Upgrade: Any 1.3 to Professional 3.0";
      break;
	
	case "CLX20-P30":				// STC 11/5/07
      price = 49.95;  
	  description = "Upgrade: Express 2.0 to Professional 3.0";
      break;
	
	case "PSP1":					// STC 1/31/09
      price = 99.00;
	  description = "Premium Support (1-user)";
      break;
	  
 	case "PSP5":					// STC 1/31/09
      price = 249.00;
	  description = "Premium Support (5-user)";
      break;

	case "RSTOL":					// STC 6/4/09
	  price = 39.00;				// 29.00;  7/27/09
	  productDescription = "RunStart for Outlook";
	  break;

	case "RSTPD":					// STC 6/4/09
	  price = 39.00;				// 29.00;  7/27/09
	  productDescription = "RunStart for Palm Desktop";
	  break;
	  
	case "RSTACT":					// STC 6/24/09
	  price = 49.00;
	  productDescription = "RunStart for Act!";
	  break;
	  
    case "CLTC20":
      price = 49.95;
      description = "Chaos Sync for Handhelds 2.0";
      break;      
    case "RA":
      price = 49.95;
      description = "ReportAbility";
      break;
    case "AA":
      price = 199.95;
      description = "AdjustAbility";
      break;
    case "SWS":
      price = 54.95;
      description = "Split Wizard (Single User)";
      break;
    case "SWN":
      price = 194.95;
      description = "Split Wizard (Network)";
      break;
    case "RLP":
      price = 99.95;	// $39.95 - pre 6/15/09 
      description = "RegisterLink Pro";
      break;
    case "PB":
      price = 0.00;
      description = "PDO Backup";
      break;
    case "PD":
      price = 29.95;
      description = "PDO Desktop";
      break;
    case "WL":
      price = 29.95;
      description = "WindowsLink";
      break;
  }
  document.getElementById("itemId").value = product;
  document.getElementById("itemPrice").value = price;
  document.getElementById("quantity").value = quantity;
  document.getElementById("itemDesc").value = description;
  document.getElementById("iSubTotal").value = price * quantity;
  document.getElementById("sSubTotal").value = formatCurrency(price * quantity);
  document.getElementById("iTotal").value = (price * quantity) + shippingCost;
  document.getElementById("sTotal").value = formatCurrency((price * quantity) + shippingCost);
  
  return(price);
}

function formatCurrency(num)
{
  num = num.toString().replace(/\$|\,/g,'');
  if(isNaN(num))
    num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10)
    cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
  return (((sign)?'':'-') + num + '.' + cents);
}

// isChecked
// 3/12/09
// Steven Cahill
function isChecked(checkboxId)
{
	var isChecked = 0;
	aCheckbox = document.getElementById(checkboxId);
	
	if (aCheckbox != null)			// if there is no checkbox with the passed in checkboxId, return 0
	{
		var checkbox_val = aCheckbox.value;
		
		if(aCheckbox.checked == true) 
		{
			isChecked = 1;
			aCheckbox.value = 1;			// value is used to store if checked
			// alert("Checkbox with name = " + aCheckbox.name + " and value =" + checkbox_val + " is checked");
		} 
		else 
		{
			isChecked = 0;
			aCheckbox.value = 0;
			// alert("Checkbox with name = " + aCheckbox.name + " and value =" + checkbox_val + " is not checked");
		}
	}
	return(isChecked);
}

// showHideRowSTC
// 6/3/09
// Steven Cahill
//
function showHideRowSTC(elementId)
{
	var pim = $F('pim');
	var tr;
	var iRunStartItemPriceField;
	var runStartPrice = 0.0;
	
	// document.write('      <a href="/products/doublelook-enterprise.html" class="subNav">showHideRunStart</a>')

	tr = document.getElementById("hiddenRunStartRow");			
	if (tr) 
	{

		// Outlook/Palm Desktop RunStart row 
		//
		if ((pim == "OL") || (pim == "PDT"))
		{
			// alert("showHideRunStart SHOW: " + pim + "elementId: " + elementId);			
			
			// http://www.w3schools.com/HTMLDOM/prop_style_display.asp
			tr.style.display = "table-row";
			
			// new Effect.BlindDown(\'runstart\');  does NOT work on table rows1
		}
		else
		{
			// alert("showHideRunStart HIDE: " + pim);	
			
			tr.style.display = "none";
		}
	
		// Act Runstart row - 6/24/09
		//
		tr = document.getElementById("hiddenRunStartRowAct");	
		if (tr) 
		{
			if (pim == "ACT") 
			{
				tr.style.display = "table-row";
			}
			else
			{
				tr.style.display = "none";
			}
		}
	
		changeTotalPrice();			// makes this less general
	}
	else
	{
		alert("showHideRunStart Could not find hiddenRunStartRow");	
	}
}

// checkProductCompatability
// 7/2/10
// Ryan Crosby
//
function checkProductCompatability()
{
	//$F('product')
	//$F('pim')
	//$F('hh')
// 	(stripos('APL BBY', CLLibrary::getPostField('hh')) !== false 		&& stripos('CLX30 CLP30 CLX40 CLP40', CLLibrary::getPostField('product')) === false) ||
// 	(stripos('OL OL14 PDT', CLLibrary::getPostField('pim')) === false 	&& stripos('CLX30 CLP30 CLX40 CLP40', CLLibrary::getPostField('product')) === false)
	
	// alert("Product found at: " + ['APL','BBY'].indexOf($F('hh')));
	
	var message = '';
    
	//"CLP30","CLP40","CLX30","CLX40","CLG30","CLG40","JCLG30","CLW","CLW40","CLIN","CLU","CLU40","DL30","DN30","O2G-CLG40","CL13-CLP30","CLX20-P30","CLG-CLG40"
	//"CLP-CLP40","CLX-CLX40","CLX-CLP40"
	var clgProducts 	= ['CLG40','JCLG40','O2G-CLG40','CLG-CLG40'];
	var cluProducts 	= ['CLU40','CLW40'];
	
	var clxDevices		= ['APL','BBY','WM5'];
	var clxDatabases 	= ['ACT','GM','GW','LN'];
	
	if ( 	cluProducts.indexOf($F('product'))								!= -1 && 	// If product is clu AND
			(		clxDevices.indexOf($F('hh')) 							!= -1 ||	// hh is clx handheld OR
				  	clxDatabases.indexOf($F('pim')) 						!= -1 		// pim is a clx pim
			)
		)																				// Then display compatability message
	{
		message = 'CompanionLink USB will not do this. Please purchase CompanionLink Express.';
	}

	if ( 	clgProducts.indexOf($F('product'))								!= -1 && 	// If product is clu AND
			clxDatabases.indexOf($F('pim')) 								!= -1 		// pim is a clx pim
		)																				// Then display compatability message
	{
		message = 'CompanionLink for Google will not do this. Please purchase CompanionLink Express.';
	}

	// Display the message if needed, and hide/show message
	tr = document.getElementById("hiddenHHCompatabilityRow");
	if ( message == '')
	{
		tr.style.display = "none";
		$('hhCompatabilityMessage').update("");
	}
	else
	{
		$('hhCompatabilityMessage').update(message);
		tr.style.display = "table-row";
	}
	
	//alert("ProductCompatabilityRan!");
}
