
function openWindow(URL, name, options) {
    window.open(URL,name,options)
}

var showDateShort = 1;
var showDate= 2;
var showDateTime= 3;
var showTime= 4;
function ShowDateTime(dateStyle)
{
var today = new Date();
var dStr = "";
switch (dateStyle)
{
case showDateShort:
dStr = today.toDateString();
break;
case showDateTime:
dStr = today.toLocaleString();
break;
case showTime:
dStr = today.toLocaleTimeString();
break;
case showDate:
default:
dStr = today.toLocaleDateString();
break;
}
document.write(dStr.toUpperCase());
}



/**
 * FlashObject v1.3c: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
  if (!document.createElement || !document.getElementById) return;
  this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
  this.params = new Object();
  this.variables = new Object();
  this.attributes = new Array();
  this.useExpressInstall = useExpressInstall;

  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 com.deconcept.PlayerVersion(ver.toString().split(".")));
  this.installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
  if(c) this.addParam('bgcolor', c);
  var q = quality ? quality : 'high';
  this.addParam('quality', q);
  var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
  this.setAttribute('xiRedirectUrl', xir);
  this.setAttribute('redirectUrl', '');
  if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
}
com.deconcept.FlashObject.prototype = {
  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;
  },
  createParamTag: function(n, v){
    var p = document.createElement('param');
    p.setAttribute('name', n);
    p.setAttribute('value', v);
    return p;
  },
  getVariablePairs: function(){
    var variablePairs = new Array();
    var key;
    var variables = this.getVariables();
    for(key in variables){
      variablePairs.push(key +"="+ variables[key]);
    }
    return variablePairs;
  },
  getFlashHTML: function() {
    var flashNode = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
      flashNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
      flashNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
      var params = this.getParams();
       for(var key in params){ flashNode += [key] +'="'+ params[key] +'" '; }
      var pairs = this.getVariablePairs().join("&");
       if (pairs.length > 0){ flashNode += 'flashvars="'+ pairs +'"'; }
      flashNode += '/>';
    } else { // PC IE
      if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
      flashNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
      flashNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
      var params = this.getParams();
      for(var key in params) {
       flashNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
      }
      var pairs = this.getVariablePairs().join("&");
      if(pairs.length > 0) {flashNode += '<param name="flashvars" value="'+ pairs +'" />';}
      flashNode += "</object>";
    }
    return flashNode;
  },
  write: function(elementId){
    if(this.useExpressInstall) {
      // check to see if we need to do an express install
      var expressInstallReqVer = new com.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);
      }
    } else {
      this.setAttribute('doExpressInstall', false);
    }
    if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
      var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
      n.innerHTML = this.getFlashHTML();
    }else{
      if(this.getAttribute('redirectUrl') != "") {
        document.location.replace(this.getAttribute('redirectUrl'));
      }
    }
  }
}

/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
  var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
  if(navigator.plugins && navigator.mimeTypes.length){
    var x = navigator.plugins["Shockwave Flash"];
    if(x && x.description) {
      PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
    }
  }else{
    try{
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      for (var i=3; axo!=null; i++) {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
        PlayerVersion = new com.deconcept.PlayerVersion([i,0,0]);
      }
    }catch(e){}
    if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
    // this only does the minor rev lookup if the user's major version 
    // is not 6 or we are checking for a specific minor or revision number
    // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
    if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
      try{
        PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
      }catch(e){}
    }
  }
  return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
  this.major = parseInt(arrVersion[0]) || 0;
  this.minor = parseInt(arrVersion[1]) || 0;
  this.rev = parseInt(arrVersion[2]) || 0;
}
com.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 ---- */
com.deconcept.util = {
  getRequestParameter: function(param){
    var q = document.location.search || document.location.hash;
    if(q){
      var startIndex = q.indexOf(param +"=");
      var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
      if (q.length > 1 && startIndex > -1) {
        return q.substring(q.indexOf("=", startIndex)+1, endIndex);
      }
    }
    return "";
  }
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;

// Javascript Magnifier v 0.97
// Written by Dino Termini - termini@email.it - May 9, 2003
// Portions of code by zoomIN, zoomOUT
// Author: Nguyen Duong Minh (Obie) - obie4web@yahoo.com
// WWW: http://ObieWebsite.SourceForge.net
// License: GNU (GPL)

// Configuration parameters
// ------------------------
// Measure unit in pixel (px) or points (pt)
// measureUnit = "pt"
measureUnit = "px"

// Minimum size allowed for SIZE attribute (like in <FONT SIZE="1"> )
minSize = 1;

// Minimum size allowed for STYLE attribute (like in <FONT STYLE="font-size: 10px"> )
minStyleSize = 10;

// Maximum size allowed for SIZE attribute
maxSize = 6;

// Maximum size allowed for STYLE attribute
maxStyleSize = 30;

// Start size for tags with no SIZE attribute defined
startSize = 1;

// Start size for tags with no font-size STYLE or CLASS attribute defined
startStyleSize = 10;

// Increasing and decreasing step
stepSize = 1;

// Increasing step for STYLE definition (measure previously declared will be used)
stepStyleSize = 2;

// To set your own hotkeys, use key generator tool page included
// Keys to zooming in (with and without CAPS lock). Default: "+"
// var keyin = 61;
// var keyinCAPS = 43;

// Keys to zooming out (with and without CAPS lock). Default: "-"
// var keyout = 45;
// var keyoutCAPS = 95;

// Keys for "hard" zooming in (with and without CAPS lock). Default: ">"
// var keyinIe = 46;
// var keyinIeCAPS = 62;

// Keys for "hard" zooming out (with and without CAPS lock). Default: "<"
// var keyoutIe = 44;
// var keyoutIeCAPS = 60;

// "Hard" zoom factor
var zoomFactor = 1.1;

// Max zoom allowed
var maxZoom = 4.096;

// Min zoom allowed
var minZoom = 0.625;

// Initial decrease zoom
var startDecZoom = 0.7;

// Initial increase zoom
var startIncZoom = 1.3;

// Cookie expiry (default one year, actually 365 days)
// 365 days in a year
// 24 hours in a day
// 60 minutes in an hour
// 60 seconds in a minute
// 1000 milliseconds in a second
userExpiry = 365 * 24 * 60 * 60 * 1000;

// Enable or disable alert messages
alertEnabled = false;

// Allow input fields resize (text, buttons, and so on)
allowInputResize = false;

// End of configuration parameters. Please do not edit below this line
// --------------------------------------------------------------------------------

// Input values:
// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  // Check whether cookies enabled
  document.cookie = "Enabled=true";
  var cookieValid = document.cookie;

  // if retrieving the VALUE we just set actually works
  // then we know cookies enabled
  if (cookieValid.indexOf("Enabled=true") != -1) {
    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");

    document.cookie = curCookie;
    return(true);
  }
  else {
    return(false);
  }
}

