$(document).ready(function(){


	$("#headerSearch").submit(function() {
		var searchWord = $("input#name").val();
			if (searchWord.length < 3) {
				alert('You must enter at least 3 characters to do a search.');
				return false;
				}				
	});
	
	$("#homePageSearch").submit(function() {
		var searchWord = $("input#name2s").val();
			if (searchWord.length < 3) {
				alert('You must enter at least 3 characters to do a search.');
				return false;
				}				
	});
	
	$("#HeadSearch").submit(function() {
		var searchWord = $("input#namerx").val();
			if (searchWord.length < 3) {
				alert('You must enter at least 3 characters to do a search.');
				return false;
				}				
	});

	$(".tipShipping img").jHelperTip({
		 trigger: "hover",
		 source: "ajax",
		 topOff: 10,
		 leftOff: 20,
		 type: "GET", 
		 url: 'includes/tips.cfm',
		 data: 'tip=shipping2',
		 loadingImg: '/images/ajax-loader.gif',
		 autoClose: true 
	});
	$(".tipPrescription img").jHelperTip({
		 trigger: "hover",
		 source: "ajax",
		 topOff: 10,
		 leftOff: 20,
		 type: "GET", 
		 url: 'includes/tips.cfm',
		 data: 'tip=prescription',
		 loadingImg: '/images/ajax-loader.gif',
		 autoClose: true 
	});
			  
	$(".tipOTC img").jHelperTip({
		 trigger: "hover",
		 source: "ajax",
		 topOff: 10,
		 leftOff: 20,
		 type: "GET", 
		 url: 'includes/tips.cfm',
		 data: 'tip=otc',
		 loadingImg: '/images/ajax-loader.gif',
		 autoClose: true
	});
			  
});
var showpopop = true;
var pop
function popup(url,p)//opens a winow in pop up with param: p
{
	if(pop!=null && !pop.closed) pop.close()
	pop=window.open(url,"pop",p)
	pop.focus()
}

function logPopup(url, width, height){ 
	var xc = ((screen.availWidth - 10) - width) / 2;
	var yc = ((screen.availHeight- 30) - height) / 2;
	new_window = window.open(url, '', 'toolbar=0,menubar=0,resizable=no,dependent=0,status=0,scrollbars=yes,width=' + width + ',height=' + height + ',left=' + xc + ',top=' + yc);
}

// start onmouseovers
image1 = new Image();
image1.src = "images/new/1_on.jpg";

image2 = new Image();
image2.src = "images/new/2_on.jpg";

image3 = new Image();
image3.src = "images/new/3_on.jpg";

image4 = new Image();
image4.src = "images/new/4_on.jpg";

image5 = new Image();
image5.src = "images/new/5_on.jpg";

image6 = new Image();
image6.src = "images/new/6_on.jpg";

image7 = new Image();
image7.src = "images/new/7_on.jpg";
// end onmouseovers

// start toggle
function toggleDisplay(itemname)
{
var ele=document.getElementById(itemname);
if(ele.style.display=='none')ele.style.display='';
else ele.style.display='none';
}

// auto bump for phone numbers
function phone_focus(current_element, next_element, max_length) {
	var oCurrent = document.getElementById(current_element);
	var oNext = document.getElementById(next_element);
	
	if (!isDefined(oCurrent)) {
		return;
	}
	if (!isDefined(oNext)) {
		return;
	}
	
	var currentLength = oCurrent.value.length;
	
	if (currentLength == max_length) {
		oNext.focus();
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
