jQuery.fn.extend(
		
		getMyWindow = function(setting){
			var h = setting.heigth || 400;
			var w = setting.width || 400;
			
			var options = {
			   className: "cifit_web", 
		       title: "弹出窗口", 
		       showEffect:Effect.BlindDown, 
		       hideEffect: Effect.SwitchOff, 
		       showEffectOptions: {duration:0.5},
		       draggable: true, 
		       maximizable: true, 
		       minimizable: true,
		       resizable: true, 
			   destroyOnClose:true,
		       width:w, 
		       height:h,
		       minWidth: 100,
		       show: false
			};
			jQuery.extend(options, setting);
			var win = new Window(options);
			
			if(options.show){
				win.show(true);
				win.showCenter(false);
			}
			return win;
		}

);

/**
 * 获取网站根目录路径
 */
function getRootPath(){
	var strFullPath=window.document.location.href;
	var strPath=window.document.location.pathname;
	var pos=strFullPath.indexOf(strPath);
	var prePath=strFullPath.substring(0,pos);
	var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1);
	return(prePath+postPath);
}

/**
 * 添加收藏
 * @param faveoriteDefineId
 * @param entityId
 * @param favoriteTitle
 * @return
 */
function addFavor(faveoriteDefineId,entityId,favoriteTitle,data_locale)
{
	var locationHref = this.location.href.replace(/#.*$/,"");  //去掉url后面的#，防止重复收藏
	var params = "model.favoriteDefineId="+faveoriteDefineId+"&model.entityId="+entityId+"&model.favoriteTitle="+favoriteTitle+"&model.favoriteUrl="+locationHref+"&data_locale="+data_locale;
	jQuery.ajax({	
		url: getRootPath()+"/favorite!saveFavor.do",
		type: 'post',
		data: params,
		error: function(data){
			alert(data);
		},
		success: function(data){
			//var result = eval(data);
			alert(data);
		}
	});
}

/**
 * 收藏文章
 * @return
 */
function favorArticle(entityId,favoriteTitle,data_locale)
{
	addFavor(1,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏政策
 * @return
 */
function favorPolicy(entityId,favoriteTitle,data_locale)
{
	addFavor(2,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏投资意向
 * @return
 */
function favorIntention(entityId,favoriteTitle,data_locale)
{
	addFavor(3,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏项目
 * @return
 */
function favorProject(entityId,favoriteTitle,data_locale)
{
	addFavor(4,entityId,favoriteTitle,data_locale);
}


/**
 * 收藏活动
 * @return
 */
function favorActivty(entityId,favoriteTitle,data_locale)
{
	addFavor(5,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏机构展台
 * @return
 */
function favorArea(entityId,favoriteTitle,data_locale)
{
	addFavor(6,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏投资人
 * @return
 */
/*
function favorInvestor(entityId,favoriteTitle,data_locale)
{
	addFavor(7,entityId,favoriteTitle,data_locale);
}
 */

/**
 * 收藏网上路演
 * @return
 */
function favorProjectShow(entityId,favoriteTitle,data_locale)
{
	addFavor(8,entityId,favoriteTitle,data_locale);
}

/**
 * 收藏项目对接
 * @return
 */
function favorProjectDock(entityId,favoriteTitle,data_locale)
{
	addFavor(9,entityId,favoriteTitle,data_locale);
}






