function getRandom( max )
{
	var iRandom;
	iRandom = Math.round((Math.random() * max + 0.5));
	return iRandom;
}

function ad_rotator(ad_set, language, alt_text)
{
	//ad_set is a number which corresponds to the client product:
	//	1 = ZoneAlarm
	//	2 = ZoneAlarm Pro
	//	3 = ZoneAlarm Pro - Integrity Desktop or any other Integrity client with MoreInfo functionality enabled
	//	4 = ZoneAlarm Plus
  	//	5 = NEC PCGATE Personal
  	//	6 = CA EZ Firewall
  	//	7 = ZoneAlarm with Antivirus
  	//	8 = ZoneAlarm Internet Security Suite
	//	9 = CA EZ Armor Security Suite
	//	10 = Zone Labs Security Scanner

	//language is the language of the client product:
	//	en = English
	//	es = Spanish
	//	de = German
	//	fr = French
	//	jp = Japanese

	if (ad_set == 3) //No ads for Integrity clients
	{
		return;
	}

	if (ad_set == 5) //No ads for NEC
	{
		return;
	}

	if ((ad_set == 6) || (ad_set == 9)) //No ads for CA
	{
		return;
	}

	if (ad_set == 10) //No ads for Security Scanner
	{
		return;
	}

	if (language == "jp" || language == "es") //No ads for Japanese clients or Spanish clients
	{
		return;
	}

	var ads_per_product = 4;		//Change this to accomodate varying banner ad count per product
						//(same for all products);
						//set to -1 to disable ads

	var product_ad = getRandom(ads_per_product);			//Which ad within the set to display

	var ad	  = ((ad_set - 1) * ads_per_product) + product_ad;	
		// 1-4 ZA
		// 5-8 ZAP
		// 9-12 ZAPID
		// 13-16 ZAPlus
		// 17-20 NEC
		// 21-24 CA
		// 25-28 AV
		// 29-32 Suite
		// 33-36 CA Suite
		// 37-40 Zone Labs Security Scanner

	var url = "http://download.zonealarm.com/bin/updates/AlertAdvisor/" + language + "/zlbanners/avrbnr" + ad + ".htm";
	var banner = "http://download.zonealarm.com/bin/updates/AlertAdvisor/" + language + "/zlbanners/avrbnr" + ad + ".gif";
	var width = "116";
	var height = "400";

	// default alt text values
	var alt_en = "Zone Labs AlertAdvisor Offer";
	var alt_es = "Spanish Zone Labs AlertAdvisor Offer";
	var alt_de = "German Zone Labs AlertAdvisor Offer";
	var alt_fr = "French Zone Labs AlertAdvisor Offer";
	var alt_jp = "Japanese Zone Labs AlertAdvisor Offer";

	var alt = alt_en;
	if (language == "es") {alt = alt_es;}
	if (language == "de") {alt = alt_de;}
	if (language == "fr") {alt = alt_fr;}
	if (language == "jp") {alt = alt_jp;}
	if (alt_text != null) {alt = alt_text;}

	document.write('<a href=\"' + url + '\" target=\"_blank\">');
	document.write('<img src=\"' + banner + '\" width=\"')
	document.write(width + '\" height=\"' + height + '\" ');
	document.write('alt=\"' + alt + '\" border="0">');
	document.write('</a><br/>');
}

