/*
@@@BUILDINFO@@@ st20MiscDlgs.jsx 466 16-March-2007
*/

/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2005 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/

if( ( stockphoto.timeKeeperOn != undefined )&&( stockphoto.timeKeeperOn ) )
{
	stockphoto.timeKeeper.st20MiscDlgs        = {};
	stockphoto.timeKeeper.st20MiscDlgs.StTime = new Date();
}

stockphoto.MiscDlgs        ={};
stockphoto.MiscDlgs.bRet   =0;
stockphoto.MiscDlgs.bNormalExit = false;
stockphoto.MiscDlgs.RefCnt =0;
stockphoto.MiscDlgs.CntCd  =-1;
stockphoto.MiscDlgs.dType  =0;
stockphoto.MiscDlgs.zc     =new stockphoto.zstringCache("st20MiscDlgs");
stockphoto.MiscDlgs.zc.dict="st20MiscDlgs.txt";

stockphoto.MiscDlgs.NoSearchCnvTable=
{
	BGCOLOR     : "#C5D7D9",
	BGCOLOR3    : "#afbebf",
	WIDTHSTR    : "508",
	HEIGHTSTR   : "360",
	TABLE_WIDTH : "362",
	TABLE_HEIGHT: "10",
	BLONG_WD    : "150",
	BMID_WD     : "94",
	BSMALL_WD   : "60",
	LINE_HEIGHT : "20px",
	SLINE_HEIGHT: "12px"
};
stockphoto.MiscDlgs.NewNoSearchCnvTable=
{
	FONTSIZE13  : "13px",
	FONTSIZE11  : "11px",
	FONTCOL1    : "#9A8F34",
	FONTCOL2    : "#000000",
	FONTCOL3    : "#000000",
	FONTCOL4    : "#027ABB",
	URLPHD      : "http://cs2-stockphotos.adobe.com/get_more_images"
};
stockphoto.MiscDlgs.BillingCountryCnvTable=
{
	BGCOLOR     : "#C5D7D9",
	BGCOLOR3    : "#AFBEBF",
	WIDTHSTR    : "508",
	HEIGHTSTR   : "364",
	TABLE_WIDTH : "362",
	TABLE_HEIGHT: "10",
	LINE_HEIGHT : "20px",
	SLINE_HEIGHT: "12px"
};
stockphoto.MiscDlgs.ProxyAuthCnvTable=
{
	BGCOLOR     : "#C5D7D9",
	BGCOLOR3    : "#AFBEBF",
	WIDTHSTR    : "410",
	HEIGHTSTR   : "300",
	TABLE_WIDTH : "362",
	TABLE_HEIGHT: "10",
	LINE_HEIGHT : "20px",
	SLINE_HEIGHT: "12px"
};
stockphoto.MiscDlgs.MyAccountContext =
{
	url:			undefined,
	thumbnail:		undefined
};

stockphoto.MiscDlgs.LoadLocaleData=function( doc_id )
{
	if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) )
	{
		if( stockphoto.NavExtFnc.GetStyleSheetLocale( doc_id ) != stockphoto.core.getValidLocale() )
		{
			stockphoto.NavExtFnc.CreateStyleSheet( doc_id );
		};
		if( stockphoto.core.util.loadLocaleData( "st20MiscDlgs.par" ) )
		{
			stockphoto.NavExtFnc.SetStyleSheetLocale( doc_id );
		}
	};
}

stockphoto.MiscDlgs.closeDialog=function()
{
	var i, doc_id;
	for( i=0; i<5; i++ )
	{
		if( stockphoto.MiscDlgs.jsCallbacks.dialogOn[i] )
		{
			stockphoto.MiscDlgs.jsCallbacks.dialog[i].closing = true;
			stockphoto.MiscDlgs.jsCallbacks.dialogOn[i] = false;
			doc_id = stockphoto.MiscDlgs.jsCallbacks.dialogId[i];
			app.scheduleTask( "stockphoto.core.util.bringParentToFront("+(doc_id)+");", 200, false );
			stockphoto.MiscDlgs.jsCallbacks.dialogId[i] = 0;
		};
	};
}

