var UPGRADE_JS = 3;function updateextralistings( isonsubmit )	{	if ( document.renewform.M_is_loggedin.value ==1)		{		var extratot = parseFloat(document.renewform.M_extralistings.selectedIndex*20);		if ( document.renewform.M_extralistings.selectedIndex == 0 )			{			if ( isonsubmit )				{				alert('Please select how many extra listings you wish to purchase');				}			document.renewform.amount.value=0;			return false;			}		else			{			document.renewform.amount.value=makeprice(extratot);			document.renewform.desc.value = document.renewform.M_extralistings.options[ document.renewform.M_extralistings.selectedIndex ].text + " extra bold listings";			return true;			}		}	}function updatetotal() 	{	if ( document.renewform.M_is_loggedin.value ==1)		{		var discountpc= 0;		var discount = 0;		var extratot = 0;		var subtot =0;		var grandtotal =0;		var prodperiod = "";				var extra_listings_price = 0; 				var payment_method = 'worldpay';		var secondstep_required = false;				for (var i=0; i<document.renewform.payment_method.length; i++)			{			if ( document.renewform.payment_method[i].checked )				{				payment_method = document.renewform.payment_method[i].value;				}			}		for (var i=0; i<document.renewform.M_prodprice.length; i++)			{			if ( document.renewform.M_prodprice[i].checked )				{				subtot = parseFloat(document.renewform.M_prodprice[i].value);				}			}		if ( subtot >= 7 && subtot <= 10 )			{			prodperiod = "7 days";			//secondstep_required = true;			}		//else if ( subtot == 9  )		//	{		//	prodperiod = "7 days";		//	secondstep_required = true;		//	}		else if ( subtot >= 11 && subtot <= 15 )			{			prodperiod = "14 days";			//secondstep_required = true;			}		//else if ( subtot == 15  )		//	{		//	prodperiod = "14 days";		//	secondstep_required = true;		//	}		else if ( subtot >= 18 && subtot <= 26)			{			prodperiod = "28 days";			extra_listings_price = 11;			//secondstep_required = true;			if ( subtot == 22 )				{				// london so upselling photo ad				// secondstep_required = true;				}			}		else if ( subtot == 29 )			{			prodperiod = "3 months";			extra_listings_price = 14;			}		else if ( subtot == 32 )			{			prodperiod = "Unlimited time UNTIL LET";			secondstep_required = true;			}		else if ( subtot >= 39 && subtot < 59)			{			prodperiod = "6 months";			extra_listings_price = 19;			}		else if ( subtot >= 59 )			{			prodperiod = "1 year";			extra_listings_price = 29;			}					if ( document.renewform.proupgrade.value ==1)			{			if ( prodperiod == "7 days" || prodperiod == "14 days" )				{//only available for 28day + options				if ( document.renewform.M_extralistings.selectedIndex!=0 )					{					alert("Extra listings only available for the 28 day, 6 mth and 1 year options");					document.renewform.M_extralistings.selectedIndex=0;					}				document.renewform.M_extralistings.disabled=true;				}			else				{				document.renewform.M_extralistings.disabled=false;				}			// is pro upgrade form so look for extra listings too!			extratot = parseFloat( document.renewform.M_extralistings.options[ document.renewform.M_extralistings.selectedIndex ].text * extra_listings_price);			//alert( document.renewform.M_extralistings.selectedIndex );			//alert( document.renewform.M_extralistings.selectedIndex*15);			document.renewform.extralistingscost.value = extratot;			}		subtot = subtot+extratot;		// discount		discountpc = document.renewform.M_discount.value;		grandtotal = subtot;		if ( discountpc )			{			discount = discountpc/100;			grandtotal = subtot-(subtot*discount);			}		var refundamount = document.renewform.M_refund.value;		if ( refundamount )			{			grandtotal = grandtotal - refundamount;			}		document.renewform.amount.value=makeprice(grandtotal);		document.renewform.desc.value = document.renewform.base_desc.value + " for "+ prodperiod;		if ( document.renewform.proupgrade.value ==1)			{			if ( document.renewform.M_extralistings.selectedIndex!=0 )				{				document.renewform.desc.value += " plus "+document.renewform.M_extralistings.options[ document.renewform.M_extralistings.selectedIndex ].text +" extra listings";				}			}				// payment method and form action		if ( secondstep_required )			{			document.renewform.action='/flatshare/get_upgrade_step2.pl';			}		else			{			if ( payment_method == "paypal" )				{				document.renewform.action='/flatshare/paypal.pl';				}			else				{				document.renewform.action='https://secure.worldpay.com/wcc/purchase';				}			}		}	}
