if (top.location != self.location) top.location.replace(self.location);

function openInWindow() {

	baseUrl = String(document.location);

	setCookie('intro', true, 10, '/');

	window.refresh();

}

function openFullScreen(domain) {

	baseUrl = String(document.location);

	setCookie('intro', true, 10, '/', domain);

	window
			.open(
					baseUrl,
					'cityfashion',
					'width='
							+ screen.width
							+ ', height='
							+ screen.height
							+ ', channelmode=yes, titlebar=yes, resizable=no, toolbar=yes, location=no, directories=no, status=no, menubar=no, scrollbars=yes');

}

function getVars() {

	var url = String();

	baseUrl = String(document.location);
	baseUrl2 = baseUrl.split('#');
	if (baseUrl.indexOf('#') > 0)
		url = "#" + baseUrl2[1];

	url = url.replace("#/", "");

	pageVars = url.split('/');

	emptyVars = false;
	for (i = 0; i <= 5; i++) { // loop array pageVars
		if (pageVars[i])
			if (pageVars[i].indexOf('.htm') > 0) {
				pageTitle = pageVars[i].replace(/.html/i, '').replace(/.htm/i,
						'').replace(/-/g, ' ').capitalize();
				pageVars[i] = null;
				emptyVars = true;
			} else if (emptyVars)
				pageVars[i] = null;
	}
	if (emptyVars)
		pageVars[i] = null;

	countryCode = pageVars[0] ? pageVars[0] : countryCode;
	languageCode = pageVars[1] ? pageVars[1] : languageCode;
	cityName = pageVars[2] ? pageVars[2] : cityName;
	moduleName = pageVars[3] ? pageVars[3] : moduleName;
	ID = pageVars[4] ? pageVars[4] : ID;

	if (!pageTitle || !emptyVars)
		pageTitle = pageTitle;

	// get screen size
	if (self.innerHeight) // all except Explorer
	{
		screenWidth = self.innerWidth;
		screenHeight = self.innerHeight;
	} else if (document.documentElement
			&& document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		screenWidth = document.documentElement.clientWidth;
		screenHeight = document.documentElement.clientHeight;
	} else if (document.body) // other Explorers
	{
		screenWidth = document.body.clientWidth;
		screenHeight = document.body.clientHeight;
	}

}

String.prototype.capitalize = function() {
	return this.replace(/\w+/g, function(a) {
		return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
	});
};

function setCookie(name, value, expires, path, domain, secure) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime(today.getTime());

	if (expires) {
		expires = expires * 1000;
	}
	var expires_date = new Date(today.getTime() + (expires));

	document.cookie = name + "=" + escape(value)
			+ ((expires) ? ";expires=" + expires_date.toGMTString() : "")
			+ ((path) ? ";path=" + path : "")
			+ ((domain) ? ";domain=" + domain : "")
			+ ((secure) ? ";secure" : "");
}

function readCookie(cookieName) {
	var theCookie = "" + document.cookie;
	var ind = theCookie.indexOf(cookieName);
	if (ind == -1 || cookieName == "")
		return "";
	var ind1 = theCookie.indexOf(';', ind);
	if (ind1 == -1)
		ind1 = theCookie.length;
	return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}
