function changeImage(siteId, imageUrl) {
    var url = 'base.cofp?action=user.prepare.change.photo';
    url+='?siteId='+siteId;
    url+='&url='+imageUrl;
    showPopWin(url, 400, 300, null, false);
}

function closePopupAndGoToPage(siteId) {
    window.parent.hidePopWin();
    window.top.updateElement('imageDiv'+siteId, '/jsp/imageDiv.jsp?siteId=' + siteId);
}

function closePopup() {
    window.parent.hidePopWin();
}

function closePopopAndExecuteAction(action){
	window.parent.hidePopWin();
	document.location = action;
}

function publish(siteId, servletRoot){
    var url = 'base.cofp?action=user.prepare.site.publish';
    if (servletRoot != null) {
	   url = servletRoot + 'prepare.site.publish';
    }
	url += '?siteId=' + siteId;
	showPopWin(url, 465, 465, null, false);
}

function closePopupAndUpdateLogo(userId) {
    window.parent.hidePopWin();
    window.top.updateElement('agentsLogoDiv', '/jsp/logoDiv.jsp?userId='+userId);
}

function goToHomePage(servletRoot){
	var url = servletRoot + 'personalPage.login';
	document.location = url;
}

function signUpforPackage(servletRoot, packageId){
	var url = servletRoot + 'pay.for.package&package_id='+packageId;
	document.location = url;
}

function unsubscribeAgent(servletRoot){
	var url = servletRoot + 'unsubscribe.agent';
	document.location = url;
}

function goToContactUs(){
	var url = 'base.cofp?action=user.index.info.pages&nav=contact';
	document.location = url;
}

function upgradeAgencyAccount(servletRoot){
	   var url = servletRoot + 'prepare.change.subscription';
   document.location = url;
}

function importFeed(servletRoot, msgContainerId){
	var url = servletRoot + 'import.feed';
	updateElementWithProgessAndPostprocess(msgContainerId, url, function(){
		//$(msgContainerId).innerHTML="";
	}, 
	function(){
		$(msgContainerId).innerHTML="";
		$(msgContainerId).insert(Builder.node('img', {src: '/img/feedImportProgress.gif'}));
	});
}
