/*******************************************************************************
____________________________ API DOCUMENTATION BEGIN ___________________________
````````````````````````````````````````````````````````````````````````````````
Variables and functions used throughout website.

````````````````````````````````````````````````````````````````````````````````
_____________________________ API DOCUMENTATION END ____________________________
*******************************************************************************/

//------------------------------------------------------------------------------
// VARIABLES BEGIN
//------------------------------------------------------------------------------

pageLoaded = false; //set page loaded flag

//------------------------------------------------------------------------------
// VARIABLES END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// AUTO INVOKE FUNCTIONALITY BEGIN
//------------------------------------------------------------------------------

if(top.location.href != self.location.href) top.location.href = self.location.href; //prevent unauthorized framing

//------------------------------------------------------------------------------
// AUTO INVOKE FUNCTIONALITY END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// ROLLOVER FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- preload images
function preloadImage(argVirtualName, argFilePath, argFileName) {
 eval(argVirtualName +' = new Image()'); //create a new image object
 eval(argVirtualName +'.src = "' + argFilePath + argFileName + '"');
}

//------------------------------------------------------------------------------

//FUNCTION-- dynamically swaps one image
function swapImageSingle(argImageName, argImageState) {
 document.images[argImageName].src = eval(argImageName + argImageState + ".src");
}

//------------------------------------------------------------------------------

//FUNCTION-- sets rollover highlight
function setRollover(argID, argFilePath, argFileName) {
 preloadImage(argID +"_off", argFilePath, argFileName);
 preloadImage(argID +"_on", argFilePath, argFileName);
 swapImageSingle(argID, '_on');
}

//------------------------------------------------------------------------------
// ROLLOVER FUNCTIONS END
//------------------------------------------------------------------------------

function outsideLink(URL) {
   		var writeURL = URL;
   		var thisSite="www.levaquin360.com";
	   	if (URL.length > 60)
	   	{
		   writeURL = URL.substr(0, 60) + "...";
	   	}
	   	if (confirm("\nThank you for visiting " + thisSite + ".\n\nBy clicking 'OK' you will be taken to: \n\n" + writeURL +"\n\nA Web site to which our Privacy Policy \ndoes not apply.\n\nYou are solely responsible for your \ninteractions with such Web sites.\n\n"))
	   	{
		   window.open(URL,"_blank");
	   	}
}


/*	function: newWin - opens a new window
			newWin 			takes on 7 values:
			WinURL: 		the URL to be loaded into the new window
			WinNAME:		the NAME of the popup window
			WinWIDTH: 	the WIDTH of the popup window (currently set at 700px)
			WinHEIGHT:	the HEIGHT of the popup window (currently set at 480px)
			WinRESIZE:	the "yes" or "no" value for the resize window property
			WinSCROLL:	the "yes" or "no" value for the scrollbars window property
			WinTOOLBAR: the "yes" or "no" value for the toolbar property
*/

function newWin(WinURL, WinNAME, WinWIDTH, WinHEIGHT, WinRESIZE, WinSCROLL, WinTOOLBAR)
{	
	/*	variables passed by the link calling the function	*/
	var URL = WinURL;
	var WINDOW_NAME = WinNAME;
	var POPUP_WIDTH = WinWIDTH;
	var POPUP_HEIGHT = WinHEIGHT;
	var POPUP_RESIZE = WinRESIZE;
	var POPUP_SCROLL = WinSCROLL;
	var POPUP_TOOLBAR = WinTOOLBAR;

	/*	window properties that determine the window attributes depending on what values are passed by the link calling the function	*/
	var window_toolbar = POPUP_TOOLBAR;
	var window_resize = POPUP_RESIZE;
	var window_scroll = POPUP_SCROLL;
	var window_width = POPUP_WIDTH;
	var window_height = POPUP_HEIGHT;
	var screen_balance_w = ((screen.width)-(window_width))/2;
	var screen_balance_h = ((screen.height)-(window_height))/2;
	var set_top = screen_balance_h;
	var set_left = screen_balance_w;	

	win = window.open(URL,WINDOW_NAME,'resizable=' + window_resize + ',toolbar=' + window_toolbar + ',scrollbars=' + window_scroll + ',width=' + window_width + ',height=' + window_height + ',top=' +  set_top + ',left=' + set_left + '');
	win.focus();
}