stockphoto.MiscDlgs.jsCallbacks=
{
	dialog:    [ { title:"", modal:false, width:508, height:360 }, { title:"", modal:false, width:508, height:360 },
                     { title:"", modal:false, width:508, height:360 }, { title:"", modal:false, width:508, height:360 },
		     { title:"", modal:false, width:300, height:360 } ],
	dialogOn:  [ false, false, false, false, false ],
	dialogId:  [     0,     0,     0,     0,     0 ],
	doClose:   function()
	{
		// if this call is the result of the close widget, just simulate a cancel button
		if (stockphoto.MiscDlgs.bNormalExit == false)
		{
			stockphoto.MiscDlgs.bRet |= 32;
			if( stockphoto.MiscDlgs.dType == 1 )
			{
				stockphoto.DL.MiscDlgs.BillingCountry_Status = 0;
			}
			stockphoto.MiscDlgs.closeDialog();
		}
	},
	willClose: function() { return true ; },
	/*B*/	_burpUrl_omitBurpUrl: function()
	/*B*/	{
	/*B*/		stockphoto.Burp.omitUrl = false;
	/*B*/ 	},
	_cbMisc_CloseDialog: function( cmdString )
	{
		switch( cmdString ) {
			case "dir": stockphoto.MiscDlgs.bRet |= 1;  break;
			case "tip": stockphoto.MiscDlgs.bRet |= 2;  break;
			case "ok":  stockphoto.MiscDlgs.bRet |= 4;  break;
			// first time dialog
			case "hlp":
			{
                stockphoto.MiscDlgs.HelpTopic( stockphoto.core.helpTopicBase );
				break;
			};
			case "can":
			{
				stockphoto.MiscDlgs.bRet |= 32;
				if( stockphoto.MiscDlgs.dType == 1 )
				{
					stockphoto.DL.MiscDlgs.BillingCountry_Status = 0;
					stockphoto.MiscDlgs.bNormalExit = true;
				}
				break;
			};
			case "sav":
			{
				stockphoto.MiscDlgs.bRet |= 64;
				if( stockphoto.MiscDlgs.dType == 1 )
				{
					stockphoto.DL.MiscDlgs.BillingCountry_Status = 2;
					stockphoto.MiscDlgs.bNormalExit = true;
				}
				if( ( stockphoto.MiscDlgs.CntCd >= 0 )&&
				    ( stockphoto.MiscDlgs.CntCd < stockphoto.prefs.regions.length ) )
				{
					var regionName = stockphoto.prefs.regions[stockphoto.MiscDlgs.CntCd];
					app.preferences.bm_billing_region = stockphoto.LangCountry.GetCodeFromBillingCountryName(regionName);
				};
				break;
			};
			default: stockphoto.MiscDlgs.bRet |= 8;
		};
		if( cmdString != "hlp" )
		{
			stockphoto.MiscDlgs.closeDialog();
		}
	},
	_cbMisc_LoadCounter: function( dummy )
	{
		return ( stockphoto.MiscDlgs.RefCnt++ );
	},
	_cbMisc_GetCountryName: function( indStr )
	{
		k = parseInt( indStr );
		if( ( k >= 0 )&&( k < stockphoto.prefs.regions.length ) )
		{
			return( stockphoto.prefs.regions[k] );
		}
		return( "N/A" ); // Do not localize
	},
	_cbMisc_SetCountry: function( indStr )
	{
		if( indStr != "X" )
		{
			stockphoto.MiscDlgs.CntCd = parseInt( indStr );
		}
	},
	_cbMisc_GetProxyServer: function()
	{
		//var str = stockphoto.MiscDlgs.ProxyServer;
		var str = "aws-proxy.corp.adobe.com";
		return( str );
	},
	_cbMisc_SetProxyServer: function(strInput)
	{
		//stockphoto.MiscDlgs.ProxyServer = strInput;
		return;
	},
	_cbMisc_GetProxyUser: function()
	{
		//var str = stockphoto.MiscDlgs.ProxyUser;
		var str = "lmaclenn";
		return( str );
	},
	_cbMisc_SetProxyUser: function(strInput)
	{
		// stockphoto.MiscDlgs.ProxyUser = strInput;
		return;
	},
	_cbMisc_GetProxyPwd: function()
	{
		//var str = stockphoto.MiscDlgs.ProxyPwd;
		var str = "abcde";
		return( str );
	},
	_cbMisc_SetProxyPwd: function(strInput)
	{
		//stockphoto.MiscDlgs.ProxyPwd = strInput;
		return;
	},
	_cbMisc_GetProxyRemember: function()
	{
		// return " " or "checked" for not checked/checked
		var str = "checked";	// default

		//var saved = stockphoto.MiscDlgs.ProxyRemember;
		var saved = "junk";
		if (saved != "checked")
		{
			str = " ";
		}
		return( str );
	},
	_cbMisc_SetProxyRemember: function(strInput)
	{
		// set " " or "checked" for not checked/checked
		if (strInput != "checked")
		{
			strInput = " ";
		}

		//stockphoto.MiscDlgs.ProxyRemember = strInput;
		return;
	}
};

