
var hasCreditsLoaded = false;

function goOnLoad() {
// start ajax content shifting
if (hasAjax) goContentLoop();
}

function rotateCenterImageAndCaption() {
// start ajax.  Ajax will insert the urls
goAjaxCenterImageAndCaption();
// repeat
setTimeout("rotateCenterImageAndCaption();", Math.floor(Math.random()*rotateTimeoutMin) +rotateTimeoutMax);
}

function moflags(what, color) {
changeborder(what, color);
}

function changeborder(what, color) {
document.getElementById(what).style.border = "solid 1px "+color;
}

function popPrintFront() {
// determine the card's content
var topimage     = document.getElementById("imgTop").src;
topimage         = topimage.substr(topimage.lastIndexOf("/")+1);
var leftimage    = document.getElementById("imgLeft").src;
leftimage        = leftimage.substr(leftimage.lastIndexOf("/")+1);
var centerimage  = document.getElementById("imgCenter").src;
centerimage      = centerimage.substr(centerimage.lastIndexOf("/")+1);
var rightimage   = document.getElementById("imgRight").src;
rightimage       = rightimage.substr(rightimage.lastIndexOf("/")+1);
var captionimage = document.getElementById("imgCaption").src;
captionimage     = captionimage.substr(captionimage.lastIndexOf("/")+1);
var bottomimage  = document.getElementById("imgBottom").src;
bottomimage      = bottomimage.substr(bottomimage.lastIndexOf("/")+1);
// create url
var url = cardurl+'?countriesid='+countriesid+'&languagesid='+languagesid+'&top='+topimage+'&left='+leftimage+'&center='+centerimage+'&right='+rightimage+'&caption='+captionimage+'&bottom='+bottomimage;
// open window
window.open(url, "PrintPage", "menubar=yes,toolbar=no,resizable=yes,status=no,scrollbars=no,location=no,width=450,height=520");
}

function popPrintBack() {
// determine the card's content
var localFileName  = window.frames['iframeRss'].localFileName;
var localMyField   = window.frames['iframeRss'].localMyField;
var localMyValue   = window.frames['iframeRss'].localMyValue;
var contentNum     = window.frames['iframeRss'].contentNum;
var titleimage     = document.getElementById("imgTitle").src;
titleimage         = titleimage.substr(titleimage.lastIndexOf("/")+1);
var rcountryimage  = document.getElementById("imgRCountry").src;
rcountryimage      = rcountryimage.substr(rcountryimage.lastIndexOf("/")+1);
// create url
var url = cardurl+'?countriesid='+countriesid+'&languagesid='+languagesid+'&title='+titleimage+'&rcountry='+rcountryimage+'&localFileName='+localFileName+'&localMyField='+localMyField+'&localMyValue='+localMyValue+'&contentNum='+contentNum;
// open window
window.open(url, "PrintPage", "menubar=yes,toolbar=no,resizable=yes,status=no,scrollbars=no,location=no,width=450,height=520");
}

function ajaxAboutThisProject() {
document.getElementById("divCreditsOuter").style.visibility = "visible";
document.getElementById("linkPrintCardLeft").style.visibility = "hidden";
document.getElementById("linkPrintCardRight").style.visibility = "hidden";
document.getElementById("tdLanguageOptions").style.visibility = "hidden";
document.getElementById("linkAboutThisProject").style.visibility = "hidden";
document.getElementById("spanProjectHome").style.visibility = "hidden";
if (window.frames[0].document.getElementById("objectVideo1")) window.frames[0].document.getElementById("objectVideo1").style.visibility = "hidden";
if (window.frames[0].document.getElementById("objectVideo1")) window.frames[0].document.getElementById("objectVideo2").style.visibility = "hidden";
if (!hasCreditsLoaded) goAjaxCredits();
}

function resetCard() {
document.getElementById("linkPrintCardLeft").style.visibility = "visible";
document.getElementById("linkPrintCardRight").style.visibility = "visible";
document.getElementById("tdLanguageOptions").style.visibility = "visible";
document.getElementById("linkAboutThisProject").style.visibility = "visible";
document.getElementById("spanProjectHome").style.visibility = "visible";
document.getElementById("divCreditsOuter").style.visibility = "hidden";
if (window.frames[0].document.getElementById("objectVideo1")) window.frames[0].document.getElementById("objectVideo1").style.visibility = "visible";
if (window.frames[0].document.getElementById("objectVideo1")) window.frames[0].document.getElementById("objectVideo2").style.visibility = "visible";
}

function popAboutThisProject() {
window.open('ajaxCredits.php?ajax=no', "AboutThisProject", "menubar=yes,toolbar=no,resizable=yes,status=no,scrollbars=yes,location=no,width=390,height=520");
}