/*	mos_javascript	mos javascript library*/var isIE=document.all?true:false;var isDOM=document.getElementById?true:false;function triggerPop(id) {	switch (id) {		case "slm_upload":		case "slm_form":		case "tvfm_compare":			window.open('/popups/'+id+'.html', 'pop1','titlebar=no,width=600,height=800,location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');		case "byo":		case "3":			window.open('/popups/'+id+'.html', 'pop1','titlebar=no,width=800,height=600,location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');		break;		case "NPANXX_ProductDetails":			window.open('/popups/'+id+'.html', 'pop1','titlebar=no,width=800,height=600,location=no,menubar=yes,scrollbars=yes,toolbar=no,resizable=yes');		break;		default:			window.open('/popups/'+id+'.html', 'pop1','titlebar=no,width=600,height=400,location=no,menubar=yes,scrollbars=yes,toolbar=no,resizable=yes');		break;	}}function doMelPop() {	window.open('/popups/melissadata.html', 'mel','titlebar=no,width=550,height=700,location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes');}function validate_radius_ring(inp) {	var r = document.getElementById('RADIUS');	if (r == inp) {		if (r.value != '' && isNaN(r.value)) {			alert('Please enter only a numerical value into the Radius field');			r.value = r.value.substring(0,r.value.length-1);		}		return;	}	if (isNaN(r.value) || r.value == '') {		alert('Please enter a value for the map radius before entering extra ring radius values');		inp.value = '';		return;	}	x = inp.value;	if (isNaN(x)) {		alert('Please enter a numerical value only into the Radius Ring field');		inp.value = '';		return;	}	var a = r.value*1;	var b = x*1;	if (a <= b) {		alert('Your extra ring radius must be smaller than the radius of the map. Please lower the value');		inp.value = '';		return;	}}function showByoDesc(div) {	if (isIE) {		theDiv = eval('document.all.'+div);	} else {		theDiv = document.getElementById(div);	}	if (theDiv.style.display=='block') {		theDiv.style.display='none';	} else {		theDiv.style.display='block';	}}function checkByoSize(obj) {	if (obj.checked == false) {		return;	}	selectedSizeObj = 'none';	if (isIE) {		thisForm = document.all.prodSelect;		selectedSizeElements = document.all.BYO_SIZE;		for (var i=0;i<selectedSizeElements.length;i++) {			if (selectedSizeElements[i].checked == true) {				selectedSizeObj = selectedSizeElements[i];			}		}	} else {		thisForm = document.getElementById('prodSelect');		for (var i=0;i<thisForm.length;i++) {			if (thisForm[i].checked == true && thisForm[i].id == 'BYO_SIZE') {				selectedSizeObj = thisForm[i];			}		}	}	selectedItem = obj;	objSizeString = obj.id;	objName = obj.name;	if (objName.substring(0,8) == 'BYO_GEOM') {		replaceString = obj.value;	} else {		replaceString = objName;	}	objSize = objSizeString.replace(replaceString, '');	if (selectedSizeObj == 'none') {		for (var i=0;i<thisForm.length;i++) {			if (thisForm[i].value == objSize && thisForm[i].id == 'BYO_SIZE') {				thisForm[i].checked=true;			}		}	} else {		if(selectedSizeObj.value != objSize) {			obj.checked = false;		}	}}function doByoSubmitCheck() {	selectedSizeObj = false;	if (isIE) {		thisForm = document.all.prodSelect;		selectedSizeElements = document.all.BYO_SIZE;		for (var i=0;i<selectedSizeElements.length;i++) {			if (selectedSizeElements[i].checked == true) {				selectedSizeObj = selectedSizeElements[i];			}		}	} else {		thisForm = document.getElementById('prodSelect');		for (var i=0;i<thisForm.length;i++) {			if (thisForm[i].checked == true && thisForm[i].id == 'BYO_SIZE') {				selectedSizeObj = thisForm[i];			}		}	}	if (!selectedSizeObj) {		if (isIE) {		eDiv = document.all.byoerror;		} else {			eDiv = document.getElementById('byoerror');		}		eDiv.innerHTML = "Please select a size category for your map";		return;	}	var selectedLayers = 0;	var selectedGeography = false;	for (var i=0;i<thisForm.length;i++) {		selectedItem = thisForm[i];		objSizeString = selectedItem.id;		objName = selectedItem.name;		tmp = objName.split("_");		if (tmp.length > 2) {			objSize = tmp.pop();		} else {			objSize = objSizeString.replace(objName, '');		}	//	alert(selectedItem.id+': '+objSize);		if (objSize == selectedSizeObj.value) {			if (selectedItem.checked == true) {				if (selectedItem.type == "checkbox") {					selectedLayers++;				}				if (selectedItem.type == "radio") {					selectedGeography = true;				}			}		}	}/*	if (selectedLayers == 0) {		alert('You have not selected any map features (checkboxes). You must selected at least one map feature before continuing');	}	if (selectedGeography == false){		alert('You have not selected any map geography (radio buttons). You must selected a map geography to be displayed before continuing');	}*/	if (selectedLayers != 0 || selectedGeography == true) {		thisForm.submit();	} else {		if (isIE) {		eDiv = document.all.byoerror;		} else {			eDiv = document.getElementById('byoerror');		}		eDiv.innerHTML = "More information is needed to make your map. Please select at least one feature to appear on your map.";	}}function resetByoSize(obj) {	targetSize = obj.value;	if (isIE) {		thisForm = document.all.prodSelect;		selectedSizeElements = document.all.BYO_SIZE;		thistnImg = document.all.tnImg;		thistnText = document.all.tntext;	} else {		thisForm = document.getElementById('prodSelect');		thistnImg = document.getElementById('tnImg');		thistnText = document.getElementById('tntext');	}	var imgUrl = '';	switch (targetSize) {		case "small":			imgUrl = '/images/byo/BYOM-ZCR-5-ZI.png';			sampleHtml = '<a class=\"red\" id=\"samplelink\" href=\"/images/image.php?filename=/samples/Maponics_Radius_ZIP_CR_5mi.pdf\">Click Here to Download a Sample</a>';		break;		case "medium":			imgUrl = '/images/byo/BYOM-ZIP-15-ZI.png';			sampleHtml = '<a class=\"red\" id=\"samplelink\" href=\"/images/image.php?filename=/samples/Maponics_Radius_ZIP_15mi.pdf\">Click Here to Download a Sample</a>';		break;		case "large":			imgUrl = '/images/byo/BYOM-ZIP-35-ZI.png';			sampleHtml = '<a class=\"red\" id=\"samplelink\" href=\"/images/image.php?filename=/samples/Maponics_Radius_ZIP_30mi.pdf\">Click Here to Download a Sample</a>';		break;		case "xlarge":			imgUrl = '/images/byo/BYOM-GEN-100-ZI.png';			sampleHtml = '<a class=\"red\" id=\"samplelink\" href=\"/images/image.php?filename=/samples/Maponics_Radius_GEN_100mi.pdf\">Click Here to Download a Sample</a>';		break;	}	thistnImg.src=imgUrl;	thistnText.innerHTML = sampleHtml;	for (var i=0;i<thisForm.length;i++) {		selectedItem = thisForm[i];		objSizeString = selectedItem.id;		objName = selectedItem.name;		objSize = objSizeString.replace(objName, '');		if (objSize != targetSize && selectedItem != obj && objName != 'format') {			selectedItem.checked = false;		}	}}function find_element(id) {	if (document.getElementById) {		if (document.getElementById(id)) {			return (document.getElementById(id));		} else {			return false;		}	} else {		if (document.all[id]) {			return (document.all[id]);		} else {			return false;		}	}}in_array = function(search_term, arr) {  var i = arr.length;  if (i > 0) {	 do {		if (arr[i] === search_term) {		   return true;		}	 } while (i--);  }  return false;}function supress_alpha() {}function calculate_price() {	var subsBox = find_element('cbx_sub');	var pdfFormat = find_element('format_0');	var cdFormat = find_element('format_3');	var xlFormat = find_element('format_4');	// If subs box is checked, then run the check on the format before running the price code	// otherwise just run the price code.	if (subsBox.checked) {		if (!pdfFormat.checked && !cdFormat.checked && !xlFormat.checked) {			if (confirm('Subscriptions are only available on products delivered in digital format.\nWould you like to order this product in digital format?')) {				if (cdFormat) {					cdFormat.checked = true;				}				if (xlFormat) {					xlFormat.checked = true;				}				if (pdfFormat) {					pdfFormat.checked = true;				}			} else {				subsBox.checked = false;			}		}	}	var AJAX;	if (window.XMLHttpRequest) {    AJAX=new XMLHttpRequest();  } else {    AJAX=new ActiveXObject("Microsoft.XMLHTTP");  }	var theForm = find_element('prodSelectForm');	var CurrentPrice = 0;	for (var i=0;i<theForm.elements.length;i++) {		if (theForm.elements[i].id.substring(0,7) == 'format_' && theForm.elements[i].checked) {			var fDiv = find_element('form_price_'+theForm.elements[i].id.substring(7));			var pString = fDiv.innerHTML;			var pTmp = pString.split('$');			if (pTmp.length == 1) {				CurrentPrice = '-';			} else {					var pTmp2 = pTmp.pop();				CurrentPrice = pTmp2.replace('</span>','');			}		}	}	var catId=find_element('catId').value;  var url = '/ajax/calculate_subs_price.php?subs='+subsBox.checked+'&cp='+CurrentPrice+'&catId='+catId;  AJAX.open("GET", url, false);	AJAX.send(null);	res = AJAX.responseText;	var tDiv = find_element('newPriceDiv');	tDiv.innerHTML = res;}