stockphoto.MiscDlgs.NoSearchResults=function( keyword, doc )
{
	var szEnter, doc_id = doc.id;
	stockphoto.MiscDlgs.LoadLocaleData( doc_id );
	stockphoto.MiscDlgs.NewNoSearchCnvTable.PRIMARYFONT=stockphoto.DL.NavBar.GetFontNames();
	stockphoto.MiscDlgs.NewNoSearchCnvTable.BASICTITLE =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/basic_title=No Search Result");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P1LINE1_1  =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p1l1_1=Your search for ^Q");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P1LINE1_2  =keyword;
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P1LINE1_3  =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p1l1_3=^Q did not have any matches.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P1LINE2    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p1l2=Please modify your search and try again.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P2LINE1    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p2l1=Search Tips:");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE1    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l1=Double-check the search text for incorrect spellings or typos.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE2    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l2=Type 'and' between keywords, if you want the search results to contain all of your keywords.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE3    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l3=Type 'or' between keywords, if you want the search results to contain any of your keywords.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE4    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l4=Do not begin your initial search with the words 'and', 'or', and 'not'. However, you may begin your Search Within starting with these operators.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE4b   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l4b=.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE5a   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l5a=You can search by photographer. Simply type the photographer's name in the keywords field above.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE5b   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l5b=You can also search additional libraries, including Rights-Managed images, by clicking on the");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE5c   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l5c=More Ways to Find Images");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE5d   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l5d=icon above.");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P4LINE1    =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p4l1=For additional guidance, try the ");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.P4LINE1LBL =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p4l1lbl=Adobe Stock Photos Help");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.LBLRMI     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/lblrmi=Rights-Managed Image Collections");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.LBLPHD     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/lblphd=More Ways to Find Images");
	stockphoto.MiscDlgs.NewNoSearchCnvTable.URLPHD     =stockphoto.core.html.urlForMoreWaysFindImg;
	
    var sSearchLocale = stockphoto.core.getASPSearchLangLocale();
    var sBridgeLocale = stockphoto.core.getValidLocale();

    if (sSearchLocale == sBridgeLocale || sSearchLocale == "ja_JP")
    {
        stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE_LOCALE_OPS = '';
    }
    else
    {
        stockphoto.MiscDlgs.NewNoSearchCnvTable.P3LINE_LOCALE_OPS = '<li>' + stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_NSN/Lines/p3l_localeops=Words 'and', 'or', and 'not' need to be specified in the current selected search language.") + '</li>';
    }
    
	// #1135772
	szEnter = stockphoto.NavIntDt.TheEnter;
	stockphoto.NavIntFnc.SetKeyWord( szEnter, false /*=unescaped*/, doc_id, true );
	stockphoto.NavExtFnc.SendKeyWordToHTM( escape( szEnter ), doc_id, 0 /* web */, 0 );
	stockphoto.NavExtFnc.SendKeyWordToHTM( "", doc_id, 2 /* current */, 0 );
	if( stockphoto.DL.HTMLUtil.SubLocalHTMLbyDocID( stockphoto.core.folder.getTemplateFolder()+"/st20NewNoSearch.htm",
						stockphoto.MiscDlgs.NewNoSearchCnvTable, "st20NewNoResult.htm", doc_id ) )
	{
		stockphoto.core.html.doLocalHtm( stockphoto.MiscDlgs.NewNoSearchCnvTable.BASICTITLE, stockphoto.HTMLUtil.fsOut.fsName, true, doc_id );
		stockphoto.core.NavBar.SwitchNavBar( "DISPLAYSTARTPAGE", 0, 1, doc );
	};
}

