function bgprint(doctype)
{ 
	if(window.location.href.indexOf("patient_portrait") != -1)
	{
		printfrom=window.location.href.replace('patient_portrait/detail','bgprint');
		printfrom+='&pageName=patient_portrait';
	}
	else if(window.location.href.indexOf("hiv_perspective") != -1)
	{
		printfrom=window.location.href.replace('hiv_perspective/detail','bgprint');
		printfrom+='&pageName=hiv_perspective';
	}
	else if(window.location.href.indexOf("faqdisplay") != -1)
	{
		printfrom=window.location.href.replace('faqdisplay','bgprint');
		printfrom+='&pageName=faqdisplay';
	}
	else if(window.location.href.indexOf("faq") != -1)
	{
		printfrom=window.location.href.replace('faq','bgprint.jhtml');
		printfrom+='?pageName=faq';
		
	}
	else
	{
		printfrom=window.location.href.replace('bgdisplay','bgprint');
	}
	printfrom=printfrom.replace('education/detail','bgprint');
	printfrom=printfrom.replace('clinical_info/detail_trial','bgprint');
	printfrom=printfrom.replace('congresses/detail','bgprint');
	printfrom=printfrom.replace('events/detail','bgprint');
	printfrom=printfrom.replace('news/detail','bgprint');
	printfrom=printfrom.replace('disease/item_detail','bgprint');
	printfrom=printfrom.replace('disease/detail','bgprint');
	printfrom=printfrom.replace('product/detail','bgprint');
	printfrom=printfrom.replace('medline/details','bgprint');
	if (doctype == "disease" || doctype == "product" || doctype == "clinicaltrail" || doctype == "congresses" || doctype == "events" || doctype == "news" || doctype == "medline") {
		printfrom=printfrom+"&doctype="+doctype;
	}
	window.open(printfrom,'popup','scrollbars=no,resizable=no,width=200,height=100,menubar=no,toolbar=no,status=no,location=no');
}
function printMasterContent(url) {
	windowUrl = "/printMasterContent.jhtml?url="+url;
	window.open(windowUrl,'popup','scrollbars=no,resizable=no,width=200,height=100,menubar=no,toolbar=no,status=no,location=no');
}
function openPrintableVersion(url,name,w,h) {
	if (w != "" && h != "") {
		sizeText = 'width=' + w +',height=' + h + ',';
	}
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = sizeText + 'top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=no,menubar=no,toolbar=yes,status=no,location=no';
	window.open(url,name,settings);
}
function printableVersion() {
	printfrom=window.location.href.replace('bgdisplay','bgprint');
	printfrom=printfrom.replace('backgrounders/article_du_mois','bgprint');
	printfrom=printfrom.replace('fichedisplay','ficheprint');
	//KLAPSJO: ma-douleur.com: fiches need to be printed 1 by 1
	if (printfrom.indexOf('ficheprint') == -1){
		printfrom=printfrom+"&printerfriendly=true";
	}
	openPrintableVersion(printfrom,'popup',780,500);
}
function openExternalWarningWindow(url,name,w,h) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=no,menubar=no,toolbar=no,status=no,location=no';
	window.open(url,name,settings);
	return false;
}
function openCenteredWindow(url,name,w,h) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=no,menubar=no,toolbar=no,status=no,location=no';
	window.open(url,name,settings);	
}
function openInParent(url){
	window.opener.location=url;
	window.close();
} 
function MM_jumpMenuNewWindow(selObj,w,h,restore){
	if ( (selObj.options[selObj.selectedIndex].value!="") && (selObj.options[selObj.selectedIndex].value!="null") ) {
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable,location=yes,toolbar=yes,status=yes,directories=no,menubar=yes';
		window.open(selObj.options[selObj.selectedIndex].value,'JC',settings);
	}
	if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenuNewWindowWarning(selObj,w,h,restore){
	if ( (selObj.options[selObj.selectedIndex].value!="") && (selObj.options[selObj.selectedIndex].value!="null") ) {
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable,location=yes,toolbar=yes,status=yes,directories=no,menubar=yes';
		//window.open(selObj.options[selObj.selectedIndex].value,'JC',settings);
		openCenteredWindow('/backgrounders/externalwarning.jhtml?referer=' + selObj.options[selObj.selectedIndex].value + '&newWindow=true','popup','350','200');
	}
	if (restore) selObj.selectedIndex=0;
}
//	sets the CSS class of the element, W3C & IE
function setClass(element, className) { 
	element.setAttribute('class',className);
	element.setAttribute('className',className); //<iehack>
}
function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5)
		try { 
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) { 
			try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (E) { 
			xmlhttp = false; 
		} 
	} 
	@else 
	xmlhttp = false; 
	@end @*/  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 
		try { 
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp; 
}
/**
* From http://labnol.blogspot.com/2006/01/add-to-favorites-ie-bookmark-firefox.html
* FRAME-91
**/
function bookmarkThisPage(url, title) { 
	//if no title is specified don't bookmark
	if (title == null) {
		return;
	}
	if (window.sidebar) { 
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if ( window.external ) { 
		// IE Favorite
		window.external.AddFavorite( url, title); 
	} else if (window.opera && window.print) { 
		// Opera Hotlist
		return true; 
	}
}
function openWindow(url,name,w,h) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=no,menubar=no,toolbar=no,status=no,location=no';
	window.open(url,name,settings);
}
