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_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_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];}
}

var price = '';
var description = ''
function checkAddons(){
	var gx = 1;
	if(document.getElementById('addon_total').value == "0"){
	var answer = confirm ("You haven't selected any addons. FOR A LIMITED TIME you can save 15% to 20% on your ENTIRE ORDER when you purchase two or more addons! Click OK to continue or CANCEL to select more addons and SAVE MONEY!")
	if (!answer)
	return false;
	}
}
function countTotal2() {
	//If bulk ebook is selected then unselect individual ebook checkboxes
	//if (document.getElementById('bulkebook').checked == true){ 
	//	document.getElementById('ebook1').checked = false;
	//	document.getElementById('ebook2').checked = false;
	//	document.getElementById('ebook3').checked = false;
	//	document.getElementById('ebook4').checked = false;
	//}
	document.getElementById('plimus_pro').value = "1";
	var total = 99;
	if (document.getElementById('base1').checked == true){
		document.getElementById('plimus_pro').value = "0";
		document.getElementById('plimus_standard').value = "1";
		total = 67;
		payment_total = 67;
	}else{
		document.getElementById('plimus_pro').value = "1";
		document.getElementById('plimus_standard').value = "0";
		total = 99;
		payment_total = 99;
	}
	addons = 0;
	ebook_total = 0;
	other_total = 0;
	if (document.getElementById('addon1').checked == true){ addons++; total=total + 99; document.getElementById('plimus_captcha').value = "1"; } else { document.getElementById('plimus_captcha').value = "0"; }
	if (document.getElementById('addon2').checked == true){ addons++; total=total + 99; document.getElementById('plimus_repost').value = "1"; } else { document.getElementById('plimus_repost').value = "0"; }
	if (document.getElementById('addon4').checked == true){ addons++; total=total + 99; document.getElementById('plimus_scheduler').value = "1"; } else { document.getElementById('plimus_scheduler').value = "0"; }
	if (document.getElementById('addon6').checked == true){ addons++; total=total + 99; document.getElementById('plimus_myspace').value = "1"; } else { document.getElementById('plimus_myspace').value = "0"; }
	if (document.getElementById('addon8').checked == true){ addons++; total=total + 99; document.getElementById('plimus_kijiji').value = "1"; } else { document.getElementById('plimus_kijiji').value = "0"; }
	if (document.getElementById('addon7').checked == true){ addons++; total=total + 99; document.getElementById('plimus_yahoo').value = "1"; } else { document.getElementById('plimus_yahoo').value = "0"; }
	if (document.getElementById('addon3').checked == true){ addons++; total=total + 99; document.getElementById('plimus_proxy').value = "1"; } else { document.getElementById('plimus_proxy').value = "0"; }
	if (document.getElementById('addon5').checked == true){ addons++; total=total + 99; document.getElementById('plimus_dialer').value = "1"; } else { document.getElementById('plimus_dialer').value = "0"; }
	//if (document.getElementById('ebook1').checked == true){ ebook_total+= 14; total=total + 14; document.getElementById('plimus_ebook1').value = "1"; } else { document.getElementById('plimus_ebook1').value = "0"; }
	//if (document.getElementById('ebook2').checked == true){ ebook_total+= 24; total=total + 24; document.getElementById('plimus_ebook2').value = "1"; } else { document.getElementById('plimus_ebook2').value = "0"; }
	//if (document.getElementById('ebook3').checked == true){ ebook_total+= 29; total=total + 29; document.getElementById('plimus_ebook3').value = "1"; } else { document.getElementById('plimus_ebook3').value = "0"; }
	//if (document.getElementById('ebook4').checked == true){ ebook_total+= 49; total=total + 49; document.getElementById('plimus_ebook4').value = "1"; } else { document.getElementById('plimus_ebook4').value = "0"; }
	//if (document.getElementById('bulkebook').checked == true){ ebook_total = 89; total=total + 89; document.getElementById('plimus_bulkebooks').value = "1"; } else { document.getElementById('plimus_bulkebooks').value = "0"; }
	if (document.getElementById('other1').checked == true){ other_total = 47; total=total + 47; document.getElementById('plimus_software1').value = "1"; } else { document.getElementById('plimus_software1').value = "0"; }
	if (document.getElementById('other2').checked == true){ other_total = 79; total=total + 79; document.getElementById('plimus_software2').value = "1"; } else { document.getElementById('plimus_software2').value = "0"; }
	if (document.getElementById('jiffy').checked == true){ other_total = other_total+97; total=total + 97; document.getElementById('plimus_jiffycreator').value = "1"; } else { document.getElementById('plimus_jiffycreator').value = "0"; }
	total_price = "Total Price: $" + total;
	if (addons < 2){ payment_total = total; payment_total; document.getElementById('coupon').value = "";document.getElementById('addon_total').value = "0";}
	if (addons == 2){ payment_total = (total - (Math.round((total-ebook_total-other_total)*.15))); total_price += " - 15% Discount($" + Math.round((total-ebook_total-other_total)*.15) +") = $" + payment_total; document.getElementById('coupon').value = "15-45";document.getElementById('addon_total').value = "1";}
	if (addons == 3){ payment_total = (total - (Math.round((total-ebook_total-other_total)*.2))); total_price += " - 20% Discount($" + Math.round((total-ebook_total-other_total)*.2) +") = $" + payment_total; document.getElementById('coupon').value = "20-79";document.getElementById('addon_total').value = "1";}
	if (addons == 4){ payment_total = (total - (Math.round((total-ebook_total-other_total)*.2))); total_price += " - 20% Discount($" + Math.round((total-ebook_total-other_total)*.2) +") = $" + payment_total; document.getElementById('coupon').value = "20-99";document.getElementById('addon_total').value = "1";}
	if (addons >= 5){ payment_total = (total - (Math.round((total-ebook_total-other_total)*.2))); total_price += " - 20% Discount($" + Math.round((total-ebook_total-other_total)*.2) +") = $" + payment_total; document.getElementById('coupon').value = "20-119";document.getElementById('addon_total').value = "1";}
	document.getElementById('total').innerHTML = total_price;
	price = payment_total;
	document.getElementById('p').value = payment_total;
}

