//========= =========
// javascript for ads
// file: rotated_top_ad.js
// called from any or all softwareqatest.com pages
// copyright 2009 Digital Media Group Inc.
// NEEDS TO BE FIXED for the XHTML Strict re <table align=center
//=============== ===============
// Setup for anywhere from 1 to 4 ads
MaxAds = 4;

Ad1 = 0;
Ad2 = 1;
Ad3 = 2;
Ad4 = 3;

//============== ===============

var Ad = new Array(MaxAds);
//Note: Ad 'length' now = 4;  Ad[0], Ad[1], etc each with value of NULL

var AdHTMLcode = new Array(MaxAds);


//=============== ===============

// Set up an array for holding lines of HTML code for each ad (up to
// MaxAds # of ads, set above) allowing up to 12 lines of HTML code 
// for each ad, which should be more than enough lines in all cases
var CounterA = 0;
var CounterB = 0;
for(CounterA = 0; CounterA < MaxAds; CounterA++)
{
	Ad[CounterA] = new Array;
  	for (CounterB = 0; CounterB < 12; CounterB++)
  	{
  		Ad[CounterA][CounterB] = "";
  	}
}

// enumerate these values as a reminder of numbering details.
Line1 = 0;
Line2 = 1;
Line3 = 2;
Line4 = 3;
Line5 = 4;
Line6 = 5;
Line7 = 6;
Line8 = 7;
Line9 = 8;
Line10 = 9;
Line11 = 10;
Line12 = 11;

//=============== =============== 
//Setup templates for 4 ads and fill in as needed
//Any lines not specified here are defaulted
//as having a NULL value - set previously 
//NOTE - NEED \ in front of "quote" chars
//===================== ==================

//Some code for allowing an ad to switch between two different versions
//var now = new Date();
//var sec = now.getSeconds();
//var SubAdNum = sec % 2;
var ran_unrounded=Math.random()*2;
var SubAdNum=Math.floor(ran_unrounded);
//the random function returns a random number eg 0.4782 between zero and 1
//to return a # between 0 and 3, use Math.random()*4 etc
//SubAdNum will now = 1 or 0

//pair these up


var styleSettingLine7 = "";
if ((screen.width>=1024) && (screen.height>=768))
{
styleSettingLine7 = "<div style=\"color:white;font-weight:600;text-align: center\">";
}
else
{
styleSettingLine7 =  "<div style=\"font-size:90%;color:white;font-weight:600;text-align: center\">";
}


//=================== start of  [if (SubAdNum)]] =====================
if (SubAdNum == 0)
{
//------- Start Ad1_1 ----------
Ad[Ad1][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad1][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad1][Line3] = '</div>';
Ad[Ad1][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad1][Line5] = '<tr><td>';
Ad[Ad1][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad1][Line7] = styleSettingLine7;
Ad[Ad1][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad1][Line9] = '</div></a></td></tr>';
Ad[Ad1][Line10] = '</table>';
//--------- End Ad1_1 ----------	

//--------- Start Ad1_2 ----------
Ad[Ad2][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad2][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad2][Line3] = '</div>';
Ad[Ad2][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad2][Line5] = '<tr><td>';
Ad[Ad2][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad2][Line7] = styleSettingLine7;
Ad[Ad2][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad2][Line9] = '</div></a></td></tr>';
Ad[Ad2][Line10] = '</table>';
//--------- End Ad1_2 ----------	

//------- Start Ad1_3 ----------
Ad[Ad3][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad3][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad3][Line3] = '</div>';
Ad[Ad3][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad3][Line5] = '<tr><td>';
Ad[Ad3][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad3][Line7] = styleSettingLine7;
Ad[Ad3][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad3][Line9] = '</div></a></td></tr>';
Ad[Ad3][Line10] = '</table>';
//--------- End Ad1_3 ----------	

//------- Start Ad1_4 ----------
Ad[Ad4][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad4][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad4][Line3] = '</div>';
Ad[Ad4][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad4][Line5] = '<tr><td>';
Ad[Ad4][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad4][Line7] = styleSettingLine7;
Ad[Ad4][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad4][Line9] = '</div></a></td></tr>';
Ad[Ad4][Line10] = '</table>';
//--------- End Ad1_4 ----------
	

}
else
{

//------- Start Ad2_1 ----------
Ad[Ad1][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad1][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad1][Line3] = '</div>';
Ad[Ad1][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad1][Line5] = '<tr><td>';
Ad[Ad1][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad1][Line7] = styleSettingLine7;
Ad[Ad1][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad1][Line9] = '</div></a></td></tr>';
Ad[Ad1][Line10] = '</table>';
//--------- End Ad2_1 ----------	

//--------- Start Ad2_2 ----------
Ad[Ad2][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad2][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad2][Line3] = '</div>';
Ad[Ad2][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad2][Line5] = '<tr><td>';
Ad[Ad2][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad2][Line7] = styleSettingLine7;
Ad[Ad2][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad2][Line9] = '</div></a></td></tr>';
Ad[Ad2][Line10] = '</table>';
//----------- End Ad2_2 ----------	

//------- Start Ad2_3 ----------
Ad[Ad3][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad3][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad3][Line3] = '</div>';
Ad[Ad3][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad3][Line5] = '<tr><td>';
Ad[Ad3][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad3][Line7] = styleSettingLine7;
Ad[Ad3][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad3][Line9] = '</div></a></td></tr>';
Ad[Ad3][Line10] = '</table>';
//--------- End Ad2_3 ----------	

//------- Start Ad2_4 ----------
Ad[Ad4][Line1] = '<div style=\"text-align:center; font-size:75%\">';
Ad[Ad4][Line2] = 'sponsored link: www.yourcompany.com';
Ad[Ad4][Line3] = '</div>';
Ad[Ad4][Line4] = '<table align=\"center\" width=75% bgcolor=\"BLACK\"  border=1 cellpadding=1 cellspacing=0>';
Ad[Ad4][Line5] = '<tr><td>';
Ad[Ad4][Line6] = '<a href=\"ad_info.html\">';
Ad[Ad4][Line7] = styleSettingLine7;
Ad[Ad4][Line8] = 'Test Tool/Service: Text for Your Test Tool or Service Ad Here up to 85 chars. total.';
Ad[Ad4][Line9] = '</div></a></td></tr>';
Ad[Ad4][Line10] = '</table>';
//--------- End Ad2_4 ----------


}  //=================== end of [if (SubAdNum)] =====================	



//=============== =============== 

// These next few lines will concatenate the lines 
// for an ad into 1 string, with spaces between each line.
// old browsers mentioned 256 char limit as best; no longer an issue

//?chg this to only join the chosen ad?

CounterA = 0;
for (CounterA = 0; CounterA < MaxAds; CounterA++)
{
	AdHTMLcode[CounterA] = Ad[CounterA].join("");
}


// Set up a random Ad chooser  

var ran_unrounded=Math.random()*4;
var ChosenAdNum=Math.floor(ran_unrounded);
document.write(AdHTMLcode[ChosenAdNum]);


// End of rotated_top_ads.js 
// =============================== ==========================

