var zoom_min_width = "315";
var zoom_add_width = "100";
var zoom_add_height = "150";

var ns4 = (document.layers)  ? 1:0;
var ie4 = (document.all)  ? 1:0;
var moz5 = ((navigator.userAgent.toLowerCase().indexOf("mozilla")==0) && (navigator.userAgent.toLowerCase().charAt(8) >= 5) && (navigator.userAgent.toLowerCase().indexOf("compatible")<0));

var nslayer = (document.layers)  ? 1:0;
var ielayer = (document.all)  ? 1:0;
var do_submit = "";

function checksearchform2() {
do_submit = "YES";

if(do_submit=="YES") {
if(document.searchform2.search_term.value=='') {
alert("Please enter one or more KEYWORDS.          ");
if(nslayer==1 || ielayer==1)
{document.searchform2.search_term.focus()}
do_submit="NO"}}

if(do_submit=="YES") {
document.searchform2.submit();
}
}

// var ns4 = (document.layers)  ? 1:0;
// var ie4 = (document.all)  ? 1:0;
// var moz5 = ((navigator.userAgent.toLowerCase().indexOf("mozilla")==0) && (navigator.userAgent.toLowerCase().charAt(8) >= 5) && (navigator.userAgent.toLowerCase().indexOf("compatible")<0));

function doLayer(whichLayer) {
	if(moz5) {
	document.getElementById(whichLayer).style.position="relative";
	document.getElementById(whichLayer).style.visibility="visible";
	document.getElementById(whichLayer).style.display="none";
	}
	if(ns4) {
	document.layers[whichLayer].position="relative";
	document.layers[whichLayer].visibility="visible";
	}
	if(ie4) {
	document.all[whichLayer].style.position="relative";
	document.all[whichLayer].style.visibility="visible";
	}
}

function undoLayer(whichLayer) {
	if(moz5) {
	document.getElementById(whichLayer).style.visibility="hidden";
	document.getElementById(whichLayer).style.display="block";
	}
	if(ns4) {
	document.layers[whichLayer].visibility="hidden";
	}
	if(ie4) {
	document.all[whichLayer].style.visibility="hidden";
	}
}

// <!--- BEGIN POP UP WINDOW FUNCTION --->
function openwin(page_name,width1,height1,scrollbars1,resizable1,menubar1,status1,toolbar1,titlebar1,location1) {
if(typeof popup_window != 'undefined') {
if(popup_window != null) {
if(popup_window.closed==false) {
popup_window.close();
} // window closed
} // window null
} // window undefined
popup_window=window.open(page_name,"popup_window","WIDTH="+width1+",HEIGHT="+height1+",top=45,left=50,menubar="+menubar1+",resizable="+resizable1+",scrollbars="+scrollbars1+",status="+status1+",toolbar="+toolbar1+",titlebar="+titlebar1+",location="+location1);
if(typeof popup_window != 'undefined') {
if(popup_window != null) {
if(popup_window.closed==false) {
popup_window.focus();
} // window closed
} // window null
} // window undefined
return
}
// <!--- END POP UP WINDOW FUNCTION --->

// <!--- BEGIN JAVASCRIPT FOR ZOOM WINDOW --->
var winywidth = 0;
var winyheight = 0;

function zoomwin(id,ywidth,yheight,what_2_zoom,whatcat,whatsubcat) {
winywidth = 0;
winyheight = 0;

if(ywidth!=0 && yheight!=0) {
winywidth = parseInt(ywidth) + parseInt(zoom_add_width);
winyheight = parseInt(yheight) + parseInt(zoom_add_height);
if(winywidth<zoom_min_width) {winywidth=zoom_min_width}
openwin(theserver+"zoom.cfm?catid="+whatcat+"&subcatid="+whatsubcat+"&id="+id+"&w="+ywidth+"&h="+yheight+"&what_2_zoom="+what_2_zoom,winywidth,winyheight,1,1,0,0,0)
}
}
// <!--- END JAVASCRIPT FOR ZOOM WINDOW --->

// Browser detect
var doit = false

with(navigator) {
  code = appCodeName; 
  app = appName; 
  version = appVersion; 
  iver = parseInt(version); 
  ua = userAgent;
  }

// this will work in "Mozilla" 3+ (includes MSIE 4)
if( code == "Mozilla" && iver >= 3 )
{doit = true}
else 
{doit = false}

