// Javascript functions for ScrapSayings.com

// on .com or on .info?
var myloc = "x" + document.location;
var oncom = false;
if(myloc.toLowerCase().indexOf("scrapsayings.com") >= 0)
oncom = true;

var oninfo = false;
if(myloc.toLowerCase().indexOf("scrapsayings.info") >= 0)
oninfo = true;

// login prefix
var lgp = "???";

if(oninfo) {
// grab log prefix from cookie
var cook = document.cookie.split(";");
for(var i=0; i<cook.length; ++i) {
var crumb = cook[i].split("=", 2);
crumb[0] = crumb[0].replace(/^ */, "");
if(crumb[0] != "lgp") continue;
lgp = crumb[1];
break;
}
}

function adBlue()
{
if(!oncom) return;
google_ad_client = "pub-8142127721329304";
/* scrap ads-leader */
google_ad_slot = "1741895615";
google_ad_width = 728;
google_ad_height = 90;
document.writeln("<center><P>Custom Links:<br>");
document.writeln('<scri' + 'pt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
document.writeln('</scri' + 'pt>');
document.writeln('</P></center>');
}

function adWhite()
{
if(!oncom) return;
google_ad_client = "pub-8142127721329304";
/* scrapads-p */
google_ad_slot = "8172973639";
google_ad_width = 728;
google_ad_height = 90;
document.writeln("<center><P>Custom Links:<br>");
document.writeln('<scri' + 'pt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
document.writeln('</scri' + 'pt>');
document.writeln('</P></center>');
}

function linkBlue()
{
if(!oncom) return;
google_ad_client = "pub-8142127721329304";
/* scrap-link cube200 */
google_ad_slot = "9967186690";
google_ad_width = 200;
google_ad_height = 90;
document.writeln("<center><P>Custom Links:<br>");
document.writeln('<scri' + 'pt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
document.writeln('</scri' + 'pt>');
document.writeln('</P></center>');
}

function addToFavorites(url, desc)
{
url = "http://www.scrapsayings.com/" + url;
desc = "ScrapSayings, " + desc;
if (window.external) {
window.external.AddFavorite(url,desc) ;
} else {
alert("Sorry - your browser doesn't support this function.  You will need to bookmark this site manually."  +
"Add this page to favorites, then edit the entry, so that the description reads`" +
desc + "'.");
}
}

function bookThis(explain, url, desc)
{
document.writeln("<P>If you " + explain +
", you may want to <a href=javascript:addToFavorites('" +
url + "','" + desc +"')>Bookmark this particular Page</A>.</P>");
}

// nothing but the ad in the header
function showHeader()
{
if(oninfo)
document.writeln("<P class=login>Logged in as " + lgp + "");

if(oncom) {
var d = new Date();
var ds = d.getSeconds() % 10;
if(ds == 77) {
document.writeln("<P><table class=loginsay border=5 width=80% cellspacing=0 cellpadding=7><tr><td>");
document.writeln("This site contains third party ads;");
document.writeln("for a commercial free version of this website, please visit");
document.writeln("<A href=http://www.scrapsayings.info/d/login.html>ScrapSayings.info</A>.&nbsp; Thank you.");
document.writeln("</td></tr></table>");
} else {
adBlue();
}
}
}

function showFooter(backpage, backwords)
{
if(backpage.substr(0,4) == "say-") {
adBlue();
}

document.writeln('<P><A href="' + backpage +
'.htm">Back</A> to the ' +
backwords +
', or <A href="/index.htm">return</A> to the ScrapSayings.com home page. </P>');

if(backpage.substr(0,4) == "say-") {
document.writeln('<P class=copy>Copyright &copy; 2002-2010 Wendy Dahlke ');
}
}
