// USED FOR ALL LINKS TO THIRD PARTY content  DO NOT EDIT WITHOUT AUTHORITY
function OpenWindow(URL)
{
	if (confirm("You are now leaving the Norbord web site. Access to other web sites is provided for your convenience only.  Norbord does not endorse or accept any liability for the content or use of the information contained within any other web site."))
	{
		window.open(URL, "_newWin");
	}
}

function popUp(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300,left = 326,top = 232');");
}

// Added Functions for dealing with dynamic Request Type list
function RemoveAllItems(Source, ProdType)
{
	var i;

	for(i=document.forms["Form1"].type.options.length-1;i>=0;i--)
		{ document.forms["Form1"].type.remove(i);   }

    document.getElementById("ExportQuestions").style.display = "none";
		
	if (Source == "NA")
		AddNAItems(document.forms["Form1"].elements["category"].options[document.forms["Form1"].elements["category"].options.selectedIndex].text, ProdType) 
	else
	    AddItems(document.forms["Form1"].elements["category"].options[document.forms["Form1"].elements["category"].options.selectedIndex].text) 
}

// Add individual select list option item
function addOption(text,value)
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	document.forms["Form1"].type.options.add(optn);
}

// Update select options based on a input value
function AddItems(Category)
{
	if (Category == "Pricing")
	{
		addOption("Pricing", "Pricing");
	}
	else if(Category == "Request sales call")
	{
		addOption("Request sales call", "Request sales call");
	}
	else if(Category == "Technical")
	{
		addOption("-None-", "None") 
		addOption("Product", "Technical - Product");
		addOption("Building system/technique", "Technical - Building system/technique");
	} 
	else if(Category == "Request Brochure")
	{
		addOption("-None-", "None") 
		addOption("Norbord Brochure", "Request Brochure - Norbord Brochure");
		addOption("BBA certificate for Caberdek", "Request Brochure - BBA certificate for Caberdek");
		addOption("BBA Certificate for SterlingOSB", "Request Brochure - BBA Certificate for SterlingOSB");
		addOption("Caberwood MDF", "Request Brochure - Caberwood MDF");
		addOption("Caberboard PB", "Request Brochure - Caberboard PB");
		addOption("SterlingOSB", "Request Brochure - SterlingOSB");
	}
	else if(Category == "Request Sample")
	{ 
		addOption("-None-", "None") 
		addOption("Caberwood MDF", "Request Sample - Caberwood MDF");
		addOption("Caberboard PB", "Request Sample - Caberboard PB");
		addOption("SterlingOSB", "Request Sample - SterlingOSB");
	}
	else if (Category == "Other")
	{
		addOption("Other", "Other");
	}
	else if (Category == "Export Queries")
	{
	    addOption("Export Queries", "Export Query");
	    document.getElementById("ExportQuestions").style.display = "block";
	}	
}

// Update select options based on a input value for North American forms
function AddNAItems(Category, ProdType)
{
	if (Category == "Pricing")
	{
		addOption("Pricing", "Pricing");
	}
	else if(Category == "Request sales call")
	{
		addOption("Request sales call", "Request sales call");
	}
	else if(Category == "Technical")
	{
		addOption("-None-", "None") 
		addOption("Product", "Technical - Product");
		addOption("Building system/technique", "Technical - Building system/technique");
	} 
	else if(Category == "Request Brochure")
	{
		addOption("-None-", "None") 
		addOption("Norbord Brochure", "Request Brochure - Norbord Brochure");

		if (ProdType == "OSB")
		{
			addOption("Request Brochure - General OSB information", "Info on OSB");
			addOption("Request Brochure - Windstorm information", "Info on Windstorm");
			addOption("Request Brochure - TallWall information", "Info on TallWall");
			addOption("Request Brochure - Solarbord information", "Info on Solarbord");
			addOption("Request Brochure - Stabledge information", "Info on Stabledge");
			addOption("Request OSB Material Safety Data Sheet", "OSB MSDS");
		}
		else if (ProdType == "MDF")
		{
			addOption("Request Brochure - Premium Standard MDF", "Info on Premium MDF");
			addOption("Request Brochure - UltraLight Density", "Info on UL");
			addOption("Request Brochure - Light Density", "Info on LD");
			addOption("Request Brochure - Moisture Resistant", "Info on MR");
			addOption("Request MDF Material Safety Data Sheet", "MDF MSDS");
		}
		else if (ProdType == "HP")
		{
			addOption("Request Brochure - Veneer Core Plywood", "Info on Veneer");
			addOption("Request Brochure - FX Plywood", "Info on FX Plywood");
			addOption("Request Brochure - FX-P", "Info on FX-P");
			addOption("Request Brochure - Prefinished Plywood", "Info on Prefinished Plywood");
		}
		else if (ProdType == "EW")
		{
			addOption("Request Brochure - Rimboard", "Rimboard");
		}
	} 
	else if(Category == "Request Sample")
	{ 
		addOption("-None-", "None") 

		if (ProdType == "OSB")
		{
			addOption("Request Sample - OSB", "OSB");
			addOption("Request Sample - Windstorm", "Windstorm");
			addOption("Request Sample - TallWall", "TallWall");
			addOption("Request Sample - Solarbord", "Solarbord");
			addOption("Request Sample - Stabledge", "Stabledge");
		}
		else if (ProdType == "MDF")
		{
			addOption("Request Sample - MDF", "MDF");
			addOption("Request Sample - UltraLight Density", "UL");
			addOption("Request Sample - LDF", "LDF");
			addOption("Request Sample - Moisture Resistant", "MR");
		}
		else if (ProdType == "HP")
		{
			addOption("Request Sample - Veneer", "Veneer Core Plywood");
			addOption("Request Sample - FX Plywood", "FX Plywood");
			addOption("Request Sample - FX-P", "FX-P");
			addOption("Request Sample - Prefinished Plywood", "Prefinished Plywood");
		}
		else if (ProdType = "EW")
		{
			addOption("Request Sample - Rimboard", "Rimboard");
		}
	}
	else if (Category = "Other")
	{
		addOption("Other", "Other");
	}
}