stockphoto.MiscDlgs.BillingCountry=function( doc )
{
	if( ( ! stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_LangCountry ) )||
	    ( ! stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_Preference  ) ) )
	{
		return( false );
	}
	var doc_id = doc.id;
	
	stockphoto.MiscDlgs.bNormalExit = false;
	stockphoto.MiscDlgs.LoadLocaleData( doc_id );
	stockphoto.MiscDlgs.BillingCountryCnvTable.MAIN_TITLE =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Label/main_title=Before You Begin...");
	stockphoto.MiscDlgs.BillingCountryCnvTable.SELCOUNTRY =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Label/SelectCountry=Please select the country or region where you receive your billing statement:");
	stockphoto.MiscDlgs.BillingCountryCnvTable.LABEL1     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Label/help=Help");
	stockphoto.MiscDlgs.BillingCountryCnvTable.LABEL2     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Label/cancel=Cancel");
	stockphoto.MiscDlgs.BillingCountryCnvTable.LABEL3     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Label/save=Continue");
	stockphoto.MiscDlgs.BillingCountryCnvTable.LINE_A     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Lines/l1=You can then make a purchase, view pricing information for Stock Photo images, or create a new account.");
	stockphoto.MiscDlgs.BillingCountryCnvTable.LINE_B     =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/Lines/l2=If your country or region isn't listed above, it's not currently supported by Adobe Stock Photos. We're always improving our service, so please check back with us to see if we've added your country or region.");
	stockphoto.MiscDlgs.BillingCountryCnvTable.SELECTCL   =stockphoto.MiscDlgs.zc.get("$$$/MiscDlgs_FT/SelLC=Select a country or region");
	stockphoto.MiscDlgs.dType = 1;
	if( stockphoto.DL.HTMLUtil.SubLocalHTMLbyDocID( stockphoto.core.folder.getTemplateFolder()+"/st20FirstTime.htm",
							stockphoto.MiscDlgs.BillingCountryCnvTable, "st20FirstTime.htm", doc_id ) )
	{
		doc.bringToFront(); // in BillingCountry()
		stockphoto.MiscDlgs.bRet         =0;
		stockphoto.MiscDlgs.RefCnt       =0;
		stockphoto.MiscDlgs.closeDialog();
		stockphoto.MiscDlgs.jsCallbacks.dialog[1]       =new Dialog("file:"+stockphoto.HTMLUtil.fsOut.fsName );
		stockphoto.MiscDlgs.jsCallbacks.dialogOn[1]     =true;
		stockphoto.MiscDlgs.jsCallbacks.dialogId[1]     =doc_id;
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].title =stockphoto.MiscDlgs.BillingCountryCnvTable.MAIN_TITLE;
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].modal =true;
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].width =stockphoto.DL.HTMLUtil.ConvertToInteger( stockphoto.MiscDlgs.BillingCountryCnvTable.WIDTHSTR );
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].height=stockphoto.DL.HTMLUtil.ConvertToInteger( stockphoto.MiscDlgs.BillingCountryCnvTable.HEIGHTSTR );
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].wDir  =0;
		stockphoto.MiscDlgs.jsCallbacks.dialog[1].run( stockphoto.MiscDlgs.jsCallbacks );
		if( ( stockphoto.MiscDlgs.bRet & 32 ) == 0 )
		{
			return( true );
		}
	};
	return( false );
}

