
function update (theform) {
	if (check_form(theform))
		theform.submit();
}

function screen_changed (object) {
	object.value = "yes";
}

function goto_page(theform,page) {
	theform.current_page.value = page;
	theform.submit();
}

function row_changed (theform,row) {
	theform.elements['row_changed_'+row].value = "yes";
}

function submit_form (target) {
	document.forms[0].action = target
	document.forms[0].target = "_self"
	document.forms[0].submit()
}

function order_by (theform,sortorder) {
	theform.sortorder.value = sortorder
	theform.submit()
}

function confirm_delete (delete_message) {
	return confirm(delete_message);
}

function round_decimal (number, precision) {
	var value,i

	value = Math.round (number * Math.pow(10,precision))
	value = ""+value

	len = value.length
	if (len <= precision) {
		for (i=0; i<precision-len; i++)
			value = "0"+value
		value = "0." + value
	} else
		value = value.substring(0,len-precision)+"."+value.substring(len-precision,len)

	return value
}

function check_date (input_date) {
	var day_of_month = new Array(12);
	day_of_month[0] = 31;
	day_of_month[1]=28;
	day_of_month[2]=31;
	day_of_month[3]=30;
	day_of_month[4]=31;
	day_of_month[5]=30;
	day_of_month[6]=31;
	day_of_month[7]=31;
	day_of_month[8]=30;
	day_of_month[9]=31;
	day_of_month[10]=30;
	day_of_month[11]=31;
	var i = 0;
	var j,month,message,day,year;
	var result = input_date;

	i = input_date.indexOf('/',i);

	if (i>=0) {

		month = input_date.substring(0,i);
		j = i+1;
		if (parseInt(month,10) <= 0 || parseInt(month,10) >12) {
			alert(invalid_date);
			return false;
		}
	} else {
		alert(invalid_date);
		return false;
	}
	i = input_date.indexOf('/',j);
	if (i>=0) {
		day = input_date.substring(j,i);
		k = i + 1;
		year = input_date.substring(k,input_date.length);
		if (parseInt(year,10) < 0) {
			alert(invalid_date);
			return false;
		}
		if ((parseInt(year,10) % 4) == 0) {
			day_of_month[1]=29;
		} else
			day_of_month[1]=28;
		if (parseInt(day,10) <=0 || parseInt(day,10) > day_of_month[month-1]) {
			alert(invalid_date);
			return false;
		}
	} else {
		alert(invalid_date);
		return false;
	}
	return true;
}

function select_cal (obj) {
	selected_cal = obj.id;
}

function select_date (day,month,year) {
	if (selected_cal == "cal_start") 
		document.forms[0].start_date.value = month+"/"+day+"/"+year;
	else
		document.forms[0].end_date.value = month+"/"+day+"/"+year;
	toggle_calendar (selected_cal);
}

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_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_findObj(n, d) { //v3.0
  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); 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];}
}

