var export_text = "\nThe BullDogPatch free offer will soon expire, don't delay in getting in this special program! \n\nAll you pay is the postage to test out this potent new formula! \n";
var export_link = '{WWW_ROOT}';
var exit=true;

function doExit(){
        if(exit){
                window.location.href = newloc;
                return false;
        }
}
function DontShowWin_upsell(){
        var cc = readCookie('BIGPENIS');
        if(cc){
        } else {
                createCookie('BIGPENIS','BIGPENIS',365);
                goNewWin();
        }
        exit = false;
        return true;
}
var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 45;

var usa_ship = 12.95;

function process_contact(){
	var country = document.contact.contact_country.options[document.contact.contact_country.selectedIndex].value;
	if(country == 1){
		document.getElementById('inside').style.display = '';
		document.getElementById('outside').style.display = 'none';
	} else {
		document.getElementById('inside').style.display = 'none';
		document.getElementById('outside').style.display = '';
	}
	return true;
}
function combo_country_change(my_order_value){
        var country = document.order.order_country.options[document.order.order_country.selectedIndex].value;
	if(country == 1){
		document.getElementById('shipping_us').style.display = '';
		document.getElementById('shipping_non_us').style.display = 'none';
	} else {
		if(country == 2){
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = '';
		} else {
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = 'none';
		}
	}
}
function country_change(my_order_value){
        var country = document.order.order_country.options[document.order.order_country.selectedIndex].value;
	if(country == 1){
		document.getElementById('shipping_us').style.display = '';
		document.getElementById('shipping_non_us').style.display = 'none';
		document.order.order_shipping.selectedIndex = 0;
	} else {
		if(country == 2){
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = '';
		} else {
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = 'none';
		}
		document.order.order_shipping.selectedIndex = 1;
	}
	exchange(my_order_value);
}
function bcountry_change(my_order_value){
        var country = document.order.order_bcountry.options[document.order.order_bcountry.selectedIndex].value;
	if(country == 1){
		document.getElementById('billing_us').style.display = '';
		document.getElementById('billing_non_us').style.display = 'none';
	} else {
		if(country == 2){
			document.getElementById('billing_us').style.display = 'none';
			document.getElementById('billing_non_us').style.display = '';
		} else {
			document.getElementById('billing_us').style.display = 'none';
			document.getElementById('billing_non_us').style.display = 'none';
		}
	}
}
function aff_country_change(){
        var country = document.edit_affiliate.aff_country.options[document.edit_affiliate.aff_country.selectedIndex].value;
	if(country == 1){
		document.getElementById('shipping_us').style.display = '';
		document.getElementById('shipping_non_us').style.display = 'none';
	} else {
		if(country == 2){
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = '';
		} else {
			document.getElementById('shipping_us').style.display = 'none';
			document.getElementById('shipping_non_us').style.display = 'none';
		}
	}
}

