loadStylesheet("common","common.css");
loadStylesheet(toc,"common.css");
if (browser.isNS || browser.isMozilla) {
	loadStylesheet("common","navMozilla.css");
	if (browser.isNS)
		loadStylesheet("common","nav.css");
	else if (browser.isMozilla){
		if (browser.versionMinor<1.6)
			loadStylesheet("common","mozilla_1.6down.css");
		else if (browser.versionMinor<1.7)
			loadStylesheet("common","mozilla_1.7down.css");
	}
} else if (browser.isIE){	
	if (browser.isWin){
		loadStylesheet("common","winIe.css");	
		if (browser.isIE55Down)
			//IE 5.5 down excluding 5.5
			loadStylesheet("common","winIe55Down.css");
		else if (!browser.isIE6up)
			//IE 6 down excluding 6
			loadStylesheet("common","winIe6Down.css");	
	} else if (browser.isMac){
		loadStylesheet("common","macIe.css");
	}
} else if (browser.isOpera)
	loadStylesheet("common","opera.css");
  else if (browser.isSafari)
  	loadStylesheet("common","safari.css");
  else if (browser.isFirefox)
  	loadStylesheet("common","firefox.css");
  else if (browser.isKonqueror){
  	loadStylesheet("common","konqueror.css");
  }
	
function loadStylesheet(aDirectory,aStylesheet){
	document.write("<link href=\""+resourcesPrefix+"/"+aDirectory+"/web/css/"+aStylesheet+"\" rel=\"stylesheet\" type=\"text/css\"/>");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
  	if ((x=MM_findObj(a[i]))!=null){
  		document.MM_sr[j++]=x; 
  		if(!x.oSrc) x.oSrc=x.src; 
  		x.src=a[i+2];
  	}
}

function help(aId){
	var width=250;
	var height=350;
	var aWindow=window.open("/"+toc+"/help/"+aId,"","width="+width+",height="+height+",scrollbars=yes");
	aWindow.moveTo(parseInt((screen.width-width)/2),parseInt((screen.height-height)/2));
}

function action(aAction){
	var doAction=true;
	//brings up a warning dialog if there is a second argument - which is the warning message
	//used in the "remove me" action on the myDetails page
	if (arguments.length>1)
		doAction=confirm(arguments[1]);
		
	if (doAction){
		//cforms
		document.form[aAction].value=aAction;	
		//journeycheck
		document.form.action.value=aAction;
		document.form.submit();
	}
}

function hide(aId){
	var element=document.getElementById(aId);
	element.style.display="none";
}

//modified from http://homepage.ntlworld.com/bobosola/
function correctPNG(){
	if (browser.IEPNGSupport || (browser.isWin && browser.isIE55Down)) {
		for(var i=0; i<document.images.length; i++){
			var img = document.images[i];
			var imgName = img.src.toLowerCase();
			if (imgName.substring(imgName.length-4, imgName.length) == ".png" && (imgName.indexOf("_t.")!=-1 || imgName.indexOf("_t_")!=-1)){
				var imgId = (img.id) ? "id='" + img.id + "' " : "";
				var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				if (browser.IEPNGSupport){
					//IE PNG fix
			 		var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
					var imgStyle = "display:inline-block;" + img.style.cssText ;
			 		if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			 		if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			 		if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;	
			 		
			 		var newHTML;
			 		if (imgId.indexOf("_rollover")!=-1){
			 			newHTML="<span " + imgId + imgClass + imgTitle+
			 				" style=\"width:" + img.width + "px; height:" + img.height + "px;" + imgStyle +
			 				"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+
			 				"(src='" + img.src + "', sizingMethod='image');\""+
			 				" onmouseover=\"iePngSwap('" + img.id + "')\" onmouseout=\"iePngSwap('" + img.id +"')\""+
			 				"></span>";
			 		} else {		 		
				 		newHTML = "<span " + imgId + imgClass + imgTitle+
			 				" style=\"width:" + img.width + "px; height:" + img.height + "px;" + imgStyle +
		     				"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+
				 			"(src=\'" + img.src + "\', sizingMethod='image');\"></span>";
				 	}
			 		img.outerHTML = newHTML;
			 		i = i-1;
			 	} else if (browser.isIE55Down) {
			 		//IE5 and below
			 		var newImageName=imgName.substring(0,imgName.length-4)+".gif";
			 		newHTML="<img id=\""+imgId+"\" src=\""+newImageName+"\" width=\""+img.width+"\" height=\""+img.height+"\" border=\"0\" "+imgClass;
			 		if (imgId.indexOf("_rollover")!=-1){
			 			newHTML+=" onmouseover=\"gifSwap(this)\" onmouseout=\"gifSwap(this)\"";
			 		}
			 		newHTML+="/>";
				 	img.outerHTML=newHTML;
			 	}
			}
		}
	} 
}

function iePngSwap(aImageId){
   var oSpan = document.getElementById(aImageId);
   var currentSrc = oSpan.filters(0).src;
   if (currentSrc.indexOf("_f2") != -1)
      oSpan.filters(0).src = currentSrc.replace("_f2","");
   else
      oSpan.filters(0).src = currentSrc.replace(".png","_f2.png");
}

function gifSwap(aImage){
   var imageSrc = aImage.src
   if (imageSrc.indexOf("_f2") != -1) 
      aImage.src = imageSrc.replace("_f2","");
   else
      aImage.src = imageSrc.replace(".gif","_f2.gif");
}

function imageSwap(aImage){
   var imageSrc = aImage.src
   if (imageSrc.indexOf("_f2") != -1) 
      aImage.src = imageSrc.replace("_f2","");
   else
      aImage.src = imageSrc.replace(".png","_f2.png");
}

function displayImage(aImage,aWidth,aHeight){
	var html="<div style=\"width:"+aWidth+"px;height:"+aHeight+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aImage+".png', sizingMethod='scale')\"></div>";
	document.write(html);
}

function expandCollapseIncident(aId){
	elem=document.getElementById(aId);
	image=document.getElementById("image_"+aId);
	if (elem.style.display=="none" | elem.style.display==""){
		if (browser.isNS || browser.isMozilla || browser.isFirefox || browser.isOpera)
			elem.style.display="table-row";
		else
			elem.style.display="block";
		image.src=image.src.replace("plus","minus");
	} else {
		elem.style.display="none";		
		image.src=image.src.replace("minus","plus");
	}
}
