function fieldBlur(field_id, default_value){
	if($('#'+field_id).attr("value") == ''){
		$('#'+field_id).attr("value", default_value);
	}
}

function fieldFocus(field_id, default_value){
	if($('#'+field_id).attr("value") == default_value){
		$('#'+field_id).attr("value", "");
	}
}

function contentDropdownOn(id){
	document.getElementById(id).style.display = '';
//	change_image(img_src, img_id);
	window.contentDropdownMouseIsOver = true;
	if(window.contentDrdopdownId && window.contentDrdopdownId != id){
		hideDropdown(true);
	}
	window.contentDrdopdownId = id;
}

function contentDropdownOff(id){
	window.contentDropdownMouseIsOver = false;
//	window.contentDrdopdownImgId = img_id;
//	window.contentDrdopdownImgSrc = img_src;
	setTimeout('hideDropdown(false)', 100);
}

function hideDropdown(force){
	if(!window.contentDropdownMouseIsOver || force){
//		change_image(window.contentDrdopdownImgSrc, window.contentDrdopdownImgId);
		document.getElementById(contentDrdopdownId).style.display = 'none';
	}
}

var tabsStat = 'play';

function startStopSlider(){
	if(window.tabsStat == 'play'){
		$("div.tabs").tabs().stop();
		window.tabsStat = 'stop';
		$("#play-stop-img").attr("src", "/images/butt-stop-active.png");
	}else{
		$("div.tabs").tabs().play();
		window.tabsStat = 'play';
		$("#play-stop-img").attr("src", "/images/butt-stop.png");
	}
}

function setupExternalLinks() {
	var links       = document.getElementsByTagName('a');
	var linkcount = 1;
	var setup_link;
	for (var i = links.length; i != 0; i--) {
		setup_link = false;
		var a = links[i-1];
		if (!a.href) continue;
		
		// Track external links
		if(a.href.indexOf('http') != -1 &&
            a.href.indexOf(window.location.hostname) == -1){
			url = a.href;
			if (url == 'http://www.sepracormedical.com/') continue;
			if (url == 'http://nuvola.coresecure.net/XopenexInhalationSolution.wmv') continue;
			if (url == 'http://nuvola.coresecure.net/XopenexHFAMDISPACER.wmv') continue;
			if (url == 'http://www.caringforeverybreath.com/') continue;
			a.onclick = function(){

				// select the overlay element - and "make it an overlay"
				$('#ok-continue').attr('href', this.href);
				$('#ok-continue').attr('target', 'blank');
				$("#facebox").overlay({

					// custom top position
					top: 272,

					// some expose tweaks suitable for facebox-looking dialogs
					expose: {

						// you might also consider a "transparent" color for the mask
						color: '#000',

						// load mask a little faster
						loadSpeed: 200,

						// highly transparent
						opacity: 0.7
					},

					// disable this for modal dialog-type of overlays
					closeOnClick: true,

					// we want to use the programming API
					api: true

				// load it immediately after the construction
				}).load();
				
				return false;
			}

			linkcount++;
            
		}
	}
	
}

function openHealthcare(){
	$("#popup-health").overlay({

		// custom top position
		top: 272,

		// some expose tweaks suitable for facebox-looking dialogs
		expose: {

			// you might also consider a "transparent" color for the mask
			color: '#000',

			// load mask a little faster
			loadSpeed: 200,

			// highly transparent
			opacity: 0.7
		},

		// disable this for modal dialog-type of overlays
		closeOnClick: false,

		// we want to use the programming API
		api: true

	// load it immediately after the construction
	}).load();
	
	return false;
}

