//==========================================================================================
// Verndale.com - GlobalJavascript.js
//==========================================================================================
/* In this file:
	[JavaScript and jQuery Plugins] - all plugins written in javascript or jQuery
	[Javascript Functions] - all none jQuery functions
	[jQuery functions on load] - all modules / controls of the site
*/


//==========================================================================================
// BEGIN: JavaScript and jQuery Plugins


// --------------------------------------------------------------------------------------
// BEGIN: default.js
var IE4 = (document.all && !document.getElementById) ? true : false;
var NS4 = (document.layers) ? true : false;
var IE5 = (document.all && document.getElementById) ? true : false;
var N6 = (document.getElementById && !document.all) ? true : false;

function jumpto(sel){
  var i;
  i = sel.selectedIndex;
  
    if (sel.options[i].value != "") {
     window.location = sel.options[i].value;
    }
  
}

function which_Browser()
    {var a,b;
    a  = navigator.appVersion;
    b = a.charAt(0);
    if (b > 2)
    	{nav_refresh();
    	}
	}

function nav_refresh() {
	document.navform.reset();
}

var browserOK = false;
              var pics;
              var NameString;
              var objCount = 0;
              NameString = navigator.appname + navigator.appCodeName + navigator.appVersion;
              if (NameString.indexOf("Explorer") == -1)
                {if (NameString.indexOf("2.0") == -1)
                  {browserOK = true;
                          pics = new Array();
                  }
                }

              function preload(name, first, second) {
                        if (browserOK) {
                          var args = (arguments.length);
                          pics[objCount] = new Array(args);
                          pics[objCount][0] = name;
                          for(var i=1; i < args; i++) {
                                  pics[objCount][i] = new Image();
                                  pics[objCount][i].src = arguments[i];
                          }
                  objCount++;
                  }
              }

              function on(name) {
                var imgIndex = 2;
                if (browserOK) {
                  if (arguments.length > 1) {
                    imgIndex = parseInt(arguments[1]);
                  }
                  for (i = 0; i < objCount; i++) {
                    if (document.images[pics[i][0]] != null) {
                      if (name != pics[i][0])
                        { document.images[pics[i][0]].src = pics[i][1].src; }
                      else {
                        if (imgIndex < pics[i].length) { document.images[pics[i][0]].src =
			pics[i][imgIndex].src;
                        } else { document.images[pics[i][0]].src = pics[i][1].src; }
                      }
                    }
                  }
                }
              }

              function extra(name) {
                var i=0;
                var imgIndex = 2;
                if (browserOK) {
                  if (document.images[name] == null) { return 0; }
                  if (arguments.length > 1) {
                    imgIndex = parseInt(arguments[1]);
                  }
                  for(i=0;i<objCount;i++) {
                    if (pics[i][0] == name) { break; }
                  }
                  if (pics[i][0] != null && imgIndex < pics[i].length)
                  { document.images[name].src = pics[i][imgIndex].src; }
                  else { document.images[name].src = pics[i][1].src; }
                  return 1;
                }
                return 0;
              }

              function off() {
                if (browserOK) {
                  for (i = 0; i < objCount; i++) {
                    if (document.images[pics[i][0]] != null) {
                    document.images[pics[i][0]].src = pics[i][1].src;
                    }
                  }
                }
	      }
			
function goToMailForm (formURL, recipient)
{
	document.mailRecipientForm.recipient.value = recipient;
	document.mailRecipientForm.action = formURL;
	document.mailRecipientForm.submit ();
}

function writeMailRecipientBlock ()
{
	document.write ("<form name='mailRecipientForm' action='http://www.dow.com/' method='POST'>");
	document.write ("<input name='recipient' type='hidden' value='' />");
	document.write ("</form>");
}

function litOrder(title, formnum, business)
 {
    changecookie("doctitle", title);
    changecookie("formnum", formnum);
    var oldvar = "http://www.dow.com/webapps/lit/litorder.asp?OPTION="+formnum+"&Business="+business+"&DocTitle="+title;
    var newvar = oldvar;
    while(oldvar.indexOf(" ") != -1)
     {
        newvar = oldvar.substring(0,oldvar.indexOf(" "))+"%20"+oldvar.substring(oldvar.indexOf(" ")+1,oldvar.length);
        oldvar = newvar;
     }
    window.location = oldvar;
  }
// END: default.js


// --------------------------------------------------------------------------------------
// BEGIN: JavaScript.js
CheckOtherWins = 'Y';
if(opener)
	{
	if(opener.opener)
		{
		CheckOtherWins = 'N';
		location='about:blank';
		opener.location='CloseMe.htm';
		if(opener.opener)
			{
			opener.opener.location.replace('noback.htm');
			}
		self.close();
		}
	else
		{
		if(CheckConditions())
			{
			CheckOtherWins = 'N';
			location='about:blank';
			opener.location='CloseMe.htm';
			if(opener.opener)
				{
				opener.opener.location.replace('noback.htm');
				}
			self.close();
			}
		}
	}

function CheckConditions()
	{
	ckthis = opener;
	if(ckthis.document.displayform) return true;
	if(ckthis.locid) return true;
	if(ckthis.pollspeed) return true;
	if(ckthis.numspeeds) return true;
	if(ckthis.speedid) return true;
	if(ckthis.polltime) return true;
	if(ckthis.passnumber) return true;
	if(ckthis.highestframe) return true;
	if(ckthis.highestframeopened) return true;
	if(ckthis.document.forms.length > 0)
		{
		for(var a=0; a < ckthis.document.forms.length; a++)
			{
			if(ckthis.document.forms[a].message) return true;
			if(ckthis.document.forms[a].gostop) return true;
			if(ckthis.document.forms[a].speed) return true;
			if(ckthis.document.forms[a].smge) return true;
			}
		}
	return false;
	}

if(CheckOtherWins=='Y')
	{
	var szName = 'BPVisit';
	function SetUpC()
		{
		WinAExists = 'N';
		if(document.cookie)
			{
			var arr = document.cookie.split((escape(szName) + '='));
			if(arr.length>=2)
				{
				if(arr[1].substr(0,1)=='Y')
					{
					WinAExists = 'Y';
					alert('You may only browse the Bhopal site in one window at a time.');
					if(opener)
						{
						self.close();
						}
					else
						{
						location.replace('noback.htm');
						}
					}
				else
					{
					WriCToP();
					}
				}
			else
				{
				WriCToP();
				}
			}
		else
			{
			WriCToP();
			}
		}
	
	function WriCToP()
		{
		document.cookie = szName + "=Y; expires=Thu, 01-Jan-09 00:00:01 GMT";
		}
		
	function DelCFromP()
		{
		if(WinAExists=='N')
			{
			document.cookie = szName + "=N; expires=Thu, 01-Jan-70 00:00:01 GMT";
			}
		}
	}
// END: JavaScript.js


window.onload= SetUpC;
window.onunload= DelCFromP;



// END: JavaScript and jQuery Plugins


//==========================================================================================
// BEGIN: jQuery functions on load
// BEGIN: jQuery functions on load