// Input value:
// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// Input values:
// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// Input value:
// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function searchTags(childTree, level) {
  var retArray = new Array();
  var tmpArray = new Array();
  var j = 0;
  var childName = "";
  for (var i=0; i<childTree.length; i++) {
    childName = childTree[i].nodeName;
    if (childTree[i].hasChildNodes()) {
      if ((childTree[i].childNodes.length == 1) && (childTree[i].childNodes[0].nodeName == "#text"))
        retArray[j++] = childTree[i];
      else {
        tmpArray = searchTags(childTree[i].childNodes, level+1);
        for (var k=0;k<tmpArray.length; k++)
          retArray[j++] = tmpArray[k];
        retArray[j++] = childTree[i];
      }
    }
    else
      retArray[j++] = childTree[i];
  }
  return(retArray);
}

function changeFontSize(stepSize, stepStyleSize, useCookie) {

  if (document.body) {
    var myObj = searchTags(document.body.childNodes, 0);
    var myCookieSize = parseInt(getCookie("incrSize"));
    var myCookieStyleSize = parseInt(getCookie("incrStyleSize"));
    var myStepSize = stepSize;
    var myStepStyleSize = stepStyleSize;

    var now = new Date();

    // Fix the bug in Navigator 2.0, Macintosh
    fixDate(now);

    if (isNaN(myCookieSize)) myCookieSize = 0;
    if (isNaN(myCookieStyleSize)) myCookieStyleSize = 0;

    // For debug purpose only
    // if (!confirm("COOKIE: SIZE ["+myCookieSize+"] STYLESIZE ["+myCookieStyleSize+"]")) return(0);

    // Check valid increment/decrement sizes or useCookie parameter
    if (useCookie) {
      myStepSize = myCookieSize;
      myStepStyleSize = myCookieStyleSize;
    }

    now.setTime(now.getTime() + userExpiry);

    myObjNumChilds = myObj.length;
    for (i=0; i<myObjNumChilds; i++) {
	myObjName = myObj[i].nodeName;
	myObjClass = myObj[i].className;

      // Only some tags will be parsed
	if (myObjClass == "head2" || myObjClass == "head3" || myObjClass == "head4" ||
		myObjClass == "storyTitle" || myObjClass == "byLine" || myObjClass == "underlineLink" ||
		myObjClass == "storyAgency" || myObjClass == "caption" || myObjClass == "Extra" ||
		myObjClass == "story" || myObjClass == "storyByline") {

        // Skip INPUT fields, if required
        if (!allowInputResize && myObjName == "INPUT") continue;

	// alert("TAG ["+myObjName+"]");

        size = parseInt(myObj[i].getAttribute("size"));

        // Internet Explorer uses a different DOM implementation
        if (myObj[i].currentStyle)
          styleSize = parseInt(myObj[i].currentStyle.fontSize);
        else 
          styleSize = parseInt(window.getComputedStyle(myObj[i], null).fontSize);

        // For debug purpose only. Note: can be very annoying
	// alert("TAG ["+myObjName+"] SIZE ["+size+"] STYLESIZE ["+styleSize+"]");

        if (isNaN(size) || (size < minSize) || (size > maxSize))
          size = startSize;

        if (isNaN(styleSize) || (styleSize < minStyleSize) || (styleSize > maxStyleSize))
          styleSize = startStyleSize;

        if ( ((size > minSize) && (size < maxSize)) || 
             ((size == minSize) && (stepSize > 0)) || 
             ((size == maxSize) && (stepSize < 0)) || useCookie) {
          myObj[i].setAttribute("size", size+myStepSize);
        }

        if ( ((styleSize > minStyleSize) && (styleSize < maxStyleSize)) || 
             ((styleSize == minStyleSize) && (stepStyleSize > 0)) ||
             ((styleSize == maxStyleSize) && (stepStyleSize < 0)) || useCookie) {
          newStyleSize = styleSize+myStepStyleSize;
          myObj[i].style.fontSize = newStyleSize+measureUnit;
        }
      } // End if condition ("only some tags")
    } // End main for cycle

    // Set the cookies
    if (!useCookie) {
      cookieIsSet = setCookie("incrSize", myStepSize+myCookieSize, now);
      cookieIsSet = setCookie("incrStyleSize", myStepStyleSize+myCookieStyleSize, now);
      if (alertEnabled && !cookieIsSet) {
        alert("Per mantenere in memoria la dimensione scelta, abilita i cookie nel browser");
      }
    }

  } // End if condition ("document.body exists")
} // End function declaration

