function fToggleDiv(strDiv) { 
 var objDiv = document.getElementById(strDiv); 
 if(objDiv.style.visibility == "hidden") { 
 objDiv.style.visibility = "visible"; 
 objDiv.style.display = "block"; 
 } else { 
 objDiv.style.visibility = "hidden"; 
 objDiv.style.display = "none"; 	 
 } 
 if (strDiv == "flash"){
 document.getElementById("cssMapImg").innerHTML = 
		"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" name=\"objflashtop\" id=\"objflashtop\" width=\"246\" height=\"106\">" +
		"<param name=\"movie\" value=\"./flash/drs_map_btn.swf\"><param name=\"quality\" value=\"high\">" +
		"<param name=\"menu\" value=\"false\"><param name=\"bgcolor\" value=\"#000000\">" + 
		"<embed name=\"objflashtop\" id=\"objflashtop\" src=\"./flash/drs_map_btn.swf\" width=\"246\" height=\"106\" quality=\"high\" " +
		"menu=\"false\" bgcolor=\"#000000\" type=\"application/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?p1_prod_version=shockwaveflash\"><\/embed>" +
		"<\/object>";
	} 
}

function fEmbedMapImage(strDiv) { 
	document.getElementById(strDiv).innerHTML = 
		"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" name=\"objflashtop\" id=\"objflashtop\" width=\"246\" height=\"106\">" +
		"<param name=\"movie\" value=\"./flash/drs_map_btn.swf\"><param name=\"quality\" value=\"high\">" +
		"<param name=\"menu\" value=\"false\"><param name=\"bgcolor\" value=\"#000000\">" + 
		"<embed name=\"objflashtop\" id=\"objflashtop\" src=\"./flash/drs_map_btn.swf\" width=\"246\" height=\"106\" quality=\"high\" " +
		"menu=\"false\" bgcolor=\"#000000\" type=\"application/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?p1_prod_version=shockwaveflash\"><\/embed>" +
		"<\/object>";
} 


function fWriteHomeFlash() {		
	document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" name=\"objflashtop\" id=\"objflashtop\" width=\"800\" height=\"434\">");
	document.writeln("<param name=\"movie\" value=\"./flash/drs_home_flash.swf\"><param name=\"wmode\" value=\"transparent\" /><param name=\"quality\" value=\"high\">");
	document.writeln("<param name=\"menu\" value=\"false\">");
	document.writeln("<embed wmode=\"transparent\" name=\"objflashtop\" id=\"objflashtop\" src=\"./flash/drs_home_flash.swf\" width=\"800\" height=\"434\" quality=\"high\" ");
	document.writeln("menu=\"false\" bgcolor=\"#000000\" type=\"application/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?p1_prod_version=shockwaveflash\"><\/embed>");
	document.writeln("<\/object>");		
} 

function fPreWriteMapFlash() {
	document.getElementById("cssFloatingMap").innerHTML = 
		"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" name=\"objflashtop\" id=\"objflashtop\" width=\"800\" height=\"405\">" +
		"<param name=\"movie\" value=\"./flash/map_2.swf\"><param name=\"quality\" value=\"high\">" +
		"<param name=\"menu\" value=\"false\"><param name=\"bgcolor\" value=\"#000000\">" + 
		"<embed name=\"objflashtop\" id=\"objflashtop\" src=\"./flash/map_2.swf\" width=\"800\" height=\"405\" quality=\"high\" " +
		"menu=\"false\" bgcolor=\"#000000\" type=\"application/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?p1_prod_version=shockwaveflash\"><\/embed>" +
		"<\/object><br /><br />";
}

function fWriteMapButon2() {
	document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" name=\"objflashtop\" id=\"objflashtop\" width=\"246\" height=\"106\">");
	document.writeln("<param name=\"movie\" value=\"./flash/drs_map_btn.swf\"><param name=\"quality\" value=\"high\">");
	document.writeln("<param name=\"menu\" value=\"false\"><param name=\"bgcolor\" value=\"#000000\"><param name=\"wmode\" value=\"transparent\" />");
	document.writeln("<embed name=\"objflashtop\" id=\"objflashtop\" src=\"./flash/drs_map_btn.swf\" width=\"246\" height=\"106\" wmode=\"transparent\" quality=\"high\" menu=\"false\">");
	document.writeln("</object>");
}

