var isNav6, isIE4;
var isOpera = true;
var isNavigator = true;
var isExplorer = true;
var supportsGetElementById = false;
var agt="";
var is_major = 1;
var is_minor = 1;
var is_nav  = false;
var is_nav4orlower = false;

// if (document.all && window.attachEvent)
// 	window.attachEvent("onload", fixWinIE);

// function fixWinIE() {
//       if (document.body.scrollHeight && document.all.content.style)
// 	{
//                 document.all.content.style.display = 'block';
// 	}
// }


function stdStatus()
{
    window.status = "Super Natural Woman";
    return true;
}

// for all pages but first page... (that code is on page itself)

function validateThisPage()
{
	document.write('<span class="fine"><a  target="_blank" title="Check page against XHTML 1.0 Transitional standards, not yet certified" href="http://validator.w3.org/check/referer">Validate page code (W3)</a></span> &nbsp; &nbsp; ');
}

function validateThisPageBrief()
{
	// include page validation
	document.write('<a  target="_blank" title="Check page against XHTML 1.0 Transitional standards, not yet certified" href="http://validator.w3.org/check/referer"><span style="color: #2175bc">&Dagger;</span></a>');
}

function drawHomePageValidate()
{
	document.write(' <a target="_blank" title="Check page against XHTML 1.0 Transitional standards, not yet certified" href="http://validator.w3.org/check/referer"><span style="color: #2175bc">&Dagger;</span></a>');
}


// POP UP A PREFORMATTED EMAIL MESSAGE WINDOW
function emailThisPage() {
  var to = "";
  var body = document.location.href
  var doc = "mailto:" + to + "?" +
      "body=" + escape(body); 
  window.location.href = doc;
}

// javascript:emailThisPage();

function addEmailButton()
{
  extraInfo = '';
  if (isExplorer)
    extraInfo = 'style="border:1px #2175bc solid;" myrolloverstyle="border:1px #FFD700 solid;" onmouseover="rollIn(this)" onmouseout="rollOut(this)"';

  document.write('<a href="javascript:emailThisPage();"><img src="email6.gif" width=20 height=14 alt="Email this page" title="Email this page" border=0 '+extraInfo+' /></a>');
}

function addLanguage(url,lp,flag,language)
{
  // urltrurl for frameless, tr for framed translation
  if (lp == 'en_en')
	transUrl = url;
  else
	transUrl = 'http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url='+url+'&lp='+lp;
  document.write('&nbsp;<a href="'+transUrl+'"><img src="'+flag+'" alt="'+language+'" title="'+language+'" width=20 height=14 border=0 /></a>');

}

function getRawDocUrl()
{
  docUrl = document.location.href;
  if (docUrl.indexOf("file") != -1)
	docUrl = "http://www.supernaturalwoman.com"; // offline testing

  isBabel = docUrl.indexOf("babel") != -1;
  if (isBabel)
	docUrl = babelOrigUrl;
  return docUrl;
}

function addTranslationControls()
{
  docUrl = getRawDocUrl();

  if (true)
  {
    addLanguage(docUrl,'en_en','en_flag.gif','Show in original English');
    addLanguage(docUrl,'en_fr','fr_flag.gif','Translate to French (AltaVista Babelfish)');
    addLanguage(docUrl,'en_de','de_flag.gif','Translate to German (AltaVista Babelfish)');
//    addLanguage(docUrl,'en_it','it_flag.gif','Translate to Italian (AltaVista Babelfish)');
    addLanguage(docUrl,'en_es','sp_flag.gif','Translate to Spanish (AltaVista Babelfish)');
  }
}

function addTranslateText()
{
  docUrl = getRawDocUrl();
  document.write('<a href="http://babelfish.altavista.com/babelfish/tr?tt=url&url='+docUrl+'" target="_blank">Translate</a>');
}

function hideNavMenu()
{
	if (supportsGetElementById)
	{
	 	var targetElement = document.getElementById("showmenu");
		if (targetElement)
	 		targetElement.style.display = '';
	}
	setActiveStyleSheet('hidemenu');
	return false;
}

function showNavMenu()
{
	if (supportsGetElementById)
	{
	 	var targetElement = document.getElementById("showmenu");
		if (targetElement)
		targetElement.style.display = 'none';
	}
	setActiveStyleSheet('default');
	return false;
}

function drawHideMenu()
{
  setBrowserSniffer();
  if (isExplorer)
	document.write('<div id="hidemenu"><a onclick="hideNavMenu();"><img src="closebtn5.gif" alt="Hide Menu" title="Hide Menu" myrolloverstyle="background-color: #FFD700" onmouseover="rollIn(this)" onmouseout="rollOut(this)" border=0 /></a></div>');
}

function drawShowMenu()
{
  setBrowserSniffer();
  if (isExplorer && !is_nav4orlower)
	document.write('<div id="showmenu" style="display: none;">&nbsp;&lt;&lt;&nbsp;<a href="'+document.location.href+'" onclick="showNavMenu();">Show Menu</a>&nbsp;</div>');
}


