//<%--
//********************************************************************
//*-------------------------------------------------------------------
//* Licensed Materials - Property of IBM
//*
//* WebSphere Commerce
//*
//* (c) Copyright IBM Corp.  2007
//* All Rights Reserved
//*
//* US Government Users Restricted Rights - Use, duplication or
//* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//*
//*-------------------------------------------------------------------
//*
//--%>

	dojo.registerModulePath("wc", "wc");
	
	dojo.require("dojo.io.*");
	
	//product quick view with tooltip widget
	dojo.require("wc.widget.ProductQuickView");
	dojo.require("wc.widget.BaseContent");
	dojo.require("wc.widget.ToolTipContent");

	//category menu support
	dojo.require("dojo.widget.Button");
	dojo.require("dojo.widget.Menu2");
		
	//reload widgets when parts of the page has been re-loaded from server
	dojo.require("dojo.xml.Parse");
	
	//publish and subscribe event support
	dojo.require("dojo.event.*");
	
	dojo.require("wc.widget.ScrollablePane");
	dojo.require("dojo.animation.*");
	dojo.require("dojo.lfx.*");
	dojo.require("dojo.string.extras");
	dojo.require("dojo.collections.ArrayList");

	dojo.require("dojo.widget.TabContainer");
	dojo.require("dojo.widget.ContentPane");
	dojo.require("dojo.widget.Button");
	dojo.require("dojo.widget.Tree");
	dojo.require("dojo.widget.TreeSelector");

	dojo.require("dojo.undo.browser");

	dojo.require("wc.widget.RefreshArea");
	dojo.require("wc.render.RefreshController");
	dojo.require("wc.render.Context");
	dojo.require("dojo.widget.Tooltip");
	
