var baseurl = '';
var registurl = '';
var cccURL = "" + document.location;
var protocol = "http";

if (cccURL.match(/^https:/))
	protocol = "https";

if (cccURL.match(/\/\/corporate\.hongkongdisneyland/))
{
	baseurl = protocol + '://corporate.hongkongdisneyland.com';
	registurl = "https://secure.hongkongdisneyland.com";
}
else if (cccURL.match(/\/\/www\.hongkongdisneyland/))
{
	baseurl = protocol + '://www.hongkongdisneyland.com';
	registurl = "https://secure.hongkongdisneyland.com";
}
else if (cccURL.match(/\/\/secure\.hongkongdisneyland/))
{
	baseurl = protocol + '://secure.hongkongdisneyland.com';    
	registurl = "https://secure.hongkongdisneyland.com";
}
else if (cccURL.match(/\/\/staging\.hongkongdisneyland/) || cccURL.match(/\/\/staging\.corporate\.hongkongdisneyland/))
{
	baseurl = protocol + '://staging.corporate.hongkongdisneyland.com';
	registurl = "https://staging-secure.hongkongdisneyland.com";
}
else if (cccURL.match(/\/\/dev\.hongkongdisneyland/) || cccURL.match(/\/\/dev\.corporate\.hongkongdisneyland/))
{
	baseurl = protocol + '://dev.corporate.hongkongdisneyland.com';
	registurl = "https://staging-secure.hongkongdisneyland.com";
}
else if (cccURL.match(/\/\/ns2\.opencreative/))
{
	baseurl = protocol + '://ns2.opencreative.com/~hkdlcorp';   
	registurl = "https://staging-secure.hongkongdisneyland.com";
}

// e.g
// reglang = 'tch'
// url = 'new_regist.jsp?BANDAGE=2&pid=1860'
// nurl = 'discover/mwod_askjacky_main.jsp'
function goRegURL(reglang, url, nurl)
{
	var rurl = registurl;
	if (reglang == 'eng')
		rurl = registurl + '/regist/eng/secure/';
	else if (reglang == 'sch')
		rurl = registurl + '/regist/sch/secure/';    
	else
		rurl = registurl + '/regist/secure/';
	
	rurl = rurl + url + '&nurl=' + baseurl + '/' + nurl;
	self.location = rurl;
}