

<!--	
// wei's test functions start here

//var isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);


function getDWTproperty(strPropertyName){
	var rtnString = "";
	
	var iStartIndex, iEndIndex, strRemaining;
	strRemaining = "";
	var searchStringBegin = '<!-- InstanceBeginEditable name="'+ strPropertyName + '" -->';
	var searchStringEnd = '<!-- InstanceEndEditable -->';
	var sourceString = document.body.innerHTML;
	
	
	
	iStartIndex = sourceString.indexOf(searchStringBegin);	//looking for searching string
	
	if (iStartIndex > -1) {
		iStartIndex +=  searchStringBegin.length;	//get start position of return string
		strRemaining = sourceString.substring(iStartIndex, sourceString.length);	//get the text between the first found to the end of body tag	
		iEndIndex = strRemaining.indexOf(searchStringEnd);
		rtnString = strRemaining.substring(0, iEndIndex);
	}
	return rtnString;

}

//replace 
function replace(srcString, searchString, replaceString)
{
	rtnString = "";
	arrayOfStrings = srcString.split(searchString);
	for (var i=0; i < arrayOfStrings.length; i++) {      
		rtnString += arrayOfStrings[i] ;  
	if(i<arrayOfStrings.length-1){rtnString += replaceString}
	}
	
	return rtnString;
}

function getDWOptions()	//collect gift options from all selects; assume all selects on this page are for options
{

	var rtnString = "";
	
	var coll = document.all.tags("select");	//get all selects
	if (coll!=null)
	{
	    for (i=0; i<coll.length; i++) {
	    	
	    	m = coll[i].selectedIndex;
	    	if (m > -1) {
			rtnString += escape(coll[i].name) + "=" + escape(coll[i].options[m].text);
		
		}
		if(i<coll.length-1){rtnString += ' - '}
	    }
	      
	}
	rtnString = replace(rtnString, "+" , "%2B");	//replace "+" in option text with its encoded code "%2B"; "+" has to be encoded to be parse by atr.cfm
	return rtnString;

}



function CollectGiftPropertiesDW(storeID)
{
	var giftItemno = "";
	var giftShipWeight= "";
	var giftName = "";
	var giftDescript = "";
	var giftImgSrc = "";
	var giftPrice = "";
	var giftQuantity = "";
	var giftOption = "";
	var sendStr = "";
	
	//send storeid
	sendStr += "storeid" + '=' + storeID;
	
	//peter added 10/31/2006 get gift Item number '<!-- InstanceBeginEditable name="Itemno" --> '
	giftItemno = getDWTproperty("Itemno")
	if (giftItemno!=""){	
	//alert(giftItemno);
		sendStr += "&" + "model" + '=' + giftItemno;
				
	}
	
	//get gift name in '<!-- InstanceBeginEditable name="Name" --> '
	giftName = getDWTproperty("Name")
	if (giftName!=""){	
		sendStr += "&" + "gname" + '=' + giftName;
				
	}

	//get giftPrice in '<!-- InstanceBeginEditable name="Price" -->'
	giftPrice = getDWTproperty("Price")
	if (giftPrice!=""){	
		sendStr += "&" + "price" + '=' + giftPrice;
				
	}
	
	
	
	//get giftShipWeight in '<!-- InstanceBeginEditable name="Weight" -->'
	giftShipWeight = getDWTproperty("Weight");
	if (giftShipWeight!=""){	
	 	
	 	sendStr += "&" + "weight" + '=' + giftShipWeight;
				
	}  
	
	//Quantity is always 1
	sendStr += "&" + "Quantity" + '=' + 1;
	
	//send page URL
	sendStr += "&" + "gdescURL" + '=' + escape(self.location);
	
	//collect gift options
	giftOption = getDWOptions();
	//alert(giftOption);
	if (giftOption !="")
	{
	sendStr += "&" + "ewishp" + '=' + giftOption;	// append Name + Options to make Model Type (EwishP)

	}
	
	//get giftDescript in '<!-- InstanceBeginEditable name="Description" -->'
	giftDescript = getDWTproperty("Description")
	if (giftDescript!=""){	
		sendStr += "&" + "gdesc" + "=" + escape(giftDescript);	
		//alert("giftDescript =" + giftDescript);
		
		if (giftOption !="")	//Also append options into Description so they appear to registrant in pop-up
		{
		sendStr += escape("; ") + giftOption;
		}
		
				
	}
	
	
	//alert(sendStr);
	PopUpOpenDW('http://www.ewish.com/merchants/atr.cfm',"EwishLogon", sendStr);
	
}
//end of function CollectGiftPropertiesMC
	
	
	function PopUpOpenDW(url,winname, queryString){
		winprops = ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1";
		//ATRpopup = window.open(url,name,"height=550,width=380"+winprops);
		ATRpopup = window.open(url+ "?"+queryString,winname,"height=550,width=380"+winprops);
		ATRpopup.focus();
	}



//end of wei's test function


//-->