stockphoto.MiscDlgs.MyAccountFailHandler = function()
{
	if (stockphoto.DL.demandJsxLoading(stockphoto.DL.jsx_AlertBox))
	{
		stockphoto.DL.alertBox(stockphoto.alertBox.eCommerceComponentID+1); /*ERROR_ECOM_CONNECTION_ERROR*/
	}
}

stockphoto.MiscDlgs.MyAccount=function( doc_id )
{
	var onCompleteObj = {};
	onCompleteObj.urlReceived = function(urlString)
	{
		if (urlString != undefined)
		{
			stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_LangCountry );
			var billingCountry = stockphoto.core.BoxCar.LangCountry.getBillingCountry();
			var locale = stockphoto.core.getValidLocale(true);
			var uiLang = ((locale ).substr(0,2)).toLowerCase();
			var uiCountry  = ((locale).substr(3,2)).toUpperCase();
			
			urlString = urlString + "&Country=" + billingCountry + "&Locale=" + uiLang + "-" + uiCountry + "&appVersion=" + stockphoto.core.BM_3Version;

			stockphoto.MiscDlgs.MyAccountContext.url = unescape(urlString);
			stockphoto.MiscDlgs.MyAccountContext.thumbnail = app.document.thumbnail;

			app.document.thumbnail = new Thumbnail(urlString);
		}
		else
		{
			app.document.thumbnail = new Thumbnail("http://store.digitalriver.com/DRHM/servlet/SecureControllerServlet?Action=DisplayMyAccountPage&SiteID=adobe");
		}
	}

	var doc;
	doc = stockphoto.documents[doc_id].documents;
	if( doc == undefined )
	{
		doc = app.document;
	}
	stockphoto.core.BoxCar.NavBar.SetInECOMFlag( true, doc_id );
	stockphoto.core.html.setUrlFilter( doc );
	stockphoto.core.NavBar.SwitchNavBar( "st20_MyAccount", 0, 1, doc );

	var request =
	{
		group: "EComPartners",
		xmlPath: "",		// set when getPartnersXMLItem function is called
		keyword: "MyAccountURL",
		iteration: 1,
		eventHandler: stockphoto.MiscDlgs.getPartnersXMLItem_EventHandler,
		onComplete: onCompleteObj
	};

	if( stockphoto.Burp.doIt ) // in stockphoto.MiscDlgs.MyAccount(), changeView "MyAccount"
	{
	/*B*/	try
	/*B*/	{
	/*B*/		stockphoto.Burp.callSPSUI( doc_id, stockphoto.Burp.code_changeView, "MyAccount", "", "", "" ); 
	/*B*/	} catch(e) { ; }
	}
	stockphoto.MiscDlgs.getPartnersXMLItem(onCompleteObj, request, doc);
	return 0;
}

stockphoto.MiscDlgs.getPartnersXMLItem_EventHandler = function(event)
{
	if (event.eventClass == "getValue")
	{
		if (event.eventName == "value")
		{
			this.onComplete.urlReceived(event.value);
		}
	}
}