function exchange(my_order_value){
        var rate = document.order.order_currency.options[document.order.order_currency.selectedIndex].value;
        var rate_label = document.order.order_currency.options[document.order.order_currency.selectedIndex].text;
        var quantity = document.order.order_quantity.options[document.order.order_quantity.selectedIndex].value;
        var shipping = document.order.order_shipping.options[document.order.order_shipping.selectedIndex].value;
        var shipping_label = document.order.order_shipping.options[document.order.order_shipping.selectedIndex].text;

	if(shipping < 100){
		if(shipping == 1){
					document.order.order_country.selectedIndex = 0;
              		document.getElementById('shipping_us').style.display = '';
	                document.getElementById('shipping_non_us').style.display = 'none';
		} else {
			var country = document.order.order_country.options[document.order.order_country.selectedIndex].value;
			if(country == 1){
				document.order.order_country.selectedIndex = 1;
	       		        document.getElementById('shipping_non_us').style.display = '';
			} else {
				if(country == 2){
		       		        document.getElementById('shipping_non_us').style.display = '';
				} else {
		       		        document.getElementById('shipping_non_us').style.display = 'none';
				}
			}
	                document.getElementById('shipping_us').style.display = 'none';
		}
	} else {
		combo_country_change(my_order_value);
	}

	bcountry_change(my_order_value);

        var order_value = parseFloat(my_order_value*rate);
        var order_value = order_value.toFixed(2);

        element = document.getElementById("order_value");
        element.innerHTML = '<strong>'+order_value+'</strong>';

	var new_shipping = my_shipping[shipping]*rate;
	new_shipping = new_shipping.toFixed(2);

	var brokenstring=shipping_label.split(" "); 
	var new_shipping_label = brokenstring[0]+' '+brokenstring[1]+' '+brokenstring[2]+' ('+new_shipping+' '+rate_label+')';
	var new_shipping_label = brokenstring[0]+' '+brokenstring[1]+' '+brokenstring[2]+' '+brokenstring[3]+' ('+new_shipping+' '+rate_label+')';
	//var new_shipping_label = brokenstring[0]+' ('+new_shipping+' '+rate_label+')';

	document.order.order_shipping.options[document.order.order_shipping.selectedIndex].text = new_shipping_label;

        var order_subtotal = order_value*quantity;

	if(quantity > 1){
		order_subtotal = order_subtotal - discount;
	}
        order_subtotal = order_subtotal.toFixed(2);

        element = document.getElementById("order_subtotal");
        element.innerHTML = '<strong>'+order_subtotal+' '+rate_label+'</strong>';

        element = document.getElementById("order_shipping_l");
	element.innerHTML = '<strong>'+new_shipping_label+'</strong>';

	var order_total = parseFloat(order_subtotal);
	order_total += parseFloat(new_shipping);
	order_total = order_total.toFixed(2);

        element = document.getElementById("order_total");
        element.innerHTML = '<strong>'+order_total+' '+rate_label+'</strong>';

        if(document.order.billing[1].checked){
                document.getElementById('show_billing').style.display = '';
	        var bcountry = document.order.order_bcountry.options[document.order.order_bcountry.selectedIndex].value;

		if(bcountry > 1){
			document.order.order_bstate.selectedIndex = 0;
		}

       	} else {
               	document.getElementById('show_billing').style.display = 'none';
        }
	return true;
}
function popUp(URL) {
	left = (screen.width - 240) / 2;
	topp = (screen.height - 124) / 2;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=240,height=124,left = "+left+",top = "+topp+"');");
}
function process_affiliates(){
        var payment = document.edit_affiliate.aff_payment.options[document.edit_affiliate.aff_payment.selectedIndex].value;
	if(payment == 'paypal'){
		document.getElementById('paypal').style.display = '';
		document.getElementById('check').style.display = 'none';
	} else {
		document.getElementById('paypal').style.display = 'none';
		document.getElementById('check').style.display = '';
	}
	aff_country_change();
}
function show_billing(dis){
	document.getElementById('show_billing').style.display = dis;
}