if(doit==true) {
if(document.images) {
// Main Rollover ON Graphics (when moused over)
home_buton = new Image();  home_buton.src = theserver+"images/nav/home_on.gif";
contact_us_buton = new Image();  contact_us_buton.src = theserver+"images/nav/contact_us_on.gif";
tech_support_buton = new Image();  tech_support_buton.src = theserver+"images/nav/tech_support_on.gif";
install_fan_buton = new Image();  install_fan_buton.src = theserver+"images/nav/install_fan_on.gif";
fan_tips_buton = new Image();  fan_tips_buton.src = theserver+"images/nav/fan_tips_on.gif";
get_quote_buton = new Image();  get_quote_buton.src = theserver+"images/nav/get_quote_on.gif";
delivery_time_buton = new Image();  delivery_time_buton.src = theserver+"images/nav/delivery_time_on.gif";
about_us_buton = new Image();  about_us_buton.src = theserver+"images/nav/about_us_on.gif";

fans_buton = new Image();  fans_buton.src = theserver+"images/nav/fans_on.gif";
lighting_buton = new Image();  lighting_buton.src = theserver+"images/nav/lighting_on.gif";
mirrors_buton = new Image();  mirrors_buton.src = theserver+"images/nav/mirrors_on.gif";
furniture_buton = new Image();  furniture_buton.src = theserver+"images/nav/furniture_on.gif";
accessories_buton = new Image(); accessories_buton.src = theserver+"images/nav/accessories_on.gif";
specials_buton = new Image();  specials_buton.src = theserver+"images/nav/specials_on.gif";

brand_buton = new Image();  brand_buton.src = theserver+"images/nav/brand_on.gif";
style_buton = new Image();  style_buton.src = theserver+"images/nav/style_on.gif";
collection_buton = new Image();  collection_buton.src = theserver+"images/nav/collection_on.gif";
size_range_buton = new Image();  size_range_buton.src = theserver+"images/nav/size_range_on.gif";
price_range_buton = new Image();  price_range_buton.src = theserver+"images/nav/price_range_on.gif";
specials2_buton = new Image();  specials2_buton.src = theserver+"images/nav/specials2_on.gif";
quick_ship2_buton = new Image();  quick_ship2_buton.src = theserver+"images/nav/quick_ship2_on.gif";
type_buton = new Image();  type_buton.src = theserver+"images/nav/type_on.gif";

quote_it_buton = new Image();  quote_it_buton.src = theserver+"images/quote_it_on.gif";
go_login_buton = new Image();  go_login_buton.src = theserver+"images/go_login_on.gif";
// <CFIF #trim(getfilefrompath(CGI.CF_TEMPLATE_PATH))# IS "index.cfm" AND #trim(hold_dots)# IS "">
go_login2_buton = new Image();  go_login2_buton.src = theserver+"images/go_login_on.gif";
go_login3_buton = new Image();  go_login3_buton.src = theserver+"images/go_login_on.gif";
// </CFIF>
go_search_buton = new Image();  go_search_buton.src = theserver+"images/go_search_on.gif";
submit_info_buton = new Image();  submit_info_buton.src = theserver+"images/submit_info_on.gif";

// <!--- BEGIN JS SECTION OF SHOPPING CART ROLLOVERS 1 of 2 --->
but_viewon   = new Image();  but_viewon.src   = theserver+"images/view_cart_on.gif";
but_check2on = new Image();  but_check2on.src = theserver+"images/checkout_top_on.gif";
// <!--- END JS SECTION OF SHOPPING CART ROLLOVERS 1 of 2 --->

// Main Rollover OFF Graphics (when NOT moused over)
home_butoff = new Image();  home_butoff.src = theserver+"images/nav/home_off.gif";
contact_us_butoff = new Image();  contact_us_butoff.src = theserver+"images/nav/contact_us_off.gif";
tech_support_butoff = new Image();  tech_support_butoff.src = theserver+"images/nav/tech_support_off.gif";
install_fan_butoff = new Image();  install_fan_butoff.src = theserver+"images/nav/install_fan_off.gif";
fan_tips_butoff = new Image();  fan_tips_butoff.src = theserver+"images/nav/fan_tips_off.gif";
get_quote_butoff = new Image();  get_quote_butoff.src = theserver+"images/nav/get_quote_off.gif";
delivery_time_butoff = new Image();  delivery_time_butoff.src = theserver+"images/nav/delivery_time_off.gif";
about_us_butoff = new Image();  about_us_butoff.src = theserver+"images/nav/about_us_off.gif";

fans_butoff = new Image();  fans_butoff.src = theserver+"images/nav/fans_off.gif";
lighting_butoff = new Image();  lighting_butoff.src = theserver+"images/nav/lighting_off.gif";
mirrors_butoff = new Image();  mirrors_butoff.src = theserver+"images/nav/mirrors_off.gif";
furniture_butoff = new Image();  furniture_butoff.src = theserver+"images/nav/furniture_off.gif";
accessories_butoff = new Image(); accessories_butoff.src = theserver+"images/nav/accessories_off.gif";
specials_butoff = new Image();  specials_butoff.src = theserver+"images/nav/specials_off.gif";

brand_butoff = new Image();  brand_butoff.src = theserver+"images/nav/brand_off.gif";
style_butoff = new Image();  style_butoff.src = theserver+"images/nav/style_off.gif";
collection_butoff = new Image();  collection_butoff.src = theserver+"images/nav/collection_off.gif";
size_range_butoff = new Image();  size_range_butoff.src = theserver+"images/nav/size_range_off.gif";
price_range_butoff = new Image();  price_range_butoff.src = theserver+"images/nav/price_range_off.gif";
specials2_butoff = new Image();  specials2_butoff.src = theserver+"images/nav/specials2_off.gif";
quick_ship2_butoff = new Image();  quick_ship2_butoff.src = theserver+"images/nav/quick_ship2_off.gif";
type_butoff = new Image();  type_butoff.src = theserver+"images/nav/type_off.gif";

quote_it_butoff = new Image();  quote_it_butoff.src = theserver+"images/quote_it_off.gif";
go_login_butoff = new Image();  go_login_butoff.src = theserver+"images/go_login_off.gif";

// <CFIF #trim(getfilefrompath(CGI.CF_TEMPLATE_PATH))# IS "index.cfm" AND #trim(hold_dots)# IS "">
go_login2_butoff = new Image();  go_login2_butoff.src = theserver+"images/go_login_off.gif";
go_login3_butoff = new Image();  go_login3_butoff.src = theserver+"images/go_login_off.gif";
// </CFIF>

go_search_butoff = new Image();  go_search_butoff.src = theserver+"images/go_search_off.gif";
submit_info_butoff = new Image();  submit_info_butoff.src = theserver+"images/submit_info_off.gif";

// <!--- BEGIN JS SECTION OF SHOPPING CART ROLLOVERS 2 of 2 --->
but_viewoff   = new Image();  but_viewoff.src   = theserver+"images/view_cart_off.gif";
but_check2off = new Image();  but_check2off.src = theserver+"images/checkout_top_off.gif";
// <!--- END JS SECTION OF SHOPPING CART ROLLOVERS 2 of 2 --->

view_family_buton    = new Image();  view_family_buton.src    = theserver+"images/view_family_on.gif"  ;
view_family_butoff   = new Image();  view_family_butoff.src   = theserver+"images/view_family_off.gif" ;
other_colors_buton   = new Image();  other_colors_buton.src   = theserver+"images/other_colors_on.gif" ;
other_colors_butoff  = new Image();  other_colors_butoff.src  = theserver+"images/other_colors_off.gif";

more_info3_buton     = new Image();  more_info3_buton.src     = theserver+"images/more_info3_on.gif"   ;
more_info3_butoff    = new Image();  more_info3_butoff.src    = theserver+"images/more_info3_off.gif"  ;
buy_now3_buton       = new Image();  buy_now3_buton.src       = theserver+"images/buy_now3_on.gif"     ;
buy_now3_butoff	     = new Image();  buy_now3_butoff.src      = theserver+"images/buy_now3_off.gif"    ;

}
}

