<!--
/*
**************  TAB NAVIGATION  **************
*/

var arrSections = ['intro', 'video', 'steps', 'shop', 'feedback'];

function changeSection(whichSection) {
	hideAll();
	var strTab = whichSection + 'Tab';
	var strTable = whichSection + 'Table';
	
	document.getElementById(strTab).innerHTML = '<img src=\"/images/howto_' + whichSection + '_selected.gif\" width=\"76\" height=\"26\" border=\"0\">';
	
	strStyle = document.getElementById(strTable).style;
	strStyle.display = '';
}

function hideAll() {
	for (var i=0; i < arrSections.length; i++) { 
		var strTab = arrSections[i] + 'Tab';
		var strTable = arrSections[i] + 'Table';
		
		document.getElementById(strTab).innerHTML = '<a href=\"javascript:;\" \onClick=\"changeSection(\'' + arrSections[i] + '\')"><img src=\"/images/howto_' + arrSections[i] + '.gif\" width=\"76\" height=\"26\" border=\"0\"></a>';

		strStyle = document.getElementById(strTable).style;
		strStyle.display = 'none';
	} 
}

/*
**************  BREAD CRUMB NAVIGATION  **************
*/

var parent1 = '';
var child1 = '';
var parent2 = '';
var strBreadCrumb = '';

var arrURL = document.location.href.split('?');
if(arrURL.length > 1) {
	var arrTmp = arrURL[1].split('&');
	for(var x=0; x < arrTmp.length; x++) {
		var tmp = arrTmp[x].split('=');
		eval('var ' + unescape(tmp[0]) + '=\'' + unescape(tmp[1]) + '\'');
	}
}

strBreadCrumb = '<a href=\"/index.asp\">Home</a> :: '
if(parent1 != '' && child1 != '') {
	strBreadCrumb += '<a href=\"/module_list.asp?parent1=' + escape(parent1) + '&child1=' + escape(child1) + '&parent2=' + escape(parent2) + '\">' + parent1 + ' - ' + child1 + '</a> :: ';
}
strBreadCrumb += strTutTitle;

/*
**************  FLASH CONTROLS  **************
*/

var lcId = new Date().getTime();
var flashProxy = new FlashProxy(lcId, "http://webapps.easy2.com/ediy/JavaScriptFlashGateway.swf");

function buildFlash() {
	var mainFlash = new FlashTag("http://webapps.easy2.com/ediy/mount_dv_directvar.swf?" + strFlashQString, 400, 340, "7,0,0,0");
	mainFlash.setFlashvars("lcId=" + lcId);
	//mainFlash.write(document);
	var flash = mainFlash.toString();
	var el = document.getElementById("flashCell");
	el.innerHTML = flash;
}

function activateVideo() {
	changeSection('video');
}

/*
**************  EMAIL A FRIEND  **************
*/

function validateForm() {
	var eFrom = document.form1.from.value;
	var eTo1 = document.form1.to_1.value;
	var eSubject = document.form1.subject.value;
	var eBody = document.form1.ebody.value;
	document.form1.url.value = document.location.href;
	var eCaptcha = document.form1.strCAPTCHA.value;

	if(eFrom.length == 0){
		alert("Please enter your valid email address.");
		document.form1.from.focus();
		return false;
	}
	
	if(eFrom.length != 0){
		if (eFrom.indexOf("@") == -1 || eFrom.indexOf(".") == -1){
			alert("Please enter your valid email address.");
			document.form1.from.focus();
			return false;
		}
	} 
	
	if(eTo1.length == 0){
		alert("Please enter at least 1 recipient.");
		document.form1.to_1.focus();
		return false;
	}
	
	if(eTo1.length != 0){
		if (eTo1.indexOf("@") == -1 || eTo1.indexOf(".") == -1){
			alert("Please enter a valid recipient email address.");
			document.form1.to_1.focus();
			return false;
		}
	} 
	
	if(eSubject.length == 0){
		alert("Please enter a subject for your email.");
		document.form1.subject.focus();
		return false;
	}
	
	if(eBody.length == 0){
		alert("Please enter your message text.");
		document.form1.ebody.focus();
		return false;
	}
	if(eCaptcha.length == 0){
		alert("Please enter the security code.");
		document.form1.strCAPTCHA.focus();
		return false;
	}

	return true;
}

function submitForm(theform) {
	if(validateForm()) {
		var textback = '';
		var el1 = document.getElementById('submitRow');
		var el2 = document.getElementById('statusMessage');
		var status = AjaxRequest.submit(
		theform
				,{
					'onSuccess':function(req){ 
						if(req.responseText == 'Email sent') {
							var textback = '<br><br><strong>' + req.responseText + '</strong><br><a href=\"javascript:;\" \onClick=\"showEF()\">Close</a>';
							textback += ' | <a href=\"javascript:;\" \onClick=\"resetEF()\">Reset Form</a>';
							el2.innerHTML = textback;
							el1.style.display = 'none';
						} else {
							el2.innerHTML = '<br><br><strong>' + req.responseText + '</strong>';
						}
					}
					,'onError':function(req){ el2.innerHTML = req.responseText; }
				}
			);		
		return status;
	}
}

function resetEF() {
	document.form1.to_1.value = '';
	document.form1.to_2.value = '';
	document.form1.to_3.value = '';
	document.form1.ebody.value = '';
	document.form1.strCAPTCHA.value = '';
	document.getElementById('submitRow').style.display = '';
	document.getElementById('statusMessage').innerHTML = '&nbsp;';
}

function showEF() {
	strStyle = document.getElementById('emailSuccess').style;
	if(strStyle.display == 'none') {
		strStyle.display = '';
	} else {
		strStyle.display = 'none';
	}
}

//-->