function resetValue( value, target)
{
   if (target.value == value)
   {
     target.value = "";
   }
}

function spliter (id,blurb){
	var i;
	var j;
	var k;
	for (i=0;i<document.forms.length;i++)
	{
		for (j=0;j<document.forms[i].length;j++)
		{
			if (document.forms[i].elements[j].name.length>=id.length)
			{
				var tempstr= document.forms[i].elements[j].name.substring(0,id.length)
				if (id==tempstr)
				{
					if(document.forms[i].elements[j].checked)
					{
					location.href="/sections/account/cart.asp?offerproductid=" + id + "&addtofizzorder=1&qty_" + id + "=1&check" + id + "=true&splitpayment=true&catblurb=" + blurb
					}
					else
					{
					location.href="/sections/account/cart.asp?addtoorder=1&offerproductid=" + id 
					}
				}

			}
			
		}
	}
}

function spliter2 (id,blurb,offline){
	var i;
	var j;
	var k;
	var found;
	found=false;
	iloop:
	for (i=0;i<document.forms.length;i++)
	{
		jloop:
		for (j=0;j<document.forms[i].length;j++)
		{
			if (document.forms[i].elements[j].name.length>=id.length)
			{
				var tempstr= document.forms[i].elements[j].name.substring(0,id.length)
				if (id==tempstr)
				{
					if(document.forms[i].elements[j].checked)
					{
						if (offline)
							{
								location.href="/sections/account/cart.asp?offerproductid=" + id + "&offline=1&split_payment=1&catblurb=" + blurb
								found=true;
								break jloop;
								
							}
						else
							{
								location.href="/sections/account/cart.asp?offerproductid=" + id + "&offline=0&split_payment=1&catblurb=" + blurb
								found=true;
								break jloop;
							}
					}
					else
					{
						if (offline)
							{
								location.href="/sections/account/cart.asp?offline=1&offerproductid=" + id 
								found=true;
								break jloop;
							}
						else
							{
								location.href="/sections/account/cart.asp?offline=0&offerproductid=" + id 
								found=true;
								break jloop;
							}
					}
				}

			}
			
		}
		if (found)
		{
			break iloop;
		}
	}
}

function spliter3 (id,blurb,offline,minicart){
	var i;
	var j;
	var k;
	var found;
	found=false;
	var mincarttext="";

	if (minicart)
	{
		mincarttext = "addtoordernoshowcart=1&"
	}
	
	iloop:
	for (i=0;i<document.forms.length;i++)
	{
		jloop:
		for (j=0;j<document.forms[i].length;j++)
		{
			if (document.forms[i].elements[j].name.length>=id.length)
			{
				var tempstr= document.forms[i].elements[j].name.substring(0,id.length)
				if (id==tempstr)
				{
					if(document.forms[i].elements[j].checked)
					{
						if (offline)
							{
								location.href="/sections/account/cart.asp?"+mincarttext+"offerproductid=" + id + "&offline=1&split_payment=1&catblurb=" + blurb
								found=true;
								break jloop;
								
							}
						else
							{
								location.href="/sections/account/cart.asp?"+mincarttext+"offerproductid=" + id + "&offline=0&split_payment=1&catblurb=" + blurb
								found=true;
								break jloop;
							}
					}
					else
					{
						if (offline)
							{
								location.href="/sections/account/cart.asp?"+mincarttext+"offline=1&offerproductid=" + id + "&catblurb=" + blurb
								found=true;
								break jloop;
							}
						else
							{
								location.href="/sections/account/cart.asp?"+mincarttext+"offline=0&offerproductid=" + id + "&catblurb=" + blurb
								found=true;
								break jloop;
							}
					}
				}

			}
			
		}
		if (found)
		{
			break iloop;
		}
	}
}


  //context menus would be better implemented as a behavior.  that work is under way.

  //this menu can not be seen if it is clipped by a frame or a window.  there is a beta2 task to enable display:popup.

  function showMenu() {
     //this function will position and display a nested div that acts like a menu
     whichDiv=event.srcElement;
     menu1.style.posLeft=event.clientX+document.body.scrollLeft;
     menu1.style.posTop=event.clientY+document.body.scrollTop;
     menu1.style.display="";
     menu1.setCapture();
  }

  function toggleMenu() {   
     //as the mouse moves over the menuItems, highlight them
     el=event.srcElement;
     if (el.className=="menuItem") {
        el.className="highlightItem";
     } else if (el.className=="highlightItem") {
        el.className="menuItem";
     }
  }

  function clickMenu() {
     //when the custom menu is visible (and capturing events),
     //this handler runs after a click event.  if one of the
     //menu items is clicked, it takes appropriate action.  
     //otherwise, it just hides the menu.
     menu1.style.display="none";
     el=event.srcElement;
     if (el.id=="mnuCart") {
	 	this.location.href="/sections/account/cart.asp"
     } else if (el.id=="mnuHelp") {
 	 	this.location.href="/sections/help/index.asp"
     }
     menu1.releaseCapture();
  }

  function contextTwice() {
     //this handles the case in div#5 when you might right-click, and then you ctrl-right-click in the same div.
     if (event.srcElement==whichDiv)
       showMenu();
  }

function open_win(url)
	{if (navigator.appName == "Netscape")
			{
			var siteseal_win = window.open(url, "win", "toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=645,height=540");
			siteseal_win.focus();
			}
		if (navigator.appName == "Microsoft Internet Explorer")
			{
			var siteseal_win = window.open(url, "win", "toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=645,height=540");
			}}

function carddemo(start)
{var thiswindow,posx,posy,posl,post,page;
if (start==1)
{page = "demoGeneral.html"}
else if (start==2)
{page = "demoCart.html"}
else if (start==3)
{page = "demoMyaccount.html"}
else{page = "DemoGeneral.html"}
posl = (screen.width/2) - (690/2);
post = (screen.height/2) - (550/2);
posx = (screen.width/2) - (690/2);
posy = (screen.height/2) - (550/2);
thiswindow= window.open(page,"Demonstration","scrollbars=no,resizable=yes,width=690,height=550,screenX=" + posx + ",screenY=" + posy + ",left=" + posl + ",top=" + post);
thiswindow.focus();}

