//This changes an image's path to the one given by newImagePath.
//The image must be given as an object in imageObj, which you can
//do from the image itself by attaching events and passing 'this',
//with no quotes.
//The value of newImagePath is relative to the images directory.
function SwapImage(imageObj, newImagePath)
{
	imageObj.src = "images/" + newImagePath;
}

//Example: WriteNamedEmailLink("John Smith", "johnsmith", "gmail.com")
function WriteNamedEmailLink(linkText, emailAddressName, emailAddressDomain)
{
    document.write("<a class=\"email\" href=\"mailto:" + emailAddressName + "@" + emailAddressDomain + "\">" + linkText + "</a>");
}

//Example: WriteEmailLink("johnsmith", "gmail.com")
function WriteEmailLink(emailAddressName, emailAddressDomain)
{
    document.write("<a class=\"email\" href=\"mailto:" + emailAddressName + "@" + emailAddressDomain + "\">" + emailAddressName + "@" + emailAddressDomain + "</a>");
}

//When the user clicks on the JPG preview of the YouTube video,
//in the side pane, it will be replaced with this code, which is
//an auto-playing YouTube video player.
function ShortPSAHTMLReplace()
{
    document.getElementById("Layout_RightPane_ShortPSA").innerHTML
        = "<object width=\"160\" height=\"124\"><param name=\"movie\" value=\"http://www.youtube.com/v/PscSBTPGeN8&hl=en&fs=1&rel=0&color1=0xFEBB1D&color2=0xFFCA65&border=1&autoplay=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/PscSBTPGeN8&hl=en&fs=1&rel=0&color1=0xFEBB1D&color2=0xFFCA65&border=1&autoplay=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"160\" height=\"124\"></embed></object><div class=\"otherVideoLink\"><a href=\"http://www.youtube.com/watch?v=I_gpspoeLXI\">Also view our full<br>Campaign Video</a></div>";
}

//When the user clicks on the JPG preview of the longer YouTube
//video, it will be replaced with this code, which is an auto-
//playing YouTube video player
function LongPSAHTMLReplace()
{
    document.getElementById("LongPSAParagraph").innerHTML
        = "View our full-length opening campaign video:<br><object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/I_gpspoeLXI&hl=en&fs=1&rel=0&color1=0xB5D6F1&color2=0xD4E6F5&autoplay=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/I_gpspoeLXI&hl=en&fs=1&rel=0&color1=0xB5D6F1&color2=0xD4E6F5&autoplay=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>";
}

function JWindow(loc, wid, hei) {
  window.open(loc, "CMACNewWindow" + Math.round(Math.random()*1000), "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=" + wid + ",height=" + hei);
}

