// Browser Detection //



    var agt = navigator.userAgent.toLowerCase();



	var is_major = parseInt(navigator.appVersion);

	var is_minor = parseFloat(navigator.appVersion);

	

	// Browser Family -------- CSS File You Need To Edit

	

	// Internet Explorer ----- ie.css

	var is_ie    = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

	

	// Mozilla Family -------- main.css

	var is_moz   = ((agt.indexOf("gecko") != -1) && (agt.indexOf("khtml") == -1));

	

	// Safari, Konqueror ----- khtml.css

	var is_khtml = (agt.indexOf("KHTML") != -1);

	

	// Opera Family ---------- opera.css

	var is_opera = (agt.indexOf("opera") != -1);



// end Browser Detection





	// Second Nav Items generated by XML template



// -- initializes the page behaviors

//  - Auto-selects second nav



function select_nav() {



	var nav_links = document.getElementById('main-nav').getElementsByTagName('a');

	// change this var to be only the keyword (e.g. http://www.l10-dev.com/engineering.html becomes engineering)

	// also change deeper links: http://www.l10-dev.com/engineering/Prototyping.html = engineering

	var selected = location.pathname;



	// for each nav link, check and see if the url contains the section which think link points to

	// if it does point to the section we're in, show its subnav in the bar - rollOver()

	for (var i = 0; i < nav_links.length; i++) {

		var link = nav_links[i].pathname;

		if (link.substring(0, 1) != '/') link = '/' + link; // fiddle IE's view of the link

		if (link == selected) {

			var section = link.substring(1,(link.length - 5));

			rollOver(section);

		}

	}

}



// -- Main Nav rollovers

// When you mouseover the main navigation items, their internal 

// sections appear in the second row



function rollOver(section) {

	

	document.getElementById("n-"+section).src = "images/n_" + section + "_o.gif";

	secondNav(section);

	

}







function resetSegments() {

	document.successForm.segmentid.selectedIndex = 0;

}



function truncate(string, length, mode) {

	

	var output = '';

	var array = new Array();

	

	if (mode == 'words') {

		array = string.split(" ");

		for (i = 0; i <= length; i++) {

			output += array[i] + " ";

		}

	} else {

		output = string.substring(0,length);

	}



	return output;

}



function prettyDate(datestring,format) {

	var output = '';

	

	if (format == 'mmddyyyy') {

		var theDate = datestring.split(" ");

		var pieces = theDate[0].split("-");

		output = pieces[1] + "\/" + pieces[2] + "\/" + pieces[0];

	}

	

	return output;

}





function popUp(url) {

	var popUp = window.open(url+'?refer=http://www.deeperbiblestudies.com'+location.pathname,'emailWindow','width=420,height=400,location=no,menubar=no,scrollbars=no');

	return false;

}



function printPage() {

	window.print();

	return false;

}



function showInfoTab(activeTab) {

	

	// get tabs and info boxes

	var theInfo = $('product-info-tabs').getElementsByTagName('div');

	var theTabs = $('info-tabs').getElementsByTagName('li');

	

	// hide all

	for(var i = 0; i <= theInfo.length - 1; i++) {

		theInfo[i].style.display = 'none';

		theTabs[i].style.borderBottom = "1px solid #333333";

	}



	// set active

	theInfo[activeTab].style.display = 'block';

	theTabs[activeTab].style.borderBottom = '1px solid #ffffff';

}


function showInfoTab2(activeTab) {

	

	// get tabs and info boxes

	var theInfo = $('product-info-tabs2').getElementsByTagName('div');

	var theTabs = $('info-tabs2').getElementsByTagName('li');

	

	// hide all

	for(var i = 0; i <= theInfo.length - 1; i++) {

		theInfo[i].style.display = 'none';
		theTabs[i].style.backgroundImage = 'url(../images/tab_back_off.gif)';
		theTabs[i].style.height = '19px';
		theTabs[i].style.marginTop = '7px';
		theTabs[i].style.color = '#000000';
		//theTabs[i].style.borderBottom = "1px solid #009631";

	}



	// set active

	theInfo[activeTab].style.display = 'block';
	theTabs[activeTab].style.backgroundImage = 'url(../images/tab_back_on.gif)';
	theTabs[activeTab].style.height = '22px';
	theTabs[activeTab].style.marginTop = '4px';
	theTabs[activeTab].style.color = '#ffffff';
	//theTabs[activeTab].style.borderBottom = '1px solid #ffffff';

}




function validateCCForm() {

	

	return true;

	

}



// opens a window with a Flash demo in it

function demoWindow(swfURL) {



	 window.open ("http://www.deeperbiblestudies.com/demos/"+swfURL,"demoWindow","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=0,width=640,height=516");

	 

	 return false;



}



function emailFriend(url){

	

	var popUp = window.open(url+'?refer='+L10_SITE_URL+''+location.pathname.substr(1, location.pathname.length-1),'emailWindow','width=420,height=400,location=no,menubar=no,scrollbars=no');

	

	return false;

}





function checkSafari() {

	

	alert(is_khtml);

	if (is_khtml) { document.write('<link rel="stylesheet" href="/includes/khtml.css" type="text/css" />'); }

	

}





function selectURL(select){
	if(select.selectedIndex != -1){
		if(select.options[select.selectedIndex].value != ""){
			window.location = select.options[select.selectedIndex].value;
		}
	}
}