function make_picture(str, folder)
{
	return (folder + '/' + str + '.jpg');	
}

function make_link(str)
{
	var temp = null;
	
	if (str.indexOf("c_") != -1)
		{
			temp = str.substr(2);
			temp = 'view_category.asp?cat=' + temp;
		}
	if (str.indexOf("p_") != -1)
		{
			temp = str.substr(2);
			temp = 'product.asp?itemid=' + temp;
		}
	
	return (temp);	
}





function Sad()
{
	///////////////////////AREA 2 //////////////////////
  var t_ad=new Array()
  //random images below.
  t_ad[1]="c_47"
  t_ad[2]="c_58"
  t_ad[3]="c_78"
  t_ad[4]="c_79"
  t_ad[5]="c_88"
  t_ad[6]="p_109"
  t_ad[7]="p_114"
  t_ad[8]="p_178"
  t_ad[9]="p_186"
  

	var i = 0
	var ry = 0
	for (ry = 0, i = 0; i < 3; i++)
	{
		ry = Math.floor(Math.random()*t_ad.length)
		if (ry == 0) ry = 1
		if (t_ad[ry] == null)
		{
			i--
			continue
		}
	//	if (i == 3) ry = 2; //5% OFF ALWAYS SHOWING.
		alt = "Light duty cable protectors and heavy duty cord covers for the home, office, job-site";
		document.write('<a href='+'"' + make_link(t_ad[ry]) + '"'+'><img src="/assets/templates/layout8/images/ads/'+make_picture(t_ad[ry], 'area2')+'" border="0" alt="'+alt+'"></a><br>');
		t_ad[ry] = null;
	}
	
	//5% OFF
document.write('<a href="infopage.asp?page=41&extra=1"><img src="/assets/templates/layout8/images/ads/area2/e_41.jpg" border="0" alt="5% Off on the website"></a><br>');

}

function ad()
{
	///////// AREA 1 /////////////
	
  var t_ad=new Array()
  //random images below.
  t_ad[1]="c_48"
  t_ad[2]="c_71"
  t_ad[3]="c_72"
  t_ad[4]="c_68"
  t_ad[5]="p_17"
  t_ad[6]="p_135"


	var i = 0
	var ry = 0
	for (ry = 0, i = 0; i < 2; i++)
	{
		ry = Math.floor(Math.random()*t_ad.length)
		if (ry == 0) ry = 1
		if (t_ad[ry] == null)
		{
			i--
			continue
		}	
		alt = "Light duty cable protectors and heavy duty cord covers for the home, office, job-site";
		document.write('<a href='+'"'+make_link(t_ad[ry])+'"'+'><img src="/assets/templates/layout8/images/ads/'+make_picture(t_ad[ry], 'area1')+'" border="0" alt="'+alt+'"></a>')
		t_ad[ry] = null;
	}

}