function setBrowserSniffer()
{
	if (false)
		isExplorer = true;
	else
	{
//	document.write('sniffer<br>');
//	document.write('!'+navigator.appVersion + '<br>');
//	document.write('@'+navigator.userAgent + '<br>'); // userAgent
//	document.write('#'+navigator.appVersion + '<br>');
	isOpera =	  navigator.userAgent.indexOf("Opera") != -1;
	isNavigator = navigator.appName.indexOf("Netscape") != -1;
	isExplorer = (navigator.appName.indexOf("Explorer") != -1) && (!isOpera) && (!isNavigator);
	if (document.getElementById)
		supportsGetElementById = true;

	if (document.all)
		isIE4 = true;
	else if (document.getElementById)
		isNav6 = true;


	agt=navigator.userAgent.toLowerCase();
	is_major = parseInt(navigator.appVersion);
	is_minor = parseFloat(navigator.appVersion);

	is_nav  = ((agt.indexOf('mozilla')!=-1)
            && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1)
            && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1));

	is_nav4orlower = (is_nav && (is_major <= 4));
	}

}

function textSizeCtrlHome()
{
  setBrowserSniffer();
  if (true)
  {
	document.write('<span style="font-size:10pt">Text Size: </span><a href="#" onclick="setActiveStyleSheet(\'smalltype\'); return false;"><span style="font-size:10pt">A</span></a> <a href="#" onclick="setActiveStyleSheet(\'default\'); return false;"><span style="font-size:12pt">A</span></a> <a href="#" onclick="setActiveStyleSheet(\'bigtype\'); return false;"><span style="font-size:14pt">A</span></a>');
  }
}

function skinStyleSelector()
{
  setBrowserSniffer();
  if (isExplorer)
  {
	document.write('<br /><span style="font-size:10pt">Skin: </span><a href="#" onclick="setActiveStyleSheet(\'default\'); return false;">New</a> <a href="#" onclick="setActiveStyleSheet(\'goldmenu\'); return false;">Old</a>');
  }
}

function addSNWFavorite()
{
  if(isIE4 && isExplorer)
  {
	var url="http://www.SuperNaturalWoman.com/";
	var title="SuperNaturalWoman.com";
	external.AddFavorite(url, title);
  }
}

function addFavoriteBtn()
{
  if(isIE4 && isExplorer)
  {
	instr = "Add SuperNaturalWoman to your favorites!";
	document.write('<br /><a href="#" onclick="javascript:addSNWFavorite(); return true;"><img src="favorites.gif" alt="'+instr+'" title="'+instr+'" width=18 height=14 border=0></a>');
  }
}


function drawHomePageControls()
{
	setBrowserSniffer();
	textSizeCtrlHome();
	drawHomePageValidate();
//	skinStyleSelector();
	document.write('<br /><div style="margin-top: 5px;">');
      document.write('<div class="flagborder">');
	addEmailButton();
	addTranslationControls();
	document.write('</div>');
	document.write('</div>');
//	addFavoriteBtn();
}


function pageCtrlsTop()
{
	setBrowserSniffer();
}

function pageCtrlsBottom()
{
	setBrowserSniffer();
	if (!is_nav4orlower)
	{
		document.write('<div style="margin-top: 7px;">');
	      document.write('<div class="flagborder">');
		addEmailButton();
		addTranslationControls();
		document.write('</div>');
		document.write('&nbsp;');
		validateThisPageBrief();
		document.write('<br clear="all" /><div></div></div>');
	}
}

function contentPageBelowNav()
{
	setBrowserSniffer();
	if (!is_nav4orlower)
	{
		document.write('<br><center><a href="store.htm">');
		document.write('<img src="patio_yoga_easy_1 small.jpg" width=137 height=171 border=1>');
		document.write('<br><font color="white">Poster of the Week</font></a></center>'); // Buy Now
	}
}


function rollIn(el)
{
//	var ms = navigator.appVersion.indexOf("MSIE")
//	ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
	if(isIE4 && isExplorer)
	{
		el.initstyle=el.style.cssText;
		el.style.cssText=el.myrolloverstyle;
	}
}

function rollOut(el)
{
	if(isIE4 && isExplorer)
		el.style.cssText=el.initstyle
}

function articleImgRollIn(object)
{
	object.filters.alpha.opacity=100;
}

function articleImgRollOut(object)
{
	object.filters.alpha.opacity=25;
}

function open_popup(page,title,width,height) {
//		window.open(page);
	params = 'menubar=yes,width=' + width + ',height=' + height;
//	params = 'width=200,height=200';
	window.open(page,title,params);
	return false;
}

function open_bdayparty(page,title) {
	return open_popup(page,title,400,450);
}


function switchMainImage(imageName) {
    if (document.images)
        document.mainimage.src = imageName;
}



