// Copyright Acro Media Inc. 1998-2006, www.acromediainc.com


var newWin;
var popup = {
	newWin : null,
	open : function( pArgs ){return this.named( pArgs.url, pArgs.w, pArgs.h, pArgs.y, pArgs.x, pArgs.scroll, pArgs.resize, pArgs.name, pArgs.pos, pArgs.tool, pArgs.menu );},
	named : function(url, width, height, top, left, scroll, resize, name, position, tool, menu){
		if(!scroll) scroll = "no";
		if(!resize) resize = "no";
		if(!name) name = "popup";
		if(!width || !height){
			if(!scroll)	scroll = "yes";
			if(!resize) resize = "yes";
		}
		if(!width) width = screen.availWidth;
		if(!height) height = screen.availHeight;
		if(!top || top == "center") top = (screen.availHeight / 2 - height / 2);
		if(!left || left == "center") left = (screen.availWidth / 2 - width / 2);

		newWin = window.open(url,name,"toolbar="+tool+",menubar="+menu+",width="+width+",height="+height+",top="+top+",left="+left+",scrollbars="+scroll+",resizable="+resize);
		(position == "behind") ? setTimeout('newWin.blur();',100) : setTimeout('newWin.focus();',100);
	}
}



var copyrightYear = {
	init: function(){
		if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = new Date().getFullYear();
	}
}

var externalLinks = {
	init: function(){
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") anchors[i].target = "_blank";
		}
	}
}


//Checks to see if safari is on, boolean
var detect = navigator.userAgent.toLowerCase();
var safStatus,thestring;
function checkSafari(){	
	if (checkIt('safari')) safStatus = true;
	else safStatus = false;
	function checkIt(string){
		place = detect.indexOf(string) + 1;
		return place;
	}
}

// Grabs a random quote/story for the side nav of every page.
function getStory() {
	var story = new Array(10)
	var storyBox = document.getElementById('storyBox');
   var rand = 1+Math.round(Math.random()*10);
	story[0] = '<p>Michele,<br />I have many times nearly written to you to tell you of my success thanks to you. Sometimes, though, I wondered if things would go wrong again. Now I feel confident enough to tell you my good news&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Chris,<br />Tampa, Florida</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[1] = '<p>Michele,<br />I just want to let you know what a great job my coach did after my wife left me and planned to get divorced&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Morgan,<br />San Francisco, CA</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a>'
	story[2] = '<p>Having no progress, I called and spoke with a Divorce Busting Coach. In just two phone sessions she gave me more practical, useful problem solving techniques and advice than 6 hours of face-to-face therapy&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Terry,<br />Birmingham, Alabama</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[3] = '<p>The coach I spoke to helped me realize that my situation wasn&lsquo;t as hopeless as I had thought and that there really were some things I could do right away to show my husband that our marriage could be saved&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Loren<br />Milwaukee, Wisconsin</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[4] = '<p>I had a very good session with my Divorce Busting Coach. He was extremely helpful. When I called him, my thoughts were scattered and foggy. He helped me start thinking more clearly and got me going in the right direction&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Abigail, <br />London, England</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[5] = '<p>The tips and resources were invaluable. The session was worth 10 times the cost. I can&lsquo;t thank you and Michele Weiner-Davis, enough for saving myself and my girlfriend from the pain of potential future needless conflicts&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Michael T.<br />Walker</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[6] = '<p>My consultation with my coach was fantastic. He went a long way to make me feel like I&lsquo;m on track with Divorce Busting. He answered a lot of questions about communication, thought-stopping, and being more authentically who I am. He reminded me that letting my husband see me laugh is important&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Martha, <br />Ontario, Canada</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[7] = '<p>If it wasn&lsquo;t for Michele&lsquo;s book and website recommendations to read everything I could, I&lsquo;d never survive&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Diane</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[8] = '<p>Honestly, I would highly recommend a Divorce Busting Coach if anyone is feeling like they&lsquo;re flailing around and not sure what to do next. Not to sound like an infomercial, but both times I&lsquo;ve talked with him I&lsquo;ve felt a million times stronger and more centered&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Scott,<br />Washington, DC</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[9] = '<p>I have never talked to Michele, but if her coaches are this good she must be Scary good!!! I am thankful to have found Divorce Busting and I am especially thankful to have found Dotty, my coach&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Hector</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[10] = '<p>In her coaching, Laurie used her bright personality and insight to re-focus me on goal oriented approaches and I believe she helped position me so that there is the best possible change of success for the outcome of my marriage&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Meredith,<br />Chicago, Illinois</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[11] = '<p>My wife and I are getting back together, her words even! She actually said, "So and so said they are so happy we are getting back together!"&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Pat,<br />New York, NY</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>'
	story[12] = '<p>I had a great conversation with Laurie this morning. I encourage you all who haven&lsquo;t yet decided to make that step to call for coaching - to just do it - you won&lsquo;t regret it!<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Joe,<br />Ft. Lauderdale, Florida</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>';
	story[13] = '<p>I just wanted to let you know what a wonderful consultation I just had with Dotty. She is a life (marriage) saver!!  She helped me to see that there is definitely hope for my marriage and that my husband is clearly in a midlife crisis&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Kris,<br />Lawrence, Kansas</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>';
	story[14] = '<p>While I never mentioned Divorce Busting specifically, the attorney remarked that whoever was advising me was giving me tremendous advice and probably represented my best hope for saving the marriage&hellip;<img src="../graphics/quote_right.gif" alt="" height="9" width="11" /><span>Ronnie,<br />Atlanta, Georgia</span><br /><a href="http://www.divorcebusting.com/success_stories.htm">Read more</a></p>';
	if(storyBox) {
		storyBox.innerHTML = story[rand];
	}
	else {
		return false;
	}
}

// Grabs a random picture for the side nav of every page.
function getBGPicture() {
	var sbPicture = new Array(10)
	var successContent = document.getElementById('successContent');
   var rand = 1+Math.round(Math.random()*10);
	sbPicture[0] = 'url(graphics/bg_success_stories.jpg) 100% 100% no-repeat';
	if(successContent) {
		successContent.style.background = sbPicture[0];
	}
	else {
		return false;
	}
}


window.onload = init;
function init(){
	checkSafari();
	copyrightYear.init();
	externalLinks.init();

if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"body h1", sWmode:"true", sFlashSrc:"century.swf", sColor:"#850000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:12, sFlashVars:"textalign=left"}));
	};
}