function increaseFontSize() {
  if (document.body) {
    changeFontSize(stepSize, stepStyleSize, false);
  }
  else {
    if (alertEnabled) {
      alert("Spiacente, il tuo browser non supporta questa funzione");
    }
  }
}

function decreaseFontSize() {
  if (document.body) {
    myStepSize = -stepSize;
    myStepStyleSize = -stepStyleSize;
    changeFontSize(myStepSize, myStepStyleSize, false);
  }
  else {
    if (alertEnabled) {
      alert("Spiacente, il tuo browser non supporta questa funzione");
    }
  }
}

function zoomin() {
  if (window.parent.document.body.style.zoom < maxZoom) {
    if (window.parent.document.body.style.zoom > 0) {
      window.parent.document.body.style.zoom *= zoomFactor; 
    }
    else { 
      window.parent.document.body.style.zoom = startIncZoom;
    }
  }
  else {
    if (alertEnabled) {
      alert("Warning: Max size reached");
    }
  }
}

function zoomout() {
  if ( (window.parent.document.body.style.zoom > minZoom) ||
       (window.parent.document.body.style.zoom == 0) ) {
    if (window.parent.document.body.style.zoom > 0) {
      window.parent.document.body.style.zoom /= zoomFactor; 
    }
    else {
      window.parent.document.body.style.zoom = startDecZoom;
    }
  }
  else {
    if (alertEnabled) {
      alert("Warning: Min size reached");
    }
  }
}

