
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

function changeImages() {
  if (document.images) {
    for (var i=0; i<arguments.length; i+=2) {
	  document[arguments[i]].src = eval(arguments[i+1] + ".src");
    }
  }
}

/* nav roll overs */
preload("nav_patients_up", "/i/nav/patients_up.gif");
preload("nav_patients_off", "/i/nav/patients_off.gif");
preload("nav_providers_up", "/i/nav/providers_up.gif");
preload("nav_providers_off", "/i/nav/providers_off.gif");
preload("nav_products_up", "/i/nav/products_up.gif");
preload("nav_products_off", "/i/nav/products_off.gif");
preload("nav_corporate_up", "/i/nav/corporate_up.gif");
preload("nav_corporate_off", "/i/nav/corporate_off.gif");
preload("nav_sales_up", "/i/nav/sales_up.gif");
preload("nav_sales_off", "/i/nav/sales_off.gif");
preload("nav_shop_up", "/i/nav/shop_up.gif");
preload("nav_shop_off", "/i/nav/shop_off.gif");

//popup window for emailing
function emailWindow(pageTitle) {
	var loc = self.location;
	window.open("/emailpage.asp?url="+ escape(loc) +"&pagetitle="+escape(pageTitle), "emailWindow", "width=300,height=340");
}

//bookmark 
function bookMarkThisPage() {
	var url = document.location.toString();
	var title = document.title;
	if (document.all && parseInt(navigator.appVersion) >= 4) {
		window.external.AddFavorite(url,title);
	} else if (navigator.appName == "Netscape") {
		alert("You must press CTRL-D to bookmark this page");
	}
}

/* print */
function printThisPage() {
	pWindow = window.open('','printWindow');
	dpt = document.getElementById('contentBox');
	document.printThisPageForm.printHTML.value = dpt.innerHTML;
	document.printThisPageForm.submit();
}

function toggleLoginUtility(oDiv){
	oDiv.style.display = (oDiv.style.display == '' || oDiv.style.display == 'none')?'block':'none';
	return false;
}

function launchVideo(vid, w, h){
   	var posLeft = Math.floor( (screen.width - w) / 2);
    var posTop = Math.floor( (screen.height - h) / 2);
	videoWin = window.open(vid,"_new","toolbar=no,height="+h+",width="+w+",location=no,address=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no,copyhistory=true,left="+posLeft+",top="+posTop); 
	videoWin.focus();
}

function printHtmlItem(oForm,sHtmlID) {
	pWindow = window.open('','printWindow');
	dpt = document.getElementById(sHtmlID);
	oForm.printHTML.value = dpt.innerHTML;
	oForm.submit();
}

var clickmessage="Manipulation of images has been disabled to protect brand integrity.";
function associateimages(){
	//function from dynamicdrive.com
	for(i=0;i<document.images.length;i++)
	document.images[i].onmousedown=disableclick;
}

function disableclick(e) {
   if (
   			(navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3 || e.ctrlKey || e.altKey) && e.target.tagName=='IMG')
   			||
   			(navigator.appName != 'Netscape' && (event && (event.button==2||event.button==3||event.ctrlKey||event.altKey) && event.srcElement.tagName=='IMG'))
   		) {
			if (document.domain.indexOf('pelago') == -1)
			{
				alert(clickmessage);
				return false;
			}
	} 
	return true;
}

function protectImages() {
	if (document.all)
		document.onmousedown=disableclick
	else if (document.getElementById)
		document.onmouseup=disableclick
	else if (document.layers)
		associateimages();
	window.onmousedown=disableclick;
	
}

document.addEvent = function(object, eventType,fn, useCapture) {
	if (object.addEventListener) {
		object.addEventListener(eventType, fn, useCapture);
		return true;
	} else {
		if (object.attachEvent) {
			var r = object.attachEvent("on"+eventType, fn);
			return r;
		}
	}
};

document.addEvent(window,'load',protectImages, false);

function privacy_win(url) {
	var w = 500;
	var h = 500;
	var posLeft = Math.floor( (screen.width - w) / 2);
    var posTop = Math.floor( (screen.height - h) / 2);
	var thewin = window.open(url,"PrivacyWin","height="+h+",width="+w+",toolbar=no,statusbar=no,scrollbars=yes,left="+posLeft+",top="+posTop);
	thewin.focus();
	return false;
}