Common={
	//All the global variables declarations will be here
	errorMessages: {},
	errorList:[],
	nextError:[],
	emailMask: /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i,
	
	
	//summary: This is a collection of commonly used functions
	containsDoubleByte:function(target) {
		// summary:Checks whether a string contains a double byte character
		// target = the string to be checked
		//
		// Return true if target contains a double byte char; false otherwise
		 var str = new String(target);
		 var oneByteMax = 0x007F;

		 for (var i=0; i < str.length; i++){
			chr = str.charCodeAt(i);
			if (chr > oneByteMax) {return true;}
		 }
		 return false;
	},
	
	isValidEmail:function(strEmail){
		//summary: A simple function to validate an email address
		// It does not allow double byte characters
		// strEmail = the email address string to be validated
		//
		// Return true if the email address is valid; false otherwise

		if (this.containsDoubleByte(strEmail)){
			return false;
		}
		
		if (this.emailMask.test(strEmail))
			return true;
		else 
			return false;
	},
	
	getCurrentYear: function(){
		//summary: returns the current year. 
		return new Date().getFullYear();
	}, 
	
	getCurrentMonth: function(){
		//summary: returns the current month. January is 1, and Decement is 12. 
		return new Date().getMonth()+1;	
	}, 
	
	getCurrentDay: function(){
		//summary: returns the current day of the current month, starting from 1. 
		return new Date().getDate();
	}, 
	
	getRenderContextProperty : function(/*wc.render.Context*/context, /*String*/propertyName){
		//summary: retrieves the value of the property from a render context
		//description: This function retrieves the value of the property whose name is propertName
		//	from the given context. 
		//returns: null if the context is null. undefined if the property is not found. 
		//	otherwise, the value of the property int he given context. 
		dojo.debug("enter getRenderContextProperty with propertyName = "+propertyName);
		if(context == null){
			dojo.debug("context is null. Return null...");
			return null;
		}
		
		var result = context.properties[propertyName]
		dojo.debug("the found property value is: "+result);
		
		return result;	
	}, 
	
	loadAddressContentFromURL: function(/*String*/contentURL, /*String*/areaID, /*String*/method, /*Object?*/params){
		//summary: loads the response from invoking a given URL to the area that has the given ID. 
		//description: This function invokes the given contentURL, and then updates the area whose ID is 
		//	the given areaID with the response content. 
		//contentURL: the URL used to get new content
		//areaID: the ID of the area that will be updated. The area can be anything that supports
		//	innerHTML, such as table, and div. 
		//method: The HTTP method used for invoking the given URL. The default is GET.
		//params: Optional parameters used when invoking URL
		var contentArea = document.getElementById(areaID);
		if(!contentArea){
			return;	
		}
		
		dojo.io.bind({
			url: contentURL,
			method: method?method:'GET',
			load: function(type, data, evt){
				contentArea.innerHTML = data;
				cursor_clear();	
			},
			mimetype: "text/html", 
			params: params
		});
		cursor_wait();
	}, 
	
	loadAddressContentFromForm: function(form, areaID, params){
		//summary: loads the response from submitting a given form to the area that has the given ID. 
		//description: This function submits a given form, and then updates the area whose ID is 
		//	the given areaID with the response content. 
		//form: the form that is to be submitted
		//areaID: the ID of the area that will be updated. The area can be anything that supports
		//	innerHTML, such as table, and div. 
		var contentArea = document.getElementById(areaID);
		if(!contentArea){
			return;	
		}
		
		dojo.io.bind({
			formNode: form, 
			load: function(type, data, evt){
				contentArea.innerHTML = data;
				cursor_clear();	
			},
			mimetype: "text/html", 
			params: params
		});
		cursor_wait();
	}, 
	
	
	getErrorFields: function(serviceResponse){
		if(!serviceResponse){
			return [];	
		}
		
		var result = serviceResponse.errorMessageParam;
		if(dojo.lang.isArrayLike(result)){
			return result;	
		}else{
			return [result];	
		}
	}, 
	
	reportServiceError: function(/*String*/formName, /*JSONObject*/serviceResponse){
		dojo.require("dojo.html.*");
		dojo.lang.forEach(Common.getErrorFields(serviceResponse), function(field){
			var input = document.forms[formName].elements[field];
			input.style.border="thick double red ";
			input.focus();
			input.value="Please enter this field";
		});	
	},	
	
	setErrorMessage:function(key, msg) {
	///////////////////////////////////////////////////////////////////
	// summary: This function is used to initialize the error messages object 
	//	with all the required error messages.
	// Description: Setup a JS object with any key/value.
	// key: The key used to access this error message.
	// msg: The error message in the correct language.
	//////////////////////////////////////////////////////////////////
		this.errorMessages[key] = msg;
	},
	
	formErrorHandle:function(serviceResponse,formName,parentDivName){
			
	///////////////////////////////////////////////////////////////////
	// summary: This function will show the an error message tooltip
	//    around the input field with the problem.
	// Description: The function assumes the "serviceResponse" is the
	//    JSON object from a WebSphere Commerce exception. The error 
	//    field is in the serviceResponse.errorMessageParam and the
	//    error message is in the serviceResponse.errorMessage.
	// serviceResponse: The JSON object with the error data.
	// formName: The name of the form where the error field is.
	// parentDivName: The name of the division area that contains the
	//    form with the error field.
	//////////////////////////////////////////////////////////////////	
	 this.formErrorHandleClient(serviceResponse.errorMessageParam, serviceResponse.errorMessage, formName, parentDivName);

  },
  
  formStoreErrorFields:function(errorInputField,errorMessage){
  	var error = new Object();
  	error['inputField'] = errorInputField;
  	error['inputMsg'] = errorMessage;
  	this.errorList.push(error);
  },
  
  formErrorDisplay:function(formName,parentDivName){
  	this.hideErrorNode();
  	var form = document.forms[formName];
  	var parent = document.body;
  	for( var i=0; i< this.errorList.length; i++ ){
  		if (i < 1) {
  			var input = form.elements[this.errorList[i].inputField];
  			var length = form.elements[this.errorList[i].inputField].length;
  			var type = input.type;
  			if ( (type == undefined) && (length > 0) ) {
  				input = form.elements[this.errorList[i].inputField][length-1];
  			}
  			var clientErrorMsg1 = this.errorList[i].inputMsg;
  			var x1 = dojo.html.getAbsoluteX(input, true)+ input.offsetWidth;
			var y1 = dojo.html.getAbsoluteY(input, true)- 7;
			this.setErrorMsg(parent,clientErrorMsg1,x1,y1);
			this.onClickShow(input,parent,clientErrorMsg1,x1,y1);
			this.onChangeHide(input, i);
			this.onFocusShow(input,parent,clientErrorMsg1,x1,y1);
			input.focus();
			input.style.borderColor="#FF0000";
  		}else{
  			var input = form.elements[this.errorList[i].inputField];
  			var length = form.elements[this.errorList[i].inputField].length;
  			var type = input.type;
  			if ( (type == undefined) && (length > 0) ) {
  				input = form.elements[this.errorList[i].inputField][length-1];
  			}
			var next = new Object();
			var clientErrorMsg2 = this.errorList[i].inputMsg;
			var x2 = dojo.html.getAbsoluteX(input, true)+ input.offsetWidth;
			var y2 = dojo.html.getAbsoluteY(input, true)- 7;
			next['parent'] = parent;
			next['errorMsg'] = clientErrorMsg2;
			next['x'] = x2;
			next['y'] = y2;
			this.nextError.push(next);
  			this.onClickShow(input,parent,clientErrorMsg2,x2,y2);
  			this.onFocusShow(input,parent,clientErrorMsg2,x2,y2);
  			this.onChangeHide(input, i);
  			input.style.borderColor="#FF0000";
  		}
  	}
  },

  removeFormErrorDisplay:function(formName,parentDivName){
  	this.hideErrorNode();
  	var form = document.forms[formName];
  	var parent = document.body;
  	this.resetBorder(formName);
  	for( var i=0; i< this.errorList.length; i++ ){
  		var input = form.elements[this.errorList[i].inputField];
  		var length = form.elements[this.errorList[i].inputField].length;
  		var type = input.type;
  		if ( (type == undefined) && (length > 0) ) {
  			input = form.elements[this.errorList[i].inputField][length-1];
  		}
		input.onclick = '';
		input.onfocus = '';
		input.onkeypress = '';
  	}
  	
  	this.errorList = new Array();
	this.nextError = new Array();
  },
  
  onClickShow:function(pv_oInput,pv_oParent,pv_sClientErrorMsg2,pv_nX,pv_nY) {
    pv_oInput.onclick = function() {
    	Common.hideErrorNode();
    	Common.setErrorMsg(pv_oParent,pv_sClientErrorMsg2,pv_nX,pv_nY);
    };   
  },
  
  onFocusShow:function(pv_oInput,pv_oParent,pv_sClientErrorMsg2,pv_nX,pv_nY) {
    pv_oInput.onfocus = function() {
    	Common.hideErrorNode();
    	Common.setErrorMsg(pv_oParent,pv_sClientErrorMsg2,pv_nX,pv_nY);
    };   
  },
  
  onChangeHide:function(pv_oInput, pv_nNextError) {
  	pv_oInput.onkeypress = function() { if(pv_oInput.value.length < 1) { Common.hideErrorNode(); Common.showNextErrorField(pv_nNextError); }};
  },
  
  showNextErrorField:function(pv_nNextError) {
  	if (this.nextError[pv_nNextError]) {
  		var X = this.nextError[pv_nNextError].x;
  		var Y = this.nextError[pv_nNextError].y;
  		var parent = this.nextError[pv_nNextError].parent;
  		var errorMsg = this.nextError[pv_nNextError].errorMsg;
  		Common.setErrorMsg(parent,errorMsg,X,Y);
  	}
  },
  
  resetBorder:function(formName) {
  	var form = document.forms[formName];
  	for( var i=0; i< this.errorList.length; i++ ){
  		var input = form.elements[this.errorList[i].inputField];
  		var length = form.elements[this.errorList[i].inputField].length;
  		var type = input.type;
  		if ( (type == undefined) && (length > 0) ) {
  			input = form.elements[this.errorList[i].inputField][length-1];
  		}
  		input.style.borderColor="#333333";
  	}
  },

  formErrorHandleClient:function(errorInputField,errorMessage,formName,parentDivName){
		
		///////////////////////////////////////////////////////////////////
		// summary: This function will show the an error message tooltip
		//    around the input field with the problem.
		// Description: The function takes the error field name and the 
		//    error message to display.
		// errorInputField: The name of the field with error.
		// errorMessage: The error message to display.
		// formName: The name of the form where the error field is.
		// parentDivName: The name of the division area that contains the
		//    form with the error field.
		//////////////////////////////////////////////////////////////////	
		 this.hideErrorNode();	
		 var form = document.forms[formName];
		 var parent = document.body;
		 if (form.elements[errorInputField].length > 0)
		 {
		 	 var lastButton = form.elements[errorInputField].length - 1;
			 var input = form.elements[errorInputField][lastButton];
			 input.focus();
			 input.onclick=(function() {Common.hideErrorNode();});
			 input.onchange=(function() {Common.hideErrorNode();});
			 var x = dojo.html.getAbsoluteX(input, true)+ input.offsetWidth;
			 var y = dojo.html.getAbsoluteY(input, true)- 7;
			 this.setErrorMsg(parent,errorMessage,x,y);
		 }
		 else if(form.elements[errorInputField]){
			 var input = form.elements[errorInputField];
			  input.style.backgroundColor = "red";
			 input.focus();
			 input.onclick=(function() {Common.hideErrorNode(); input.style.backgroundColor = "";});
			 input.onchange=(function() {Common.hideErrorNode();});
			 var x = dojo.html.getAbsoluteX(input, true)+ input.offsetWidth;
			 var y = dojo.html.getAbsoluteY(input, true)- 7;
			 this.setErrorMsg(parent,errorMessage,x,y);
		 }else{
			 Common.hideErrorNode();
			 alert(errorMessage);
		 }
	},
	
	formErrorHandleEmailClient:function(errorInputField,errorMessage,formName,parentDivName){
		
		///////////////////////////////////////////////////////////////////
		// summary: This function will show the an error message tooltip
		//    around the input field with the problem.
		// Description: The function takes the error field name and the 
		//    error message to display.
		// errorInputField: The name of the field with error.
		// errorMessage: The error message to display.
		// formName: The name of the form where the error field is.
		// parentDivName: The name of the division area that contains the
		//    form with the error field.
		//////////////////////////////////////////////////////////////////	
		 this.hideEmailErrorNode();	
		 var form = document.forms[formName];
		 var parent = document.body;
		 if (form.elements[errorInputField].length > 0)
		 {
		 	 var lastButton = form.elements[errorInputField].length - 1;
			 var input = form.elements[errorInputField][lastButton];
			 //input.focus();
			 input.value = "";
			 //input.onclick=(function() {Common.hideEmailErrorNode();});
			 input.onchange=(function() {Common.hideEmailErrorNode();});
			 var x = dojo.html.getAbsoluteX(input, true) + input.offsetWidth - 50;
			 var y = dojo.html.getAbsoluteY(input, true) - 100;
			 this.setEmailErrorMsg(parent,errorMessage,x,y);
		 }
		 else if(form.elements[errorInputField]){
			 var input = form.elements[errorInputField];
			 //input.style.backgroundColor = "red";
			 //input.focus();
			 input.value = "";
			 //input.onclick=(function() {Common.hideEmailErrorNode(); input.style.backgroundColor = "";});
			 input.onchange=(function() {Common.hideEmailErrorNode();});
			 var x = dojo.html.getAbsoluteX(input, true) + input.offsetWidth - 50;
			 var y = dojo.html.getAbsoluteY(input, true) - 100;
			 this.setEmailErrorMsg(parent,errorMessage,x,y);
		 }else{
			 Common.hideEmailErrorNode();
			 alert(errorMessage);
		 }
	},
	
  setEmailErrorMsg:function(parentNode,content,x,y){
	///////////////////////////////////////////////////////////////////
	// summary: This function will set the Error Message and position for the "errorNode".
	// Description: This function will takes "parentNode" , "content" and positions x,y  
	// as input arguments, and set those to "errorNode" 
	// if "errorNode" is not created,then it will call "createErrorNode" 
	// method first before setting message and position.
	//////////////////////////////////////////////////////////////////	

	 if(document.getElementById('foundEmail')) var errorNode = document.getElementById('foundEmail');
	 else var errorNode = this.createEmailErrorNode(parentNode);

	 errorNode.innerHTML = content;
	  
	 errorNode.style.left = x +"px";
	 errorNode.style.top = y + "px";
	 //errorNode.style.padding = "35px 25px";
	 errorNode.style.position = "absolute";
	 //errorNode.style.background-color = "rgb(199, 188, 157)";
	 //errorNode.style.zIndex = "445";
 	document.LogonForm.logonPassword.focus(); 
  },

  setErrorMsg:function(parentNode,content,x,y){
	
	///////////////////////////////////////////////////////////////////
	// summary: This function will set the Error Message and position for the "errorNode".
	// Description: This function will takes "parentNode" , "content" and positions x,y  
	// as input arguments, and set those to "errorNode" 
	// if "errorNode" is not created,then it will call "createErrorNode" 
	// method first before setting message and position.
	//////////////////////////////////////////////////////////////////	

	 if(document.getElementById('bubble')) var errorNode = document.getElementById('bubble');
	 else var errorNode = this.createErrorNode(parentNode);
	 
	 var msg=document.getElementById('error_content');
	 msg.innerHTML = content;
	  
	 errorNode.style.left = x +"px";
	 errorNode.style.top = y + "px";
	 errorNode.style.zIndex = "10000"; 
  },
   
  createErrorNode:function(parentNode){
	
	///////////////////////////////////////////////////////////////////
	// summary: This function will create new "errorNode".
	// Description: This function will take "parentNode" as input arguments,  
	// it will create new "errorNode" and appends that to "parentNode", then
	// it will return that "errorNode".
	//////////////////////////////////////////////////////////////////	
	 
	 var errorNode = parentNode.appendChild(document.createElement("div"));
	 errorNode.id="bubble";
	 var leftEnd = errorNode.appendChild(document.createElement("div"));
	 leftEnd.className="lefttail";
	 var content = errorNode.appendChild(document.createElement("div"));
	 content.className="error_content";
	 content.id="error_content";
	 var rightEnd = errorNode.appendChild(document.createElement("div"));
	 rightEnd.className="rightend";
	 
	 return errorNode;
  },
  
  createEmailErrorNode:function(parentNode){
	
	///////////////////////////////////////////////////////////////////
	// summary: This function will create new "errorNode".
	// Description: This function will take "parentNode" as input arguments,  
	// it will create new "errorNode" and appends that to "parentNode", then
	// it will return that "errorNode".
	//////////////////////////////////////////////////////////////////	
	 
	 var errorNode = parentNode.appendChild(document.createElement("div"));
	 errorNode.id="foundEmail";
	 	 
	 return errorNode;
  },
  
  hideErrorNode:function(){
	///////////////////////////////////////////////////////////////////
	// summary: This function will remove the "errorNode".
	// Description: This function will remove the "errorNode" if its there,  
	//////////////////////////////////////////////////////////////////	
	if(document.getElementById('bubble'))
		dojo.dom.removeNode(document.getElementById('bubble'));

  },	
  
  hideEmailErrorNode:function(){
	///////////////////////////////////////////////////////////////////
	// summary: This function will remove the "errorNode".
	// Description: This function will remove the "errorNode" if its there,  
	//////////////////////////////////////////////////////////////////	
	if(document.getElementById('foundEmail'))
		dojo.dom.removeNode(document.getElementById('foundEmail'));

  },

	isValidUTF8length: function(UTF16String, maxlength) {
	//////////////////////////////////////////////////////////
	// summary: This function will check if the number of bytes of the string
	// is within the maxlength specified.
	// Description: Check if the number of bytes is within the maxlength specified.
	//
	// UTF16String: the UTF-16 string
	// maxlength: the maximum number of bytes allowed in your input field
	//
	// Return false is this input string is larger then arg2
	// Otherwise return true...
	//////////////////////////////////////////////////////////
	    if (this.utf8StringByteLength(UTF16String) > maxlength) return false;
	    else return true;
	},
	
	utf8StringByteLength: function(UTF16String) {
	//////////////////////////////////////////////////////////
	// summary: This function will count the number of bytes
	// represented in a UTF-8 string
	// Description: Check if the number of bytes is within the maxlength specified.
	//
	// UTF16String: the UTF-16 string you want a byte count of...
	// Return the integer number of bytes represented in a UTF-8 string
	//////////////////////////////////////////////////////////
	  if (UTF16String === null) return 0;
	  var str = String(UTF16String);
	  var oneByteMax = 0x007F;
	  var twoByteMax = 0x07FF;
	  var byteSize = str.length;
	
	  for (i = 0; i < str.length; i++) {
	    chr = str.charCodeAt(i);
	    if (chr > oneByteMax) byteSize = byteSize + 1;
	    if (chr > twoByteMax) byteSize = byteSize + 1;
	  }  
	  return byteSize;
	},
	
   goBack:function(){
	
	// summary: this function belong to HistoryTracking for receiving Back notifications
	// description: this function belong to HistoryTracking for receiving Back notifications	
	
		document.getElementById(this.elementId).innerHTML = this.content;
		
        },
        
        goForward:function(){
       
	// summary: this function belong to HistoryTracking for receiving forward notifications
	// description:this function belong to HistoryTracking for receiving forward notifications	
	
        	document.getElementById(this.elementId).innerHTML = this.content;
        	
        },
		
	
	HistoryTracker:function(content, elementId, changeUrl){
	
	// summary: History state object for history tracking
	// description:History state object for history tracking
	// content: String
	//		the html to be displayed
	// elementId: String
	//		the name of the DOM object
	// changeUrl: String
	//		the identifier for the current state of this page
	
		this.content = content;
		this.elementId = elementId;
		//TODO: commenting this out breaks FF 1.5. Others? Can't seem to find iframe id/name?
		this.changeUrl =  changeUrl;
		
		
	}
} 
	Common.HistoryTracker.prototype.back = Common.goBack;
	Common.HistoryTracker.prototype.forward=Common.goForward;
	