function copyValue (f) {
	var string = editorctl.DocumentHTML;
	if (arguments.length > 1)
	{
		string = string.replace (/\'/g,"&#039");
		string = string.replace (/\r\n/g, "");
	}
	f.elements.description.value = string;
	return true;
}

function add_product (theform,item,product_id) {
	total_product = parseInt (theform.total_product.value,10);
	for (i=0; i<total_product; i++) {
		if (theform.elements['qty_'+i].value != "") {
			quantity = parseFloat (theform.elements['qty_'+i].value,10)
			if (isNaN(quantity) || quantity <= 0) {
				alert (invalid_quantity);
				return false;
			}
		}
	}

	theform.submit();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/* addedd*/

/***********************************************

* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit http://www.dynamicdrive.com/ for full source code

***********************************************/

//Contents for menu 1

var menu1=new Array()

menu1[0]='<a href="http://www.wildwoodnh.com/page.aboutus">OUR STORY</a>'
menu1[1]='<a href="http://www.wildwoodnh.com/mission_values.html">MISSION & VALUES</a>'
menu1[2]='<a href="http://www.wildwoodnh.com/testimonials.html">TESTIMONIALS</a>'
menu1[3]='<a href="http://www.wildwoodnh.com/affiliates.html">AFFILIATES</a>'

//Contents for menu 2

var menu2=new Array()




//Contents for menu 3

var menu3=new Array()

menu3[0]='<a href="http://www.wildwoodnh.com/gift_baskets.html">CUSTOM GIFT BASKETS</a>'
menu3[1]='<a href="http://www.wildwoodnh.com/nh_made_specialties.html">NH MADE SPECIALTIES</a>'
menu3[2]='<a href="http://www.wildwoodnh.com/business_gifts.html">BUSINESS GIFTS</a>'
menu3[3]='<a href="http://www.wildwoodnh.com/everlasting_florals.html">EVERLASTING FLORALS</a>'
menu3[4]='<a href="http://www.wildwoodnh.com/favors_centrepieces.html">FAVORS & CENTERPIECES</a>'
menu3[5]='<a href="http://www.wildwoodnh.com/custom_imprinted_ribbon.html">CUSTOM IMPRINTED RIBBON</a>'
menu3[6]='<a href="http://www.wildwoodnh.com/decorative_product_packaging.html">DECORATIVE PRODUCT PACKAGING</a>'

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)

var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all

var ns6=document.getElementById&&!document.all

if (ie4||ns6)

document.write('<div id="dropmenudiv" style="visibility:hidden;width: 170px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){

var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;

var parentEl=what.offsetParent;

while (parentEl!=null){

totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;

parentEl=parentEl.offsetParent;

}

return totaloffset;

}

function showhide(obj, e, visible, hidden, menuwidth){

if (ie4||ns6)

dropmenuobj.style.left=dropmenuobj.style.top=-500

dropmenuobj.widthobj=dropmenuobj.style

dropmenuobj.widthobj.width=menuwidth

if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")

obj.visibility=visible

else if (e.type=="click")

obj.visibility=hidden

}

function iecompattest(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body

}

function clearbrowseredge(obj, whichedge){

var edgeoffset=0

if (whichedge=="rightedge"){

var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15

dropmenuobj.contentmeasure=dropmenuobj.offsetWidth

if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)

edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth

}

else{

var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset

var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18

dropmenuobj.contentmeasure=dropmenuobj.offsetHeight

if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?

edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight

if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)

edgeoffset=dropmenuobj.y

}

}

return edgeoffset

}

function populatemenu(what){

if (ie4||ns6)

dropmenuobj.innerHTML=what.join("")

}

function dropdownmenu(obj, e, menucontents, menuwidth){

if (window.event) event.cancelBubble=true

else if (e.stopPropagation) e.stopPropagation()

clearhidemenu()

dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv

populatemenu(menucontents)

if (ie4||ns6){

showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")

dropmenuobj.y=getposOffset(obj, "top")

dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"

dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"

}

return clickreturnvalue()

}

function clickreturnvalue(){

if (ie4||ns6) return false

else return true

}

function contains_ns6(a, b) {

while (b.parentNode)

if ((b = b.parentNode) == a)

return true;

return false;

}

function dynamichide(e){

if (ie4&&!dropmenuobj.contains(e.toElement))

delayhidemenu()

else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))

delayhidemenu()

}

function hidemenu(e){

if (typeof dropmenuobj!="undefined"){

if (ie4||ns6)

dropmenuobj.style.visibility="hidden"

}

}

function delayhidemenu(){

if (ie4||ns6)

delayhide=setTimeout("hidemenu()",disappeardelay)

}

function clearhidemenu(){

if (typeof delayhide!="undefined")

clearTimeout(delayhide)

}

/*
CSS Browser Selector v0.2.9
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera\s(\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('chrome')?'chrome webkit safari':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();