stockphoto.MiscDlgs.getPartnersXMLItem = function(onCompleteObj, request, doc)
{

	if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_ShoppingCart ))
	{
		// save location if it is one to which we wish to return. - rwe
		var root = doc.thumbnail.path.split(":");
		if ((root[0] == "stockphoto") || (root[0] == "bridge") || (doc.thumbnail.path.indexOf(stockphoto.core.folder.getMyFolder()) >=0))
		{
			stockphoto.shoppingCart.savedThumbnail = doc.thumbnail;
		}
	}

	if( stockphoto.core.init.partnersXMLfsObj == undefined )
	{
		stockphoto.core.init.checkPartnersXML();
	}

	if( stockphoto.core.init.partnersXMLfsObj != undefined )
	{
		request.xmlPath = Folder.decode(stockphoto.core.init.partnersXMLfsObj.fsName);
		stockphoto.impl.getValue(request);
	}
	else  //failed to find partners.xml.  Simulate a callback.
	{
		onCompleteObj.urlReceived(undefined);
	}
	

}

stockphoto.MiscDlgs.GotoFolder=function( WhichOne /* 1,2,3 */, doc_id )
{
	doc = stockphoto.documents[doc_id].documents;
	if( doc == undefined )
	{
		doc = app.document;
	}
	stockphoto.core.BoxCar.NavBar.SetInECOMFlag( false, doc_id );
	switch( WhichOne )
	{
		case 2:
			stockphoto.core.NavBar.SwitchNavBar( "st20_GotoFolder", 0, 1, doc );
			doc.thumbnail = stockphoto.places.comps;
			break;
		case 3:
			stockphoto.core.NavBar.SwitchNavBar( "PURCHAS", 0, 1, doc );
			doc.thumbnail = stockphoto.places.purchases;
			break;
		default:
			doc.thumbnail = stockphoto.places.recentSearches;
			stockphoto.core.NavBar.SwitchNavBar( "st20_GSrch", 0, 1, doc );
	};
}
//SA
stockphoto.MiscDlgs.ShowCurrentPurchasedFolder = function(doc_id)
{
	doc = stockphoto.documents[doc_id].documents;
	if( doc == undefined )
	{
		doc = app.document;
	}
	var dolarLevel = $.level;
	$.level=0;
	try
	{
		doc.thumbnail = new Thumbnail(File(stockphoto.core.GetCurrentPurchaseFolder()));
	}
	catch(e){}
	$.level = dolarLevel; 
}
//SA

stockphoto.MiscDlgs.SearchTips=function( doc_id )
{
	if( stockphoto.Burp.doIt ) // in stockphoto.MiscDlgs.SearchTips(), changeView "searchTips"
	{
	/*B*/	try
	/*B*/	{
	/*B*/		stockphoto.Burp.callSPSUI( doc_id, stockphoto.Burp.code_changeView, "searchTips", "", "", "" ); 
	/*B*/	} catch(e) { ; }
	}
	stockphoto.MiscDlgs.HelpTopic( stockphoto.core.helpTopicBase );
}

stockphoto.MiscDlgs.HelpTopic=function( helpTopic )
{
	var lcb, szLocale, topic = helpTopic;
	if ( (undefined != topic) && stockphoto.core.init.loadBMScripts() )
	{
		lcb      = stockphoto.core.html.GetLanguageCountryBilling();
		if (undefined == lcb)
		{
            // fallback - en_US
            lcb = { szLanguage: "en", szCountry: "US" };
        }
		szLocale = ( lcb.szLanguage ).toLowerCase() + "_" + ( lcb.szCountry ).toUpperCase();

         // append the language information...		
        if ((stockphoto.core.helpTopicBase == topic) && (undefined != lcb.szCountry) && ("US" != ( lcb.szCountry ).toUpperCase()))
        {
            topic += "_" + lcb.szCountry;
        }
        
		if ("no_NO" == szLocale)
		{
		   	szLocale = "nb_NO";
		}
        var params=
		{
			product: "Bridge",
			topic:   topic,
			locale:  szLocale,
			// version: stockphoto.core.BM_VersionMajor + '.' + stockphoto.core.BM_VersionMinor
			version: stockphoto.core.helpTopicBridgeVersion  // Bridge version number
		};
		var bHelpRes = app.launchHelp( params );
		stockphoto.core.log.logString( 0,  "Launched Adobe Help. Result: " + bHelpRes + "\n");
	};
}