function fShow(strDiv) {
	if(navigator.userAgent.match("Safari") == "Safari" && strDiv == "cssMapImg") {
		window.close();
	} else {
		document.getElementById(strDiv).style.visibility = "visible";
		document.getElementById(strDiv).style.display = "block";
	}
}

function fHide(strDiv) {
	document.getElementById(strDiv).style.visibility = "hidden";
	document.getElementById(strDiv).style.display = "none";
}

function fVerifyInput(strID, strText) {
	var oInput = document.getElementById(strID);
	if(oInput.value == "") {
		oInput.style.background = "#ffffff";
		return strText;
	} else {
		oInput.style.background = "#ffffff";
		return "";
	}
}

function fVerifyEmail(strEmail) {
	re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
	if (re.test(strEmail)) {
		return true;
	} else {
		return false;
	}
}

	function fValidateSignup(strEmail) {
	strError = "";
	strError += fVerifyInput("txtEmail","Please enter a valid email address\n");
	if(!fVerifyEmail(strEmail)) {
		strError += "Please enter a valid email address\n";
	}

	if(strError != "") {
				fShow('cssSignupError');
				fHide('cssSignupCopy');
				return false;
			}
			fSignupEmail(strEmail);
			return false;
	}

		
function fSignupEmail(strEmail) {
	var oAjax = $.ajax({ type: "get", url: "dbSignup.php", dataType: "html", data: "txtEmail="+strEmail, async:false });				
		fShow('cssSignupThanks');
		fHide('cssSignupCopy');
		return false;
	}
	
function fShowMap2(){
	if(navigator.userAgent.match("Safari") == "Safari") {
		win = window.open("floatingmap.html","floatingmap","width=830,height=450");
		win.focus();
	} else {
		fHide('cssMapImg');
		fShow('cssFloatingMap');
		fShow('cssSecondDisclaimer');
		fPreWriteMapFlash();
	}
}
	
	
function fToggleDivFAQ(strDiv) { 
	var objDiv = document.getElementById(strDiv); 
		if(objDiv.style.visibility == "hidden") { 
		objDiv.style.visibility = "visible"; 
		objDiv.style.display = "block"; 		
		document.getElementById(strDiv + "plus").src = "img/img_minus.gif";
		
	} else { 
		objDiv.style.visibility = "hidden"; 
		objDiv.style.display = "none"; 
		document.getElementById(strDiv + "plus").src = "img/img_plus.gif"; 
	} 
} 

function fHideBlocker() { 
	setTimeout("fHide('cssBlocker')", 3000);
	setTimeout("fShow('cssSignupCopy')", 3000);
	setTimeout("fShow('cssCopyWrapper')", 3000);
}

function fHideMap() {
	fShow('cssMapImg'); 
	fHide('cssSecondDisclaimer');
	fHide('cssFloatingMap'); 	
}

function fWriteMapFlash() {
	document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"800\" height=\"475\" id=\"armor_home\" align=\"middle\" >");
	document.writeln("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	document.writeln("<param name=\"movie\" value=\""+strPageRoot+"flash/drs_map2.swf\" />");
	document.writeln("<param name=\"quality\" value=\"high\" />");
	document.writeln("<param name=\"wmode\" value=\"transparent\" />");
	document.writeln("<embed src=\""+strPageRoot+"flash/drs_map2.swf\" wmode=\"transparent\" quality=\"high\" width=\"800\" height=\"475\" name=\"flash_button\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
	document.writeln("<\/object>");
}

function fPopMapFlash() {
	window.open ("flash_map.html","map_flash","location=0,status=0,scrollbars=0,width=800,height=475");
}


$(document).ready(function(){
	$(".contentList").hide();
	$(".subcontentList").hide();
	$(".subSubContentList").hide();
	
	$(".parentResource").click(function(){
		$(this).nextAll('.contentList').toggle();
		$(this).find('div:first').toggleClass('expandCollapseActive');
	});
	$(".subParentResource").click(function(){
		$(this).nextAll('.subcontentList').toggle();
		$(this).find('div:first').toggleClass('expandCollapseActive');
	
	});
	$(".subSubParentResource").click(function(){
		$(this).nextAll('.subSubContentList').toggle();
		$(this).find('div:first').toggleClass('expandCollapseActive');
	
	});
	
});