// BBBonline window popper
function Certify(URL) {
  popupWin = window.open(URL, 'Participant', 'location,scrollbars,width=450,height=300')
  window.top.name = 'opener';
}

// contact us popup window
function contactPop(url) {
quizWin=window.open(url, "", "toolbar=yes,directories=no,status=no,location=0,resizable=no,scrollbars=yes,menubar=no,width=880,height=595,screenY=25,screenX=25,top=25,left=25")  
}

// copyright popup window
function copyPop(url) {
quizWin=window.open(url, "", "toolbar=no,directories=no,status=no,location=0,resizable=no,scrollbars=no,menubar=no,width=460,height=220,screenY=25,screenX=25,top=25,left=25")  
}

// custom popup window
function customPop(url, iwidth, iheight) {
quizWin=window.open(url, "", "toolbar=yes,directories=no,status=no,location=0,resizable=no,scrollbars=yes,menubar=no,width=" + (iwidth+40) + ",height=" + (iheight+40) + ",screenY=25,screenX=25,top=25,left=25")  
}

// strip (01.23.2003)
// strips single quotes from page titles

function strip (ToStrip) {
	var QuoteChar = "'";
	var StrippedString = "";
	for (loop = 0; loop < ToStrip.length; loop++)
	{
	if (ToStrip.charAt(loop) != QuoteChar.charAt(0)) 
		StrippedString += ToStrip.charAt(loop);
	else
		StrippedString += "`";
	}
	return StrippedString;
}
// grab query string to be used for cookie
function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}

}
//cookie code starts here
QueryString_Parse();

var bikky = document.cookie;

function getCookiehms(name) { // use: getCookie("name");
  var index = bikky.indexOf(name + "=");
  if (index == -1) return null;
  index = bikky.indexOf("=", index) + 1;
  var endstr = bikky.indexOf(";", index);
  if (endstr == -1) endstr = bikky.length;
  return unescape(bikky.substring(index, endstr));
}

var today = new Date();
var expiry = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); // plus 365 days

function setCookiehms(name, value) { // use: setCookie("name", value);
  if (value != null && value != "")
    document.cookie=name + "=" + escape(value) + "; path=/;  expires=" + expiry.toGMTString();
  bikky= document.cookie; // update bikky
}  

function subCookie() {
 // in every newsletter linked page
if (QueryString("subscriber") !== "") {
	setCookiehms("subscriber",QueryString("subscriber"));
}	
 if (QueryString("subscribe") !== "") {
	setCookiehms("subscriber",QueryString("subscribe"));	
	//alert("subscriber =" + QueryString("subscriber"));
	//alert("subscribe =" + QueryString("subscribe"));
}
 //on popular exit or entry pages (onLOAD)
if ((getCookiehms("subscriber") !== "1")  || (getCookiehms("subscriber")) == "null"){
	window.open('/sub_pop.htm','win1','width=450,height=320,scrollbars=no,resizable=no,toolbar=no,screenY=25,screenX=25,top=25,left=25'); };
}

//cookie code ends here

// date function
function getDate() {
var Today=new Date();
var ThisDay=Today.getDay();
var ThisDate=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();  //included if you wish to insert the year
var DayName=DayTxt(ThisDay);
var MonthName=MonthTxt(ThisMonth);
return DayName + " " + MonthName + " " + ThisDay + ", " + ThisYear;
}

function DayTxt (DayNumber) {
var Day=new Array();
Day[0]="Sunday";
Day[1]="Monday";
Day[2]="Tuesday";
Day[3]="Wednesday";
Day[4]="Thursday";
Day[5]="Friday";
Day[6]="Saturday";
return Day[DayNumber];
}

function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}

//used by simple_solutions.js, this_issye.js and special_offers.js
function Random(nMin, nMax) {
	// Returns a random number between nMin and nMax
	var iRand;
	iRand = Math.floor(Math.random()*(nMax-nMin+1))+nMin;
	return iRand
}

function getRandom(nCount, nMin, nMax, nUnique) {
	// Returns an array (with length nCount) of random numbers between nMin and nMax.
	// If nUnique is 1, then only unique random numbers are returned.
	// If nUnique is 0, then the same random number can be returned more than once.
	if ( ((nMax-nMin) < (nCount-1)) && nUnique==1) {
		alert("You are requesting more unique values than possible");
		return 0;
	}
	var ay = new Array(nCount);
	var n, j;
	var nFound;
	for (q=0;q<nCount;q++){
		n=Random(nMin, nMax);
		if (nUnique==1){
			nFound=1;
			while (nFound==1) {
				nFound=0;
				n=Random(nMin, nMax);
				for (j=0;j<nCount;j++){
					if (ay[j] == n){
						nFound=1;
					}
				}
			}
		}
		ay[q]=n;
	}
	return ay;
}