// Main Rollover Functions (ON and OFF)
function turnOn(imageName) {
if(doit==true)
{if(document.images) {
    document[imageName].src = eval(imageName + "on.src"); }}
}        
function turnOff(imageName) {
if(doit==true)
{if(document.images) {
    document[imageName].src = eval(imageName + "off.src"); }}
}

var thclass = "";
var tclass_on_name = "top_nav_on_bgd";

function top_nav_rollover(objectnumber,the_action) {
thclass = "";
if(the_action=="open") {
thclass = tclass_on_name;
} // open
	if(moz5) {
	document.getElementById("top"+objectnumber).className = thclass;
	}
	if(ns4) {
	document.layers["top"+objectnumber].className = thclass;
	}
	if(ie4) {
	document.all["top"+objectnumber].className = thclass;
	}
return;
}


var field_name = "";
var has_more = "";

// BEGIN RADIO BUTTON CLICK
function dolink(butname,option) {
has_more = "NO";
field_name = "document.foreform."+butname;
if(typeof eval(field_name).length != "undefined") {
if(eval(field_name).length != null) {
has_more = "YES";
}}

if(has_more=="YES") {
for(i = 0; i < eval(field_name+".length"); i++) {
if(eval(field_name)[i].value==option) {
eval(field_name)[i].checked=true;
}
else {
eval(field_name)[i].checked=false;
}
} // for
} // has_more
else {
if(eval(field_name).checked) {
eval(field_name).checked=false;
}
else {
eval(field_name).checked=true;
}
}}
// END RADIO BUTTON CLICK

