function  Start(page) { 
  OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes");
}
function  pop(page) { 
  OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,width=620,height=500");
}
// Week In Pictures
function  popWIP(page) { 
  OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes,width=400,height=325");
}
// Delegate Tracking Map
function  popDTM(page) { 
  OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes,width=640,height=515");
}
function  popFTAF(page) { 
  OpenWin=this.open(page,"CtrlWindow","toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,width=615,height=565");
}


//Begin Audio Console

function launchAudio( audioId )
{
    var launchUrl = 'http://www.johnkerry.com/audio/console.php?audio=' + audioId;
    var newWin = window.open( launchUrl, 'bigconsole','width=350,height=300' );
    newWin.focus();
}

/* Begin video-launching functions */


// Launches the video into the media console for modern browsers, 
// or the legacy page for Netscape 4.x
function launchVideo( videoId )
{
  if ( document.layers )
  {
    // Netscape 4.x
    var launchUrl = 'http://www.johnkerry.com/video/legacy.php?video=' + videoId;
    var newWin = window.open( launchUrl, 'video','width=300,height=300' );
    newWin.focus();
  }
  else
  {
    // All other browsers
    var launchUrl = 'http://www.johnkerry.com/video/console.php?video=' + videoId;
    var newWin = window.open( launchUrl, 'bigconsole','width=656,height=400' );
    newWin.focus();
  }
}

// Launches the video into the media console for modern browsers, 
// or the legacy page for Netscape 4.x
function launchVideoMini( videoId )
{
  if ( document.layers )
  {
    // Netscape 4.x
    var launchUrl = 'http://www.johnkerry.com/video/legacy.php?video=' + videoId;
    var newWin = window.open( launchUrl, 'miniconsole','width=300,height=300' );
    newWin.focus();
  }
  else
  {
    // All other browsers
    var launchUrl = 'http://www.johnkerry.com/video/console_mini.php?video=' + videoId;
    var newWin = window.open( launchUrl, 'miniconsole','width=344,height=400,resizable=1' );
    newWin.focus();
  }
}

// let's you choose a specific video console

function launchMulti (videoId, consoleUrl) {

  var launchUrl = 'http://www.johnkerry.com/video/' + consoleUrl + '?video=' + videoId;
  var newWin = window.open( launchUrl, 'bigconsole','width=656,height=400' );
  newWin.focus();

}



/* End video-launching files */

/* Begin state functions */

// Launches the staet console for modern browsers, 
function launchState (state)
{
    var launchUrl = 'http://www.johnkerry.com/contact/state_console.php?state=' + escape(state);
    var newWin = window.open( launchUrl, 'bigconsole','width=656,height=400' );
    newWin.focus();
}

/* End state-launching files */

function pf() {
  // printer-friendly

  // requires: content in title, div with id=content (in all pages of the site)

  var t = document.getElementsByTagName("title");
  var title = t[0].innerHTML;
  c = document.getElementById("content").innerHTML;

  var newWin;
  newWin = window.open("","","toolbar=yes,menubar=yes,status=yes,width=615,height=500,scrollbars=yes,resize=yes");
  newWin.document.write("<html><head><title>print: " + title + "</title>\n");
  newWin.document.write("<link rel='stylesheet' href='http://www.johnkerry.com/css/jkstyles.css' type='text/css'>\n");

  newWin.document.write("<body class=print bgcolor='#ffffff' bottomMargin=0 leftMargin=0 topMargin=0 marginheight='0' marginwidth='0'>\n");
  newWin.document.write("<img src='http://www.johnkerry.com/zdvl/images/ban.gif' width=598 height=69 alt='John Kerry for President'>\n");
  newWin.document.write("<table cellpadding=0 cellspacing=0 border=0 width=598 style='background-color: white'>\n");
  newWin.document.write("<tr><td width=18>&nbsp;&nbsp;&nbsp;&nbsp;</td><td width=580>\n");
  newWin.document.write("<div align=right><a href='javascript:print()'>print this page</a> | <a href='javascript:close()'>close this window</a>&nbsp;&nbsp;</div>\n");
  newWin.document.write("<div id=content class=largetext>" + c + "</div>\n");
  newWin.document.write("<br><br>\n");
  newWin.document.write("Paid for and authorized by Kerry-Edwards 2004, Inc.\n</td></tr></table>\n");
  newWin.document.close();

}