stockphoto.MiscDlgs.PhotographersDirectory=function( doc_id )
{
	var lcb={}, Url;
	doc = stockphoto.documents[doc_id].documents;
	if( doc == undefined )
	{
		doc = app.document;
	}
	
    // Removed initilization of ASP
	// http://cs2-stockphotos.adobe.com/get_more_images
	if( stockphoto.Burp.doIt ) // in stockphoto.MiscDlgs.PhotographersDirectory(), changeView "moreWaysToFind"
	{
	/*B*/	try
	/*B*/	{
	/*B*/		stockphoto.Burp.callSPSUI( doc_id, stockphoto.Burp.code_changeView, "moreWaysToFind", "", "", "" ); 
	/*B*/	} catch(e) { ; }
	}
	lcb=stockphoto.core.html.GetLanguageCountryBilling();
	Url = stockphoto.core.html.urlForMoreWaysFindImg+"?language="+lcb.szLanguage+"&country="+lcb.szCountry+"&billing="+lcb.szBilling;
	stockphoto.core.html.openInDeafaultBrowser( Url );
}

//	stockphoto.MiscDlgs.ProxyAuth=function()
//	{
//		var doc_id=app.document.id;
//		stockphoto.MiscDlgs.LoadLocaleData( doc_id );
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.MAIN_TITLE =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/main_title=Authenticate");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL1     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/server=Server:");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL2     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/username=User Name:");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL3     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/password=Password:");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL4     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/remember=Remember my password");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL5     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/ok=OK");
//		stockphoto.MiscDlgs.ProxyAuthCnvTable.LABEL6     =stockphoto.MiscDlgs.zc.get("$$ $/MiscDlgs_PA/Label/cancel=Cancel");
//		stockphoto.MiscDlgs.dType = 1;
//		if( stockphoto.DL.HTMLUtil.SubLocalHTMLbyDocID( stockphoto.core.folder.getTemplateFolder()+"/st20ProxyAuth.htm",
//							stockphoto.MiscDlgs.ProxyAuthCnvTable, "st20ProxyAuth.htm", doc_id ) )
//		{
//			stockphoto.MiscDlgs.bRet         =0;
//			stockphoto.MiscDlgs.RefCnt       =0;
//			stockphoto.MiscDlgs.closeDialog();
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1]       =new Dialog("file:"+stockphoto.HTMLUtil.fsOut.fsName );
//			stockphoto.MiscDlgs.jsCallbacks.dialogOn[1]     =true;
//			stockphoto.MiscDlgs.jsCallbacks.dialogId[1]     =doc_id;
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1].title =stockphoto.MiscDlgs.ProxyAuthCnvTable.MAIN_TITLE;
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1].modal =false;
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1].width =stockphoto.DL.HTMLUtil.ConvertToInteger( stockphoto.MiscDlgs.ProxyAuthCnvTable.WIDTHSTR );
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1].height=stockphoto.DL.HTMLUtil.ConvertToInteger( stockphoto.MiscDlgs.ProxyAuthCnvTable.HEIGHTSTR );
//			stockphoto.MiscDlgs.jsCallbacks.dialog[1].run( stockphoto.MiscDlgs.jsCallbacks );
//			if( ( stockphoto.MiscDlgs.bRet & 32 ) == 0 )
//			{
//				return( true );
//			}
//		};
//		return( false );
//	}

if( ( stockphoto.timeKeeperOn != undefined )&&( stockphoto.timeKeeperOn ) )
{
	stockphoto.core.util.edTime( stockphoto.DL.jsx_MiscDlgs );
}