function Check() 
{
	var validform = true

	if (document.enquiry.firstname.value=="")
	{
		alert("Please input your first name");
		document.enquiry.firstname.focus();
		validform = false;
		return validform;
	}

	if (document.enquiry.lastname.value=="")
	{
		alert("Please input your last name");
		document.enquiry.lastname.focus();
		validform = false;
		return validform;
	}
	
	if (document.enquiry.emailaddress.value=="")
	{
		alert("Please input your email address");
		document.enquiry.emailaddress.focus();
		validform = false;
		return validform;
	}
	
	if (document.enquiry.category.value=="--None--")
	{
		alert("Please select a category - your enquiry will be dealt with quicker.");
		document.enquiry.category.focus();
		validform = false;
		return validform;
	}

	if (document.enquiry.description.value=="")
	{
		alert("Please add a description of your enquiry");
		document.enquiry.description.focus();
		validform = false;
		return validform;
	}
}

// BROWSER SNIFFER CODE AND RELATED TOP NAVIGATION ON-THE-FLY RENDERING
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
// *** BROWSER VERSION ***
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly	= (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));

if(navigator.appName == "Netscape" && navigator.userAgent.indexOf("Opera")<0 && (navigator.userAgent.indexOf("Netscape/7")>-1))
{
    var is_nav7=true; 
} 
else
{
    var is_nav7=false;
}

if(navigator.appName == "Netscape" && navigator.userAgent.indexOf("Opera")<0 && (navigator.userAgent.indexOf("Netscape/7.1")>-1))
{
    var is_nav71=true; 
} 
else
{
    var is_nav71=false;
}

if(navigator.appName == "Netscape" && navigator.userAgent.indexOf("Opera")<0 && (navigator.userAgent.indexOf("Netscape/7.2")>-1))
{
    var is_nav72=true; 
} 
else
{
    var is_nav72=false;
}

if(navigator.appName == "Netscape" && navigator.userAgent.indexOf("Opera")<0 && (navigator.userAgent.indexOf("Netscape/8")>-1))
{
    var is_nav8=true; 
} 
else
{
    var is_nav8=false;
}

var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
var is_ie7 = (is_ie && (is_major == 4) && (agt.indexOf("msie 7.0") != -1));

if(navigator.userAgent.indexOf("Firefox")!=-1)
{
    var versionindex=navigator.userAgent.indexOf("Firefox")+8;

    if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
	{
	    var is_firefox=true;
	} 
	else
	{
	    var is_firefox=false;
	}
}

if(is_nav7)
{
	function IEHoverPseudo() 
	{
		var navItems = document.getElementById("net-nav").getElementsByTagName("li");
 
		for (var i=0; i<navItems.length; i++) 
		{
			if(navItems[i].className == "nnparent") 
			{
				navItems[i].onmouseover=function() { this.className += " over"; }
				navItems[i].onmouseout=function() { this.classname=" nnparent"; }
			}
		}
	}
	window.onload = IEHoverPseudo;
}

if(is_nav8)
{
	function NavHoverPseudo() 
	{
		var navItems = document.getElementById("net-nav8").getElementsByTagName("li");
 
		for (var i=0; i<navItems.length; i++) 
		{
			if(navItems[i].className == "nnparent") 
			{
				navItems[i].onmouseover=function() { this.className += " over"; }
				navItems[i].onmouseout=function() { this.classname=" nnparent"; }
			}
		}
	}
	window.onload = NavHoverPseudo;
}

if(is_ie7)
{
   sfHover = function() 
   {     
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");     
		
		for (var i=0; i<sfEls.length; i++) 
		{         
			sfEls[i].onmouseover=function() 
			{             
                 this.className+=" sfhover";         
			}         
			
			sfEls[i].onmouseout=function() 
			{             
                 this.className=this.className.replace(new RegExp(" sfhover\\b"), "");         
             }     
         } 
	} 
	if (window.attachEvent) window.attachEvent("onload", sfHover); 
}

function OpenWin()
{
	window.document.location = "Investor_StockData.shtml"
}
