var obj_p_pipe;
var obj_c_pipe;
var obj_o_pipe;
var obj_p_msg;
var obj_c_msg;
var obj_o_msg;
var obj_msg_ul;

function getObject(objectName)
{	
  var objItem;
  
  if (document.all)
    objItem = document.all[objectName];
  else
  {
    objItem = document.getElementById(objectName);
    if (objItem==null)
      objItem= document.getElementsByName(objectName)[0];
    if (document.getElementsByName(objectName).length>1)
      objItem=document.getElementsByName(objectName);	
  }
  if(objItem == null) return false;
  return objItem;
}


function load_rollover()
{
	obj_p_pipe = getObject("home_p_pipe");
	obj_c_pipe = getObject("home_c_pipe");
	obj_o_pipe = getObject("home_o_pipe");
	obj_p_msg = getObject("home_p_msg");
	obj_c_msg = getObject("home_c_msg");
	obj_o_msg = getObject("home_o_msg");
	obj_msg_ul = getObject("home_msg_ul");
}

function pipe_on(pipe)
{
	obj_pipe = eval("obj_" + pipe + "_pipe");
	obj_pipe.style.visibility = "visible";
	obj_msg = eval("obj_" + pipe + "_msg");
	obj_msg.style.visibility = "visible";
	obj_msg_ul.style.visibility = "visible";
	return;
}

function pipe_off(pipe)
{
	obj_pipe = eval("obj_" + pipe + "_pipe");
	obj_pipe.style.visibility = "hidden";
	obj_msg = eval("obj_" + pipe + "_msg");
	obj_msg.style.visibility = "hidden";
	obj_msg_ul.style.visibility = "hidden";
	return;
}

function init()
{
	obj_home_content_box = getObject("home_content_box");
	//obj_home_news_box = getObject("home_news_box");
	obj_newsbox = getObject("newsbox");
	
	obj_ilex = getObject("home_ilex");
	if(obj_ilex) {
		obj_ilex.style.left = obj_home_content_box.offsetWidth+120;
	}
	if(sniff())
	{
		obj_home_content_box.style.paddingTop = 0;
		obj_home_content_box.style.marginTop = 316;
		obj_newsbox.style.height = 300;
		
		//Fix title
		obj_home_title = getObject("home_title");
		obj_home_title.style.width = 400;
	}
	else
	{
	
	//alert(obj_home_news_box.offsetHeight);
	//alert(obj_home_content_box.offsetHeight);
	
	//set up news box height to match content box
	//obj_home_news_box.style.height = obj_home_content_box.offsetHeight;
	obj_newsbox.style.height = obj_home_content_box.offsetHeight - 366;
	}
	
	obj_bg = getObject("bg");
	obj_blue_strip = getObject("blue_strip");
	obj_bg.style.height = obj_blue_strip.offsetTop;
}

function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null) // if something went wrong
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}

function form_popup(form_id, product)
{
	uri = "form.php?form_id=" + form_id;
	
	if(product && product.length != 0)
	{
		uri += "&product=" + product;
	}
	
	launch(uri, "form_popup", "height=400,width=500,channelmode=0,dependent=0,directories=0,fullscreen=0,location=1,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0", "myWindow");
	
	return;
}

function sniff()
{
	var ie = new RegExp("MSIE 5.0");
	
	if(ie.test(navigator.appVersion)) return true;
	
	return false;
}
