/***************************************************************************
* FILENAME      : /includes/js/fchp.js                                    *
*   DESCRIPTION : FCHP JavaScript library.                            *
*                                                                          *
* Copyright (C) Molecular, Inc.                                            *
***************************************************************************/


/////////////////////
// Write Style Sheet
/////////////////////

if ((navigator.userAgent.toLowerCase()).indexOf("mac") != -1 && document.layers)
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/UserControls/css/mac.css">');
else if (document.all || document.getElementById)
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/UserControls/css/ie.css">');
else if (document.layers)
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/UserControls/css/ns.css">');

///////////////
// Write Layer
///////////////

function writeLayer(id,src) {
	var str;
	if (document.all || document.getElementById)
		str = '<IFRAME ID="'+id+'" SRC="'+src+'" MARGINHEIGHT="0" MARGINWIDTH="0" FRAMEBORDER="0" SCROLLING="no" NORESIZE></IFRAME>';
	else if (document.layers)
		str = '<LAYER ID="'+id+'" SRC="'+src+'"></LAYER>';
	document.write(str);
}


/////////////////
// Pop-Up Window
/////////////////

function popupWindow(url,name,width,height) {
	var myWin = window.open(url,name,'toolbar=no,location=no,status=no,menubar=no,scrollbars,resizable=no,width='+width+',height='+height);
	myWin.focus();
}

/////////////////////////////////
// Printer-friendly Pop-Up Window
////////////////////////////////

function popupPrinterWindow(url,name,width,height) {
	var myWin = window.open(url,name,'toolbar=no,location=no,status=no,menubar=yes,scrollbars,resizable=no,width='+width+',height='+height);
	myWin.focus();
}

////////////////////////////////////
// Pop-Up Window for provider form
///////////////////////////////////

function openWin(url){
    var w = 625;
    var h = 225;
    var name = "remotewin";
    var features = 		
		'height=' + h + ',' +
		'width=' + w + ',' +
		'toolbar=' + 0 + ',' +
		'location=' + 0 + ',' +
		'status=' + 0 + ',' +
		'menubar=' + 0 + ',' +
		'resizable=' + 'no' + ',' +
		'scrollbars=' + 1;

	var remote=window.open(url, name, features);
	remote.focus();
}

////////////////////////////////////
// Pop-Up Window for pdf form
///////////////////////////////////

function openWinPDF(url){
    var w = 625;
    var h = 500;
    var name = "remotewin";
    var features = 		
		'height=' + h + ',' +
		'width=' + w + ',' +
		'toolbar=' + 0 + ',' +
		'location=' + 0 + ',' +
		'status=' + 0 + ',' +
		'menubar=' + 0 + ',' +
		'resizable=' + 'yes' + ',' +
		'scrollbars=' + 1;

	var remote=window.open(url, name, features);
	remote.focus();
}



///////////////////////
// Netscape Resize Fix
///////////////////////

function resizeFix() {
	if (widthCheck != window.innerWidth || heightCheck != window.innerHeight)
		document.location.href = document.location.href;
}

if (document.layers) {
	widthCheck = window.innerWidth;
	heightCheck = window.innerHeight;
	window.captureEvents(Event.RESIZE);
	window.onResize = resizeFix;
}



/////////////////////////////////////////////////////////
// Force no caching, so that dynamic pages are refreshed
/////////////////////////////////////////////////////////

// adding to specific pages only
//document.write('<META HTTP-EQUIV="pragma" CONTENT="no-cache">');
//document.write('<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">');
//document.write('<META HTTP-EQUIV="EXPIRES" CONTENT="0">');
//document.write('<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-STORE">');