var flashVars = "";

var searchZip = getURLVar("zip");
if( searchZip == "" ){
	searchZip = customZip;
}
if( searchZip != ""){
	flashVars += "&zip=" + searchZip;
}

var windowID = getURLVar("windowID");
if( windowID != ""){
	flashVars += "&windowID=" + windowID;
}

if( customLoc != ""){
	flashVars += "&customLoc=" + customLoc;
}

if( windowTheme != "" ){
	flashVars += "&windowTheme=" + windowTheme;
}

function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></scr' + 'ipt>'); 
}

if( includeAC_FL == "true" ){
	//var AC_FL_RunContent = 0;
	//IncludeJavaScript("http://www.mytiwi.com/system/ContentModule/WeatherWindow/JavaScript/AC_RunActiveContent.js")
	document.write('<script src="http://www.mytiwi.com/system/ContentModule/WeatherWindow/JavaScript/AC_RunActiveContent.js" type="text/javascript"></script>');
}
if (AC_FL_RunContent == 0) {
	alert("This page requires AC_RunActiveContent.js.");
} else {
	AC_FL_RunContent(
	'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
	'width', windowWidth,
	'height', windowHeight,
	'src', 'http://www.mytiwi.com/system/ContentModule/WeatherWindow/flash/weather_window_custom',
	'quality', 'high',
	'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
	'align', 'middle',
	'play', 'true',
	'loop', 'true',
	'scale', 'showall',
	'wmode', 'transparent',
	'devicefont', 'false',
	'id', 'weather_window',
	'bgcolor', '#ffffff',
	'name', 'weather_window',
	'menu', 'true',
	'allowFullScreen', 'false',
	'allowScriptAccess','always',
	'movie', 'http://www.mytiwi.com/system/ContentModule/WeatherWindow/flash/weather_window_custom',
	'flashVars', flashVars,
	'salign', ''
	); //end AC code
}

function getURLVar(urlVarName) {
	var urlHalves = String(document.location).split('?');
	var urlVarValue = '';
	if(urlHalves[1]){
		var urlVars = urlHalves[1].split('&');
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
				var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	return urlVarValue;   
}