var showdropcart = true;
var timerCart;
var timeCartOutAt;
var timerCartRunning;
var menuCart = ['div-cart'];
timeCartOutAt = parseInt(1000);
timeToStart = parseInt(500);
timerCartRunning = false;
var showdropwish = true;
var timerWish;
var timeWishOutAt;
var timerWishRunning;
var menuWish = ['div-wish'];
timeWishOutAt = parseInt(1000);
timerWishRunning = false;

function initCart(thisdiv) {
	timer = setTimeout("show_cart('"+thisdiv+"')",timeToStart);
	timerCartRunning = true;
}

function initWish(thisdiv) {
	timer = setTimeout("show_wish('"+thisdiv+"')",timeToStart);
	timerWishRunning = true;
}
	
//Cart Functions
function show_cart(thisdiv) {
    //var cart_plus = document.getElementById("div-cart");
    //var cart_plus = document.getElementById("cart_plus");
    //set the current div open, others to close
	for( var i=0; i<menuCart.length; i++ ){
 		 if(menuCart[i] == thisdiv)
 		 {
			dojo.html.setVisibility(menuCart[i],true);
 		 	//cart_plus.src = "/wcsstore/Moosejaw/images/redminus.gif";
        	showdropcart = false;   
 		 } 
 		 else
 		 {
 		 	dojo.html.setVisibility(menuCart[i],false);
 		 	//cart_plus.src = "/wcsstore/Moosejaw/images/redcross.jpg";
        	showdropcart = true;
 		 }
	}
}

