﻿var hsCloseConfig={
	crmMapper:{
		3:'http://baanpreuksa.ps.co.th/',
		7:'http://pkv.ps.co.th/',
		11:'http://theconnect.ps.co.th/',
		//15:'http://theplant.ps.co.th/',
		19:'http://passorn.ps.co.th/',
		23:'http://preuksavillage.ps.co.th/'
	},
	newsletterMapper:{
		51:'http://baanpreuksa.ps.co.th/',
		52:'http://pkv.ps.co.th/',
		54:'http://theconnect.ps.co.th/',
		49:'http://theplant.ps.co.th/',
		50:'http://passorn.ps.co.th/',
		53:'http://preuksavillage.ps.co.th/'
	},
	getCrmMapVal:function(key){
		return this.crmMapper[key];
	},
	getNewsletterMapVal:function(key){
		return this.newsletterMapper[key];
	},
	brochure:{
		close:function(cmsId){
			var pThis=hsCloseConfig;
			var url=pThis.getCrmMapVal(cmsId);
			if(url&&url!==undefined&&url!=null)
				self.location.href=url+'hs-close/hs-close-brochure.html';
			else
				parent.hs.close();
		}
	},
	appointment:{
		close:function(cmsId, isNormalClose){
			var pThis=hsCloseConfig;
			var url=pThis.getCrmMapVal(cmsId);
			if(url&&url!==undefined&&url!=null){
				if(isNormalClose)
					self.location.href=url+'hs-close/hs-close.html';
				else
					self.location.href=url+'hs-close/hs-close-appointment.html';
			}
			else
				parent.hs.close();
		}
	},
	contact:{
		close:function(cmsId, isNormalClose){
			var pThis=hsCloseConfig;
			var url=pThis.getCrmMapVal(cmsId);
			if(url&&url!==undefined&&url!=null){
				if(isNormalClose)
					self.location.href=url+'hs-close/hs-close.html';
				else
					self.location.href=url+'hs-close/hs-close-contact.html';
			}
			else
				parent.hs.close();
		}
	},
	register:{
		close:function(cmsId, isNormalClose){
			var pThis=hsCloseConfig;
			var url=pThis.getCrmMapVal(cmsId);
			if(url&&url!==undefined&&url!=null){
				if(isNormalClose)
					self.location.href=url+'hs-close/hs-close.html';
				else
					self.location.href=url+'hs-close/hs-close-register.html';
			}
			else
				parent.hs.close();
		}
	},
	newsletter:{
		close:function(key, isNormalClose){
			var pThis=hsCloseConfig;
			var url=pThis.getNewsletterMapVal(key);
			if(url&&url!==undefined&&url!=null){
				if(isNormalClose)
					self.location.href=url+'hs-close/hs-close.html';
				else
					self.location.href=url+'hs-close/hs-close-newsletter.html';
			}
			else
				parent.hs.close();
		}
	}
};