function forceBP(){
	//make sure BP addon is checked when clicking BPCaptcha
	if(!document.getElementById('addon9').checked && document.getElementById('addon13').checked == true){
		document.getElementById('addon9').checked = true
	}
}

function downSell(){
	var exitsplashmessage = '***************************************\n\n W A I T ! 	B E F O R E 	Y O U 	G O !\n\n CLICK THE *CANCEL* BUTTON RIGHT NOW\n\n TO GET A HUGE DISCOUNT OF 75% OFF! \n\n---------- PAY ONLY $19 ---------- \n\n THIS DISCOUNT IS ONLY OFFERED ONCE SO TAKE ADVANTAGE NOW!!\n\n***************************************';
			var exitsplashpage = 'https://usd.swreg.org/cgi-bin/s.cgi?s=104998&p=104998-4&q=1&v=0&d=0';
	function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); }}}
	function addClickEvent(a,i,func) { if (typeof a[i].onclick != 'function') { a[i].onclick = func; } }
	var theDiv = '<div id="ExitSplashDiv" onmouseover="javascript:hideexitcancelbuttonimage();StopExitImpactAudio();" style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
	theDiv = theDiv + '<div id="ExitCancelButtonImageDiv" style="background: #ffffff; width: 100%;" align="left"><img src="https://usd.swreg.org/soft_shop/templates/103213/exitbutton.gif" border="0"></div>';
	theDiv = theDiv + '<div onmouseover="this.style.background=\'#FFFFFF\'; document.getElementById(\'exitsplashlink\').style.color=\'#0000FF\'" onmouseout="this.style.background=\'#3399cc\'; document.getElementById(\'exitsplashlink\').style.color=\'#FFFFFF\'" style="padding-top:0px; padding-left:0px; margin-top:0px; margin-left:0px; background:#3399cc; width: 100%; height: 80px; text-align:center;"><span id="exitsplashlink" style="font-family: Arial; font-size: 16px; font-weight: bold; color: rgb(255, 255, 255);"><br/>Take Advantage of the SPECIAL DISCOUNT below!<br>SAVE OVER 75% IF YOU PURCHASE NOW!</span></div>';
	theDiv = theDiv + '<div id="exitsplashimpactaudio"><embed wmode="transparent" src="https://www.plimus.com/developers/318586/player.swf?url=https://www.plimus.com/developers/318586/exit.mp3&mode=play&autostart=true&exit4b0d8664795ff" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></div>';
	theDiv = theDiv + '<iframe src="'+exitsplashpage+'" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
	theDiv = theDiv + '</div>';
	theBody = document.body; if (!theBody) {theBody = document.getElementById("body"); if (!theBody) {theBody = document.getElementsByTagName("body")[0];}}
	var PreventExitSplash = false;
	function DisplayExitSplash() {
		if (PreventExitSplash == false) 
		{
			window.scrollTo(0, 0); PreventExitSplash = true;
			divtag = document.createElement("div");
			divtag.setAttribute("id", "ExitSplashMainOuterLayer");
			divtag.style.position = "absolute"; divtag.style.width = "100%";
			divtag.style.height = "100%"; divtag.style.zIndex = "99";
			divtag.style.left = "0px"; divtag.style.top = "0px";
			divtag.innerHTML = theDiv; theBody.innerHTML = "";
			theBody.topMargin = "0px";
			theBody.rightMargin = "0px";
			theBody.bottomMargin = "0px";
			theBody.leftMargin = "0px";
			theBody.style.overflow = "hidden";
			theBody.appendChild(divtag);
			return exitsplashmessage; 
		} 
	}
	
	var a = document.getElementsByTagName('A');
	for (var i = 0; i < a.length; i++) 
	{
		if (a[i].target !== '_blank') 
		{
			addClickEvent(a, i, function() { PreventExitSplash = true; });
		} else { addClickEvent(a, i, function() { 
		PreventExitSplash = false; }); }
	}
	var aa = document.getElementsByTagName('AREA');
	for (var i = 0; i < aa.length; i++) 
	{
		addClickEvent(aa, i, function() { PreventExitSplash = true; });
	}
	
	disablelinksfunc = function() {
		var a = document.getElementsByTagName('A');
		for (var i = 0; i < a.length; i++) 
		{
			if (a[i].target !== '_blank') 
			{
				addClickEvent(a, i, function() { PreventExitSplash = true; });
			} else 
			{
				addClickEvent(a, i, function() { PreventExitSplash = false; }); 
			} 
		}
	}
	
	hideexitcancelbuttonimage = function(){ document.getElementById('ExitCancelButtonImageDiv').style.display='none'; }
	StopExitImpactAudio = function(){ var esDiv = document.getElementById('ExitSplashDiv'); var esiaDiv = document.getElementById('exitsplashimpactaudio'); esDiv.removeChild(esiaDiv); }
	addLoadEvent(disablelinksfunc);

	var f = document.getElementsByTagName('input'); 
		for (var i=0;i<f.length;i++){ 
			if (f[i].type == "image"){ 
				f[i].onclick=function(){ PreventExitSplash=true; }
						alert(f[i]);
			}
		}

	disableformsfunc = function(){ var f = document.getElementsByTagName('FORM'); for (var i=0;i<f.length;i++){ if (!f[i].onclick){ f[i].onclick=function(){ PreventExitSplash=true; } }else if (!f[i].onsubmit){ f[i].onsubmit=function(){ PreventExitSplash=true; }}}}
	addLoadEvent(disableformsfunc);
	window.onbeforeunload = DisplayExitSplash;
}