function viewEdetail(URL)
{
var URL = URL
win = window.open(URL,"mywindow","location=1,status=1,scrollbars=1,width=1025,height=820");
win.focus();
}
/* Script for print starts here */


var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
		html=html+'\n<link rel="stylesheet" type="text/css" media="screen" href="/levaquin360/css/print.css"/>\n<link rel="stylesheet" type="text/css" media="print" href="/levaquin360/css/print.css"/>\n';
		}

		html += '\n</HEAD>\n<BODY>\n';
		html += '\n<div style="text-align:right; margin: 10px;"><a href="javascript:print();">Print</a>&nbsp; &nbsp; &nbsp; <a href="javascript:window.close();">Close</a></div>\n';
		html=html+'\n<div id="printContent">\n'

		var printReadyElem = document.getElementById("contentContainerDiv");
		var printReadyElem2 = document.getElementById("content");

		if (printReadyElem != null)
		{
			html += printReadyElem.innerHTML;
			html += printReadyElem2.innerHTML;
		}
		else
		{
			alert("Could not find the printReady function");
			return;
		}
		html=html+'\n</div>\n'
		html += '\n</BODY>\n</HTML>';

		var printWin = window.open("","printContent","location=1,status=1,scrollbars=1,width=700,height=610");
		printWin.document.open();
		printWin.document.writeln(html);
		printWin.document.close();
		if (gAutoPrint)
		printWin.print();
	}
	else
	{
		alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
	}
}



//------------------------------------------------------------------------------
// CSS FUNCTIONS END
//------------------------------------------------------------------------------

function outsideLink(URL) {
   		var writeURL = URL;
   		var thisSite="www.doribax.com";
	   	if (URL.length > 60)
	   	{
		   writeURL = URL.substr(0, 60) + "...";
	   	}
	   	
	   	if (confirm("\nYou are now leaving www.LEVAQUIN360.com.\n\n" + "This link will take you to a site maintained by a third party who is solely responsible for its contents.\n\nOrtho-McNeil-Janssen Pharmaceuticals, Inc provides these links as a service to Web site visitors. Ortho-McNeil-Janssen Pharmaceuticals, Inc is not responsible for the Privacy Policy of any third party Web sites. We encourage you to read the privacy policy of every Web site you visit. \n"))
	   	//if (confirm("\nThank you for visiting " + thisSite + ".\n\nBy clicking 'OK' you will be taken to: \n\n" + writeURL +"\n\nA Web site to which our Privacy Policy \ndoes not apply.\n\nYou are solely responsible for your \ninteractions with such Web sites.\n\n"))
	   	{
		   window.open(URL,"_blank");
	   	}
}

var newwindow;
function PopWindow(url)
{
	newwindow=window.open(url,'name','height=380,width=760');
	if (window.focus) {newwindow.focus()}
}

function openPrintPreview(divName, title,height1,width1){
	
	var printPreview=window.open('','printPopup','scrollbars=yes,height='+height1+',width='+width1);
	printPreview.document.writeln('<html>');
	printPreview.document.writeln('<head>');	
	printPreview.document.writeln('<title>');
	printPreview.document.writeln(title);
	printPreview.document.writeln('</title>');
	printPreview.document.writeln('<link rel="stylesheet" type="text/css" media="screen" href="/levaquin360/css/default.css" />');
	printPreview.document.writeln('<!--[if IE 6]>');
	printPreview.document.writeln('<link rel="stylesheet" type="text/css" href="css/ie6.css" />');
	printPreview.document.writeln('<![endif]-->');
	printPreview.document.writeln('<link rel="stylesheet" type="text/css" media="print" href="/levaquin360/css/print.css"/>');
	printPreview.document.writeln('<style>');
	printPreview.document.writeln('body {font-family:Arial, Helvetica, sans-serif; font-size:.76em; line-height:1.4em; padding-bottom:12px; background-color:#FFFFFF; background-image:none}');
	printPreview.document.writeln('</style>');
	printPreview.document.writeln('</head>');
	printPreview.document.writeln('<body>');
	printPreview.document.writeln('<div align="right" style="margin-right: 10px;"><a href="javascript:window.print();">Print</a></div>')
	printPreview.document.writeln('<div style="margin: 10px;">');
	printPreview.document.writeln(document.getElementById(divName).innerHTML);
	printPreview.document.writeln('</div>');	
	printPreview.document.writeln('</body>');
	printPreview.document.close();

}