function checkzoom(e) {

  if (document.all) {
    myEvent = event.keyCode;
  }
  else {
    myEvent = e.which;
  }

  switch(myEvent) {
    case keyinIe:
    case keyinIeCAPS:
      zoomin();
      break;

    case keyoutIe:
    case keyoutIeCAPS:
      zoomout();
      break;

    case keyin:
    case keyinCAPS:
      increaseFontSize();
      break;

    case keyout:
    case keyoutCAPS:
      decreaseFontSize();
      break;

    default:
      break;
  }
}

// if (document.layers) {
//  document.captureEvents(Event.KEYPRESS);
// }
// 
// document.onkeypress = checkzoom;


var tickerSpeed=50;
var pauseTime=4000;
var ticker=null; // global variable

function Ticker(name, id, shiftBy, interval, pauseTime)
{
  this.name     = name;
  this.id       = id;
  this.paused = true;
  this.pauseCounter = true
  this.pauseTime = pauseTime;
  this.shiftBy  = shiftBy ? shiftBy : 1;
  this.interval = interval ? interval : 100;
  this.runId	= null;
  this.runId2	= null;
  this.paused = true;
    this.tickerSize=0;
  this.div = document.getElementById(id);


  // remove extra textnodes that may separate the child nodes
  // of the ticker div
if (this.div!=null) {
  this.tickerSize=this.div.childNodes.length;
if (this.tickerSize>0 ) {
  var node = this.div.firstChild;
  var next;

  while (node)
  {
    next = node.nextSibling;
    if (node.nodeType == 3)
      this.div.removeChild(node);
    node = next;
  }

  //end of extra textnodes removal
 
  this.left = 0;
  this.top=0;
  this.shiftLeftAt = this.div.firstChild.offsetWidth;
  this.shiftTopAt = this.div.firstChild.offsetHeight;
  this.div.style.height	=2* screen.availHeight;
  this.div.style.visibility = 'visible';
  }
  }
}
function getTickerSize(){return this.tickerSize;}
function startTicker()
{
  if(this.paused){
    this.pauseCounter+=this.interval
    if(this.pauseCounter>this.pauseTime){this.paused=false;}
  } else {
    this.top -= this.shiftBy;
    if(this.top <= -this.shiftTopAt)
    {
      this.paused=true;
      this.pauseCounter=0;
      this.top = 0;
      // add call to removeChild() to stop Netscape from crashing (dbd,2007/01/18)
      this.div.appendChild(this.div.removeChild(this.div.firstChild));
      this.shiftTopAt = this.div.firstChild.offsetHeight;
    }
    this.div.style.top = (this.top + 'px');
  }
}
function stopTicker()
{
  if (this.runId)
    clearTimeout(this.runId);
    
  this.runId = null;
}
/* Prototypes for Ticker */
Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
Ticker.prototype.size = getTickerSize;
function init(){
if (document.getElementById)
{
	ticker = new Ticker('ticker', 'tickerID', 1, tickerSpeed,pauseTime); //tickerName, tickerID, shiftby, tickerspeed, pausetime
if(ticker.size()>0 )
	setInterval('ticker.start()',ticker.interval)
}
}

function apvDwd(pid,title,pl,t) {
 if(!pl) {pl='';}
 var w = window.open("http://video.ap.org/vws/search/aspx/ap.aspx?f="+pid+"&g="+title+"&p="+pl+"&t="+t,"apvDwd","width=788,height=598,status=1,scrollbars=1,resizable=1"); 
}
