

function emto(em, disp) {
document.write('<a href="mai' + 'lto:' + em + '">');
document.write(disp + '</a>');
}
function mk_em(v1, v2, v3) {
return v1 + '@' + v2 + '.' + v3;
}
function revr(s)
{ var len = s.length; var o=''; for(var i=len-1;i>=0;i--) {o += s.substr(i,1);} document.write(o);}
function MM_preloadImages() { //v3.0
var d = document; if (d.images) {
if (!d.MM_p) d.MM_p = new Array();
var i, j = d.MM_p.length, a = MM_preloadImages.arguments; 
for (i = 0; i < a.length; i++)
if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
}
}

function MM_swapImgRestore() { //v3.0
var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

var imagearray;
var captionarray;
var imgindex=-1;
function chg_fadein()
{
imgindex++;

if(imgindex >= imagearray.length) imgindex = 0;


var d = document.getElementById('imgrotate1');
d.src = imagearray[imgindex];
d = document.getElementById('imgcaption');
d.innerHTML = captionarray[imgindex];
$("#imgrotate1").fadeIn("slow");
setTimeout(fadeout, 3000);
}

function fadeout()
{
$("#imgrotate1").fadeOut("slow",chg_fadein);
}

function rotatethem(i1,c1,i2,c2,i3,c3,i4,c4,i5,c5)
{
imagearray = new Array(i1,i2);
captionarray = new Array(c1,c2);
fadeout();
}


function onload1() {
if(window.page_onload)
	page_onload();
/*
MM_preloadImages('images/bcfeatures_r.jpg',
'images/psfeatures_r.jpg',
'images/LogoMyRealFoodsSQ.GIF',
'images/screen_cart_th.PNG',
'images/screen_signup_th.PNG',
'images/screen_calendar_th.PNG',
'images/mrfLogo1.GIF',
'images/cabbage112.JPG',
'images/cows98-112.JPG',
'images/eggspat112.JPG',
'images/picklejar112.JPG',
'images/goat112.JPG'
);
*/
//rotatethem('images/screen_calendar_th.PNG','<< screen shot: Calendar for pickups or deliveries that you customize for your needs.'
// ,'images/screen_cart_th.PNG','<< screen shot: Shopping cart for your customers to place orders.');

}

function check_stateddl()
{
	var ddl = document.getElementById('srchstate1__1');
	if(ddl && ddl.options.length>0 && ddl.selectedIndex > 0)
		return true;
		
	alert('Please select a State before clicking Go');
	return false;
}
// /////
function popup_my(hoveritem,id)//link, hidden div id with title and optional width2 attr
{
	var d = document.getElementById(id);
	if(d)
	{
		var title2 = d.getAttribute('title');
		var html = d.innerHTML;
		var w = d.getAttribute('width2');
		
		ShowPopup_base(hoveritem,html,title2,w);
	}
}
function ShowPopup(hoveritem, title2) //CALENDAR
{
	var lnk;
	if(hoveritem && hoveritem.getAttribute)
	{
		var txt = hoveritem.getAttribute("txt");
		if(!txt)
			txt = "";
		else txt = txt.replace(/\n/g,"<br/>"); //txt.replace(/<br\/>/g,"\n");

		lnk = hoveritem.getAttribute("lnk");
		if(lnk)
			title2 += ' &nbsp;&nbsp;' + lnk;
	}
	

	
	
	txt += '<br/><br/>';
	if(lnk)
		txt += lnk;
	ShowPopup_base(hoveritem,txt, title2);
}
	
function ShowPopup_base(hoveritem,bodyhtm, title2,wid)
{
	title2 += ' &nbsp;&nbsp;[<a href="javascript:HidePopup()">close</a>]';
	var dv = document.getElementById("spanPopupTitle");
	dv.innerHTML = title2;
	dv = document.getElementById("divPopupBody");		
	dv.innerHTML = bodyhtm + ' &nbsp;&nbsp;[<a href="javascript:HidePopup()">close</a>]';
	var hp = document.getElementById("hoverpopup_cal");
	
	if(wid)
	{
		var innertbl = document.getElementById("hoverpopup_tbl");

		innertbl.style.width = wid + 'px';
	}
	// Set popup to visible
	var paren = hoveritem;
	var y_off = 0;
	var x_off = 0;
	for(var i=0; i<20 && paren; i++)
	{
		y_off += paren.offsetTop;
		x_off += paren.offsetLeft;
		//alert(i + " - " + paren.offsetTop);
		paren = paren.offsetParent;
	}
	hp.style.top = (y_off + 18) + "px";
	hp.style.left = (x_off) + "px";

	hp.style.display = "block";
}
function HidePopup()
{
	var hp = document.getElementById("hoverpopup_cal");
	hp.style.display ="none";
}


