//////////////////////////////////////////////////////////////////////
// snapshot.js
//
// Sandeep Hulsandra
//
// Created 09/16/2003
//
// This is a javascript program to display snapshots
//////////////////////////////////////////////////////////////////////

var ql_img_dir = "http://quicklinks.gannettonline.com/images";
var ql_section = "Today\'s Snapshot";

// START - variables set by filter

var ql_xml_filename = "/infinet/www/usatoday/dsc/input/upload/v2008-11-17-bargain.xml";
var ql_headline = "Where do you plan to do most of your holiday shopping\?";
var ql_url = "http://www.usatoday.com/news/snapshot.htm?section=M&amp;label=v2008-11-17-bargain&amp;csp=22";
var ql_filename = "v2008-11-17-bargain.jpg";
// END - variables set by filter

if (!ql_title) {
  var ql_title = ql_section;
  //document.write('The title is not defined. Hence title will be '+ql_title);
}
else {
  //document.write('The title is defined');
  // do nothing
}

if ((!ql_height) || (!ql_width)) {
  var imgheight = 40;
  var imgwidth = 40;
  //document.write('The height or width is not defined. Hence  default values will be '+imgheight+','+imgwidth);
}
else {
  var imgheight = ql_height;
  var imgwidth = ql_width;
  //document.write('The height and width are defined. The default values will be '+imgheight+','+imgwidth);
}

if (!ql_format) {
  var ql_format = 1;
  //document.write('The format is not defined. Hence format will be '+ql_format);
}
else {
  //document.write('The format is defined');
  // do nothing
}

var match = /\?/.test(ql_url);
  if (!match) {
    //document.write('Entered false block');
    ql_url = ql_url + '\?csp=22_'+ql_site;
    var final_url = ql_url;
  }
  else {
    ql_url = ql_url + '\_'+ql_site;
    var final_url = ql_url;
  }

if (ql_title == "blank") {
  //document.write('The title is blank');
  //do nothing
}
else {
  document.write('<span class = \"gciquicklink\">'+ql_title+'</span><br>');
}

if (!ql_site) {
  document.write('<font color=red>Error: The site code needs to be passed.</font>');
}
else {
  if (ql_format == 1) {
    document.write('<a href = \"'+ final_url+'\" class = \"gciquicklink\" target = \"_blank\"><img src=\"' +ql_img_dir+ '/' +ql_filename+ '\" border=0 align=right height=\"' +imgheight+ '\" width=\"' +imgwidth+ '\">' +ql_headline+ '</a>');
  }
  if (ql_format == 2) {
    document.write('<a href = \"' +final_url+ '\" class = \"gciquicklink\" target = \"_blank\">' +ql_headline+ '<br><img src=\"' +ql_img_dir+ '/' +ql_filename+ '\" border=0 height=\"' +imgheight+ '\" width=\"' +imgwidth+ '\"></a>');
  }
  if (ql_format == 3) {
    document.write('<a href = \"' +final_url+ '\" class = \"gciquicklink\" target = \"_blank\"><img src=\"' +ql_img_dir+ '/' +ql_filename+ '\" border=0 align=left height=\"' +imgheight+ '\" width=\"' +imgwidth+ '\">' +ql_headline+ '</a>');
  }
  if (ql_format == 4) {
    document.write('<a href = \"' +final_url+ '\" class = \"gciquicklink\" target = \"_blank\"><img src=\"' +ql_img_dir+ '/' +ql_filename+ '\" border=0 height=\"' +imgheight+ '\" width=\"' +imgwidth+ '\"><br>' +ql_headline+ '</a>');
  }
}

