


















// uncommon.js

var VoxPopDomain = "www.voxpop.tv";
var VoxPopHostInfo = "http://" + VoxPopDomain + "/";


/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		
		
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			
		  var swfAttribute = this.getAttribute('swf');
	    var randomNumber=Math.floor(Math.random()*1000000);
		  swfAttribute += "&swfobjrnd=" + randomNumber;			
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ swfAttribute +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
		  var swfAttribute = this.getAttribute('swf');
	    var randomNumber=Math.floor(Math.random()*1000000);
		  swfAttribute += "&swfobjrnd=" + randomNumber;			
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
			swfNode += '<param name="movie" value="'+ swfAttribute +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
		  // alert("No Flash Detected.  Redirect URL: " + this.getAttribute('redirectUrl'));
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	if (!deconcept.unloadSet) {
		deconcept.SWFObjectUtil.prepUnload = function() {
			__flash_unloadHandler = function(){};
			__flash_savedUnloadHandler = function(){};
			window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
		}
		window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
		deconcept.unloadSet = true;
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;




// bannerBorderWidth is set to 0
var VoxPopCommon = 
{ 
  launchPage: "/uncommon.js",

  primaryTournament: new Object,
  
  googleAnalyticsAccountNumber: "UA-1185532-1",
  
  partnerGoogleAnayticsAccountNumber: null,
  
  externalScript: new Object,
  
  adsEnabled: false,
  
  jsAdsEnabled: false,  
  
  setGameShellStyle: function(bordercolor)
  {
    var shell = document.getElementById('VoxPopGameShell');               
    if ( typeof shell != 'undefined' && shell != null )
    {
      var width = 990;
      var height = 600;    
      shell.style.position = "relative";
      if(bordercolor) 
      { 
        shell.style.border = "1px solid " + bordercolor; 
      }
      else
      {
        shell.style.border = "0px solid black"; 
      }
      
      shell.style.margin = "0";
      shell.style.padding = "0";
      shell.style.height = height + "px";
      shell.style.width = width + "px";
      shell.style.top = "0";
      shell.style.left = "0"; 
      // shell.style.backgroundColor = "black";    
      // shell.style.background = "url(http://www.voxpop.tv/images/staging.png)";       
    }   
  },

  load: function()
  {
    VoxPopCommon.externalScript.urchinLoadedFlag = false;
    VoxPopCommon.externalScript.prototypeLoadedFlag = false;  
    
    VoxPopCommon.adsEnabled = 'true';
    VoxPopCommon.jsAdsEnabled = 'false';    
    if ( typeof _uacct != 'undefined')
    {
      VoxPopCommon.partnerGoogleAnayticsAccountNumber = _uacct;
    }
    
    /* Make sure that launchPage begins with a leading slash */
    if ( typeof(VoxPopCommon.launchPage) == 'string' && VoxPopCommon.launchPage != null && !(VoxPopCommon.launchPage.indexOf("/") === 0) )
    {
      VoxPopCommon.launchPage = "/" + VoxPopCommon.launchPage;
    }    

    
    VoxPopCommon.activeBanners = new Array();    

    VoxPopCommon.loadExtraJavascript(); 
    
    /* Make sure that the shell is the correct size.  We do this again in the embedSWF */
    VoxPopCommon.setGameShellStyle();
  },
  
  loadExtraJavascript: function()
  {
    // alert("loading extra js files");
    // VoxPopCommon.importJavascriptFile("http://www.voxpop.tv/scripts/swfobject.js");      
    VoxPopCommon.importJavascriptFile("http://www.google-analytics.com/urchin.js"); 
    // VoxPopCommon.importJavascriptFile("http://www.voxpop.tv/scripts/general.js");    
  },
  
  unload: function()
  {
  },

  gamePop: function(tg, page, entrantID, width, height)
  {
    var URL ='http://' + VoxPopDomain + '/gamePop.php?tg=' + tg + '&page=' + page + '#' + entrantID;
    var windowName ='VoxPopGamePopup';
    var windowFeatures ='width=' + width + ',height=' + height + ',toolbar=no,scrollbars=no';		
      
    try 
    {
      windowName = window.open(URL, windowName, windowFeatures); 
      windowName.focus();
    } 
    catch (e) {}
  },

  embedSWF: function(tg) 
  {
    var tg = 'xrta44500';
    VoxPopCommon.primaryTournament.tournamentGuid = tg;
    var guid = 'xrta44500';
  
    var flashPath = VoxPopHostInfo;
    var swf = "voxpop.swf";
    var swfId = "VoxPopFlash";
    var bgcolor = '#ffffff';
    var width = 990;
    var height = 600;
    var minFlashVersion = "8";
  
  
    var accessDomain = VoxPopDomain;
    
      accessDomain = "www.voxpop.tv";
    
  
    var randomNumber=Math.floor(Math.random()*1000000);
    var flashString = flashPath + swf + "?g=" + guid + "&jsrnd=" + randomNumber + "&accessDomain=" + accessDomain + "&cacheId=200909091254";;
       
    if ( typeof tg == 'string' && tg != null && tg != ""  )
    {
      flashString = flashString + "&tg=" + tg;
    } 
    
    var ag = 'xtfvoxpop';
    if ( typeof ag == 'string' && ag != null && ag != ""  )
    {
      flashString = flashString + "&ag=" + ag;
    }  
       
    var shell = document.getElementById('VoxPopGameShell');               
    if ( typeof shell != 'undefined' )
    {
      // shell.innerHTML = "Howdy";
      VoxPopCommon.setGameShellStyle();      
      
      var tempStyle = "position: relative; margin: 0; padding: 0; border: 0px solid yellow;";
      var so = new SWFObject(flashString, swfId, width, height, minFlashVersion, bgcolor);
      so.setAttribute("style", tempStyle);
      
      so.setAttribute("redirectUrl", "http://www.voxpop.tv/getflash");
      
      so.addParam("quality", "high");
      so.addParam("wmode", "transparent");
      so.addParam("menu", "false");
      so.addParam("align", "T");
      so.addParam("salign", "TL");
      so.addParam("allowScriptAccess", "always");
      so.write("VoxPopGameShell");     
    }
    else
    {
      throw("Unable to embed VoxPop Flash Client: <div id='VoxPopGameShell'></div> is required but missing.");
    }
    
    /*
     * the embedding of ads has to happen AFTER the SWF loads
     */
    if ( VoxPopCommon.jsAdsEnabled == 'true' )
    {
      VoxPopCommon.embedActiveBanners();
      // setTimeout('VoxPopCommon.embedActiveBanners()', 300);
    }
  },
  
  reloadPage: function() 
  {
    window.location.reload();
  },
  
  openNewWindow: function(URLtoOpen, windowName, windowFeatures) 
  {	
    newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
  },
  
  embedExpertBadge: function(profileId) 
  {
    var embedString = '<a href="http://www.voxpop.tv/fashion.php"><img src="http://www.voxpop.tv/sitedata/badges/high-fashion-girl_badge.jpg" alt="VoxPop - Voice Your Choice!" width="200" height="250" border="0"><\/a>';
  
    document.open();
    document.write(embedString);
    document.close();	
  },

  embedUserBadge: function(profileId) 
  {
    var embedString = '<a href="http://www.voxpop.tv"><img src="http://www.voxpop.tv/sitedata/badges/VoxPop_winnerBadge.jpg" alt="VoxPop - Voice Your Choice!" width="200" height="200" border="0"><\/a>';
  
    document.open();
    document.write(embedString);
    document.close();	
  },
  
  getDomain: function(url)
  {
    var domain = url.match( /:\/\/([^\/\?:]+)/ );
    domain = domain[1]?domain[1]:'';
    return domain;
  },

  embedJavascriptFile: function(fileToImport) {
      var html_doc = document.getElementsByTagName('head')[0];
      js = document.createElement('script');
      js.setAttribute('type', 'text/javascript');
      js.setAttribute('src', fileToImport);
      html_doc.appendChild(js);
  },
  
  
  timeoutBasedImportFileTest: function(fileToImport)
  {
    // alert("timeoutBasedImportFileTest() - Entering with " + fileToImport + ". Snip is " + typeof Snip);
    if ( fileToImport == "http://www.google-analytics.com/urchin.js" )
    {
      if ( typeof urchinTracker != 'undefined' )
      {
        VoxPopCommon.jsFileLoadComplete(fileToImport);
      }
      else
      {
        window.setTimeout( function() { VoxPopCommon.timeoutBasedImportFileTest(fileToImport);}, 500);
      }
    }
    else if ( fileToImport == "http://www.voxpop.tv/scripts/prototype.js" )
    {
      if ( typeof Prototype != 'undefined' )
      {
        VoxPopCommon.jsFileLoadComplete(fileToImport);
      }
      else
      {
        window.setTimeout( function() { VoxPopCommon.timeoutBasedImportFileTest(fileToImport);}, 500);
      }
    }
  },

  importJavascriptFile: function(fileToImport) 
  {      
      VoxPopCommon.embedJavascriptFile(fileToImport);
      
      // This will load the javascript for Safari, but it won't
      // let us know when it's been loaded.  The following will.
      // alert(navigator.userAgent);
      
      if(/WebKit|Khtml/i.test(navigator.userAgent)) {
          var iframe = document.createElement('iframe');
          iframe.style.display = 'none';
          
          iframe.setAttribute('src',fileToImport);
          // alert("I am here");
          
          // Fires in Saf
          iframe.onload = function() {
              // alert('JS iframe fired');
              VoxPopCommon.jsFileLoadComplete(fileToImport);
          }
          
          // alert("Still here... iframe is " + iframe);
          
          try 
          {
            document.getElementsByTagName('body').item(0).appendChild(iframe);
          }
          catch (e) 
          {
            // alert("Exception attaching iframe to body: " + e);
            // window.setTimeout('hasSafariImportedFile()', 1000); 
          }
          
          window.setTimeout( function() { VoxPopCommon.timeoutBasedImportFileTest(fileToImport);}, 500);
  
      }    
      // Fires in IE, also modified the test to cover both states
      js.onreadystatechange = function () {
          if (/complete|loaded/.test(js.readyState)) {
              // alert('JS onreadystate fired');
              VoxPopCommon.jsFileLoadComplete(fileToImport);
          }
      }
      // Fires in FF
      js.onload = function () {
          // alert('JS onload fired');
          VoxPopCommon.jsFileLoadComplete(fileToImport);
      }
      return false;
  },
  
  embedBeacon: function(code, url)
  {
    var iframe = document.createElement('iframe');
    
    // var randomNumber=Math.floor(Math.random()*1000000);
    var iframeId = 'VoxPopBeaconFrame-' + code;
    iframe.id = iframeId;

    iframe.style.position = "absolute";
    iframe.style.zIndex = 100; 
    iframe.style.margin = 0;
    iframe.style.padding = 0;
    iframe.style.top = "-200px";
    iframe.style.left = "-200px";
    iframe.style.height = "1px";
    iframe.style.width = "1px";
    iframe.src = url;   
                        
    try 
    {
      document.getElementsByTagName('body').item(0).appendChild(iframe);
    }
    catch (e) 
    {
    }  
  
  },
  
  addLoadEvent: function(func) 
  {
    // alert("func is a " + typeof func);
    var oldonload = window.onload;
    if (typeof window.onload != 'function')
    {
      window.onload = func;
    }
    else
    {
      window.onload = function()
      {
        oldonload();
        func();
      };
    }
  },  

  
  jsFileLoadComplete: function(fileToImport)
  {  
    var allExternalsHaveLoaded = false; 
    
    if ( fileToImport == "http://www.google-analytics.com/urchin.js" )
    {
      // alert("Received: " + fileToImport);
      VoxPopCommon.externalScript.urchinLoadedFlag = true;
      
      VoxPopCommon.siteTracker(VoxPopCommon.launchPage);
    }
    else if ( fileToImport == "http://www.voxpop.tv/scripts/prototype.js" )
    {
      // alert("Received: " + fileToImport);
      VoxPopCommon.externalScript.prototypeLoadedFlag = true;
    }
    
    // alert("urchinLoaded is " + VoxPopCommon.externalScript.urchinLoadedFlag + " and prototypeLoaded = " + VoxPopCommon.externalScript.prototypeLoadedFlag);
    if ( (VoxPopCommon.externalScript.urchinLoadedFlag == true) && (VoxPopCommon.externalScript.prototypeLoadedFlag == true) )
    {
      alert("All Externals Have Loaded");
      allExternalsHaveLoaded = true;
    }
    
    if ( allExternalsHaveLoaded == true )
    {
    }
  },    
  
  siteTracker: function(requestedPage)
  {
    var page = requestedPage; 
    
    if ( typeof(requestedPage) == 'string' && requestedPage == VoxPopCommon.launchPage )
    {
      VoxPopCommon.tracker();
    }     
  
    if ( typeof(page) == 'string' )
    {
      if ( !( page.indexOf("/") === 0 ) )
      {
        page = "/" + page;
      }
      
      if ( !( page.indexOf("/VoxPopNamedPages") === 0 ) )
      {
        page = "/VoxPopNamedPages" + page;
      }
    }
    
    VoxPopCommon.tracker(page);
    
    if ( typeof(requestedPage) == 'string' && requestedPage == VoxPopCommon.launchPage )
    {
      VoxPopCommon.tracker("/VoxPopNamedPages/byGuid/xrta44500" + VoxPopCommon.launchPage );
    }    
  },  
  
  
  flashTracker: function(page)
  {
    var flashPlayerPage;
    var flashPlayerByGuidPage;
    var guid = 'xrta44500';
    
    if ( guid == "" )
    {
      guid = "unspecified";
    }
    
    if ( typeof(page) == 'string' )
    {
      if ( !( page.indexOf("/") === 0 ) )
      {
        page = "/" + page;
      }
    }
    
    VoxPopCommon.tracker( "/FlashPlayer" + page);
    VoxPopCommon.tracker( "/FlashPlayer/byGuid/" + guid + page);
  },
  
  flashPageView: function()
  {
    try { VoxPopPageView(); } catch(e) {}
  },  
  
  loadIframe: function(iframe, url)
  {
    // alert("iframe id is: " + iframe.id);
    
    // iframeSrc is direct
    
      
      
        iframe.src = url;
      
    
  },  
  
  reloadIframe: function(iframe)
  {
    VoxPopCommon.loadIframe(iframe, iframe.src);
  },
    
  embedQuicktime: function(url, height, width, autoplay, controller)
  {
     var html =  "<OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width=\"" + width + "\"";
     html += "height=\"" + height + "\" codebase='http://www.apple.com/qtactivex/qtplugin.cab'>";
     html += "<param name='src' value=\"" + url + "\">";
     html += "<param name='autoplay' value=\"" + autoplay +"\">";
     html += "<param name='controller' value=\"" + controller + "\">";
     html += "<param name='loop' value=\"true\">";
     html += "<EMBED src=\"" + url + "\" width=\""+ width +"\" height=\""+ height +"\" autoplay=\"" + autoplay + "\"";
     html += "controller=\"" + controller + "\" loop=\"true\" pluginspage='http://www.apple.com/quicktime/download/'>";
     html += "</EMBED>";
     html += "</OBJECT>";  
     document.write(html);
  },
  
  focusOnFlash: function()
  {
    try { document.voxpop_game.focus(); } catch (e) {}
  }, 
  
  
  tracker: function(page)
  {
    // alert("calling for page: " + page);
    _uacct = VoxPopCommon.googleAnalyticsAccountNumber;     
    
    try
    {
      urchinTracker(page);
    }
    catch (e) {  }    
    
    if ( typeof VoxPopCommon.partnerGoogleAnayticsAccountNumber != 'undefined' )
    {
      _uacct = VoxPopCommon.partnerGoogleAnayticsAccountNumber;
    }
  },
  
  sleep: function(millisecs)
  {
    var now = new Date();
    var exitTime = now.getTime() + millisecs;
    while (true)
    {
      now = new Date();
      if (now.getTime() > exitTime)
        return;
      }
  },
  
  openNewWindow: function(url) 
  {
    var newWindow = window.open(url,'blank');
    return newWindow;
  },  
  
  /*
   * Banner-specific functions 
   */  
  
  enableAndShowActiveBanners: function()
  {
    // alert("doing the banner thing on active banners: " + VoxPopCommon.activeBanners  );
    VoxPopCommon.embedBanners( VoxPopCommon.activeBanners );
    VoxPopCommon.showBanners( VoxPopCommon.activeBanners );
  },
  
  hideActiveBanners: function()
  {
    VoxPopCommon.hideBanners( VoxPopCommon.activeBanners );
  },   
  
  disableActiveBanners: function()
  {
    VoxPopCommon.disableBanners( VoxPopCommon.activeBanners );
  },  
  
  populateAndShowActiveBanners: function()
  {
    // alert("doing the banner thing on active banners: " + VoxPopCommon.activeBanners  );
    VoxPopCommon.populateBanners( VoxPopCommon.activeBanners );
    VoxPopCommon.showBanners( VoxPopCommon.activeBanners );
  },
  
  embedActiveBanners: function()
  {
    VoxPopCommon.embedBanners( VoxPopCommon.activeBanners );  
  },
  
  embedBanners: function( arrayOfCodes )
  {
    // alert("array of codes is: " + arrayOfCodes);
    
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.embedBanner(arrayOfCodes[ii]);
    }
  },
  
  populateBanners: function( arrayOfCodes )
  {
    // alert("array of codes is: " + arrayOfCodes);
    
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.populateBanner(arrayOfCodes[ii]);
    }
  }, 
  
  populateAndShowBanners: function( arrayOfCodes )
  {    
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.populateAndShowBanner(arrayOfCodes[ii]);
    }
  }, 
  
  populateAndShowBanner: function( code )
  {    
     VoxPopCommon.populateBanner(code);
     VoxPopCommon.showBanner(code);
  },    
  
  populateBanner: function(code)
  {
    var elementId = "VoxPopBannerFrame-" + code;
    var element = document.getElementById(elementId);
    if ( typeof element != "undefined" )
    {
      element.style.border = "0px solid #773333";
    
      // alert("found banner with code: " + code);
      var tg = 'xrta44500';
      var randomNumber=Math.floor(Math.random()*1000000);
      try
      {
        var url = 'http://www.voxpop.tv/banners/index.html?bannerCode=' + code + '&tg=' + tg + '&jsrnd=' + randomNumber;
        // element.src = url;
        // alert("element is " + element);
        // alert("typeof element is " + typeof element);
        
        /* put this URL into the iframe */
        VoxPopCommon.loadIframe(element, url);
      }
      catch ( e ) { /* alert("Something not quite right here: " + e); */ }
    }
  
  },
  
  embedBanner: function( code )
  {
    // alert ("Embedding bannering: " + code);
    var tg = 'xrta44500';
    
    
      
    
  },
  
  showBanner: function( code )
  {
    // alert("showBanner() - Entering with code = " + code);
    
    var elementId = "VoxPopBannerFrame-" + code;
    var element = document.getElementById( elementId );
    if ( typeof(element) != 'undefined' && element != null )
    {
      element.style.border = "0px solid #773377";
      
      /* toggle visibility */
      // element.style.visibility = "hidden";
      // element.style.visibility = "visible";
      
      /* toggle display */
      // element.style.display = "none";
      // element.style.display = "block";      
      
      /* toggle contents */
      // element.style.position = "relative";
      // element.style.position = "";
      element.style.border = "0px solid #00ff00";
      // element.innerHTML = element.innerHTML + "  ";
      // element.style.top = "1px";
      
    }
  }, 
  
  showBanners: function( arrayOfCodes )
  {
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.showBanner(arrayOfCodes[ii]);
    }
  },   
  
  hideBanners: function( arrayOfCodes )
  {    
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.hideBanner(arrayOfCodes[ii]);
    }
  },  
  
  hideBanner: function( code )
  {
    // alert("hideBanner() - Entering with code = " + code);
    var elementId = "VoxPopBannerFrame-" + code;
    var element = document.getElementById( elementId );
    if ( typeof(element) != 'undefined' && element != null )
    {
      try
      {
        element.style.visibility = "hidden";
      }
      catch (e) {}
    }   
  },  
  
  recycleBanner: function( code )
  {
    var elementId = "VoxPopBannerFrame-" + code;
    var iframe = document.getElementById(elementId);
    if ( typeof(iframe) != 'undefined' )
    {
      // iframe.src = iframe.src;
      VoxPopCommon.reloadIframe(iframe);
    }    
  }, 
  
  enableBanners: function( )
  {
    VoxPopCommon.adsEnabled = 'true';
    VoxPopCommon.showAllBanners();
  },
  
  disableBanners: function( arrayOfCodes )
  {
    // alert("array of codes is: " + arrayOfCodes);
    
    for (var ii = 0; ii < arrayOfCodes.length; ii++)
    {
      VoxPopCommon.disableBanner(arrayOfCodes[ii]);
    }
  },
  
  disableBanner: function(code)
  {
    // alert("disableBanner() - Entering with code = " + code);
    var elementId = "VoxPopBannerFrame-" + code;
    var element = document.getElementById(elementId);
    if ( typeof element != 'undefined' && element != null )
    {
      element.style.border = "0px solid #777744";
      try 
      {
        // element.parentNode.removeChild(element);
        // element.parentNode.style.display = "none";
        element.parentNode.style.visibility = "hidden";
      }
      catch ( e ) {}
    }
  },
  
  disableBanners: function( arrayOfCodes )
  {
    for (code in arrayOfCodes)
    {
      VoxPopCommon.disableBanner(code);
    }
  },
  
  getRequestParameter: function(param) 
  {
    var q = document.location.search || document.location.hash;
    if (param == null) { return q; }
    if(q) {
      var pairs = q.substring(1).split("&");
      for (var i=0; i < pairs.length; i++) {
        if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
          return pairs[i].substring((pairs[i].indexOf("=")+1));
        }
      }
    }
    return "";
  }  
}

