function setStyles(title,lines) {
	if(!title) {
		var cookie = readCookie("style");
		var title = cookie ? cookie : getPreferredStyleSheet();
	}
	setActiveStyleSheet(title);
	if(title == "white") var colour = "#000000";
	else var colour = "#FFFFFF";
	setsIFR(colour);
	if(lines) {
		var agt=navigator.userAgent.toLowerCase();
		var appVer = navigator.appVersion.toLowerCase();
		if(appVer.indexOf("msie")!=-1 && appVer.indexOf("windows")>-1 && agt.indexOf("opera") == -1) {
			iePng(title);
		}
	}
}
		
function switchStyles(title) {
	resetsIFR();
	setStyles(title);
}
		
function switchStylesAndLines(title) {
	resetsIFR();
	setStyles(title,1);
}

function generateBG() {
	var bgnum = Math.round( (Math.random()*100) / 20 );
	if (bgnum == 0) bgnum=1;
	document.body.background = "images/backgrounds/0"+bgnum+".jpg";
}

function Navigate(obj) {
	if(obj.value != 0) window.location = "cities.php?cityID="+obj.value;
}

function NavMap(obj) {
	if(obj.value != 0) window.location = "citymaps.php?cityID="+obj.value;
}

function goPage(page) {
	window.location = page;
}

function isEmail(str) {
	// are regular expressions supported?
	var supported = 0;
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

