//JavaScript Document

<!--- shopping cart administration functions --->
	//general administration variable declarations
	
	//function obtains HTML to show the contents of the current shopping cart
	function displayAddressInfo(urlVars) {
		if(arguments.length==0){
			urlVars = '';
		}
		if(typeof(window.frames["adminBox"].window.displayContent)!='undefined') {
			window.frames["adminBox"].window.displayContent = "";
		}
		window.frames["adminBox"].window.location.href = jsRootPath+"e-Store/Cart/addressAdmin.cfm"+urlVars;
		/*tempWin = window.open(jsRootPath+"e-Store/Cart/addressAdmin.cfm"+urlVars,"tempWindow","width=1,height=1");
		tempWin.blur();*/
		obj = window.frames["adminBox"].window;
		//
		getAddressContents(obj);
	}
	
	//function to delay and check each second whether the display content has loaded
	function getAddressContents(newWindow) {
		if(typeof(newWindow.displayContent)=='undefined') {
			t = setTimeout(function getTheContents() {getAddressContents(newWindow)},1000);
		} else if(newWindow.displayContent=="") {
			t = setTimeout(function getTheContents() {getAddressContents(newWindow)},1000);
		} else {
			clearTimeout(t);
			document.getElementById("accountDisplay").innerHTML = newWindow.displayContent;
			
			if(getBrowserType()=="IE") {
				controlToolbarDetails('close');
				if(newWindow.toolbarDetailsOpen) {
					controlToolbarDetails('account');
				}
			}
			
			//newWindow.close();
			return;
		}						
	}
	
	function retrieveAddressFields(theForm,theFrame,fieldList,addressType) {
		var arrFields = fieldList.split(",");
		if(arguments.length<4) {
			var addressType = '';
		}
		jsDebug = false;
		if(arguments.length>4) {
			jsDebug=arguments[4];
		}
		for(i=0;i<arrFields.length;i++) {
			theField = arrFields[i];
			if(typeof(theFrame.document.forms['addressForm'].elements[addressType+theField])!='undefined') {
				theForm.elements[addressType+theField].value = theFrame.document.forms['addressForm'].elements[addressType+theField].value;
				if(jsDebug==true) {
					alert(addressType+theField+"="+theFrame.document.forms['addressForm'].elements[addressType+theField].value);
				}
			}
		}
		return true;
	}