function loadjscssfile(filename, filetype){
		if (filetype=="js"){ //if filename is a external JavaScript file
			var fileref=document.createElement('script')
			fileref.setAttribute("type","text/javascript")
			fileref.setAttribute("src", filename)
		}
		else if (filetype=="css"){ //if filename is an external CSS file
			var fileref=document.createElement("link")
			fileref.setAttribute("rel", "stylesheet")
			fileref.setAttribute("type", "text/css")
			fileref.setAttribute("href", filename)
		}

		if (typeof fileref!="undefined"){
			document.getElementsByTagName("head")[0].appendChild(fileref)		
		}
	}

	function modRule(showClassName){
		if(!document.styleSheets)
			return;

		var thecss = (document.styleSheets[0].cssRules) ? document.styleSheets[0].cssRules : document.styleSheets[0].rules;

		for(i=0; i < thecss.length; i++){
			if(thecss[i].selectorText.toLowerCase()==showClassName)
				thecss[i].style.cssText="display:block;";
		}
	}

		
	//alert(cookiejar.fetch("fakeuser"))
	// If there is a UID cookie (means they are logged in), turn the loggedin styles on
	if(cookiejar.fetch("UID") && cookiejar.fetch("fakeuser") == null){
		modRule(".loggedin");	
		// If UID, BUT no curUserInfo login cookie yet, means they've JUST logged in: call setLoginCookies to initialize the login cookies
	 	if(cookiejar.fetch("curUserInfo") == null) {
			loadjscssfile("http://www.winnipegfreepress.com/templates/WFP_determine_login_status?c=n&ran=" + Math.floor(Math.random()*1000000), "js") 
	 	}
	}
	
	// If there is no longer a UID (means they are logged out), turn the loggedout styles on, and make sure the cookies we set upon login get cleared out
	else if(cookiejar.fetch("UID") == null){
		modRule(".loggedout");
		cookiejar.crumble("curUserInfo");
		cookiejar.crumble("UID");
	}
	else{
		modRule(".loggedout");
		cookiejar.crumble("UID")
		cookiejar.crumble("fakeuser")
		cookiejar.crumble("curUserInfo");
	}
	
	