function setCaret () {
	if ($('.menu ul li.active').hasClass('item0')) {
		showCarat('about');
	}
	if ($('.menu ul li.active').hasClass('item1')) {
		showCarat('befaft');
	}
	if ($('.menu ul li.active').hasClass('item2')) {
		showCarat('testimonials');
	}
}


// what about leading/trailing/spaces?
// what about long-form zip codes?
function checkMailCode(elemId) {
	var el = document.getElementById(elemId),
		bIsValid = false;

	if (el)	{
		bIsValid = el.value.length >= 5 && el.value.length <= 7 && !isNaN(parseInt(el.value));
		if (!bIsValid) {
			alert('Please enter a valid US zip code or Canadian postal code to proceed.');
		}
	}
	
	return bIsValid;
}	// checkMailCode


function activateMenu(menuName) {
	$('#link' + menuName).addClass('menuActive');
}

function activateAbout() {
	activateMenu('About');
	showCarat('about');
}

function activateBeforeAfter() {
	activateMenu('BeforeAfter');
	showCarat('befaft')
}

function activateTestimonials() {
	activateMenu('Testimonials');
	showCarat('testimonials');
}

function enactDropdown() {
	dropdownDiv = document.getElementById('aboutDrop');

	if (dropdownDiv) {
		dropdownDiv.style.display = "block";
		dropdownDiv.style.visibility = "visible";
	}
	
}

function deactDropdown() {
	dropDiv = document.getElementById('aboutDrop');

	if (dropDiv) {
		dropDiv.style.display = "none";
		dropDiv.style.visibility = "hidden";
	}
}

function closePlayer() {
	var playerObj = document.getElementById('player_pop');
	playerObj.style.visibility = "hidden";
	playerObj.style.display = "none";
	playerObj.innerHTML = ' ';
}

function openPlayer(vid2show) {
	var playerObj = document.getElementById('player_pop'),
		vidWidth = 480,		// defaults: override as required
		vidHeight = 388,
		flashvars = {wmode: "transparent"};
	playerObj.style.visibility = "visible";
	playerObj.style.display = "block";
	//swfobject rewrites the video div with its own div, so our video div has to be written back in every time
	playerObj.innerHTML = '<table cellpadding="0" cellspacing="0" border="0" style="width:100%; height:100%;"><tr><td align="right" valign="top" style="height:24px;"><a id="vidCloseButton" href="javascript:closePlayer();">&nbsp;</a></td></tr><tr><td align="center" valign="middle"><div id="videoPop"></div></td></tr></table>';
	switch (vid2show) {
		case "saying":
			videoSWF = "http://swfmachine.com/players/jw/player.swf";
			vidWidth = "560";
			vidHeight = "340";
			flashvars.streamer = 'rtmp://mmpros.rtmphost.com/zz100266';
			flashvars.file = 'IHMD_120_BLANK.flv';			
			flashvars.autostart = 'true';
			break;

		case "tv":
			videoSWF = "Lumineers-2min_2.swf"
			break;

		case "ad":
			videoSWF = "Lumineers-2min_2.swf" //note: temp video, this is Testimonials Video from TV Campaign
			break;
	}

	swfobject.embedSWF(videoSWF, "videoPop", vidWidth, vidHeight, "9.0.0", "expressInstall.swf", flashvars);
}

function showCarat(caratDiv) {
	caratDiv = caratDiv + "_carat"
	var caratObj = document.getElementById(caratDiv);
	caratObj.style.visibility = "visible";
	caratObj.style.display = "block";
}

function clearDefault(objName, defaultValue) { 
	var htmlObj = document.getElementById(objName); 
	if (htmlObj.value === defaultValue)
		htmlObj.value = "";
}

function setDefault(objName, defaultValue) { 
	var htmlObj = document.getElementById(objName); 
	if (htmlObj.value === "")
		htmlObj.value = defaultValue;
}

function playCommercial(videoName, videoDiv, vidWidth, vidHeight) {
       swfobject.embedSWF(videoName, videoDiv, vidWidth, vidHeight, "9.0.0", "expressInstall.swf", {wmode:"transparent"});
}