var VoxPopShare = 
{  
  digg: function() 
  {
    var url = "http://www.ew.com/ew/flash/voxpop/topchef";
    var title = "Can&#039;t Stand the Heat: Top Chefs Face Off";
    var synopsis = "Top Chefs Face Off";
  
  	var urlStr = 'http://digg.com/submit?phase=2&url=' + encodeURIComponent(url);
  
  	//encode single-quote entity &#8217; properly
  	var t = encodeURIComponent(title).replace(/%E2%80%99/g,"%27");
  	urlStr += '&title=' + t;
  	var s = encodeURIComponent(synopsis).replace(/%E2%80%99/g,"%27");
  	urlStr += '&bodytext=' + s;
  
  	urlStr += '&topic=playable_web_games';
  
  	//alert(urlStr);
  	var newWindow = VoxPopCommon.openNewWindow(urlStr);
  	newWindow.focus();
  },

  stumbleupon: function() 
  {
    var url = "http://www.ew.com/ew/flash/voxpop/topchef";
    var title = "Can&#039;t Stand the Heat: Top Chefs Face Off";  
  
  	var urlStr = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent(url);
  
  	//encode single-quote entity &#8217; properly
  	var t = encodeURIComponent(title).replace(/%E2%80%99/g,"%27");
  	urlStr += '&title=' + t;
  
  	//alert(urlStr);
  	var newWindow = VoxPopCommon.openNewWindow(urlStr);
  	newWindow.focus();
  },
  
  reddit: function() 
  {
    var url = "http://www.ew.com/ew/flash/voxpop/topchef";
    var title = "Can&#039;t Stand the Heat: Top Chefs Face Off";
  
  	var urlStr = 'http://reddit.com/submit?url=' + encodeURIComponent(url);
  
  	//encode single-quote entity &#8217; properly
  	var t = encodeURIComponent(title).replace(/%E2%80%99/g,"%27");
  	urlStr += '&title=' + t;
  
  	//alert(urlStr);
  	var newWindow = VoxPopCommon.openNewWindow(urlStr);
  	newWindow.focus();
  },
  
  delicious: function() 
  {
    var url = "http://www.ew.com/ew/flash/voxpop/topchef";
    var title = "Can&#039;t Stand the Heat: Top Chefs Face Off";
  
  	var urlStr = 'http://del.icio.us/post?url=' + encodeURIComponent(url);
  
  	//encode single-quote entity &#8217; properly
  	var t = encodeURIComponent(title).replace(/%E2%80%99/g,"%27");
  	urlStr += '&title=' + t;
  
  	//alert(urlStr);
  	var newWindow = VoxPopCommon.openNewWindow(urlStr);
  	newWindow.focus();
  }
}

// embedFlag = onload
// inlineEmbedSwfDelay = 

VoxPopCommon.load();

  
  VoxPopCommon.addLoadEvent(VoxPopCommon.embedSWF);
 

// setTimeout('VoxPopCommon.unload()', 300);

// Testing below this line
// setTimeout('VoxPopCommon.populateAndShowActiveBanners()', 12000);
// setTimeout('VoxPopCommon.hideActiveBanners()', 18000);
// setTimeout('VoxPopCommon.disableActiveBanners()', 22000);