function order(){
	var ship_state_id = document.order_form.order_ship_state.options[document.order_form.order_ship_state.selectedIndex].value;
	var ship_country_id = document.order_form.order_ship_country.options[document.order_form.order_ship_country.selectedIndex].value;
	if(ship_country_id > 1){
		document.order_form.order_ship_state.selectedIndex = 0;
		document.order_form.shipping_id.selectedIndex = 1;
		var ship_state_id = document.order_form.order_ship_state.options[document.order_form.order_ship_state.selectedIndex].value;
	} else {
		document.order_form.shipping_id.selectedIndex = 0;
	}
	if(ship_state_id > 1){
		document.order_form.order_ship_country.selectedIndex = 0;
		document.order_form.shipping_id.selectedIndex = 0;
		var ship_country_id = document.order_form.order_ship_country.options[document.order_form.order_ship_country.selectedIndex].value;
	} else {
		document.order_form.shipping_id.selectedIndex = 1;
	}
	var bill_state_id = document.order_form.order_bill_state.options[document.order_form.order_bill_state.selectedIndex].value;
	var bill_country_id = document.order_form.order_bill_country.options[document.order_form.order_bill_country.selectedIndex].value;
	if(bill_country_id > 1){
		document.order_form.order_bill_state.selectedIndex = 0;
		var bill_state_id = document.order_form.order_bill_state.options[document.order_form.order_bill_state.selectedIndex].value;
	} 
	if(bill_state_id > 1){
		document.order_form.order_bill_country.selectedIndex = 0;
		var bill_country_id = document.order_form.order_bill_country.options[document.order_form.order_bill_country.selectedIndex].value;
	} 
	var prod_id = document.order_form.product_id.options[document.order_form.product_id.selectedIndex].value;
	document.getElementById('product_price').innerHTML = prices[prod_id] + ' '+currency;
	var shipping_id = document.order_form.shipping_id.options[document.order_form.shipping_id.selectedIndex].value;
	document.getElementById('shipping_fee').innerHTML = shipping[shipping_id] + ' '+currency;
	document.getElementById('shipping_fee').innerHTML = shipping[shipping_id] + ' '+currency;
	var quantity_id = document.order_form.quantity.options[document.order_form.quantity.selectedIndex].value;
	//not ready yet
	switch(prod_id){
		case '1':
			//to be continued
			var subtotal = parseFloat(prices[prod_id]*quantity[quantity_id]);
			break;
		case '2':
			var subtotal = parseFloat(prices[prod_id]*quantity[quantity_id]);
			break;
		case '3':
			var subtotal = parseFloat((prices[1]*quantity[quantity_id])+(1*prices[2]));
			break;
		case '4':
			var subtotal = parseFloat(prices[prod_id]*quantity[quantity_id]);
			break;
		case '5':
			var subtotal = parseFloat((prices[1]*quantity[quantity_id])+(1*prices[4]));
			break;
	}
	var total =  parseFloat((1*subtotal) + (1*shipping[shipping_id]));
	if(subtotal < 100){
		var tval = subtotal+'';
		tval = tval.substring(0,5);
		if(tval.length < 5){
			tval += '0';
		}
	} else {
		var tval = subtotal+'';
		tval = tval.substring(0,6);
		if(tval.length < 6){
			tval += '0';
                }
        }
	subtotal = tval;
	if(total < 100){
		var tval = total+'';
		tval = tval.substring(0,5);
		if(tval.length < 5){
			tval += '0';
		}
	} else {
		var tval = total+'';
		tval = tval.substring(0,6);
		if(tval.length < 6){
			tval += '0';
                }
        }
	total = tval;
	document.getElementById('subtotal').innerHTML = subtotal + ' '+currency;
	document.getElementById('total').innerHTML = total + ' '+currency;
	if(document.order_form.billing[1].checked){
		document.getElementById('show_billing').style.display = '';
	} else {
		document.getElementById('show_billing').style.display = 'none';
	}
}

function disableSubmit(whichButton)
{
    if (document.getElementById)
    {
        // this is the way the standards work
        document.getElementById(whichButton).disabled = true;
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        document.all[whichButton].disabled = true;
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        document.layers[whichButton].disabled = true;
    }
}

function verifyform(frm){
	return true;
}
function RunA1(val){
//	if (!document.getElementById('dewplayer')) {
	if(val == 1){
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="240" height="20" id="dewplayer" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('<param name="movie" value="'+website_url+'flash/dewplayer-multi.swf?mp3='+website_url+'voice.mp3\&autostart=0&amp;showtime=0&amp;bgcolor=FFFFFF" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+website_url+'flash/dewplayer-multi.swf?mp3='+website_url+'voice.mp3&autostart=0&amp;showtime=0&amp;bgcolor=FFFFFF" quality="high" bgcolor="#ffffff" width="240" height="20" name="dewplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		document.write('</object>\n');
	} else {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1" height="1" id="dewplayer" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('<param name="movie" value="'+website_url+'flash/dewplayer-multi.swf?mp3='+website_url+'voice.mp3\&autostart=1&amp;showtime=0&amp;bgcolor=FFFFFF" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+website_url+'flash/dewplayer-multi.swf?mp3='+website_url+'voice.mp3&autostart=1&amp;showtime=0&amp;bgcolor=FFFFFF" quality="high" bgcolor="#ffffff" width="1" height="1" name="dewplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		document.write('</object>\n');
	}
//	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

var right_message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
	if (event.button==2){
	alert(message);
	return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

function no_right(){
	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	}
	else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}

	document.oncontextmenu=new Function("alert(right_message);return false")
}