// preloade global top navigation
   //Content deleted on 13May08 - Purush

/***********************************************
* Pausing updown message scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//configure the below five variables to change the style of the scroller
var scrollerdelay='6000' //delay between msg scrolls. 3000=3 seconds.
var scrollerwidth='430px'
var scrollerheight='30px'
var scrollerbgcolor='FFFFFF'
//set below to '' if you don't wish to use a background image
var scrollerbackground=''

//configure the below variable to change the contents of the scroller
var messages=new Array()  // (4) Below here
messages[0]="<span class='food4thoughtprod'>The dishwasher was invented by Josephine Cochrane more than 100 years ago. Why? She was tired of servants chipping her china.</span>"
messages[1]="<span class='food4thoughtprod'>The first automatic dishwashers became popular during the post-World War II housing boom, thanks to an outstanding economy and improved technology.</span>"
messages[2]="<span class='food4thoughtprod'>Before Cascade Complete, more than two-thirds of Americans rinsed their dishes clean before putting them into the dishwasher.</span>"
messages[3]="<span class='food4thoughtprod'>A combination dishwasher/clothes-washer was made in 1945, and a combination dishwasher/range was made in 1953. Neither idea caught on.</span>"
messages[4]="<span class='food4thoughtprod'>Dishwashers were originally seen as a &quot;luxury.&quot;</span>"
messages[5]="<span class='food4thoughtprod'>At one point, there were more than 13,000 knives, forks, and spoons in the White House.</span>"
messages[6]="<span class='food4thoughtprod'>Some Americans have used their dishwashers to clean baby toys, baseball hats, shoes, hairbrushes, yard tools, automobile parts, and even money!</span>"
messages[7]="<span class='food4thoughtprod'>On average, you can wash a load of dishes in your dishwasher for less than the cost of a postage stamp.</span>"
messages[8]="<span class='food4thoughtprod'>It takes between 6 and 10 gallons of water to run your dishwasher, compared to the 9 to 24 gallons you would consume washing them by hand.</span>"
messages[9]="<span class='food4thoughtprod'>According to food science experts, eggs are among the toughest foods to clean from dishes.</span>"
messages[10]="<span class='food4thoughtprod'>The human nose can identify 3,000 scents.</span>"
messages[11]="<span class='food4thoughtprod'>Cascade 2in1 ActionPacs<span class='svmk'>TM</span> disintegrate in your dishwasher within 10 seconds of being released from your dishwasher's dispenser.</span>"
messages[12]="<span class='food4thoughtprod'>The &quot;scratches&quot; that appear on most glassware are actually bunches of tiny dents that are 1/50th the width of a human hair.</span>"
messages[13]="<span class='food4thoughtprod'>Light will reflect off a shiny plate and to your eyes at 186,300 miles per second.</span>"
;
///////Do not edit pass this line///////////////////////

var ie=document.all
var dom=document.getElementById

if (messages.length>2)
i=2
else
i=0

function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",scrollerdelay)
setTimeout("move2(document.main.document.second)",scrollerdelay)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(messages[i])
tlayer.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",scrollerdelay)
setTimeout("move1(document.main.document.first)",scrollerdelay)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(messages[i])
tlayer2.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}
 function move3(whichdiv){
//tdiv=eval(whichdiv)
//if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
//tdiv.style.top=0+"px"
//setTimeout("move3(tdiv)",scrollerdelay)
//setTimeout("move4(second2_obj)",scrollerdelay)
//return
//}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=parseInt(scrollerheight)
tdiv.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",scrollerdelay)
setTimeout("move3(first2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)
tdiv2.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}

function startscroll(){
if (ie||dom){
//first2_obj=ie? first2 : document.getElementById("first2")
//second2_obj=ie? second2 : document.getElementById("second2")
//move3(first2_obj)
//second2_obj.style.top=scrollerheight
//second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}


/*********************************************************************
   srchSubmitMain()
   Submit search form available from all pages
**********************************************************************/
function srchSubmit(form) {
 
  var query=form.q.value;

  query=replaceAll(query,"#","");

  form.q.value=query;
  return true;
}

/*********************************************************************
   replaceAll
   Replaces a substring with in a string with a new string
**********************************************************************/
function replaceAll (string, oldstr, newstr)
{ var st = string;
  if (oldstr.length == 0)
     return st;
  var idx = st.indexOf(oldstr);
  while (idx >= 0)
  {  st = st.substring(0,idx) + newstr + st.substr(idx+oldstr.length);
     idx = st.indexOf(oldstr);
  }
  return st;
}