var signin_url = "http://www.mysanantonio.com/sharedcontent/registration/index.jsp?fw=";
var str_QueryString = self.location.search;
var search = "img";
var extra_params = "";
if(__requires_registration() == true) {
	if (document.cookie.length > 0) {
		//-------------------------------------------------------------------------
		// If we get here then there are some cookies defined.
		var offset = document.cookie.indexOf(search);
		
		if (offset != -1) {
			//---------------------------------------------------------------------
			// If we get here, then the cookie exists.
		} else {
			if(extra_params != "") {
				window.resizeTo(800,600);
			}
			
			window.location.replace(signin_url + document.URL + extra_params);
		}
	} else {
		if(extra_params != "") {
			window.resizeTo(800,600);
		}
		
		window.location.replace(signin_url + document.URL + extra_params);
	}
}
//-----------------------------------------------------------------------------
// __requires_registration() -- Determines whether the current page requires
// registration before it can be viewed.
//-----------------------------------------------------------------------------
function __requires_registration() {
	var str_HostName = self.location.hostname;
	var str_PathName = self.location.pathname;
	
	if(str_HostName == "www2.mysanantonio.com") {
		var ary_DirNames = str_PathName.split("/");
		if(ary_DirNames.length > 1) {
			if(ary_DirNames[1] == "contests") {
				if(ary_DirNames.length > 2) {
					if(ary_DirNames[2] != "micasa") {
						return yes;
					}
				}
			} else if(ary_DirNames[1] == "promotions") {
				return true;
			}
		}
	} else if(str_HostName == "obits.mysanantonio.com") {
		var ary_DirNames = str_PathName.split("/");
		if(ary_DirNames.length > 1) {
			if(ary_DirNames[1] == "search") {
				return true;
			}
		}
	} else if((str_HostName == "nl.newsbank.com") && ((str_QueryString.indexOf("s_username=safree") != -1) || (str_QueryString.indexOf("mysa_login=1") == -1))) {
		window.location.replace("http://www2.mysanantonio.com/aboutus/expressnews/archive/logincheck.cfm?link=" + document.URL);
	}
	
	return false;
}
function WriteDebug(t){
	if(str_QueryString != null && str_QueryString.indexOf('debug=1') != -1) {
		document.write(''+t+'');
		document.write('
');
	}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/*
if(self.location.pathname == "/multimedia/slideshows/index.cfm") {
	if (__get_browser_width (800) == 800) window.resizeTo(510, 580);
	extra_params = "&width=" + __get_browser_width(500)
		+ "&height=" + __get_browser_height(500);
}
if (document.cookie.length > 0) {
	//-------------------------------------------------------------------------
	// If we get here then there are some cookies defined.
	var offset = document.cookie.indexOf(search);
	
	if (offset != -1) {
		//---------------------------------------------------------------------
		// If we get here, then the cookie exists.
	} else {
		if(extra_params != "") {
			window.resizeTo(800,600);
		}
		
		window.location.replace(signin_url + document.URL + extra_params);
	}
} else {
	if(extra_params != "") {
		window.resizeTo(800,600);
	}
	
	window.location.replace(signin_url + document.URL + extra_params);
}
*/
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function __get_browser_height(def) {
	if(document.body) {
		if(document.body.clientHeight) {
			return document.body.clientHeight;
		} else if(window.innerHeight) {
			return window.innerHeight;
		} else {
			return def;
		}
	} else {
		if(window.innerHeight) {
			return window.innerHeight;
		} else {
			return def;
		}
	}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function __get_browser_width(def) {
	if(document.body) {
		if(document.body.clientWidth) {
			return document.body.clientWidth;
		} else if(window.innerWidth) {
			return window.innerWidth;
		} else {
			return def;
		}
	} else {
		if(window.innerWidth) {
			return window.innerWidth;
		} else {
			return def;
		}
	}
}