if (navigator.appName=="Microsoft Internet Explorer" || (navigator.appName=="Netscape" && navigator.appVersion.substring(0,1) == "5")){
	document.write("<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"\/css\/global.css\">");
}
else {
	document.write("<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"\/css\/globalns.css\">");
}

function showHelp(ht, hi, pwidth, pheight) {
	querystring = 'ht=' + escapeInput(ht) + '&hi=' + escapeInput(hi);

	var windowoptions = 'toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,fullscreen=no,scrollbars=yes,top=150,left=190,width=' + pwidth + ',height=' + pheight
	openNewWindow('/library/help/template.asp?' + querystring,'RRunners',windowoptions);
}

function escapeInput(inputString) {
  var myString = escape(inputString);
  myString = replaceChar(myString, "+", "%2B");   myString = replaceChar(myString, "%20", "+");   return(myString);
}
	 
function replaceChar(myString, inChar, outChar) {
  var newString = '';
  var prevPos = 0;
  var curPos = myString.indexOf(inChar);
  if(curPos == 0) {
    newString += outChar; prevPos = curPos = curPos+inChar.length;   }
  while(curPos != -1) {
    newString += myString.substring(prevPos, curPos) + outChar;
    prevPos = curPos = curPos+inChar.length;
    curPos = myString.indexOf(inChar, curPos);
  }
  return(newString + myString.substring(prevPos, myString.length)); 
}


function openNewWindow(URLLocation,windowName,windowParameters) {
	window.open(URLLocation,windowName,windowParameters);
}

/* CONNEXION */ 

function getStatus(id){
	var URL = 'status.asp'; 
	var left = (screen.availWidth - 430) / 2; // Center the window from left to right
	var top  = (screen.availHeight - 470) / 2; // Center the window from top to bottom
	window.open(URL + '?txtOrderID=' + id,'',config='height=470,width=430,toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');
}

function printShippingLabel(id){
	var URL = 'shippingLabel.asp'; 
	var left = (screen.availWidth - 580) / 2; // Center the window from left to right
	var top  = (screen.availHeight - 600) / 2; // Center the window from top to bottom
	window.open(URL + '?txtOrderID=' + id,'',config='height=600,width=580,toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');
}
function printWizard(id){
	var left = (screen.availWidth - 350) / 2;
	var top  = (screen.availHeight - 100) / 2;
	window.open('print.asp?txtOrderID=' + id ,'',config='height=100,width=350, toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');
}
function resizeWindow(w,h){
	var left = (screen.availWidth - w) / 2;
	var top  = (screen.availHeight - h) / 2;
	window.resizeTo(w,h);
	window.moveTo(left,top);

}

function printReceipt(id){
	var URL = 'receipt.asp'; 
	var left = (screen.availWidth - 450) / 2; // Center the window from left to right
	var top  = (screen.availHeight - 350) / 2; // Center the window frome top to bottom
	window.open(URL + '?txtOrderID=' + id,'',config='height=350,width=450,toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');
}

function openPackageSelector(){
	var URL = 'selector.htm';
	var left = (screen.availWidth - 645) / 2; // Center the window from left to right
	var top  = (screen.availHeight - 480) / 2; // Center the window frome top to bottom
	window.open(URL,'',config='height=480,width=645,toolbar=no,menubar=no, scrollbars=no,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');

}

function printReport(beginDate,endDate,totalsOnly,display){
	var URL = 'printReport.asp'; 
	var left = (screen.availWidth - 600) / 2; // Center the window from left to right
	var top  = (screen.availHeight - 550) / 2; // Center the window frome top to bottom
	window.open(URL + '?txtBeginDate=' + beginDate + '&txtEndDate=' + endDate + '&chkTot=' + totalsOnly + '&Continue1=1' + '&radDisplay=' + display ,'',config='height=550,width=600,toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,directories=no, status=no, left=' + left + ',top=' + top + '');
}

function changePassword(id){
	var userID = id;
	var URL = "changePassword.asp";
	var left = (screen.availWidth - 300) / 2;
	var top = (screen.availHeight - 110) / 2;
	
	window.open(URL,'passwd',config='height=110,width=300, toolbar=no,menubar=no, scrollbars=no,resizable=yes,location=no,directories=no, status=no, left=' + left + ', top=' + top + '');
}
