function disp(s_menu,i_left,i_top) 
{
var o_menu=document.getElementById('i'+s_menu);
var o_submenu=document.getElementById(s_menu);
var o_temp = o_menu.offsetParent;
var i_x=o_menu.offsetLeft;
while (o_temp!=null)
  {
  i_x+=o_temp.offsetLeft;
  o_temp=o_temp.offsetParent;
  };
i_x=i_x+i_left;
var o_temp = o_menu.offsetParent;
var i_y=o_menu.offsetTop;
while (o_temp!=null)
  {
  i_y+=o_temp.offsetTop;
  o_temp=o_temp.offsetParent;
  };
i_y=i_y+i_top;
o_menu.style.backgroundImage = "url(images/n1grad1.gif)";
o_menu.style.color="#000000";
o_menu.style.border="1px solid #000000";
o_submenu.style.Position="absolute";
o_submenu.style.left = parseFloat(i_x);
o_submenu.style.top = parseFloat(i_y);
o_submenu.style.visibility="visible";
}

function fade(s_menu) 
{
// date = new Date();
//var curDate = null;
//do { var curDate = new Date(); }
//while(curDate-date < 100);
var o_elem=document.getElementById('i'+s_menu);
o_elem.style.backgroundImage = "url(images/n1grad2.gif)";
o_elem.style.backgroundColor="#ef3f4f";
o_elem.style.color="#ffffff";
o_elem.style.border="1px solid #ef3f4f";
document.getElementById(s_menu).style.visibility="hidden";
}

function curs(tbox)
{
tbox.focus();
tbox.select();
}

function cwxf(s_name,s_hex,s_color,s_type,s_text_color)
{
window.opener.document.getElementById(s_name).innerHTML=s_color;
window.opener.document.getElementById(s_name).style.fontWeight="bold";
if (s_text_color=="w")
  {
  window.opener.document.getElementById(s_name).style.color="#ffffff";
  }
else
  {
  window.opener.document.getElementById(s_name).style.color="#000000";
  };
if (s_type=="c")
  {
  window.opener.document.getElementById(s_name).style.backgroundColor=s_hex;
  }
else
  {
  window.opener.document.getElementById(s_name).style.background="url(images/"+s_hex+".gif)";
  };
window.opener.focus();
window.close();
}

function cdtx(s_name,s_year,s_month,s_day,s_code)
{
window.opener.document.getElementById('h'+s_name).value=s_year+s_month+s_day;
window.opener.document.getElementById(s_name).innerHTML=s_month+"/"+s_day+"/"+s_year;
window.opener.document.getElementById(s_name).style.color="#ff0000";
window.opener.document.getElementById('c_code').innerHTML="Offer valid from "+window.opener.document.getElementById('sdate').innerHTML+" to "+window.opener.document.getElementById('edate').innerHTML+" | Code "+s_code;
window.opener.focus();
window.close();
}

function wsel(s_elem)
{
var b_check_1=document.getElementById('s'+s_elem+'1c').checked;
var b_check_2=document.getElementById('s'+s_elem+'2c').checked;
var v_1="hidden";
var v_2="hidden";
var c_1="md";
var c_2="md";
if (b_check_1)
  {
  c_1="me";
  v_1="visible";
  if (b_check_2)
    {
    c_2="me";
    v_2="visible";
    };
  };
document.getElementById('s'+s_elem+'1tc').className=c_1;
document.getElementById('s'+s_elem+'1hc').style.visibility=v_1;
document.getElementById('s'+s_elem+'1wc').style.visibility=v_1;
document.getElementById('s'+s_elem+'1lc').style.visibility=v_1;
document.getElementById('s'+s_elem+'1bc').style.visibility=v_1;
document.getElementById('s'+s_elem+'2cc').style.visibility=v_1;
document.getElementById('s'+s_elem+'2tc').className=c_2;
document.getElementById('s'+s_elem+'2hc').style.visibility=v_2;
document.getElementById('s'+s_elem+'2wc').style.visibility=v_2;
document.getElementById('s'+s_elem+'2lc').style.visibility=v_2;
document.getElementById('s'+s_elem+'2bc').style.visibility=v_2;
}

function wpop(sourcefile,w,h)
{
newwindow=window.open(sourcefile,"jsw","width=10,height=10,top="+(screen.height-h)/2+",left=80,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0");
// newwindow.location.href=sourcefile;
if (newwindow.opener==null)
  {
  newwindow.opener=self;
  };
newwindow.resizeTo(10,10);
newwindow.focus();
for(var i_loop=10; i_loop<h; i_loop=i_loop+20)
  {
  newwindow.resizeTo(2,i_loop);
  };
for(var i_loop=10; i_loop<w; i_loop=i_loop+20)
  {
  newwindow.resizeTo(i_loop,h);
  };
newwindow.resizeTo(w,h);
}

function capt(checkbox)
{
temp=eval(checkbox);
temp.checked=!temp.checked;
}

function strm()
{
return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

String.prototype.trim = strm;

function qval(tname,tcomp,temail,tphone)
{
tname.value=tname.value.trim();
tcomp.value=tcomp.value.trim();
temail.value=temail.value.trim();
tphone.value=tphone.value.trim();
if ((tname.value=="") || (tcomp.value=="") || ((temail.value=="") && (tphone.value=="")))
  {
  window.alert("Before CE can provide a quote, we need:\n* Your name\n* Your company name\n* Your e-mail address and/or phone number\n\nPlease remember that CE will not share\nthis information with any other party.");
  tname.focus();
  tname.select();
  event.returnValue=false;
  };
}

function qbux(tsdate,tedate,thead,ttext,tdisc)
{
tsdate.value=tsdate.value.trim();
tedate.value=tedate.value.trim();
thead.value=thead.value.trim();
ttext.value=ttext.value.trim();
tdisc.value=tdisc.value.trim();
if ((tsdate.value=="00000000") || (tedate.value=="00000000") || (tsdate.value>tedate.value) || (thead.value=="") || (ttext.value=="") || (tdisc.value==""))
  {
  window.alert("Information is missing or incorrect.\n\nPlease make sure there is:\n* A start date\n* An end date (greater than the start date)\n* A heading\n* Text\n* A disclaimer\n\nPlease try again!");
  event.returnValue=false;
  };
}

function ilres()
{
document.chx.DestinationPostalCode.value="";
document.chx.InquiryNumber.value="";
document.chx.InquiryNumber.focus();
}

function mdres()
{
document.mdx.DestinationPostalCode.value="";
document.mdx.InquiryNumber.value="";
document.mdx.InquiryNumber.focus();
}
