// ---- [Public] The event handler for the Browse button

function popWindow(childURL,height,width,type)
			{
				var re, urlstr,menu;
				re = /\^/g;
				urlstr = childURL.replace(re,"\\").replace(" ","%20");
					if (height == ''){height = "465"};
					if (width== ''){width= "620"};
					if (type== 'with_menu'){menu= "1"};
					if (type== 'without_menu'){menu= "0"};
				myRemote = window.open(urlstr, "myRemote", "height=" +height + ",width=" +width + ",ScreenX = 5,ScreenY = 5,alwaysRaised,hotkeys,menubar=" 				+menu+ ",resizable,,scrollbars,titlebar,z-lock");
			}

function onClickBrowseForPlaceholder(strTargetID)
{
	// Call InternalLinks.aspx with "wbc_caller=IEModal" query string to indicate that
	// we called it with IE's showModalDialog() call instead of JavaScript window.open()
	// Also, need to set NRMODE to Unpublished in order for the tree to display offline objects
	var strURL = document.all[strTargetID].value;
	var strDlgRet = window.showModalDialog("/Careers/CMS/WebAuthor/Dialogs/InternalLinks/InternalLinks.aspx" + "?NRMODE=Unpublished&wbc_caller=IEModal", 
												strURL, IDS_IEWIN_INTLINKS_FEATURES);
	if (strDlgRet != "Cancel")
	{
		document.all[strTargetID].value = strDlgRet;
	}
}

//Begin Modified 11-17-04 
//validate Popup
//--------------------------------------------------
/*
function onClickEdit(strTargetID)
{
	var strURL = document.all[strTargetID].value;
	popWindow('/Careers/aspx/EditPosting.aspx?URL=' + strURL,'560','760','');
}
*/
//--------------------------------------------------
//check for leading & trailing spaces
function trim(strValue) {
   objRegExp =/^[ \t]+|[ \t]+$/;
   if(objRegExp.test(strValue)) {
       strValue = strValue.replace(/ +/g,"");
    }
   return strValue;
}
//Error validation
function onClickEdit(strTargetID)
{
   var strURL = document.all[strTargetID].value;
   strURL = trim(strURL)
 
   	if (strURL != ""){
    document.all[strTargetID].value = strURL;
    popWindow('/Careers/aspx/EditPosting.aspx?URL=' + strURL,'560','760','');	
	}
	else if (document.all[strTargetID].value == "undefined"){
	alert("Please enter a valid posting link.");
	document.all[strTargetID].focus(); 
	}
	else
	{
	alert("Please enter the location and filename of the posting in the textbox provided."); 
	document.all[strTargetID].focus(); 
	}
}
//End

function onClickBrowseForResourceItem(textboxID)
{
	referenceObject = "ResourcePicker";
	referenceTextboxID = textboxID;	

	//Open ResourceManager Dialogs window
	WBC_launchAttachmentGallery(IDS_FRAMEWORK_CHANNELITEM_QUERYSTRING, 'CSSPicker', 'ThinEditIE','true', 'true', 'false'); 
	
}