//popup window for viewing accessory
function showPicture(imageName,imageWidth,imageHeight) {
   	var left = Math.floor( (screen.width - imageWidth) / 2);
    var top = Math.floor( (screen.height - imageHeight) / 2);
	newWindow = window.open("","accessoryWindow","scrollbars=no,width="+imageWidth+",height="+imageHeight+",left="+left+",top="+top);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+imageName+'</title>');
	newWindow.document.write('<head>');
	newWindow.document.write('<' + 'script language="JavaScript1.2" type="text/javascript">');
	newWindow.document.write("\n"+'function disableclick(e) {');
	newWindow.document.write("\n"+'if (');
	newWindow.document.write("\n"+'   			(navigator.appName == "Netscape" && (e.which == 2 || e.which == 3 || e.ctrlKey || e.altKey) && e.target.tagName=="IMG")');
	newWindow.document.write("\n"+'   			||');
	newWindow.document.write("\n"+'   			(navigator.appName != "Netscape" && (event && (event.button==2||event.button==3||event.ctrlKey||event.altKey) && event.srcElement.tagName=="IMG"))');
	newWindow.document.write("\n"+'   		) {');
	newWindow.document.write("\n"+'			alert("Manipulation of images has been disabled to protect brand integrity.");');
	newWindow.document.write("\n"+'			return false;');
	newWindow.document.write("\n"+'	} ');
	newWindow.document.write("\n"+'	return true;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write("\n"+'window.onload = function() {');
	newWindow.document.write("\n"+'	if (document.all)');
	newWindow.document.write("\n"+'		document.onmousedown=disableclick');
	newWindow.document.write("\n"+'	else if (document.getElementById)');
	newWindow.document.write("\n"+'		document.onmouseup=disableclick');
	newWindow.document.write("\n"+'	else if (document.layers)');
	newWindow.document.write("\n"+'		associateimages();');
	newWindow.document.write("\n"+'	window.onmousedown=disableclick;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write("\n"+'function associateimages(){');
	newWindow.document.write("\n"+'	//function from dynamicdrive.com');
	newWindow.document.write("\n"+'	for(i=0;i<document.images.length;i++)');
	newWindow.document.write("\n"+'	document.images[i].onmousedown=disableclick;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write('</script' + '>');
	newWindow.document.write('</head>');
	newWindow.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" >'); 
	newWindow.document.write('<center><img src="'+imageName+'" alt="'+imageName+'" ></center>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

//popup window for viewing accessory
function showPictureDetail(imageName,imageWidth,imageHeight,imageText) {
   	var left = Math.floor( (screen.width - imageWidth) / 2);
    	var top = Math.floor( (screen.height - imageHeight) / 2);
	newWindow = window.open("","accessoryDetailWindow","scrollbars=no,width="+imageWidth+",height="+imageHeight+",left="+left+",top="+top);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+imageName+'</title>');
	newWindow.document.write('<head>');
	newWindow.document.write('<link rel="stylesheet" type="text/css" href="/css/inogen.css">');

	newWindow.document.write('<' + 'script language="JavaScript1.2" type="text/javascript">');
	newWindow.document.write("\n"+'function disableclick(e) {');
	newWindow.document.write("\n"+'if (');
	newWindow.document.write("\n"+'   			(navigator.appName == "Netscape" && (e.which == 2 || e.which == 3 || e.ctrlKey || e.altKey) && e.target.tagName=="IMG")');
	newWindow.document.write("\n"+'   			||');
	newWindow.document.write("\n"+'   			(navigator.appName != "Netscape" && (event && (event.button==2||event.button==3||event.ctrlKey||event.altKey) && event.srcElement.tagName=="IMG"))');
	newWindow.document.write("\n"+'   		) {');
	newWindow.document.write("\n"+'			alert("Manipulation of images has been disabled to protect brand integrity.");');
	newWindow.document.write("\n"+'			return false;');
	newWindow.document.write("\n"+'	} ');
	newWindow.document.write("\n"+'	return true;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write("\n"+'window.onload = function() {');
	newWindow.document.write("\n"+'	if (document.all)');
	newWindow.document.write("\n"+'		document.onmousedown=disableclick');
	newWindow.document.write("\n"+'	else if (document.getElementById)');
	newWindow.document.write("\n"+'		document.onmouseup=disableclick');
	newWindow.document.write("\n"+'	else if (document.layers)');
	newWindow.document.write("\n"+'		associateimages();');
	newWindow.document.write("\n"+'	window.onmousedown=disableclick;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write("\n"+'function associateimages(){');
	newWindow.document.write("\n"+'	//function from dynamicdrive.com');
	newWindow.document.write("\n"+'	for(i=0;i<document.images.length;i++)');
	newWindow.document.write("\n"+'	document.images[i].onmousedown=disableclick;');
	newWindow.document.write("\n"+'}');
	newWindow.document.write('</script' + '>');
	newWindow.document.write('</head>');
	newWindow.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" >'); 
	newWindow.document.write('<center><table border="0" cellspacing="0" cellpadding="0" class="productSystemAccessories"><tr><td class="productSystemThumb"><img src="'+imageName+'" alt="'+imageName+'" ></td><td class="dProdSpecs">'+imageText+'</td></tr></table></center>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

//popup window for Inogen One Details
function newPopupWindow(pageTitle,pageLoc,pageWidth,pageHeight) {
	var loc = self.location;
	if(pageWidth == "full")
		var sizing = "fullscreen=yes"; 
	else var sizing = "width="+pageWidth+",height="+pageHeight+",resizable=yes";
	window.open(pageLoc+"?url="+ escape(loc) +"&pagetitle="+escape(pageTitle), "_blank", sizing);
}
//--->
