// JavaScript functions for Braytonlaw
// copied from functions.js

//calls print friendly version of current page
function printPage() {
	var filename = location.pathname;
	var start = filename.lastIndexOf("/");
	var url
	filename = filename.slice(start + 1, filename.indexOf("."));
	switch(filename){
		case "":
			url = "index_ptr.htm"
			break;
		case "index_hl":
			url = "index_ptr.htm"
			break;
		default:
			url = filename + "_ptr.htm";
	}
	window.open(url, "", "scrollbars, resizable,top=65,left=75,screenX=100,screenY=75,width=600,height=400");
}

//new window for picture pages
var win;	//variable to hold new window specs
var version = parseInt(navigator.Version);	//version of browser

//open pop-up window for larger pictures
 function newWin2(url){
	if(navigator.appName.indexOf("WebTV") != -1) //WebTV detected
   		window.location.href = url;
	else if (version < 3) //checks for older browsers that don't support window.open
		return;
	//opens new window for browsers that support 
	else {
		//alert(url.substr(url.indexOf("_")+1,url.lastIndexOf("_")-3));
		switch(url.substring(url.indexOf("_")+1,url.lastIndexOf("_"))){ 
			case "asbestosis":
				win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=392");
				return;
			case "meso":
				win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=385");
				return;
			case "consumer":
				win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=392");
				return;
			case "type":
				switch(url.substring(url.lastIndexOf("_")+1,url.indexOf(".htm"))){
					case "amosite":
						win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=403");
						return;
					case "chryso":
						win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=383");
						return;
					case "crocid":
						win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=566,height=430");
						return;					
				}
		}
	}                                                                         
}

//opens pop-up window for Diagram of Asbestos Product Use
function newWin3(url){
	if(navigator.appName.indexOf("WebTV") != -1) //WebTV detected
   		window.location.href = url;
	else if (version < 3) //checks for older browsers that don't support window.open
		return;
	//opens new window for browsers that support 
	else {
		//alert(url.substr(url.indexOf("_")+1,url.lastIndexOf("_")-3));
		switch(url.substring(url.indexOf("_")+1,url.lastIndexOf("_"))){ 
			case "diagram":
				switch(url.substring(url.lastIndexOf("_")+1,url.indexOf(".htm"))){
					case "home":
						win = open(url, "", "screenX=0,screenY=0,left=0,top=0,width=587,height=625,scrollbars=1");
						return;
				}
		}
	}                                                                         
}

