  function PopUp(url,wsize,hsize,resize,toolbar)
  {
    window.open(url, 'childwin', 'toolbar='+toolbar+',location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize);
  }

  function WinOpen(url,wsize,hsize,resize)
  {
     window.open(url, 'childwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width='+wsize+',height='+hsize+',resizable='+resize)
  }

  function openWinView(url)
  {
    winview=window.open(url, 'winview', 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=600,height=500,scrollbars=yes');
    winview.focus();
  }

  function changeButton(myImage)
  {

    re=/On\.gif/;

    found=re.exec(myImage.src);

    if  (found == 'On.gif')
    {
      re = /On\.gif/;
      newSrc=myImage.src.replace(re,'Off.gif');
      myImage.src=newSrc;
    }else{
      re = /Off\.gif/;
      newSrc=myImage.src.replace(re,'On.gif');
      myImage.src=newSrc;
    }

  }
  function RUSure()
  {
    if(confirm("Are you sure you want to\nclear the entire form?"))
    {
      document.registration.reset();
    }
    else
    {
      return;
    }
  }
  function printDate()
  {
     var mth=new Array(13);
mth[1]="January";
mth[2]="February";
mth[3]="March";
mth[4]="April";
mth[5]="May";
mth[6]="June";
mth[7]="July";
mth[8]="August";
mth[9]="September";
mth[10]="October";
mth[11]="November";
mth[12]="December";
var time=new Date();
var lmonth=mth[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
    if (year < 2000) {
      year = year + 1900; 
    }
    document.write(lmonth + " " + date + ", " + year);
  }

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		browse_on = newImage("/wrightreports/images/but_browse_on.gif");
		mycontent_on = newImage("/wrightreports/images/but_mycontent_on.gif");		
		myaccount_on = newImage("/wrightreports/images/but_myaccount_on.gif");				
		viewcart_on = newImage("/wrightreports/images/but_viewcart_on.gif");						
		tprofile_on = newImage("/wrightreports/images/t_profile_on.gif");						
		tcomparbus_on = newImage("/wrightreports/images/t_comparbus_on.gif");	
		tsalesanalysis_on = newImage("/wrightreports/images/t_salesanalysis_on.gif");
		tpriceanalysis_on = newImage("/wrightreports/images/t_priceanalysis_on.gif");					
		tearnanalysis_on = newImage("/wrightreports/images/t_earnanalysis_on.gif");							
		preloadFlag = true;
	}
}

var locallink=false;
function setupLinks()
{
    var j=0;

    for (var i=0;i<document.links.length;i++)
    {
        if ((document.links[i].href.substring(0, 32) == 'http://wrightreports.ecnext.com/') ||
            (document.links[i].href.substring(0, 33) == 'https://wrightreports.ecnext.com/') ||
            (document.links[i].href.substring(0,4) != 'http'))
        {
            document.links[i].onclick = function(){ locallink = true };
        }
    }
}

function checkExit()
{
    var cookieval = getCookieSurvey('survey');
    if (cookieval == null)
    {
        if (!locallink)
        {
            var expdate = new Date ();
            expdate.setTime (expdate.getTime() + (10 * 365 *   24 * 60 * 60 * 1000)); // 10 years from now
            setCookieSurvey('survey','1',expdate,' ','wrightreports.ecnext.com','');
            window.open("http://www.surveymonkey.com/s.asp?u=78770830597","","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=500");
        }
    }
}


function setCookieSurvey(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookieVal (offset)
{
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset,   endstr));
}


function getCookieSurvey (name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}


function google_ad_request_done(google_ads)
{
  if (google_ads.length < 1 )
    return;
	
  document.write("<table style=\"font-family: Arial, Helvetica, sans-serif;\" width=\"100%\" cellspacing=0 cellpadding=0>");
  document.write("<tr align=\"left\"><td>");
  if (google_info.feedback_url)
  {
    document.write("<a href=\"" + google_info.feedback_url + "\" class=\"advlink\">Ads by Google</a>");
  }
  else
  {
    document.write("<font style=\"font-size: 9px; font: verdana; color: #000000;\">Ads By Google</font>");
  }
  document.write("</td></tr>");
  
  if (google_ads[0].type == 'text')
  {
    if (google_ads.length == 1)
    {
    	document.write("<tr><td nowrap>" +
	        "<p style='line-height:24px; font-size:16px'><a href=\"" +  google_ads[0].url + "\"><b>" + google_ads[0].line1 + "</b></a>&nbsp;" + google_ads[0].line2 + "&nbsp;" + google_ads[0].line3 + "</p>" +
	        "</td></tr>");
    }
    else
    {
	    for(i = 0; i < google_ads.length; ++i)
	    {
	      document.write("<tr><td nowrap>" +
	        "<p style='line-height:24px'><a href=\"" +  google_ads[i].url + "\"><b>" + google_ads[i].line1 + "</b></a>&nbsp;" + google_ads[i].line2 + "&nbsp;" + google_ads[i].line3 + "</p>" +
	        "</td></tr>");
	    }
    }
    //document.write("<tr><td>&nbsp;</td></tr>");
  }
  document.write ("</table>");
}
