var lang; var pathName=window.location.pathname;
function linkLang(what){
  if (pathName.split('/de/').length==2){pathArray=pathName.split('/de/');}
  if (pathName.split('/en/').length==2){pathArray=pathName.split('/en/');}
  if (pathName.split('/fr/').length==2){pathArray=pathName.split('/fr/');}
  if (pathName.split('/es/').length==2){pathArray=pathName.split('/es/');}
  if (pathArray.length==2){window.location.href=pathArray[0]+'/'+what+'/'+pathArray[1];}
}
function PrintThisPage() 
{ 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sHeaderHTML = document.getElementById('headerstart').innerHTML; 
   var sContentHTML = document.getElementById('contentstart').innerHTML; 
   var sFooterHTML = document.getElementById('footerstart').innerHTML; 
   
   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><LINK href="http://www.pmtctdonations.org/css/main.css" rel=Stylesheet><body>'); 
       winprint.document.write(sHeaderHTML);
	   winprint.document.write("<hr>");
	   winprint.document.write(sContentHTML);
	   winprint.document.write("<hr>"); 
	   winprint.document.write(sFooterHTML);        
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
	   winprint.print();
}
function getRandom(){
   return (Math.round(Math.random()*(9999999999-1)))+1;
}
function popCorres(windowURL) {
  RandomNumber=getRandom();
  window.name = 'parentWnd';
  newWindow = window.open('../correspondence/popup_frame.cfm?'+windowURL,'popupCorres'+RandomNumber,'width=510,height=510,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  newWindow.focus();
}
function openWindow(windowURL) {
  window.name = 'parentWnd';
  newWindow = window.open(windowURL,'popupWindow','width=510,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  newWindow.focus();
}
function openScrollWindow(windowURL) {
  window.name = 'parentWnd';
  newWindow = window.open(windowURL,'popupWindow','width=510,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
  newWindow.focus();
}
function openBigWindow(windowURL) {
  window.name = 'parentWnd';
  newWindow = window.open(windowURL,'popupWindow');
  newWindow.focus();
}
function openGenWindow(windowURL,w,h) {
  window.name = 'parentWnd';
  newWindow = window.open(windowURL,'popupWindow','width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  newWindow.focus();
}
function confirmLink(url,msg) {
    if (confirm(msg))
        location.href = url;
}
function confirmLeaving_en(url) {
    if (confirm('Please note that the external link you have chosen is subject to its own privacy policy, terms and conditions.'))
         newWindow = window.open(url);
}
function confirmLeaving_fr(url) {
    if (confirm('Veuillez notez que le lien externe que vous avez choisi est assujeti à sa propre politique de confidentialité et à ses propres conditions d\'utilisation.'))
         newWindow = window.open(url);
}
function confirmDeleteFolder(url) {
    if (confirm('WARNING!\n\nWhen you delete a folder, you permanently delete ALL information related to the folder from the database (forms, correspondence, reviews, etc.)!\n\nThis cannot be undone.\n\nAre you sure you want to proceed?'))
        location.href = url;
}
function confirmDeleteForm() {
    if (confirm('Are you sure you want to permanently delete this form?\n\nThis cannot be undone.'))
        form.submit();
}
function confirmDeleteApplication(url) {
    if (confirm('Are you sure you want to permanently delete this application?\n\nThis cannot be undone.'))
        location.href = url;
}
function go(ACTION,ID,R) {
	document.form.ACTION.value=ACTION;
	document.form.USER_ID.value=USER_ID;
	document.form.R.value=R;
	document.form.USESQL.value='where ID='+ID;
	if (ACTION=='Edit')	document.form.USEADMINFORM.value='checkin';	
	document.form.submit();
}
function stripSpaces(x) {
    while (x.substring(0,1) == ' ') x = x.substring(1);
    return x;
}
function empty(x) { if (x.length > 0) return false; else return true; }
function stripSpaces(x) { return x.replace(/^\W+/,''); }

function popImageTitle222(image,title) {
		alert("in");
		window.status = title;
		alert("1");
		//newWindow = window.open('about:blank','popUpWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no height=485 width=563');
		newWindow = window.open('about:blank', 'popUpWindow', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,height=485,width=563'); 
		alert("2");
		//newWindow.focus();
		alert("3");
		doc = newWindow.document;
		alert("4");
		doc.open('text/html');
		alert("5");
		doc.write('<html><head><TITLE>'+title+'<\/TITLE><\/head>');
		doc.write('<body bgcolor=#dddddd topmargin=0 marginheight=0 leftmargin=0 marginwidth=0><center><form>');
		doc.write('<img width=563 height=458 border=0 src="http://www.medicaldonations.org/images/maps/' +image+ '" ALT="' +title+ '">');
		doc.write('<input type=button onClick="self.close();" value="Close this window"><\/center><\/form><\/body><\/html>');
		alert("6");
		doc.close();
		alert("out");
}
		
function popImageTitle(image,title) {
		
	var win = window.open('', 'popUpWindow', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,height=485,width=563'); // a window object

	var doc = win.document;

	doc.open("text/html", "replace");

		doc.write('<html><head><TITLE>'+title+'<\/TITLE><\/head>');
		doc.write('<body bgcolor=#dddddd topmargin=0 marginheight=0 leftmargin=0 marginwidth=0><center><form>');
		doc.write('<img width=563 height=458 border=0 src="http://www.medicaldonations.org/images/maps/' +image+ '" ALT="' +title+ '">');
		doc.write('<input type=button onClick="self.close();" value="Close this window"><\/center><\/form><\/body><\/html>');

	doc.close();

}