function kill_cart()
{
	//var cart_plus = document.getElementById("cart_plus");
	dojo.html.setVisibility("div-cart",false);
	//cart_plus.src = "/wcsstore/Moosejaw/images/redcross.jpg";
}

function startCartTimer() {
 timer = setTimeout("quietCartSubmit()",timeOutAt);
 timerCartRunning = true;
}

function killCartTimer(){
 if (timerCartRunning)
 	clearTimeout(timer);
 timerCartRunning = false;
}
function quietCartSubmit() {
	//var cart_plus = document.getElementById("cart_plus");
	if (timerCartRunning)
	{
		//close all divs
		for( var i=0; i<menuCart.length; i++ ){
	 		 	dojo.html.setVisibility(menuCart[i],false);
	 		 	//cart_plus.src = "/wcsstore/Moosejaw/images/redcross.jpg";
		}
	}
}

//Wish List Functions
function show_wish(thisdiv) {
	//alert("thisdiv:: " + thisdiv);
    //var wish_div = document.getElementById("div-wish");
    //var wish_plus = document.getElementById("wish_plus");
    //set the current div open, others to close
	for( var i=0; i<menuWish.length; i++ ){
 		 if(menuWish[i] == thisdiv)
 		 {
			dojo.html.setVisibility(menuWish[i],true);
 		 	//wish_plus.src = "/wcsstore/Moosejaw/images/greyminus.gif";
        	showdropwish = false;   
 		 } 
 		 else
 		 {
 		 	dojo.html.setVisibility(menuWish[i],false);
 		 	//wish_plus.src = "/wcsstore/Moosejaw/images/graycross.jpg";
        	showdropwish = true;
 		 }
	}
}

function kill_wish()
{
	//var wish_plus = document.getElementById("wish_plus");
	dojo.html.setVisibility("div-wish",false);
	//wish_plus.src = "/wcsstore/Moosejaw/images/graycross.jpg";
}

function startWishTimer() {
 timer = setTimeout("quietWishSubmit()",timeOutAt);
 timerWishRunning = true;
}

function killWishTimer(){
 if (timerWishRunning)
 	clearTimeout(timer);
 timerWishRunning = false;
}
function quietWishSubmit() {
	//var wish_plus = document.getElementById("wish_plus");
	//alert("wish_plus.src:: " + wish_plus.src);
	if (timerWishRunning)
	{
		//close all divs
		for( var i=0; i<menuWish.length; i++ ){
	 		 	dojo.html.setVisibility(menuWish[i],false);
	 		 	//wish_plus.src = "/wcsstore/Moosejaw/images/graycross.jpg";
		}
	}
}	

