function swapSectionVisibility(mainId, assocId) {
	if (document.getElementById(mainId).style.display == "none") {
		document.getElementById(mainId).style.display = "block";
		document.getElementById(assocId).style.display = "none";
	} else {
		document.getElementById(mainId).style.display = "none";
		document.getElementById(assocId).style.display = "block";
	}
}

function showSectionAndHideLink(targetSeccionId, linkId) {
	document.getElementById(linkId).style.display = "none";
	document.getElementById(targetSeccionId).style.display = "block";
}

function toggleSectionAndLink(sectionId, linkId) {
	if (document.getElementById(sectionId).style.display == "none") {
		document.getElementById(sectionId).style.display = "block";
		document.getElementById(linkId).style.display = "none";
	} else {
		document.getElementById(sectionId).style.display = "none";
		document.getElementById(linkId).style.display = "block";
	}
}

function toggleSectionVisibility(id) {
	if (document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
	} else {
		document.getElementById(id).style.display = "none";
	}
}

function hideSection(id) {
	document.getElementById(id).style.display = "none";
}

function showSection(id) {
	document.getElementById(id).style.display = "block";
}
// @name      The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version   1.0-RC1
// @author    Adam Michela

var Fat = {
	make_hex : function (r,g,b) 
	{
		r = r.toString(16); if (r.length == 1) r = '0' + r;
		g = g.toString(16); if (g.length == 1) g = '0' + g;
		b = b.toString(16); if (b.length == 1) b = '0' + b;
		return "#" + r + g + b;
	},
	fade_all : function ()
	{
		var a = document.getElementsByTagName("*");
		for (var i = 0; i < a.length; i++) 
		{
			var o = a[i];
			var r = /fade-?(\w{3,6})?/.exec(o.className);
			if (r)
			{
				if (!r[1]) r[1] = "";
				if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
			}
		}
	},
	fade_element : function (id, fps, duration, from, to) 
	{
		if (!fps) fps = 30;
		if (!duration) duration = 3000;
		if (!from || from=="#") from = "#FFFF33";
		if (!to) to = this.get_bgcolor(id);
		
		var frames = Math.round(fps * (duration / 1000));
		var interval = duration / frames;
		var delay = interval;
		var frame = 0;
		
		if (from.length < 7) from += from.substr(1,3);
		if (to.length < 7) to += to.substr(1,3);
		
		var rf = parseInt(from.substr(1,2),16);
		var gf = parseInt(from.substr(3,2),16);
		var bf = parseInt(from.substr(5,2),16);
		var rt = parseInt(to.substr(1,2),16);
		var gt = parseInt(to.substr(3,2),16);
		var bt = parseInt(to.substr(5,2),16);
		
		var r,g,b,h;
		while (frame < frames)
		{
			r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
			g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
			b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
			h = this.make_hex(r,g,b);
		
			setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);

			frame++;
			delay = interval * frame; 
		}
		setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
	},
	set_bgcolor : function (id, c)
	{
		var o = document.getElementById(id);
		o.style.backgroundColor = c;
	},
	get_bgcolor : function (id)
	{
		var o = document.getElementById(id);
		while(o)
		{
			var c;
			if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
			if (o.currentStyle) c = o.currentStyle.backgroundColor;
			if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
			o = o.parentNode;
		}
		if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
		var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
		if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
		return c;
	}
}
function checkEmail(myForm) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email_from.value)){
		return true
	}
	alert("Invalid E-mail Address! Please re-enter.")
	return false
}
// Copyright 2002 by Ray Stott, One Time Pop-up Windows Script ver 1.0
// OK to use if this copyright is included
// Script is available at http://www.crays.com/jsc          

var oneTimeWinName = "oneTimePop"
    
function openPopWinOnce(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
   var d_winLeft = 20  // default, pixels from screen left to window left
   var d_winTop = 20   // default, pixels from screen top to window top
   var popcookies = document.cookie

   if (openPopWinOnce.arguments.length >= 4)  // any additional features? 
      winFeatures = "," + winFeatures
   else 
      winFeatures = ""
       
   if (openPopWinOnce.arguments.length == 6)  // location specified
      winFeatures += getLocationOne(winWidth, winHeight, winLeft, winTop)
   else
      winFeatures += getLocationOne(winWidth, winHeight, d_winLeft, d_winTop)
   if (popcookies.indexOf(oneTimeWinName) == -1){ // cookie not found 
      window.open(winURL, oneTimeWinName, "width=" + winWidth 
          + ",height=" + winHeight + winFeatures)
      document.cookie=oneTimeWinName+"=used"
   }
}
   
function openPopWinOnceBack(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
   openPopWinOnce(winURL, winWidth, winHeight, winFeatures, winLeft, winTop)
   self.focus()
}
   
function getLocationOne(winWidth, winHeight, winLeft, winTop){
   try {
      var winLocation = ""
      
      if (winLeft < 0)
         winLeft = screen.width - winWidth + winLeft
      if (winTop < 0)
         winTop = screen.height - winHeight + winTop
      if (winTop == "cen")
         winTop = (screen.height - winHeight)/2 - 20
      if (winLeft == "cen")
         winLeft = (screen.width - winWidth)/2
      if (winLeft>0 & winTop>0)
         winLocation =  ",screenX=" + winLeft + ",left=" + winLeft   
                  + ",screenY=" + winTop + ",top=" + winTop
      else
         winLocation = ""
      return winLocation
   } catch(e) {
      return ""
   }
}

// END One Time Pop-up Windows Script=========================================

window.onload = function () {
	var dbg = false;
	openPopWinOnce('http://www.tdwcloseouts.com/popup.html', 200, 300)
	if (dbg == true) {
		alert ("OK")
	}
	Fat.fade_all()
}