// BEGIN CHECKBOX CLICK
function dolink2(butname) {
field_name = "document.foreform."+butname;
if(eval(field_name).checked) {
eval(field_name).checked=false;
}
else {
eval(field_name).checked=true;
}}
// END CHECKBOX CLICK

// BEGIN CHECKBOX CLICK FOR MULTIPLE CHECKBOXES WITH SAME NAME
function dolink3(butname,option) {
has_more = "NO";
field_name = "document.foreform."+butname;
if(typeof eval(field_name).length != "undefined") {
if(eval(field_name).length != null) {
has_more = "YES";
}}

if(has_more=="YES") {
for(var i = 0; i < eval(field_name+".length"); i++) {
if(eval(field_name)[i].value==option) {
if(eval(field_name)[i].checked) {
eval(field_name)[i].checked=false;
}
else {
eval(field_name)[i].checked=true;
}
} // if value=option
} // for
} // has_more
else {
if(eval(field_name).checked) {
eval(field_name).checked=false;
}
else {
eval(field_name).checked=true;
}
}}
// END CHECKBOX CLICK FOR MULTIPLE CHECKBOXES WITH SAME NAME
// <!--- END FILE --->

// <!--- BEGIN FILE --->
// <!--- JAVASCRIPT FOR CHECKING EMAIL FIELDS --->
function checkemail(the_value) {
// Checks the email field for:
// 1. must be at least 6 characters long i.e. 1@3.56
// 2. cannot begin with a "@" or a "."
// 3. cannot end with a "@" or a "."
// 4. cannot have 2 "." in a row
// 5. cannot have ".@" nor "@."
// 6. must contain 1 "@" and at least 1 "."
// 7. must have 2 or 3 characters after the final "."
// 8. checks specified bad chars like commas
var amp1 = 0;
var dot1 = 0;
var postdot1 = 0;
if (the_value.length<6)
{return false}
if (the_value.charAt(0)=='.')
{return false}
if (the_value.charAt(the_value.length)=='.')
{return false}
if (the_value.charAt(0)=='@')
{return false}
if (the_value.charAt(the_value.length)=='@')
{return false}
amp1 = 0;
dot1 = 0;
postdot1 = 0;
for (var i = 0; i < the_value.length; i++)
{
if (the_value.charAt(i)==',') // add bad chars here
{return false}
if (the_value.charAt(i)=='@')
{if (the_value.charAt(i-1)=='.')
{return false}
amp1=amp1+1}
if (the_value.charAt(i)=='.')
{if (the_value.charAt(i-1)=='.')
{return false}
if (the_value.charAt(i-1)=='@')
{return false}
if (dot1>0)
{dot1=0;
postdot1=0}
dot1=dot1+1}
if (dot1>0)
{postdot1=postdot1+1}
}
if (amp1!=1)
{return false}
if (dot1<1)
{return false}
if (postdot1!=5 && postdot1!=4 && postdot1!=3)
{return false}
return true
}
// <!--- END FILE --->

// <!--- BEGIN FILE --->
// <!--- JAVASCRIPT FOR WHEN NOT LOGGED IN --->

function checkloginform() {
do_submit = "YES";

if(do_submit=="YES") {
if(document.unameform.uname.value=="") {
alert("Please enter a USER NAME.          ");
if(nslayer==1 || ielayer==1)
{document.unameform.uname.focus()}
do_submit="NO"}}

if(do_submit=="YES") {
if(document.unameform.pword.value=="") {
alert("Please enter a PASSWORD.          ");
if(nslayer==1 || ielayer==1)
{document.unameform.pword.focus()}
do_submit="NO"}}

if(do_submit=="YES") {
document.unameform.submit();
}
}

function imgborder_gen(id,theaction) 
{
	if(theaction=="on") 
	{
		document.getElementById(id).className="imageborder_on";
	}
	else 
	{
		document.getElementById(id).className="border1";
	}
}

function imgborder(id,theaction) 
{
	if(theaction=="on") 
	{
		document.getElementById(id).className="imageborder_on";
	}
	else 
	{
		document.getElementById(id).className="imageborder_off";
	}
}

function toggleDiv(divid)
{
	if(document.getElementById(divid).style.display == 'none')
	{
		document.getElementById(divid).style.display = 'block';
	}
	else
	{
		document.getElementById(divid).style.display = 'none';
	}
}

// <!--- END FILE --->