// added by ajk to generate the date in NAME OF DAY, NAME OF MONTH, DATE format
function write_date()
{
var thetime=new Date();

var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";

if (nday==0)
  nday="Sunday";
if (nday==1)
  nday="Monday";
if (nday==2)
  nday="Tuesday";
if (nday==3)
  nday="Wednesday";
if (nday==4)
  nday="Thursday";
if (nday==5)
  nday="Friday";
if (nday==6)
  nday="Saturday";
  
  
if (nmonth==0)
  nmonth="January";
if (nmonth==1)
  nmonth="February";
if (nmonth==2)
  nmonth="March";
if (nmonth==3)
  nmonth="April";
if (nmonth==4)
  nmonth="May";
if (nmonth==5)
  nmonth="June";
if (nmonth==6)
  nmonth="July";
if (nmonth==7)
  nmonth="August";
if (nmonth==8)
  nmonth="September";
if (nmonth==9)
  nmonth="October";
if (nmonth==10)
  nmonth="November";
if (nmonth==11)
  nmonth="December";


if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

document.write(nday+", "+nmonth+" "+ntoday);

} 
//-->
// end added by ajk to generate the date in NAME OF DAY, NAME OF MONTH, DATE format

function show(sid)
{
  var idbuild = "";
	var el = document.getElementById(sid);
	 for(var i=1; i<=3;i++){
	  ibuild="info"+i;
	  document.getElementById(ibuild).style.display='none';
	 }
		el.style.display = 'block';
		checkheight();
}

function showtwo(theid)
{
	var el = document.getElementById(theid);
	if (el.style.display == 'none')
	{
		el.style.display = 'block';
		el = document.getElementById('more' + theid);

	        el.innerHTML = '<img border="0" src="../../images/minus.gif" width="11" height="14">';
	} else {
		el.style.display = 'none';
		el = document.getElementById('more' + theid);
		el.innerHTML = '<img border="0" src="../../images/plus.gif" width="11" height="14u">';
	}
}






function writeMonth(x) {
var month;
var month_name= new Array(12);
month_name["01"]="January";
month_name["02"]="February";
month_name["03"]="March";
month_name["04"]="April";
month_name["05"]="May";
month_name["06"]="June";
month_name["07"]="July";
month_name["08"]="August";
month_name["09"]="September";
month_name["10"]="October";
month_name["11"]="November";
month_name["12"]="December";

if (x != "") { month = month_name[x]; }
else { month=""; }

return month;
}
  function GetDay(intDay){
    var DayArray = new Array("Sun", "Mon", "Tue", "Wed", 
                         "Thu", "Fri", "Sat")
    return DayArray[intDay]
    }

  function GetMonth(intMonth){
    var MonthArray = new Array("Jan", "Feb", "Mar",
                               "Apr", "May", "Jun",
                               "Jul", "Aug", "Sep",
                               "Oct", "Nov", "Dec") 
    return MonthArray[intMonth] 	  	 
    }
  function getDateStrWithDOW(){
    var today = new Date()
    var year = today.getYear()
    if(year<1000) year+=1900
    var todayStr = GetDay(today.getDay()) + ", "
    todayStr += GetMonth(today.getMonth()) + " " + today.getDate()
    todayStr += ", " + year
    return todayStr
    }
// BEGIN FORM VALIDITY SCRIPT

// Check for proper e-mail address format
function isEmail(elm) {
    if (elm.value.indexOf("@") != "-1" &&
        elm.value.indexOf(".") != "-1" &&
        elm.value != "")
    return true;
    else return false;
}
// Check for proper e-mail address domain
function isEmailGov(elm) {
    if (elm.value.indexOf(".gov") != "-1" &&
        elm.value != "")
    return false;
    else return true;
}
// Check for no null field and an integer
function isNumber(elm) {
    var elmstr = elm.value + "";
    if (elmstr.length == 0) return false;
    for (var i = 0; i < elmstr.length; i++) {
        if (elmstr.charAt(i) < "0" || elmstr.charAt(i) > "9") return false;
    }
return true;
}
// Check for proper zip code format
function isZipCode(elm) {
var elmstr = elm.value + "";
    if ((elmstr.length != 5) && (elmstr.length != 10)) { return false }
    for (i=0; i < elmstr.length; i++) {
        if ((elmstr.length == 10) && (i == 5)) {
        if (elmstr.charAt(i) != "-") { return false }
    } else {
        if ((elmstr.charAt(i) < "0") || (elmstr.charAt(i) > "9")) { return false }
        }
    }
return true;
}
// Check for null and empty fields
function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null)
    return false;
    else return true;
}
// Check for unselected pull-down menus
function isPulledDown(elm) {
    if (elm.selectedIndex == "" ||
        elm.selectedIndex == null ||
        elm.selectedIndex == "null")
    return false;
    else return true;
}
// Check for unchecked radio group
function isOneChecked(elm) {
  var counter;
  for (counter = 0; counter < elm.length; counter++) {
    if (elm[counter].checked) {
      return true; 
    }
  }
  return false;
}

// -->

// added by AJK to handle voter registration pop outs
var newwindow;
function voter_pop(url)
{
	newwindow=window.open(url,'name','width=658,height=500,scrollbars=yes,resizable=yes,location=yes');
	if (window.focus) {newwindow.focus()}
}







