function presentFlash(flashSource, bgColor, width, height, wmode, flashVars) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+ width +'" height="'+ height +'" id="'+ flashSource +'" align="middle">');
	document.write('<param name="allowScriptAccess" value="always">');
	document.write('<param name="movie" value="/images/'+ flashSource +'.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="'+ bgColor +'">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="wmode" value="'+ wmode +'">');
	document.write('<param name="flashvars" value="'+ flashVars +'">');
	document.write('<embed src="/images/'+ flashSource +'.swf" flashvars="'+ flashVars +'" menu="false" wmode="'+ wmode +'" quality="high" bgcolor="'+ bgColor +'" width="'+ width +'" height="'+ height +'" name="'+ flashSource +'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer">');
	document.write('</object>');
}

function resizeDiv(divID, newHeight) {
  if (document.all) {
    document.all[divID].style.height = newHeight+"px";
  } else if (document.getElementById) {
    document.getElementById(divID).style.height = newHeight+"px";
  }
}


function contentResize() {
  if (document.all) {
    document.all.content.style.height = document.body.clientHeight+"px";
  } else if (document.getElementById) {
    document.getElementById('content').style.height = window.innerHeight+"px";
  }
}

window.onresize = contentResize;

newsletterO=new Image;
newsletterO.src="/images/newsletterO.png"
loginO=new Image;
loginO.src="/images/loginO.png"
aboutO=new Image;
aboutO.src="/images/aboutO.png"
corporateO=new Image;
corporateO.src="/images/corporateO.png"
resourcesO=new Image;
resourcesO.src="/images/resourcesO.png"
storeO=new Image;
storeO.src="/images/storeO.png"
faqO=new Image;
faqO.src="/images/faqO.png"
contactO=new Image;
contactO.src="/images/contactO.png"
sevenReasonsO=new Image;
sevenReasonsO.src="/images/sevenReasonsO.png"
saveMoneyO=new Image;
saveMoneyO.src="/images/saveMoneyO.png"
closeO=new Image;
closeO.src="/images/closeO.png"
daytimeVideoO=new Image;
daytimeVideoO.src="/images/daytimeVideoO.png"

newsletter=new Image;
newsletter.src="/images/newsletter.png"
login=new Image;
login.src="/images/login.png"
about=new Image;
about.src="/images/about.png"
corporate=new Image;
corporate.src="/images/corporate.png"
resources=new Image;
resources.src="/images/resources.png"
store=new Image;
store.src="/images/store.png"
faq=new Image;
faq.src="/images/faq.png"
contact=new Image;
contact.src="/images/contact.png"
sevenReasons=new Image;
sevenReasons.src="/images/sevenReasons.png"
saveMoney=new Image;
saveMoney.src="/images/saveMoney.png"
closer=new Image;
closer.src="/images/close.png"
daytimeVideo=new Image;
daytimeVideo.src="/images/daytimeVideo.png"


function hiLight(imgName,imgNewImage) {
  document.images[imgName].src = eval(imgNewImage + ".src");
}

var t = new Array();
var direction = new Array();
var maxHeight = new Array();
var timer = new Array();

function toggleContent(content) {
	if (document.getElementById(content)){
		t[content] = 0;
		if (document.getElementById(content).style.display == 'none') {
			direction[content] = 'down';
			document.getElementById(content).style.display = 'block';
			maxHeight[content] = document.getElementById(content).offsetHeight;
			document.getElementById(content).style.height = '1px';
			document.images[content+'Arrow'].src = '/images/arrowOpen.png';
			timer[content] = setInterval('slideTick("'+content+'" ,"'+maxHeight[content]+'", "'+direction[content]+'");', 5);
		} else {
			direction[content] = 'up';
			document.images[content+'Arrow'].src = '/images/arrowClosed.png';
			timer[content] = setInterval('slideTick("'+content+'");', 5);
		}
	}
}

function slideTick(content) {
	t[content] ++;
	if (t[content] > 20) {
		t[content] = 0;
		clearInterval(timer[content]);
		if (direction[content] == 'up') {
			document.getElementById(content).style.display = 'none';
			document.getElementById(content).style.height = maxHeight[content]+'px';
		}
	} else {
		if (direction[content] == 'down') {
			document.getElementById(content).style.height = Math.round(parseInt(t[content])/20*parseInt(maxHeight[content]))+'px';
		} else {
			document.getElementById(content).style.height = Math.round((20-parseInt(t[content]))/20*parseInt(maxHeight[content]))+'px';
		}
	}
}

window.onload = function() {
	if (window.location.hash.replace(/#/g,'') != '') {
		toggleContent(window.location.hash.replace(/#/g,''));
	}
}